/* The live site's look, in one place, for every 3D concept:
   ink background, iris teal, Plus Jakarta Sans, keys seated in carved grooves.
   A concept adds its own layout on top; it should not restate these. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0a1115;
  --bg-deep: #070d10;
  --surface: #101c21;
  --surface-2: #14242a;
  --text: #f1f3ee;
  --muted: #a0adae;
  --faint: #799092;
  --accent: #0aa4b5;
  --accent-bright: #41d3e2;
  --sheen: #c9f6fb;
  --line: #ffffff1c;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --key-teal: #087d8b;
  --lit: linear-gradient(160deg, var(--key-teal), color-mix(in srgb, var(--key-teal) 60%, #052e35));
  --lit-border: #ffffff35;
  --lit-shadow: 0 2px 6px #000000a6, inset 0 1px #ffffff40;
  --track: color-mix(in srgb, var(--bg-deep) 85%, #000);
  --track-border: color-mix(in srgb, var(--text) 9%, transparent);
  --track-shadow: inset 0 1px 1px #000, inset 0 6px 14px #000000f2, inset 0 -1px 0 #ffffff40, 0 -1px 0 #000000cc, 0 1px 0 #ffffff40;
  --key: var(--surface-2);
  --key-border: color-mix(in srgb, var(--text) 12%, transparent);
  --raised: 0 2px 4px #000000a6, inset 0 1px 0 #ffffff14;

  --gutter: clamp(20px, 4.2vw, 60px);
  --header-h: 68px;
  /* A hundredth of the width the page is drawn for. A page that draws itself smaller to fit a
     narrow window (deck.css: --fit) sets this, so type sized by the window keeps its proportion. */
  --vw: 1vw;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a {
  color: inherit;
}
img,
video {
  display: block;
  max-width: 100%;
}
:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 8px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- The stage: one fixed canvas behind the page -------------------------------- */
.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
}
.stage-ready .stage {
  opacity: 1;
  pointer-events: auto;
}
/* What paints before WebGL, and all that paints without it. */
.still {
  transition: opacity 0.9s ease;
}
.stage-ready .still {
  opacity: 0;
  pointer-events: none;
}
main,
.site-footer {
  position: relative;
  z-index: 1;
}
/* Overlay copy lets the scene take pointer input except on real controls. */
.stage-ready main {
  pointer-events: none;
}
.stage-ready main :is(a, button, input, summary, details, video, [data-interactive]) {
  pointer-events: auto;
}

/* --- Header ------------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 var(--gutter);
  background: linear-gradient(#0a1115e6, #0a111500);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  text-decoration: none;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.06em;
}
.brand img {
  width: 26px;
  height: 26px;
}
.brand .wordmark > span {
  margin-left: 0.18em;
  font-weight: 400;
  color: var(--muted);
}
.site-nav {
  display: flex;
  gap: 24px;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.2s;
}
.site-nav a:hover {
  color: var(--text);
}

/* --- Keys and grooves ----------------------------------------------------------- */
.groove {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--track-border);
  border-radius: 16px;
  background: var(--track);
  box-shadow: var(--track-shadow);
}
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--key-border);
  border-radius: 12px;
  background: var(--key);
  color: var(--text);
  box-shadow: var(--raised);
  font: 600 15px/1 var(--font);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.15s, transform 0.08s, box-shadow 0.15s;
}
.key:hover {
  filter: brightness(1.12);
}
.key:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px #00000059;
}
.key.lit {
  border-color: var(--lit-border);
  background: var(--lit);
  color: #fff;
  box-shadow: var(--lit-shadow);
}
.key svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Type ------------------------------------------------------------------------ */
h1,
h2,
h3,
p {
  margin: 0;
}
.display {
  font-size: clamp(34px, calc(3.7 * var(--vw)), 54px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.05em;
  text-wrap: balance;
}
.title {
  font-size: clamp(28px, calc(3 * var(--vw)), 44px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.accent {
  background: linear-gradient(100deg, var(--accent) 35%, var(--sheen) 50%, var(--accent) 65%) 0 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 7s ease-in-out 1.4s infinite;
}
@keyframes sheen {
  0%, 55% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
.muted {
  color: var(--muted);
}
.lead {
  max-width: 32.2em; /* 44 characters. In em, not ch: Safari scales ch twice inside a zoomed box (deck.css: Fit) */
  color: var(--muted);
  font-size: clamp(15px, calc(1.2 * var(--vw)), 18px);
  line-height: 1.55;
  letter-spacing: -0.01em;
}
.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--faint);
}

/* --- Beats: tall scroll sections whose copy holds while the camera moves ---------- */
.beat {
  position: relative;
  min-height: calc(var(--span, 1.6) * 100vh);
  padding: 0 var(--gutter);
}
.beat-copy {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  max-width: min(480px, 100%);
  padding: calc(var(--header-h) + 16px) 0 48px;
}
.beat-copy.right {
  margin-left: auto;
}
/* Copy arrives with its beat when the stage is running. */
.stage-ready .beat-copy > * {
  opacity: var(--show, 1);
  transform: translateY(calc((1 - var(--show, 1)) * 14px));
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* --- Footer ----------------------------------------------------------------------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
  padding: 28px var(--gutter) 36px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-deep) 88%, transparent);
  backdrop-filter: blur(14px);
  color: var(--muted);
  font-size: 14px;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-left: auto;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--text);
}

@media (max-width: 900px) {
  .site-nav {
    display: none;
  }
}
@media (max-width: 600px) {
  :root {
    --header-h: 58px;
  }
  .site-header .groove .key {
    min-height: 38px;
    padding: 0 14px;
    font-size: 14px;
  }
  .site-footer nav {
    margin-left: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .accent {
    animation: none;
  }
  .stage,
  .still,
  .beat-copy > * {
    transition: none;
  }
}

/* --- Without the stage (no WebGL, reduced motion): an ordinary page -------------------
   preflight.js marks <html class="no-stage">. Beats collapse to their copy, and each beat's
   .still-media (a plain image or video of what the scene would show) takes the 3D's place. */
.still-media {
  display: none;
}
.no-stage .beat {
  min-height: 0;
  padding-block: clamp(48px, 8vw, 96px);
}
.no-stage .beat-copy {
  position: static;
  min-height: 0;
  max-width: 720px;
  padding: 0;
}
.no-stage .still-media {
  display: block;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
