:root {
  --orange: #ff542d;
  --navy: #140945;
  --bg: #ffffff;
  --side-pad: clamp(28px, 5vw, 88px);
  --top-pad: clamp(28px, 4vw, 56px);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--navy);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: var(--top-pad) var(--side-pad);
  isolation: isolate;
}

/* ---------- Visual layer ---------- */
.visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
  opacity: 0;
  animation: fade-in 1.6s ease-out 0.1s forwards;
}

.globe-wrap {
  position: absolute;
  top: 50%;
  right: 0;
  width: clamp(640px, 110vh, 1280px);
  aspect-ratio: 1;
  /* push partly off-screen so the globe reads as cropped at the right edge */
  transform: translate(32%, -50%);
  /* interactive: re-enable pointer events (parent .visual disables them) */
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.globe-wrap.is-dragging {
  cursor: grabbing;
}

#globe-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Brand ---------- */
.brand {
  position: relative;
  z-index: 2;
  opacity: 0;
  transform: translateY(-8px);
  animation: fade-up 0.9s var(--ease-out) 0.2s forwards;
}

/* Let pointer events fall through the foreground to the globe canvas below
   (z-index 0). The header band is full-width over the globe, so let pointer
   events fall through it (except the logo). The hero keeps blocking events so
   the text + form area doesn't spin the globe sitting behind it. */
.brand { pointer-events: none; }
.brand-link { pointer-events: auto; }

.brand-link {
  display: inline-block;
  text-decoration: none;
  outline: none;
}

.brand-link:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 6px;
  border-radius: 2px;
}

.logo {
  width: clamp(140px, 13vw, 175px);
  height: auto;
  display: block;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 2;
  align-self: center;
  max-width: min(660px, 60%);
  padding-bottom: clamp(40px, 8vh, 96px);
}

.eyebrow {
  margin: 0 0 clamp(20px, 3vh, 32px);
  font-size: clamp(11px, 0.85vw, 13px);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--orange);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(12px);
  animation: fade-up 0.9s var(--ease-out) 0.35s forwards;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1.5px;
  background: var(--orange);
  display: inline-block;
  transform-origin: left center;
  animation: line-grow 0.9s var(--ease-out) 0.45s both;
}

.headline {
  margin: 0;
  font-weight: 600;
  font-size: clamp(26px, 5.2vw, 50px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--navy);
}

.line {
  display: block;
  overflow: hidden;
}

.line > span {
  display: inline-block;
  opacity: 0;
  transform: translateY(110%);
  animation: word-rise 1.05s var(--ease-out) forwards;
}

.line:nth-child(1) > span { animation-delay: 0.55s; }
.line:nth-child(2) > span { animation-delay: 0.72s; }

/* ---------- Stay in touch ---------- */
.cta {
  margin-top: clamp(28px, 4vh, 44px);
  opacity: 0;
  transform: translateY(12px);
  animation: fade-up 0.9s var(--ease-out) 0.95s forwards;
}

.stay-form[hidden],
.stay-thanks[hidden],
.stay-error[hidden] { display: none; }

.cta-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--navy);
  border: none;
  border-radius: 10px;
  padding: 13px 26px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 9, 69, 0.12);
  transition: background-color 0.2s var(--ease-out),
              box-shadow 0.2s var(--ease-out),
              transform 0.15s var(--ease-out);
}

.cta-btn:hover {
  background: #241466;
  box-shadow: 0 6px 16px rgba(20, 9, 69, 0.18);
}

.cta-btn:active { transform: translateY(1px); }

.cta-btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.cta-btn[disabled] {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

/* Revealed form: clean, stacked, left-aligned under the headline */
.stay-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 360px;
}

/* Reveal: the 0fr→1fr grid-row trick opens the space smoothly, then the inputs
   fade in (opacity) once it's open — so they appear from nowhere rather than
   sliding out of a clip. overflow:hidden clips during the grow; it flips to
   visible on .is-settled (added after the transition) so the inputs' focus
   glow isn't cropped. */
.stay-fields {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s var(--ease-out);
}

.stay-fields-inner {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* top-anchored: the fields hold their final positions and never translate —
     the wrapper just expands behind them, then they fade in. */
  gap: 10px;
  opacity: 0;
  transition: opacity 0.18s var(--ease-out);   /* quick fade-out on close */
}

.cta.is-open .stay-fields { grid-template-rows: 1fr; }

.cta.is-open .stay-fields-inner {
  opacity: 1;
  /* fade in only after the space has finished expanding — pure appear, no slide */
  transition: opacity 0.24s var(--ease-out) 0.26s;
}

/* once the reveal settles, stop clipping so the focus glow isn't cropped */
.cta.is-settled .stay-fields-inner { overflow: visible; }

.stay-form .field { margin: 0; }

.stay-form input {
  width: 100%;
  font-family: inherit;
  /* 16px keeps iOS Safari from auto-zooming when the field is focused */
  font-size: 16px;
  color: var(--navy);
  background: #fff;
  border: 1px solid rgba(20, 9, 69, 0.16);
  border-radius: 10px;
  padding: 13px 15px;
  transition: border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}

