/* ============================================================================
   Contact (contact.html). Grammar: a switchboard. Four real lines in on the
   left, the orb on the right; hovering or focusing a line draws a wire from it
   to the orb, which brightens. Then a hard cut to paper: a letter that opens
   in the visitor's own email app (no form backend, nothing pretends to send).
   ========================================================================== */

/* --------------------------------------------------------- switchboard -- */
.ct-board { padding: calc(var(--nav-h) + clamp(2.5rem, 1.5rem + 5vw, 6rem)) 0 clamp(4rem, 3rem + 5vw, 8rem); }
.ct-board__grid { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-5); align-items: start; }
.ct-board__main { grid-column: 1 / span 7; position: relative; z-index: 2; }
.ct-board__main .d-hero { font-size: clamp(2.75rem, 1.2rem + 5.6vw, 6.5rem); max-width: 9ch; }
.ct-board__main .lede { margin-top: var(--s-5); max-width: 38ch; }
.ct-board__orb { grid-column: 9 / span 4; position: sticky; top: calc(var(--nav-h) + 40px); z-index: 1; }

.sw-list { margin-top: clamp(2.5rem, 2rem + 2vw, 4rem); border-top: 1px solid var(--line-2); }
.sw { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr) 40px; gap: var(--s-5); align-items: center; padding: var(--s-5) var(--s-3) var(--s-5) 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); isolation: isolate; }
.sw::before { content: ""; position: absolute; inset: 0 calc(var(--s-4) * -1); z-index: -1; border-radius: var(--r-md); background: color-mix(in oklab, var(--ink) 5%, transparent); opacity: 0; transform: scale(0.985); transition: opacity var(--d-2) var(--ease-out), transform var(--d-2) var(--ease-out); }
.sw__ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-text); transition: background-color var(--d-2) var(--ease-out), color var(--d-2) var(--ease-out); }
.sw__ico .i { width: 22px; height: 22px; }
.sw__txt { display: grid; gap: 2px; min-width: 0; }
.sw__txt b { font-family: var(--f-mono); font-size: var(--t-xs); font-weight: 500; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3); }
.sw__val { font-family: var(--f-display); font-weight: 620; font-size: clamp(1.25rem, 1rem + 1vw, 1.875rem); letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.sw__txt small { margin-top: 4px; font-size: var(--t-sm); line-height: 1.5; color: var(--ink-2); max-width: 48ch; }
.sw__go { justify-self: end; color: var(--ink-3); transition: transform var(--d-2) var(--ease-out), color var(--d-2) var(--ease-out); }
.sw__go .i { width: 22px; height: 22px; }
.sw.is-on::before { opacity: 1; transform: none; }
.sw.is-on .sw__ico { background: var(--accent); color: var(--accent-ink); }
.sw.is-on .sw__go { color: var(--accent-text); transform: translateX(3px); }
.sw:active { transform: scale(0.99); }
.sw:focus-visible { outline: none; }
.sw:focus-visible::before { opacity: 1; transform: none; outline: 2px solid var(--accent-text); outline-offset: 0; }

/* the orb: an always-dark object plate in both themes */
.sw-orb { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-xl); overflow: hidden; background: #05040a; border: 1px solid rgb(239 236 247 / 0.08); box-shadow: var(--e3); }
.sw-orb img { position: absolute; left: 50%; top: 50%; width: 236%; max-width: none; height: auto; transform: translate(-50%, -54%) scale(1); opacity: 0.62; transition: opacity var(--d-4) var(--ease-out), transform 900ms var(--ease-out); }
.sw-orb.is-lit img { opacity: 1; transform: translate(-50%, -54%) scale(1.045); }
.sw-orb__port { position: absolute; left: 50%; top: 40%; width: 1px; height: 1px; }

/* the wire: drawn between the active line and the orb, wiped in with clip-path */
.sw-wire { position: absolute; left: 0; top: 0; z-index: 3; overflow: visible; pointer-events: none; clip-path: inset(0 100% 0 0); transition: clip-path 520ms var(--ease-out); }
.sw-wire.is-on { clip-path: inset(-10px -10px -10px 0); }
.sw-wire path { fill: none; stroke: var(--accent-text); stroke-width: 1.25; stroke-linecap: round; }
.sw-wire circle { fill: var(--accent-text); }

/* --------------------------------------------------------- the letter -- */
.ct-write__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-5); align-items: start; }
.ct-write__head { grid-column: 1 / span 4; }
.ct-write__head .body { margin-top: var(--s-5); }
.ct-write__safe { display: flex; gap: 10px; margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--line); color: var(--ink-2); }
.ct-write__safe .i { width: 18px; height: 18px; margin-top: 2px; color: var(--ink-3); }

