/* ==========================================================================
   OFFSITE · Leave the script
   Fonts: Instrument Serif + Instrument Sans (SIL OFL 1.1), self-hosted.
   The story page is a 3D journey (/assets/experience/main.js). Its DOM is the
   accessible narrative and, whenever WebGL is not running, a complete
   editorial version of the same story. html.xp-on switches between the two.
   ========================================================================== */

@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  --ivory: #f2ede3;
  --ivory-2: #e7e0d1;
  --graphite: #1c1b19;
  --ink: #1c1b19;
  --ink-soft: #57524a;
  --rule: rgba(28, 27, 25, 0.13);
  --signal: #e8411c;
  --signal-deep: #b8300f;
  --night: #131519;
  --cobalt: #2a3db4;
  --ochre: #e0ae3e;
  --forest: #1c4a3a;
  --paper: #efe6d1;
  --blue-ink: #20398a;
  /* Journey colour arc (00_MASTER_SPEC). */
  --xp-black: #070708;
  --xp-graphite: #171719;
  --xp-grey: #747477;
  --xp-bone: #e8e8e3;
  --xp-signal: #ff3b18;
  --xp-break: #ff5a1f;
  --xp-hot: #ff163d;
  --xp-cream: #fff8e7;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --gutter: clamp(20px, 5vw, 88px);
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--ivory); }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; }
em { font-style: italic; }
button, input, textarea { font: inherit; color: inherit; }
::selection { background: var(--signal); color: var(--graphite); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Paper grain on the apply page (the journey renders its own grain). */
.page-apply::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.display { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; line-height: 0.98; text-wrap: balance; }
.display em { font-style: italic; }

/* ---------- Skip + masthead ------------------------------------------------ */
.skip-intro {
  position: fixed; z-index: 60; top: 12px; left: 12px;
  padding: 12px 16px; background: var(--graphite); color: var(--ivory);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transform: translateY(calc(-100% - 24px));
}
.skip-intro:focus { transform: none; }

.masthead {
  position: fixed; z-index: 30; inset: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  pointer-events: none;
  --mast-ink: var(--graphite);
}
.masthead > * { pointer-events: auto; }
html[data-tone="dark"] .page-story .masthead { --mast-ink: var(--ivory); }
.masthead-actions { display: flex; align-items: center; gap: 10px; }
/* In the editorial story the shell scrolls away with the dark opening panel. */
html:not(.xp-on) .page-story .masthead { position: absolute; }

.wordmark {
  display: inline-flex; align-items: baseline; min-height: 44px; padding-block: 12px;
  color: var(--mast-ink, var(--graphite)); text-decoration: none;
  font-family: var(--sans); font-weight: 650; font-stretch: 100%;
  font-size: 15px; letter-spacing: 0.2em; line-height: 1;
  transition: color 0.4s ease;
}
.wordmark-break {
  display: inline-block; width: 0.95em; height: 2px; margin: 0 0.22em 0 0.02em;
  background: var(--signal); transform: translateY(-0.3em) rotate(-22deg);
}
.wordmark-site { display: inline-block; transform: translateY(0.24em); }
.wordmark-small { font-size: 13px; min-height: 0; padding: 0; }

.join {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.7em;
  min-height: 44px; padding: 0 18px;
  background: var(--graphite); color: var(--ivory);
  border: 1px solid color-mix(in srgb, var(--ivory) 30%, transparent);
  font: 600 14px/1 var(--sans); letter-spacing: 0.02em; text-decoration: none;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.join:hover { background: var(--signal); color: var(--graphite); }
.join-arrow { font-size: 1.15em; transition: transform 0.3s var(--ease-out); }
.join:hover .join-arrow { transform: translateX(3px); }
.join-underline {
  position: absolute; left: 0; right: 0; bottom: -7px; height: 2px;
  background: var(--signal); transform: scaleX(0); transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}
.join:hover .join-underline, .join:focus-visible .join-underline { transform: scaleX(1); }

/* ---------- The journey: editorial version (default) ----------------------
   This is what renders without JavaScript, without WebGL, or before the first
   3D frame: the same story as full-height typographic panels in the journey's
   colour arc, with the Offsite thread running down the page. */
html:has(body.page-story) { background: var(--xp-black); }
.page-story { background: var(--xp-black); color: var(--xp-bone); }
.page-story .masthead { --mast-ink: var(--xp-bone); }
html[data-tone="light"] .page-story .masthead { --mast-ink: var(--graphite); }

.motion-toggle {
  min-height: 44px; padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--mast-ink) 38%, transparent); border-radius: 0;
  background: transparent; color: var(--mast-ink);
  font: 600 11px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  cursor: pointer; transition: background-color 0.25s ease, color 0.25s ease;
}
.motion-toggle[aria-pressed="true"] { background: var(--mast-ink); color: var(--xp-black); }
/* On the light final screen the ink is dark, so the pressed toggle needs light
   text (it was black on black: an empty black box). */
