/* ==========================================================================
   Section 9 — Contact · "Start with one problem. Grow from there."
   Copy and the two paths on the left; the wireframe's form, unchanged in
   fields, in a card on the right. Interactions live in
   js/sections/contact.js; this file styles every state:
     field   default · hover · focus · valid (tick) · invalid (message)
     submit  default · hover sweep · pressed · sending (spinner) · nudge
     card    form → success (check draws, heading takes focus)
   Prefixed .ct- and scoped to .contact.
   ========================================================================== */

.contact {
  --ct-bg:     var(--surface-raised);
  --ct-card:   #ffffff;
  --ct-input:  #ffffff;
  --ct-shadow: 0 1px 2px rgba(10,47,107,0.04), 0 30px 60px -36px rgba(10,47,107,0.32);

  position: relative;
  padding: clamp(72px, 9vw, 120px) var(--page-px);
  background: var(--ct-bg);
  border-top: 1px solid var(--border);
  scroll-margin-top: var(--nav-height);
}
:root[data-theme="dark"] .contact {
  --ct-bg:     #071733;
  --ct-card:   #0B1F42;
  --ct-input:  #08193A;
  --ct-shadow: 0 30px 60px -36px rgba(0,0,0,0.7);
}

.ct-inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
  max-width: var(--container);
  margin: 0 auto;
}

