@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #f3f3ef;
  --muted: #a5a5a0;
  --faint: #6f6f6b;
  --paper: #090909;
  --gutter: max(22px, 6vw);
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  /* The live landing page's logo spacing (src/index.html); craft.js places the wordmark to match. */
  --center-offset: clamp(56px, 18vh, 190px);
  --center-offset: clamp(56px, 18svh, 190px);
  --studio-gap: clamp(24px, 3vw, 38px);
}
@media (max-width: 640px) {
  :root { --studio-gap: 26px; }
}
@media (max-height: 480px) {
  :root { --center-offset: clamp(42px, 14vh, 70px); --center-offset: clamp(42px, 14svh, 70px); --studio-gap: 20px; }
}
@media (max-height: 319px) {
  :root { --center-offset: clamp(32px, 14vh, 42px); --center-offset: clamp(32px, 14svh, 42px); --studio-gap: 10px; }
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.brand {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  padding: 24px var(--gutter);
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.06em;
}
.brand a { color: var(--ink); text-decoration: none; opacity: 0.82; transition: opacity 0.2s ease; }
.brand a:hover, .brand a:focus-visible { opacity: 1; }
.brand a:focus-visible { outline: 1px solid var(--ink); outline-offset: 6px; }

/* Both languages are in the page, and the reader's choice hides the other. lang.js shows the
   switch, so it only appears where it works. */
html:not([lang='es']) [lang='es'], html[lang='es'] [lang='en'] { display: none; }
.lang {
  position: fixed;
  z-index: 2;
  top: 12px;
  right: calc(var(--gutter) - 8px);
  display: none;
}
.can-switch .lang { display: flex; }
.lang button {
  padding: 12px 8px;
  border: 0;
  background: none;
  color: var(--faint);
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.2s ease;
}
.lang button:hover { color: var(--muted); }
.lang button[aria-pressed='true'] { color: var(--ink); }
.lang button:focus-visible { outline: 1px solid var(--ink); outline-offset: -3px; }

/* The plain story: what everyone gets first, and all they get without WebGL2. */
.stage-canvas { display: none; }
.chapter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  max-width: calc(31rem + 2 * var(--gutter));
  padding: 96px var(--gutter);
}
.chapter[data-layout] {
  align-items: center;
  width: min(44rem, 100%);
  max-width: none;
  margin: 0 auto;
  text-align: center;
}
/* The opening and closing span the window, as they do once the studio runs, so the switch to the
   live story moves nothing on screen. */
.chapter[data-layout='identity'] { width: 100%; }
.eyebrow {
  margin: 0 0 20px;
  color: var(--faint);
  font: 400 12px/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow .number { color: var(--ink); margin-right: 1.1em; }
h1, h2 {
  margin: 0;
  font-size: clamp(2.2rem, 1.25rem + 3vw, 4.3rem);
  font-weight: 560;
  line-height: 1.02;
  letter-spacing: -0.038em;
  text-wrap: balance;
}
/* Our two names always share a line. */
.names { white-space: nowrap; }
.chapter > p:not(.eyebrow, .hint, .identity) {
  max-width: 30rem;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.2rem);
  line-height: 1.55;
  text-wrap: pretty;
}
.chapter[data-layout] > p:not(.eyebrow, .hint, .identity) { max-width: 40rem; }