.letter { grid-column: 6 / span 7; position: relative; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--e3), var(--edge); }
.letter__form { display: grid; }
.letter__row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); align-items: center; gap: var(--s-4); min-height: 60px; padding: 8px var(--s-6); border-bottom: 1px solid var(--line); }
.letter__k { font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3); }
.letter__to { font-weight: 500; color: var(--ink); }
.letter__row--to .letter__to::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 10px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
.letter__pair { display: grid; grid-template-columns: 1fr 1.2fr; gap: var(--s-3); }
.field { position: relative; display: grid; }
.field input, .field select, .letter__body textarea { width: 100%; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--ink); font-size: var(--t-base); transition: border-color var(--d-2) var(--ease-out), background-color var(--d-2) var(--ease-out); }
.field input, .field select { height: 44px; padding: 0 12px; margin-left: -12px; }
.field input::placeholder, .letter__body textarea::placeholder { color: var(--ink-3); opacity: 1; }
.field input:hover, .field select:hover, .letter__body textarea:hover { background: var(--surface-2); }
.field input:focus, .field select:focus, .letter__body textarea:focus { outline: none; background: var(--surface-2); border-color: var(--accent-text); }
.field--select select { -webkit-appearance: none; appearance: none; padding-right: 36px; cursor: pointer; }
.field--select .i { position: absolute; right: 10px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--ink-3); pointer-events: none; }
.field [aria-invalid="true"], .letter__body [aria-invalid="true"] { border-color: var(--hot); background: color-mix(in oklab, var(--hot) 6%, transparent); }
.field__err { margin-top: 4px; font-size: 0.8125rem; color: var(--hot); }
.letter__body { padding: var(--s-4) var(--s-6) 0; }
.letter__body textarea { display: block; min-height: 220px; padding: 12px; margin: 0 -12px; width: calc(100% + 24px); resize: vertical; line-height: 1.6; }
.letter__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) var(--s-6) var(--s-6); }
.letter__count { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--ink-3); }

.letter__done { padding: clamp(2rem, 1.5rem + 2vw, 3.5rem) var(--s-6); display: grid; justify-items: start; gap: var(--s-4); outline: none; }
.letter__done p { max-width: 50ch; color: var(--ink-2); }
.letter__done b { color: var(--ink); overflow-wrap: anywhere; }
.letter__seal { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: color-mix(in oklab, var(--ok) 14%, transparent); color: var(--ok); }
.letter__seal .i { width: 26px; height: 26px; }
.letter__fallback { margin-top: var(--s-4); padding-top: var(--s-5); border-top: 1px solid var(--line); width: 100%; display: grid; gap: var(--s-4); }
.letter__fallback .btn-row { gap: var(--s-3) var(--s-4); }
.js .letter__done:not([hidden]) > * { animation: ct-in 620ms var(--ease-out) both; }
.js .letter__done:not([hidden]) > :nth-child(2) { animation-delay: 60ms; } .js .letter__done:not([hidden]) > :nth-child(3) { animation-delay: 120ms; } .js .letter__done:not([hidden]) > :nth-child(4) { animation-delay: 180ms; }
@keyframes ct-in { from { opacity: 0; transform: translateY(12px); } }
.letter__seal { animation-name: ct-seal !important; }
@keyframes ct-seal { from { opacity: 0; transform: scale(0.9); } }

/* --------------------------------------------------------------- phone -- */
@media (max-width: 900px) {
  .ct-board__grid { display: flex; flex-direction: column; gap: 0; }
  .ct-board__orb { order: -1; position: relative; top: 0; width: 100%; margin-bottom: var(--s-6); }
  .sw-orb { aspect-ratio: 16 / 10; border-radius: var(--r-lg); }
  .sw-orb img { width: 112%; transform: translate(-50%, -50%); }
  .sw-orb.is-lit img { transform: translate(-50%, -50%) scale(1.045); }
  .sw-wire { display: none; }
  .ct-board__main { width: 100%; }
  .ct-write__head, .letter { grid-column: 1 / -1; }
  .letter { margin-top: var(--s-6); }
}
@media (max-width: 760px) {
  .ct-board { padding-top: calc(var(--nav-h) + 1.25rem); }
  .ct-board__main .d-hero { font-size: clamp(2.5rem, 11.4vw, 3.4rem); }
  .ct-board__main .lede { font-size: var(--t-base); }
  .sw { grid-template-columns: 44px minmax(0, 1fr) 24px; gap: var(--s-4); }
  .sw__ico { width: 44px; height: 44px; }
  .sw::before { inset: 0 -8px; }
  .letter__row { grid-template-columns: 1fr; gap: 2px; padding: 12px var(--s-5); }
  .letter__pair { grid-template-columns: 1fr; gap: 4px; }
  .letter__body { padding: var(--s-4) var(--s-5) 0; }
  .letter__foot { flex-direction: column-reverse; align-items: stretch; padding: var(--s-5); }
  .letter__foot .btn { width: 100%; }
  .letter__count { text-align: right; }
  .letter__done { padding: var(--s-7) var(--s-5); }
}
@media (prefers-reduced-motion: reduce) {
  .sw-wire, .sw-orb img, .sw::before { transition-duration: 1ms !important; }
  .js .letter__done:not([hidden]) > * { animation: none !important; }
}
