/* ============================================================
   Act III — Contact
   Horizontal slide-in section, contact form, physics canvas.
   Dark-first, monochrome, one signal accent.
   Tokens come from styles/tokens.css (:root).
   ============================================================ */

/* ------------------------------------------------------------
   1. Section + sticky pin (drives the horizontal slide)
   220vh of scroll length lets the controller translateX the
   .hslide from 0 to -100vw while the pin stays fixed.
   ------------------------------------------------------------ */
.transition {
  height: 220vh;
  position: relative;
}

.transition__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--paper);
}

/* ------------------------------------------------------------
   2. The two-panel horizontal track
   Width is 200vw (two full-viewport panels side by side).
   Controller sets transform: translateX() on .hslide.
   ------------------------------------------------------------ */
.hslide {
  display: flex;
  width: 200vw;
  height: 100vh;
  will-change: transform;
}

.hpanel {
  width: 100vw;
  height: 100vh;
  flex: 0 0 100vw;
  display: grid;
  place-items: center;
  padding-inline: var(--gutter);
}

/* ------------------------------------------------------------
   3. Cap panel — the serif hand-off line
   ------------------------------------------------------------ */
.hpanel--cap {
  text-align: center;
}

.hpanel--cap .label {
  color: var(--ink-muted);
}

.hpanel--cap .serif {
  display: block;
  font-family: var(--font-editorial);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: var(--space-4) 0;
  max-width: 18ch;
  margin-inline: auto;
}

/* ------------------------------------------------------------
   4. Contact panel + physics canvas
   Canvas fills the panel behind the form (z-index: 0).
   Form content rides above it (z-index: 1).
   ------------------------------------------------------------ */
.contact {
  position: relative;
}

.contact__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
}

/* Eyebrow row above the heading */
.eyebrow {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--ink-muted);
}

.contact h2 {
  font-family: var(--font-grotesque);
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
  margin: 0 0 var(--space-4);
}

/* Closing serif italic line under the form */
.contact__inner > .serif {
  font-family: var(--font-editorial);
  font-style: italic;
  color: var(--ink-muted);
  margin: var(--space-4) 0 0;
  line-height: 1.4;
}

/* ------------------------------------------------------------
   5. Contact form
   Underline-only fields, transparent backgrounds; the lone
   filled element is the signal-coloured send button.
   ------------------------------------------------------------ */
.cform {
  display: grid;
  gap: var(--space-3);
}

.cform .field {
  display: grid;
  gap: 6px;
}

.cform .label {
  color: var(--ink-muted);
}

.cform input,
.cform textarea {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font: inherit;
  padding: 8px 0;
  outline: none;
  transition: border-color 0.25s var(--ease);
}

.cform input::placeholder,
.cform textarea::placeholder {
  color: var(--ink-muted);
  opacity: 0.6;
}

.cform input:focus,
.cform textarea:focus {
  border-color: var(--signal);
}

.cform textarea {
  resize: vertical;
  min-height: 90px;
}

/* Send button — the single filled, accented control */
.cform__send {
  justify-self: start;
  margin-top: var(--space-2);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-grotesque);
  font-weight: 500;
  color: var(--paper);
  background: var(--signal);
  border: 0;
  padding: 13px 22px;
  border-radius: 2px;
  cursor: pointer;
  transition: filter 0.25s var(--ease), transform 0.25s var(--ease);
}

.cform__send:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.cform__send:focus-visible {
  outline: 2px solid var(--signal-quiet);
  outline-offset: 3px;
}

/* ------------------------------------------------------------
   6. Success state
   Controller toggles .sent on .contact: form hides,
   the serif thank-you block appears.
   ------------------------------------------------------------ */
.contact__thanks {
  display: none;
  font-family: var(--font-editorial);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.15;
  color: var(--ink);
  max-width: 22ch;
}

.contact__thanks .label {
  display: block;
  margin-top: var(--space-3);
  font-style: normal;
  color: var(--signal);
}

.contact.sent .cform {
  display: none;
}

.contact.sent .contact__thanks {
  display: block;
}

/* ------------------------------------------------------------
   7. Mobile / reduced-motion fallback
   The horizontal hijack degrades to a normal vertical stack.
   Applies for both the no-hjack root flag and small screens.
   ------------------------------------------------------------ */
:root.no-hjack .transition {
  height: auto;
}
:root.no-hjack .transition__pin {
  position: static;
  height: auto;
  overflow: visible;
}
:root.no-hjack .hslide {
  flex-direction: column;
  width: auto;
  transform: none !important;
}
:root.no-hjack .hpanel {
  width: auto;
  flex: none;
  min-height: 80vh;
}

@media (max-width: 720px) {
  .transition {
    height: auto;
  }
  .transition__pin {
    position: static;
    height: auto;
    overflow: visible;
  }
  .hslide {
    flex-direction: column;
    width: auto;
    transform: none !important;
  }
  .hpanel {
    width: auto;
    flex: none;
    min-height: 80vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cform__send {
    transition: none;
  }
  .cform__send:hover {
    transform: none;
  }
}

/* ensure Act III paints above the fixed flight stage (z1) */
.transition { z-index: 2; }