/* ─── Copy ────────────────────────────────────────────────────────────── */
.ct-copy { position: sticky; top: calc(var(--nav-height) + 32px); }
.ct-title {
  max-width: 520px;
  margin-bottom: 16px;
  font-size: var(--fs-section-title);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.ct-title em { font-style: normal; color: var(--accent); }
.ct-sub {
  max-width: 500px;
  font-size: var(--fs-section-sub);
  line-height: 1.6;
  color: var(--text-secondary);
}

.ct-paths {
  margin-top: clamp(28px, 3.5vw, 40px);
  border-top: 1px solid var(--border);
}
.ct-path {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.ct-path-icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  font-size: 19px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 11px;
}
.ct-path-title {
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ct-path-text {
  max-width: 420px;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ─── Card ────────────────────────────────────────────────────────────── */
.ct-card {
  position: relative;
  padding: clamp(24px, 3vw, 40px);
  background: var(--ct-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--ct-shadow);
}

.ct-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}
.ct-form[hidden] { display: none; }
.ct-field { display: flex; flex-direction: column; min-width: 0; }
.ct-field--full { grid-column: 1 / -1; }
.ct-field label {
  margin-bottom: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
}
.ct-optional { font-weight: 400; color: var(--text-muted); }

.ct-control { position: relative; }
.ct-control input,
.ct-control select,
.ct-control textarea {
  width: 100%;
  height: 48px;
  padding: 0 40px 0 14px;
  font: inherit;
  font-size: 16px;                    /* 16px: no iOS zoom on focus */
  color: var(--text-primary);
  background: var(--ct-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out, background-color 0.15s ease-out;
}
.ct-control select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.ct-control textarea {
  display: block;
  height: auto;
  min-height: 112px;
  padding: 12px 14px;
  line-height: 1.55;
  resize: vertical;
}
.ct-control input::placeholder { color: var(--text-muted); }
.ct-control input:hover,
.ct-control select:hover,
.ct-control textarea:hover { border-color: var(--accent-line); }
.ct-control input:focus-visible,
.ct-control select:focus-visible,
.ct-control textarea:focus-visible,
.ct-control input:focus,
.ct-control select:focus,
.ct-control textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.ct-chev,
.ct-ok {
  position: absolute;
  right: 14px; top: 50%;
  pointer-events: none;
  transform: translateY(-50%);
}
.ct-chev { font-size: 16px; color: var(--text-muted); transition: color 0.15s ease-out; }
.ct-control select:focus + .ct-chev { color: var(--accent); }

/* Valid: a small tick lands in the field (springy, once) */
.ct-ok {
  font-size: 17px;
  color: var(--good);
  opacity: 0;
  transform: translateY(-50%) scale(0.4);
  transition: opacity 0.18s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ct-field.is-valid .ct-ok { opacity: 1; transform: translateY(-50%) scale(1); }


/* Phone: a country-code button (flag + dial code) inside the field, and a
   searchable list under it (js/sections/phone-cc.js). The wrapper wears the
   input's border so the two read as one control. */
.ct-phone {
  display: flex;
  align-items: stretch;
  height: 48px;
  background: var(--ct-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.ct-phone:hover { border-color: var(--accent-line); }
.ct-phone:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ct-control.ct-phone input#f-phone {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 14px 0 12px;
  background: transparent;
  border: 0;
  border-radius: 0 10px 10px 0;
  box-shadow: none;
}
.ct-cc {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 0 10px 0 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  background: none;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  transition: background-color 0.15s ease-out;
}
.ct-cc:hover, .ct-phone.is-open .ct-cc { background: var(--accent-soft); }
.ct-cc:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ct-cc .ti { font-size: 14px; color: var(--text-muted); transition: transform 0.2s ease-out; }
.ct-phone.is-open .ct-cc .ti { transform: rotate(180deg); color: var(--accent); }
.ct-cc-flag, .ct-cc-opt .fi {
  width: 20px; height: 15px;
  flex: none;
  border-radius: 3px;
  background-size: cover;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

.ct-cc-pop {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: max(100%, 320px);
  max-width: calc(100vw - 2 * var(--page-px));
  background: var(--ct-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 24px 48px -20px rgba(10,47,107,0.35);
  overflow: hidden;
  animation: ct-pop 0.16s ease-out;
}
.ct-cc-pop[hidden] { display: none; }
@keyframes ct-pop { from { opacity: 0; transform: translateY(-4px); } }
.ct-cc-search { position: relative; padding: 8px; border-bottom: 1px solid var(--border); }
.ct-cc-search .ti { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--text-muted); pointer-events: none; }
.ct-control .ct-cc-search input {
  height: 40px;
  padding: 0 12px 0 36px;
  font-size: 15px;
  border-radius: 8px;
}
.ct-cc-list { max-height: 280px; margin: 0; padding: 4px; overflow-y: auto; list-style: none; overscroll-behavior: contain; }
.ct-cc-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.ct-cc-group:empty { display: none; }
.ct-cc-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  font-size: 14.5px;
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
}
.ct-cc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-cc-dial { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.ct-cc-opt.is-active { background: var(--accent-soft); }
.ct-cc-opt[aria-selected="true"] { font-weight: 600; }
.ct-cc-opt[aria-selected="true"] .ct-cc-dial { color: var(--accent-text); }
.ct-cc-none { padding: 14px 10px; font-size: 14px; color: var(--text-muted); }

/* Invalid: border + message right under the field */
.ct-field.is-invalid input { border-color: var(--warn); }
.ct-field.is-invalid input:focus { box-shadow: 0 0 0 4px var(--warn-soft); }
.ct-err {
  display: grid;
  grid-template-rows: 0fr;
  font-size: 13px;
  line-height: 1.4;
  color: var(--warn);
  opacity: 0;
  transition: grid-template-rows 0.2s ease-out, opacity 0.2s ease-out, margin 0.2s ease-out;
}
.ct-err > span { overflow: hidden; }
.ct-field.is-invalid.has-msg .ct-err { grid-template-rows: 1fr; opacity: 1; margin-top: 7px; }

/* ─── Submit ──────────────────────────────────────────────────────────── */
.ct-submit {
  grid-column: 1 / -1;
  justify-content: center;
  width: 100%;
  height: 52px;
  margin-top: 6px;
  font-size: 15px;
  transition: transform 0.12s ease-out;
}
.ct-submit:active { transform: scale(0.985); }
.ct-spinner {
  display: none;
  width: 16px; height: 16px;
  margin-right: 10px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ct-spin 0.7s linear infinite;
}
.ct-submit.is-loading { pointer-events: none; }
.ct-submit.is-loading .ct-spinner { display: inline-block; }
.ct-submit.is-loading .btn-arrow { display: none; }
@keyframes ct-spin { to { transform: rotate(360deg); } }

/* A small "not yet" nudge when submitting with errors */
.ct-submit.is-nudge { animation: ct-nudge 0.32s ease-out; }
@keyframes ct-nudge {
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
}

.ct-msg {
  grid-column: 1 / -1;
  min-height: 1px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--warn);
  text-align: center;
}
.ct-msg:empty { display: none; }
.ct-msg a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* says, before the click, that the button opens the email app */
.ct-note {
  grid-column: 1 / -1;
  margin-top: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.ct-note .ti { font-size: 15px; }

/* ─── Success ─────────────────────────────────────────────────────────── */
.ct-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 5vw, 64px) 8px;
  text-align: center;
}
.ct-done[hidden] { display: none; }
.ct-done-mark {
  width: 56px; height: 56px;
  margin-bottom: 20px;
  fill: none;
  stroke: var(--accent);              /* not a success yet: the visitor still presses send */
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ct-done-mark circle,
.ct-done-mark path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.ct-done.is-in .ct-done-mark circle { animation: ct-draw 0.6s var(--ease-out) both; }
.ct-done.is-in .ct-done-mark path   { animation: ct-draw 0.4s var(--ease-out) 0.45s both; }
@keyframes ct-draw { from { stroke-dashoffset: 1; } }
.ct-done.is-in .ct-done-title,
.ct-done.is-in .ct-done-text,
.ct-done.is-in .ct-fallback,
.ct-done.is-in .ct-again { animation: ct-rise 0.45s var(--ease-out) both; }
.ct-done.is-in .ct-done-title { animation-delay: 0.55s; }
.ct-done.is-in .ct-done-text  { animation-delay: 0.62s; }
.ct-done.is-in .ct-fallback   { animation-delay: 0.7s; }
.ct-done.is-in .ct-again      { animation-delay: 0.78s; }
@keyframes ct-rise { from { opacity: 0; transform: translateY(8px); } }

.ct-done-title {
  margin-bottom: 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  outline: none;
}
.ct-done-text {
  max-width: 340px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}
/* the way through when no email app opens */
.ct-fallback {
  max-width: 380px;
  margin-top: 24px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ct-fallback a { color: var(--accent-text); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; overflow-wrap: anywhere; }
.ct-fallback a:hover { text-decoration-color: currentColor; }
.ct-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 12px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease-out, color 0.15s ease-out;
}
.ct-copy-btn:hover { color: var(--accent-text); border-color: var(--accent-line); }
.ct-copy-btn:active { transform: scale(0.98); }
.ct-copy-btn:focus-visible, .ct-again:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ct-copy-btn.is-copied { color: var(--good); border-color: var(--good); }
.ct-again {
  margin-top: 16px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-text);
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.ct-again:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .ct-inner { grid-template-columns: minmax(0, 1fr); }
  .ct-copy { position: static; }
}
@media (max-width: 560px) {
  .ct-form { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .ct-cc-pop { animation: none; }
  .ct-control input, .ct-control select, .ct-control textarea, .ct-ok, .ct-err, .ct-submit { transition: none; }
  .ct-submit.is-nudge, .ct-done.is-in * { animation: none !important; }
  .ct-spinner { animation-duration: 1.6s; }
}
