/* ==========================================================================
   NTPU AI4X | Online collaboration inquiry form (contact.html, zh/contact.html)
   Static site: the form validates in the browser and hands a fully written
   message to the visitor's mail client. Nothing is sent from the page itself.
   ========================================================================== */

.inquiry {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}

/* Holds the form and the success panel that replaces it, so the grid keeps
   two columns whichever of the two is showing. */
.inquiry-main { min-width: 0; }

/* ---- form panel ---- */
.inquiry-form {
  padding: 1.5rem 1.6rem 1.6rem;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.inquiry-form-head { margin-bottom: 1.2rem; }
.inquiry-form-head h3 { margin-bottom: 0.35rem; }
.inquiry-form-head p { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.1rem;
}
.field { display: grid; gap: 0.4rem; }
.field.full { grid-column: 1 / -1; }

.field > label,
.field-legend {
  display: block; padding: 0;
  color: var(--ink); font-size: 0.95rem; font-weight: 700;
}
.req { margin-left: 0.25rem; color: var(--clay); font-weight: 700; }
.optional {
  margin-left: 0.35rem; color: var(--ink-soft);
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 400;
  letter-spacing: 0.04em;
}
.field-hint { margin: 0; color: var(--ink-soft); font-size: 0.88rem; line-height: 1.5; }

.field input,
.field select,
.field textarea {
  width: 100%; padding: 0.68rem 0.85rem;
  color: var(--ink); background: #fff;
  border: 1px solid rgba(12, 26, 42, 0.2); border-radius: 8px;
  font-family: var(--font-body); font-size: 1rem; line-height: 1.55;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
}
.field textarea { min-height: 148px; resize: vertical; }
.field select {
  padding-right: 2.4rem; cursor: pointer;
  /* caret drawn in CSS so no image request is needed */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) calc(50% - 2px), calc(100% - 0.85rem) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.field input::placeholder,
.field textarea::placeholder { color: rgba(74, 93, 110, 0.6); }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: rgba(13, 74, 158, 0.4); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(13, 74, 158, 0.16);
}