/* owl · whisper with STUDIO below, as on the live landing page. */
.identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font-size: inherit;
  letter-spacing: normal;
  line-height: 1;
}
.identity-name {
  font-size: clamp(2.6rem, 1.2rem + 6vw, 6rem);
  font-weight: 560;
  letter-spacing: -0.04em;
}
.identity-studio {
  margin-top: var(--studio-gap);
  padding-left: 0.64em;
  color: #b1b1ad;
  font-size: clamp(20px, 1.84vw, 26px);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0.64em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* How to reach us, on the closing page: the address opens the reader's email app. */
.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 48px 0 0;
}
.contact-label {
  margin: 0;
  color: var(--faint);
  font: 400 12px/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.contact-email {
  padding: 4px 6px;
  color: var(--ink);
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-decoration-color: rgba(243, 243, 239, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  white-space: nowrap;
  transition: text-decoration-color 0.2s ease;
}
.contact-email:hover, .contact-email:focus-visible { text-decoration-color: var(--ink); }
.contact-email:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.chapter > p.hint {
  margin-top: 28px;
  color: var(--faint);
  font: 400 12px/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hint::after {
  content: '';
  display: block;
  width: 1px;
  height: 36px;
  margin: 18px auto 0;
  background: var(--faint);
  transform-origin: top;
  animation: hint 2.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes hint {
  0% { transform: scaleY(0); opacity: 1; }
  55% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* Our player cards: what's personal to each of us, like stats on a character select screen. */
.players {
  display: flex;
  justify-content: center;
  gap: 14px;
  width: 100%;
  margin: 28px 0 0;
  --card: min(20rem, 30vw);
}
.player {
  flex: 1 1 0;
  min-width: 0;
  max-width: var(--card);
  padding: 13px 16px 14px;
  border: 1px solid rgba(243, 243, 239, 0.2);
  background: rgba(9, 9, 9, 0.78);
  text-align: left;
  font: 400 12px/1.45 var(--mono);
}
.player-tag {
  margin: 0 0 11px;
  color: var(--ink);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.player dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 14px;
  margin: 0;
}
.player dl div { display: contents; }
.player dt {
  color: var(--faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.player dd { margin: 0; color: #d6d6d1; overflow-wrap: anywhere; }

/* The story, once the studio is running. The reader turns it a page at a time (pages.js), so
   the page itself never scrolls and the stage fills the window. */
.is-live, .is-live body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.is-live .stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
/* Phone browsers whose toolbar sits over the page (Firefox's bottom bar) size a fixed box to the
   window behind the bar; the dynamic viewport is the part the reader can see. */
@supports (height: 100dvh) {
  .is-live .stage { bottom: auto; height: 100dvh; }
  html.is-live .pages { top: 50dvh; } /* outranks the guide's own rule below */
}
.is-live .stage-canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.is-live .stage.is-ready .stage-canvas { opacity: 1; }
.is-live .story { position: absolute; inset: 0; pointer-events: none; }
.is-live .chapter {
  position: absolute;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  opacity: 0;
}
.is-live .chapter.is-active { opacity: 1; }
.is-live .chapter > * { transform: translate3d(0, 18px, 0); }
.is-live .chapter.is-active > * { transform: none; }
/* Copy eases in and out only once the first frame is drawn, so the switch from the plain story
   never shows every chapter at once. */
.is-ready .chapter { transition: opacity 0.4s ease; }
.is-ready .chapter.is-active { transition-duration: 0.9s; }
.is-ready .chapter > * { transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1); }
.is-ready .chapter.is-active > :nth-child(2) { transition-delay: 0.06s; }
.is-ready .chapter.is-active > :nth-child(3) { transition-delay: 0.12s; }
.is-live .chapter:not([data-layout]) {
  top: 50%;
  left: var(--gutter);
  width: min(31rem, 37vw);
  translate: 0 -50%;
}
/* The page guide numbers every screen, so the chapters drop their own numbers here. */
.is-live .eyebrow .number { display: none; }
/* The wordmark is drawn in 3D, so the page only adds STUDIO under it and the line below. */
.is-live .chapter[data-layout='identity'] { inset: 0; display: block; width: auto; }
.is-live .identity {
  position: absolute;
  left: var(--mark-x, 50%);
  top: calc(var(--mark-bottom, 40%) + var(--studio-gap));
  translate: -50% 0;
}
.is-live .identity-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.is-live .identity-studio { margin: 0; opacity: var(--studio-fade, 1); }
.is-live .contact {
  position: absolute;
  top: calc(50% + var(--center-offset));
  left: 50%;
  margin: 0;
  translate: -50% -50%;
}
/* The story ignores the pointer, except the address on the page being read. */
.is-live .chapter.is-active .contact-email { pointer-events: auto; }
.is-live .chapter[data-layout='identity'] > .hint {
  position: absolute;
  bottom: max(20px, 4vh);
  bottom: max(20px, 4svh);
  left: 50%;
  margin: 0;
  translate: -50% 0;
}
.is-live [data-chapter='0'] > .identity, .is-live [data-chapter='0'] > .hint { animation: arrive 0.8s ease-out 2s backwards; }
@keyframes arrive {
  from { opacity: 0; }
}
/* The two of us stand across the top under our avatars, then our logo, with the copy centred
   below. Each player card stands under its name (craft.js measures where the names land). */
.is-live .chapter[data-layout='team'] {
  top: calc(var(--object-bottom, 42%) + clamp(24px, 4.5vh, 52px));
  top: calc(var(--object-bottom, 42%) + clamp(24px, 4.5svh, 52px));
  left: 0;
  right: 0;
  width: auto;
  padding: 0 var(--gutter);
}
.is-live .chapter[data-layout='team'] > :not(.players) { max-width: 46rem; }
/* A little smaller here, so "Hi, we're OWL and WHISPER" fits on one line where there's room. */
.is-live .chapter[data-layout='team'] h2 { font-size: clamp(1.85rem, 0.9rem + 2.4vw, 3.4rem); }
.is-live .players {
  order: -1;
  justify-content: space-between;
  margin: 0 0 clamp(26px, 5vh, 52px);
  margin: 0 0 clamp(26px, 5svh, 52px);
  padding: 0 max(0px, calc(100% + var(--gutter) - var(--whisper-x, 75%) - var(--card) / 2)) 0 max(0px, calc(var(--owl-x, 25%) - var(--gutter) - var(--card) / 2));
}

/* The page guide: a line for each page on the right, the current one longer and brighter, and
   the page's number over the total. craft.js eases each line's --fill as the story turns, and a
   line takes the reader to its page. Each line is 24px tall, so it is easy to tap. */
.pages { display: none; --line: 28px; }
.is-live .pages {
  position: fixed;
  z-index: 2;
  top: 50%;
  right: max(0px, calc(var(--gutter) / 2 - 12px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  translate: 0 -50%;
}
.pages ol { margin: 0; padding: 0; list-style: none; }
.pages button {
  display: block;
  width: calc(var(--line) + 20px);
  height: 24px; /* the smallest comfortable tap target */
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  --lift: 0;
}
.pages button::before {
  content: '';
  display: block;
  width: var(--line);
  height: 1px;
  margin-left: auto;
  background: currentColor;
  transform-origin: right;
  transform: scaleX(calc(0.36 + 0.64 * var(--fill, 0)));
  opacity: calc(0.3 + 0.7 * var(--fill, 0) + var(--lift));
}
.pages button:hover { --lift: 0.3; }
.pages button:focus-visible { outline: 1px solid var(--ink); outline-offset: -1px; }
.pages-count {
  margin: 0;
  padding-right: 10px;
  color: var(--faint);
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.pages-now { color: var(--ink); }
.pages-slash { margin: 0 0.45em; }
.is-live .pages { animation: arrive 0.8s ease-out 2s backwards; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-aspect-ratio: 9/10) {
  h1, h2 { font-size: clamp(1.85rem, 1.1rem + 3.6vw, 2.7rem); line-height: 1.04; }
  .chapter > p:not(.eyebrow, .hint, .identity) { margin-top: 14px; font-size: 1rem; line-height: 1.5; }
  .eyebrow { margin-bottom: 14px; }
  .is-live .chapter:not([data-layout]) {
    top: auto;
    bottom: max(28px, 5vh);
    bottom: max(28px, 5svh);
    left: 22px;
    right: 22px;
    width: auto;
    translate: none;
  }
  .is-live .chapter[data-layout='team'] { --gutter: 22px; }
  /* The copy keeps clear of the page guide. */
  .is-live .chapter:not([data-layout]) { right: 40px; }
}
/* Where the width or the height is tight, a slimmer guide with its count stacked. */
@media (max-aspect-ratio: 9/10), (max-height: 560px) {
  .pages { --line: 16px; }
  .pages-count { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11px; }
  .pages-slash { margin: 0; }
}
/* On phones the two cards share the width, each still on its own side, clear of the page guide. */
@media (max-width: 640px) {
  .players { gap: 10px; }
  .player { flex: 1 1 0; max-width: 19rem; padding: 11px 12px 12px; font-size: 11px; }
  .player dl { grid-template-columns: minmax(0, 1fr); gap: 1px; }
  .player div + div dt { margin-top: 6px; }
  .is-live .players { padding: 0 16px 0 0; }
}
@media (max-height: 560px) and (min-aspect-ratio: 9/10) {
  h1, h2 { font-size: clamp(1.7rem, 1rem + 2.4vw, 2.4rem); }
  .chapter > p:not(.eyebrow, .hint, .identity) { margin-top: 12px; font-size: 0.95rem; }
  .eyebrow { margin-bottom: 12px; }
  .players { --card: min(20rem, 36vw); }
  .player { padding: 7px 11px 8px; font-size: 11px; line-height: 1.35; }
  .player-tag { margin-bottom: 4px; }
  .player dl { gap: 0 12px; }
  .is-live .chapter[data-layout='team'] { top: calc(var(--object-bottom, 42%) + 14px); }
  .is-live .chapter[data-layout='team'] h2 { font-size: clamp(1.5rem, 0.8rem + 2vw, 2.2rem); }
  .is-live .chapter[data-layout='team'] > p:not(.eyebrow) { margin-top: 8px; line-height: 1.45; }
  .is-live .players { margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint::after { animation: none; transform: none; }
  .is-live .stage-canvas { transition: none; }
  .is-live [data-chapter='0'] > .identity, .is-live [data-chapter='0'] > .hint, .is-live .pages { animation: none; }
  .is-ready .chapter, .is-ready .chapter.is-active { transition-duration: 0.2s; }
  .is-live .chapter > *, .is-ready .chapter > * { transform: none; transition: none; }
}