html[data-tone="light"] .page-story .motion-toggle[aria-pressed="true"] { color: var(--ivory); }
html:not(.xp-on) .motion-toggle { display: none; }

.journey { position: relative; z-index: 1; }
/* While the 3D journey loads, the page stays black like its opening instead of
   flashing the editorial layout. visibility (not display) keeps the scroll
   length. offsite.js/main.js drop xp-pending on the first frame, on failure,
   or after a timeout, so the editorial story is never hidden for good. */
html.xp-pending:not(.xp-on) .page-story .journey { visibility: hidden; }
.beat {
  position: relative; min-height: 100svh;
  display: grid; align-items: center;
  padding: 18vh var(--gutter);
  overflow: clip;
  background: var(--beat-bg, var(--xp-black));
  color: var(--beat-ink, var(--xp-bone));
}
.beat::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--gutter) / 2);
  width: 2px; background: var(--xp-signal); box-shadow: 0 0 18px rgba(255, 59, 24, 0.6);
}
.beat-copy { position: relative; display: grid; gap: 28px; max-width: 1200px; }
.xp-statement {
  font: 400 clamp(2.8rem, 8vw, 8.4rem)/0.94 var(--serif);
  letter-spacing: -0.01em; text-transform: uppercase; text-wrap: balance;
}
.xp-quiet { font-size: clamp(2.4rem, 6.4vw, 6.4rem); }
.xp-monument { font-size: clamp(4rem, 15vw, 15rem); letter-spacing: -0.02em; }
.xp-note { font: italic 400 clamp(20px, 2vw, 28px)/1.3 var(--serif); opacity: 0.8; }
.scroll-cue {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  font: 600 12px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; color: var(--xp-bone);
}
/* Touch screens swipe; everything else scrolls. */
.cue-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .cue-pointer { display: none; }
  .cue-touch { display: inline; }
}
.scroll-cue-track { position: relative; width: 1px; height: 44px; overflow: hidden; background: rgba(232, 232, 227, 0.25); }
.scroll-cue-dot {
  position: absolute; top: 0; left: -1px; width: 3px; height: 12px;
  background: var(--xp-signal); box-shadow: 0 0 10px rgba(255, 59, 24, 0.7);
}
@media (prefers-reduced-motion: no-preference) {
  .scroll-cue > * { animation: cue-in 0.9s 1s var(--ease) both; }
  .scroll-cue-dot { animation: cue-fall 1.8s 1.6s cubic-bezier(0.6, 0, 0.4, 1) infinite; }
}
html.motion-off .scroll-cue > *, html.motion-off .scroll-cue-dot { animation: none; }
@keyframes cue-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cue-fall {
  0% { transform: translateY(-12px); opacity: 0; }
  20%, 80% { opacity: 1; }
  100% { transform: translateY(44px); opacity: 0; }
}
html.no-js .scroll-cue { display: none; }