/* ---- collaboration type: radio chips ---- */
.field-set { grid-column: 1 / -1; margin: 0; padding: 0; border: 0; }
.field-set .field-legend { margin-bottom: 0.55rem; }
.chip-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-option { position: relative; }
.chip-option input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.chip-option span {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 42px; padding: 0 1rem;
  color: var(--ink-soft); background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(12, 26, 42, 0.18); border-radius: 999px;
  font-size: 0.95rem; font-weight: 600; line-height: 1.3;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.chip-option span::before {
  content: ''; width: 9px; height: 9px; flex: none;
  border-radius: 50%; border: 2px solid currentColor; opacity: 0.5;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.chip-option input:hover + span { border-color: rgba(13, 74, 158, 0.42); background: #fff; }
.chip-option input:checked + span {
  color: var(--blue); background: rgba(13, 74, 158, 0.09);
  border-color: rgba(13, 74, 158, 0.55);
}
.chip-option input:checked + span::before { opacity: 1; background: currentColor; }
.chip-option input:focus-visible + span {
  outline: 3px solid rgba(13, 74, 158, 0.4); outline-offset: 3px;
}

/* ---- consent ---- */
.field-check {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem; align-items: start;
}
.field-check input {
  width: 20px; height: 20px; margin: 0.2rem 0 0;
  accent-color: var(--blue); cursor: pointer;
}
.field-check label { font-size: 0.93rem; font-weight: 500; color: var(--ink-soft); line-height: 1.55; }

/* ---- validation ---- */
.field-error {
  display: none; margin: 0;
  color: var(--clay); font-size: 0.88rem; font-weight: 600;
}
.field.has-error .field-error,
.field-set.has-error .field-error,
.field-check.has-error .field-error { display: block; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(184, 92, 58, 0.14);
}
.field-check.has-error .field-error { grid-column: 2; }

.char-count {
  justify-self: end; margin: 0;
  color: var(--ink-soft); font-family: var(--font-mono); font-size: 0.82rem;
}
.char-count.over { color: var(--clay); }

/* ---- actions ---- */
.inquiry-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  padding-top: 1.15rem; margin-top: 1.3rem;
  border-top: 1px solid var(--line);
}
.btn-quiet {
  color: var(--ink); background: none;
  border-color: rgba(12, 26, 42, 0.2);
  font-family: var(--font-body); cursor: pointer;
}
.btn-quiet:hover { background: rgba(13, 74, 158, 0.07); }
button.btn { font-family: var(--font-body); cursor: pointer; }
button.btn[disabled] {
  cursor: progress; opacity: 0.65;
  transform: none; box-shadow: none;
}
button.btn[disabled] .arrow { transform: none; }

.form-status {
  flex: 1 1 100%; margin: 0;
  color: var(--ink-soft); font-size: 0.92rem; line-height: 1.55;
}
.form-status:empty { display: none; }
.form-status.ok { color: #0e7a45; font-weight: 600; }
.form-status.warn { color: var(--clay); font-weight: 600; }

/* ---- honeypot ----
   Off-screen rather than display:none or hidden: bots that skip hidden inputs
   still fill this one, and it stays out of the tab order and the a11y tree
   via tabindex="-1" / aria-hidden in the markup. */
.hp-field {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---- Turnstile ---- */
.turnstile-field { display: grid; gap: 0.5rem; margin-top: 1.3rem; }
/* display:grid above beats the UA stylesheet's [hidden]{display:none} on
   specificity ties (author rules always win over UA rules), so the JS that
   hides this field while Turnstile is unconfigured needs an explicit override. */
.turnstile-field[hidden] { display: none; }
.turnstile-field .cf-turnstile { min-height: 65px; }
.turnstile-field .field-hint { margin: 0; }

/* ---- success panel ---- */
.inquiry-success {
  display: grid; gap: 0.45rem; justify-items: start;
  padding: 1.9rem 1.7rem;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-top: 3px solid var(--cyan);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.inquiry-success[hidden] { display: none; }
.inquiry-success:focus { outline: none; }
.inquiry-success .success-mark {
  display: grid; place-items: center;
  width: 46px; height: 46px; margin-bottom: 0.4rem;
  color: #fff; background: var(--gradient);
  border-radius: 50%; font-size: 1.4rem; font-weight: 800;
}
.inquiry-success p { margin: 0; color: var(--ink-soft); }
.inquiry-success .success-id {
  margin-top: 0.35rem; padding: 0.5rem 0.9rem;
  background: rgba(13, 74, 158, 0.07); border-radius: 8px;
  font-family: var(--font-mono); font-size: 0.95rem;
}
.inquiry-success .success-id strong { font-weight: 700; }
.inquiry-success a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* ---- side rail ---- */
.inquiry-side { display: grid; gap: 1rem; }
.inquiry-steps { counter-reset: step; margin: 0; padding: 0; list-style: none; }
.inquiry-steps li {
  position: relative;
  padding: 0 0 1.05rem 2.6rem;
  color: var(--ink-soft); font-size: 0.95rem; line-height: 1.6;
}
.inquiry-steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 0; left: 0;
  display: grid; place-items: center; width: 30px; height: 30px;
  color: #fff; background: var(--gradient);
  border-radius: 50%; font-size: 0.9rem; font-weight: 800;
}
/* connector between the step bullets */
.inquiry-steps li:not(:last-child)::after {
  content: ''; position: absolute; top: 34px; left: 14px;
  width: 2px; bottom: 0.4rem; background: var(--line);
}
.inquiry-steps li:last-child { padding-bottom: 0; }
.inquiry-steps strong { display: block; color: var(--ink); font-size: 1rem; }

@media (max-width: 900px) {
  .inquiry { grid-template-columns: 1fr; }
  .inquiry-form { padding: 1.25rem 1.15rem 1.35rem; }
  .field-grid { grid-template-columns: 1fr; }
  .inquiry-actions .btn { flex: 1 1 100%; }
  /* iOS zooms into any control under 16px on focus */
  .field input, .field select, .field textarea { font-size: 16px; }
}