.stay-form input::placeholder { color: rgba(20, 9, 69, 0.4); }

.stay-form input:hover { border-color: rgba(20, 9, 69, 0.3); }

.stay-form input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 84, 45, 0.12);
}

/* invalid field + its inline message */
.stay-form input.invalid { border-color: #c0392b; }

.stay-form input.invalid:focus {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.14);
}

.field-error {
  margin: 6px 2px 0;
  font-size: 13px;
  font-weight: 500;
  color: #c0392b;
}

.field-error[hidden] { display: none; }

.stay-actions {
  display: flex;
  gap: 10px;
}

/* The primary button fills the row when collapsed (Back is 0-width) and
   shares it once Back grows in — the flex width animates between the two. */
.stay-form .cta-main { flex: 1; }

/* secondary "Back" button: collapses to zero size when closed, grows to its
   natural width when open, so the row morphs as it appears/disappears. */
.cta-back {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  background: transparent;
  border: 1px solid rgba(20, 9, 69, 0.18);
  border-radius: 10px;
  padding: 13px 18px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: max-width 0.28s var(--ease-out),
              opacity 0.28s var(--ease-out),
              padding 0.28s var(--ease-out),
              margin 0.28s var(--ease-out),
              background-color 0.2s var(--ease-out),
              border-color 0.2s var(--ease-out);
}

/* collapsed = zero size. margin-right:-10px cancels the .stay-actions gap so the
   primary button sits flush full-width; it eases back to 0 as Back grows in. */
.cta-back {
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  margin-right: -10px;
  opacity: 0;
  border-width: 0;
}

.cta.is-open .cta-back {
  max-width: 160px;
  padding-left: 18px;
  padding-right: 18px;
  margin-right: 0;
  opacity: 1;
  border-width: 1px;
}

.cta-back::before { content: "\2190"; margin-right: 7px; }

.cta-back:hover {
  background: rgba(20, 9, 69, 0.04);
  border-color: rgba(20, 9, 69, 0.32);
}

.cta-back:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stay-thanks {
  margin: clamp(18px, 2.5vh, 28px) 0 0;
  font-size: clamp(15px, 1.1vw, 17px);
  font-weight: 600;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 11px;
  /* runs when the [hidden] attribute is removed (display flips none -> flex) */
  animation: thanks-in 0.5s var(--ease-out) both;
}

/* green tick that pops in just after the message rises */
.stay-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4ade80;
  position: relative;
  transform: scale(0);
  animation: check-pop 0.42s var(--ease-out) 0.14s forwards;
}

.stay-check::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 4.5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

@keyframes thanks-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes check-pop {
  to { transform: scale(1); }
}

.stay-error {
  margin: clamp(14px, 2vh, 20px) 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #c0392b;
  animation: thanks-in 0.4s var(--ease-out) both;
}

/* ---------- Keyframes ---------- */
@keyframes fade-in {
  to { opacity: 1; }
}

@keyframes fade-up {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes word-rise {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes line-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ---------- Responsive ---------- */

/* Tablets & phones: stack vertically — text pinned to the top, globe as a
   soft accent anchored to the bottom, so the two never overlap.
   overflow-y stays scrollable so the form is reachable with the keyboard up. */
@media (max-width: 900px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .hero {
    max-width: 100%;
    align-self: start;
    margin-top: clamp(16px, 4vh, 44px);
    padding-bottom: clamp(40px, 10vh, 96px);
  }

  .globe-wrap {
    width: min(640px, 118vw);
    top: auto;
    bottom: 0;
    right: 50%;
    /* center it and push most of the sphere below the fold */
    transform: translate(50%, 34%);
    opacity: 0.5;
  }
}

@media (max-width: 520px) {
  .globe-wrap {
    width: min(560px, 134vw);
    transform: translate(50%, 36%);
    opacity: 0.45;
  }
}

/* Short / landscape screens: keep the globe off to the side instead of the
   bottom (there's no vertical room) and tighten spacing. */
@media (max-height: 600px) {
  .hero {
    margin-top: clamp(6px, 2vh, 16px);
    padding-bottom: clamp(12px, 3vh, 28px);
  }
  .eyebrow { margin-bottom: clamp(10px, 2vh, 20px); }
  .globe-wrap {
    width: clamp(420px, 80vh, 820px);
    top: 50%;
    bottom: auto;
    right: 0;
    transform: translate(34%, -50%);
    opacity: 0.55;
  }
}

/* ---------- Reduced motion ----------
   Suppress entrance pop-ins and parallax, but keep the slow ambient
   pulses + 90s rotation — they're below the threshold of motion that
   tends to bother vestibular-sensitive users. */
@media (prefers-reduced-motion: reduce) {
  .visual,
  .brand,
  .eyebrow,
  .eyebrow::before,
  .line > span,
  .cta {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Open/close the form instantly — no grow-in, fade, or width morph. */
  .stay-fields,
  .stay-fields-inner,
  .cta-back {
    transition: none !important;
  }

  /* Show the success/error state without the rise + tick-pop. */
  .stay-thanks,
  .stay-check,
  .stay-error {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