.beat-signal { --beat-bg: radial-gradient(ellipse at 50% 78%, #2a0c06 0%, var(--xp-black) 58%); }
.beat-machine {
  --beat-bg:
    repeating-linear-gradient(90deg, transparent 0 calc(100% / 9 - 1px), rgba(232, 232, 227, 0.07) calc(100% / 9 - 1px) calc(100% / 9)),
    linear-gradient(var(--xp-graphite), #0b0b0d);
}
.beat-deviation { --beat-bg: radial-gradient(circle at 80% 50%, var(--xp-cream) 0, var(--xp-break) 10%, var(--xp-hot) 26%, #1a0605 64%); }
.beat-open { --beat-bg: linear-gradient(#ecd2c1, #c4a8a0 55%, #8c7f96); --beat-ink: var(--graphite); }
.beat-build {
  --beat-bg:
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(0, 183, 255, 0.18) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(0, 183, 255, 0.18) 47px 48px),
    linear-gradient(135deg, #0f2170, #1b3fd1 62%, #0a86c7);
}
.beat-create { --beat-bg: linear-gradient(120deg, #ff2e88, #ff6f5a 48%, #3a2bd1); }
.beat-discover { --beat-bg: radial-gradient(circle at 72% 42%, rgba(200, 255, 70, 0.3), transparent 22%), linear-gradient(#07061a, #24104f); }
.beat-connect { --beat-bg: linear-gradient(135deg, #f0a93b, #e8591c 42%, #5a2b8c 78%, #1fb6c9); }
.beat-first-move { --beat-bg: linear-gradient(#d6c6b3 0 64%, #3b3632 64% 100%); --beat-ink: var(--graphite); }
.beat-go-offsite { --beat-bg: var(--ivory); --beat-ink: var(--graphite); }

.final { display: grid; gap: 18px; max-width: 920px; margin-top: 6vh; }
.final-question { font: 400 clamp(2.2rem, 5vw, 4.8rem)/1.02 var(--serif); text-wrap: balance; }
.final-underline { display: block; width: min(100%, 760px); height: 3px; background: var(--xp-signal); transform-origin: left center; }
.final-help { font: italic 400 clamp(19px, 1.6vw, 24px)/1.3 var(--serif); opacity: 0.75; }
.final-action { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 22px; }
.join-large { min-height: 64px; padding: 0 30px; font-size: 18px; }
.final-label { font-size: 14px; letter-spacing: 0.04em; opacity: 0.7; }
.journey-end { height: 1px; outline: none; }

/* ---------- The journey: 3D (html.xp-on) -------------------------------------
   Sections become lengths of the scroll timeline; their copy is a fixed overlay
   whose lines fade in and out with the camera (the script writes --o). */
:root { --journey: 1500svh; }
.beat-signal { --len: 0.055; }
/* Machine and Build are transits (no panel): the camera still flies through
   their worlds, just quickly, so the journey stays continuous but shorter. */
.beat-machine { --len: 0.05; }
.beat-deviation { --len: 0.1; }
.beat-open { --len: 0.1; }
.beat-build { --len: 0.04; }
.beat-create { --len: 0.11; }
.beat-discover { --len: 0.11; }
.beat-connect { --len: 0.09; }
.beat-first-move { --len: 0.09; }
.beat-go-offsite { --len: 0.075; }

.xp-canvas { position: fixed; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
html:not(.xp-on) .xp-canvas { visibility: hidden; }
/* A transit has no copy, so the editorial story skips it entirely. */
html:not(.xp-on) .beat-transit { display: none; }
html.xp-on .beat {
  display: block; min-height: 0; height: calc(var(--len) * var(--journey));
  padding: 0; overflow: visible; background: none; color: var(--xp-bone);
}
html.xp-on .beat::before { display: none; }
/* The destination needs room to arrive and rest, whatever the viewport. */
html.xp-on .beat-go-offsite { height: max(calc(var(--len) * var(--journey)), 150svh); }
html.xp-on .beat-copy {
  position: fixed; inset: 0; z-index: 2;
  display: grid; grid-template: 1fr / 1fr; place-items: end start;
  max-width: none; padding: 96px var(--gutter) max(9vh, 64px); text-align: left;
  pointer-events: none;
}
html.xp-on .beat-copy > * { grid-area: 1 / 1; }
html.xp-on .xp-line {
  opacity: var(--o, 0);
  transform: translateY(calc((1 - var(--o, 0)) * 18px));
  text-shadow: 0 2px 36px rgba(0, 0, 0, 0.35);
}
html.xp-on .xp-line.is-live { pointer-events: auto; }
html.xp-on .xp-statement { max-width: 14ch; font-size: clamp(2.4rem, 6.2vw, 6.8rem); }
html.xp-on .xp-quiet { font-size: clamp(2.2rem, 5.2vw, 5.6rem); }
html.xp-on .scroll-cue { justify-self: center; }
html.xp-on .beat-first-move .xp-statement { margin-bottom: clamp(3.6rem, 8vh, 5.4rem); }
html.xp-on .xp-monument { place-self: center; max-width: none; text-align: center; font-size: clamp(4rem, 13vw, 13rem); }
html.xp-on .xp-spatial {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
html.xp-on .final { place-self: center; justify-items: center; text-align: center; margin-top: 0; }
html.xp-on .final-underline { transform: scaleX(var(--land, 0)); box-shadow: none; }
html.xp-on[data-tone="light"] .beat-go-offsite { color: var(--graphite); }
html.xp-on[data-tone="light"] .xp-line { text-shadow: none; }

/* ---------- /apply ------------------------------------------------------------- */
.page-apply { background: var(--ivory); }
.back-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font-size: 14px; font-weight: 600; text-decoration: none; color: var(--graphite);
}
.back-link:hover { color: var(--signal-deep); }
.apply {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(36px, 6vw, 120px);
  min-height: 100svh; padding: clamp(120px, 16vh, 180px) var(--gutter) 96px;
}
.apply-intro { align-self: start; position: sticky; top: 120px; }
.apply-title { margin-top: 28px; font-size: clamp(3rem, 6vw, 6.4rem); line-height: 0.92; }
.apply-title em { color: var(--signal); }
.apply-lede { margin-top: 26px; max-width: 34ch; font-size: clamp(17px, 1.4vw, 20px); color: var(--ink-soft); }
.privacy { margin-top: 40px; max-width: 42ch; border-top: 1px solid var(--rule); }
.privacy summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  min-height: 48px; font-size: 13px; font-weight: 650; letter-spacing: 0.18em; text-transform: uppercase;
}
.privacy summary::-webkit-details-marker { display: none; }
.privacy summary::after { content: "+"; font-size: 20px; font-weight: 400; letter-spacing: 0; }
.privacy[open] summary::after { content: "−"; }
.privacy p { padding-bottom: 18px; font-size: 15px; color: var(--ink-soft); }

.apply-panel { max-width: 720px; width: 100%; }
.application-form { display: grid; gap: 40px; }
.application-fields { display: grid; gap: 40px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field { position: relative; display: grid; gap: 10px; }
.field label { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; font-size: clamp(18px, 1.5vw, 21px); font-weight: 560; line-height: 1.3; }
.field-number { font-size: 12px; font-weight: 650; letter-spacing: 0.1em; color: var(--signal-deep); font-variant-numeric: tabular-nums; }
.field-optional { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.field-help { font: italic 400 19px/1.3 var(--serif); color: var(--ink-soft); }
.field input, .field textarea {
  width: 100%; min-height: 52px; padding: 12px 4px; border: 0; border-radius: 0;
  background: transparent; font-size: 18px; line-height: 1.5; outline: none;
  transition: background-color 0.2s ease;
}
.field textarea { min-height: 128px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #8a8478; }
.field input:focus, .field textarea:focus { background: rgba(232, 65, 28, 0.06); }
.field-line { display: block; height: 2px; margin-top: -10px; background: rgba(28, 27, 25, 0.28); transform-origin: left; transition: background-color 0.2s ease, transform 0.2s ease; }
.field:focus-within .field-line { background: var(--signal); transform: scaleY(1.6); }
.field.is-invalid .field-line { background: #a4231b; }
.field-error { min-height: 0; font-size: 14px; font-weight: 600; color: #a4231b; }
.field-error:empty { display: none; }
/* The journey's thread lands under the question it asked. */
.field:has(#field-summary) .field-line { background: var(--signal); view-transition-name: thread; }
@media (prefers-reduced-motion: no-preference) {
  .field:has(#field-summary) .field-line { animation: land 0.9s 0.2s var(--ease) both; }
}
@keyframes land { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.trap { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.submit {
  display: inline-flex; align-items: center; gap: 18px; min-height: 60px; padding: 0 28px;
  border: 0; background: var(--graphite); color: var(--ivory);
  font-size: 17px; font-weight: 600; cursor: pointer; transition: background-color 0.25s ease, color 0.25s ease;
}
.submit:hover:not(:disabled) { background: var(--signal); color: var(--graphite); }
.submit:disabled { opacity: 0.55; cursor: not-allowed; }
.submit[aria-busy="true"] { opacity: 1; cursor: progress; }
.form-fineprint { font-size: 14px; color: var(--ink-soft); }

.form-status { font-size: 16px; line-height: 1.5; outline: none; }
.form-status:empty { display: none; }
.form-status { margin-bottom: 32px; padding: 16px 0; border-top: 2px solid var(--graphite); border-bottom: 1px solid var(--rule); }
.form-status.is-error { border-top-color: #a4231b; color: #7d1a14; }

.form-success { outline: none; padding-top: 12px; }
.success-line { width: min(100%, 420px); height: auto; overflow: visible; }
.success-line path { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .success-line path { animation: success-draw 1.1s var(--ease) both; }
}
@keyframes success-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.success-title { margin-top: 28px; font-size: clamp(2.6rem, 5vw, 5rem); }
.success-copy { margin: 14px 0 36px; font: italic 400 clamp(22px, 2vw, 30px)/1.3 var(--serif); color: var(--ink-soft); }

/* ---------- Cross-document continuity: the final underline becomes a field ---- */
@view-transition { navigation: auto; }
::view-transition-group(thread) { animation-duration: 0.7s; animation-timing-function: var(--ease); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; }

/* ---------- Responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
  .apply { grid-template-columns: minmax(0, 1fr); }
  .apply-intro { position: static; }
}
@media (max-width: 640px) {
  :root { --journey: 1250svh; }
  body { font-size: 16px; }
  .masthead { padding-top: max(10px, env(safe-area-inset-top)); }
  .masthead-actions { gap: 6px; }
  .wordmark { font-size: 13px; letter-spacing: 0.16em; }
  .join { padding: 0 14px; font-size: 13px; }
  .motion-toggle { padding: 0 8px; font-size: 10px; letter-spacing: 0.08em; }
  .xp-statement { font-size: clamp(2.3rem, 11.5vw, 3.8rem); }
  .xp-quiet { font-size: clamp(2.1rem, 10vw, 3.4rem); }
  .xp-monument { font-size: clamp(3.4rem, 19vw, 5.4rem); }
  .final-question { font-size: clamp(1.9rem, 8.4vw, 2.8rem); }
  .join-large { min-height: 58px; font-size: 17px; }
  .apply { padding-top: 104px; gap: 48px; }
  .apply-title { font-size: clamp(2.8rem, 13vw, 4rem); }
  .application-form, .application-fields { gap: 32px; }
  .submit { width: 100%; justify-content: space-between; }
}

/* ---------- Reduced motion: cuts, not flights ----------------------------------
   The 3D journey still renders, but holds one settled frame per scene. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.xp-on .xp-line { transform: none; }
  .join-underline, .join-arrow, .wordmark, .field-line, .submit, .join, .motion-toggle { transition: none; }
  @view-transition { navigation: none; }
}
html.motion-off.xp-on .xp-line { transform: none; }
