/* =====================================================================
   SOVL Studios · ink, paper & one kept spark

   Motion language, borrowed from the print shop:
     print     elements press into the paper
     register  plates land a hair off, then settle
     engrave   the hatch draws itself at the angle cut into the V (~18°)
     spark     only the spark lives; magenta stays exclusive to its ring

   Mobile first: base styles are for phones, then 600px (large phones,
   small tablets), 900px (tablets landscape, desktop).
   ===================================================================== */

:root {
  /* fixed brand colors */
  --ink: #201e1d;
  --paper: #f3f2f2;
  --magenta: #d6006c; /* spot: the spark's off-register ring only */

  /* theme tokens (light) */
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-soft: #3a3735;
  --soft: #6b6663;        /* HUD labels, captions */
  --bg-dim: #e7e5e4;
  --line: #dcdad9;
  --nav-bg: rgba(243, 242, 242, 0.9);
  --hatch: rgba(32, 30, 29, 0.07);
  --cyan: #0088b0;        /* graphic cyan */
  --cyan-text: #00779b;   /* small cyan text on paper (AA contrast) */
  --game-bg: var(--ink);
  --ghost-blend: multiply;

  --display: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --header-h: 64px;
  --gutter: 16px;
}

@media (min-width: 600px) {
  :root { --gutter: 24px; }
}

/* Dark theme: applied by system preference (unless the user chose
   light with the toggle) and by an explicit data-theme="dark".
   Page ground matches brand ink so ink-plate assets blend in. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--ink);
    --fg: var(--paper);
    --fg-soft: #c7c4c2;
    --soft: #9d9996;
    --bg-dim: #2a2726;
    --line: #3a3634;
    --nav-bg: rgba(32, 30, 29, 0.9);
    --hatch: rgba(243, 242, 242, 0.06);
    --cyan: #35b5d8;
    --cyan-text: #35b5d8;
    --game-bg: #292625;
    --ghost-blend: screen;
  }
}

:root[data-theme="dark"] {
  --bg: var(--ink);
  --fg: var(--paper);
  --fg-soft: #c7c4c2;
  --soft: #9d9996;
  --bg-dim: #2a2726;
  --line: #3a3634;
  --nav-bg: rgba(32, 30, 29, 0.9);
  --hatch: rgba(243, 242, 242, 0.06);
  --cyan: #35b5d8;
  --cyan-text: #35b5d8;
  --game-bg: #292625;
  --ghost-blend: screen;
}

/* ---------- base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.motion { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 600px) {
  body { font-size: 1.0625rem; }
}

img { max-width: 100%; display: block; }

a { color: var(--cyan-text); }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

::selection { background: var(--cyan); color: #fff; }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

section[id] { scroll-margin-top: var(--header-h); }

.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;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.nowrap { white-space: nowrap; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--fg);
  color: var(--bg);
  font: 600 0.85rem var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.skip-link:focus { top: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.7rem 1.5rem;
  border: 2px solid var(--fg);
  color: var(--fg);
  background: transparent;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s,
              transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.btn-solid { background: var(--fg); color: var(--bg); }

.btn-sm { min-height: 38px; padding: 0.45rem 0.95rem; font-size: 0.74rem; }

.btn-light { border-color: var(--paper); color: var(--paper); }

@media (hover: hover) {
  .btn:hover { background: var(--fg); color: var(--bg); }
  /* the cyan plate lands one hair off register */
  .btn-solid:hover { transform: translate(-3px, -3px); box-shadow: 5px 5px 0 var(--cyan); }
  .btn-light:hover { background: #4fc3e0; border-color: #4fc3e0; color: var(--ink); }
}

.btn:active { transform: none; box-shadow: none; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bg-dim);
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--header-h);
  max-width: 1100px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-right: auto;
  color: var(--fg);
  text-decoration: none;
}

.nav-mark { width: 30px; height: 30px; flex: none; overflow: visible; }

.nav-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-name-long { display: none; }

@media (min-width: 420px) {
  .nav-name-long { display: inline; }
}

.nav-links { display: none; }

.nav-link {
  position: relative;
  padding: 12px 2px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-soft);
  transition: color 0.15s;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 6px;
  height: 2px;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.nav-link:hover,
.nav-link.is-active { color: var(--fg); }

.nav-link:hover::after,
.nav-link.is-active::after { transform: scaleX(1); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: color 0.15s, transform 0.2s var(--ease);
}

.theme-toggle svg { width: 20px; height: 20px; }

@media (hover: hover) {
  .theme-toggle:hover { color: var(--cyan); transform: rotate(15deg); }
}

/* light shows the moon (click for dark); dark shows the sun */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-play { margin-left: 2px; }

.menu-bars { position: relative; display: block; width: 20px; height: 12px; }

.menu-bars i {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease), top 0.3s var(--ease);
}

.menu-bars i:first-child { top: 0; }
.menu-bars i:last-child { top: 10px; }
.menu-toggle[aria-expanded="true"] .menu-bars i:first-child { top: 5px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-bars i:last-child { top: 5px; transform: rotate(-45deg); }

/* the spark drops back into the header mark on hover */
@media (hover: hover) {
  .motion .nav-brand:hover .nm-dot { animation: nm-drop 0.6s var(--ease); }
  .motion .nav-brand:hover .nm-ray { animation: nm-ray 0.45s var(--ease) 0.28s both; }
}

@keyframes nm-drop {
  0% { transform: translateY(-60px); opacity: 0; }
  55% { transform: translateY(0); opacity: 1; }
  75% { transform: translateY(-8px); }
  100% { transform: none; }
}

@keyframes nm-ray {
  from { stroke-dasharray: 1; stroke-dashoffset: 1; }
  to { stroke-dasharray: 1; stroke-dashoffset: 0; }
}

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  height: 100%;
  background: var(--cyan);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
}

.mobile-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: grid;
  padding: 4px max(var(--gutter), env(safe-area-inset-left)) 22px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.mobile-menu[hidden] { display: none; }

.mobile-menu a:not(.btn) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mobile-menu small {
  font: 500 11px var(--mono);
  letter-spacing: 0.08em;
  color: var(--soft);
}

.mobile-menu .btn { margin-top: 18px; }

.motion .mobile-menu.is-open { animation: menu-in 0.3s var(--ease); }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-8px); }
}

@media (min-width: 900px) {
  .nav { gap: 10px; }
  .nav-links { display: flex; gap: 1.5rem; margin-right: 0.75rem; }
  .menu-toggle { display: none; }
  .mobile-menu { display: none !important; }
}

/* no script: the menu button can't open, so show the links in a row */
html:not(.js) .menu-toggle { display: none; }

@media (max-width: 899px) {
  html:not(.js) .nav { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; }
  html:not(.js) .nav-links { display: flex; order: 5; width: 100%; gap: 1.2rem; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  padding: 76px 0 92px;
}

@media (min-width: 900px) {
  .hero {
    min-height: min(calc(100vh - var(--header-h)), 920px);
    min-height: min(calc(100svh - var(--header-h)), 920px);
    padding: 96px 0 112px;
  }
}

/* static engraving for visitors without script; the canvas takes over */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: repeating-linear-gradient(-18deg, var(--hatch) 0 1px, transparent 1px 11px);
  pointer-events: none;
}

.hero.hatch-live::before { display: none; }

.hatch-field {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
}

.reg {
  position: absolute;
  width: 18px;
  height: 18px;
  color: var(--soft);
  opacity: 0.8;
  pointer-events: none;
}

.reg-tl { top: 12px; left: 12px; }
.reg-tr { top: 12px; right: 12px; }
.reg-bl { bottom: 12px; left: 12px; }
.reg-br { bottom: 12px; right: 12px; }

.hud {
  position: absolute;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  white-space: nowrap;
}

.hud-tl { top: 16px; left: 40px; }
.hud-tr { top: 16px; right: 40px; display: none; align-items: center; gap: 6px; }
.hud-bl { bottom: 16px; left: 40px; }
.hud-br { bottom: 16px; right: 40px; display: none; }

@media (min-width: 600px) {
  .hud-tr { display: inline-flex; }
}

@media (hover: hover) and (pointer: fine) and (min-width: 600px) {
  .hud-br { display: block; }
}

/* the readout only means something while the grain follows the pointer */
html:not(.motion) .hud-coords { display: none; }

.swatch { display: inline-block; width: 9px; height: 9px; background: var(--ink); box-shadow: inset 0 0 0 1px var(--soft); }
.swatch-cyan { background: var(--cyan); margin-left: 8px; }

.status-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: -12px 0;
  padding: 12px 0;
  text-decoration: none;
  transition: color 0.15s;
}

.status-link:hover { color: var(--fg); }

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
}

.motion .live-dot { animation: pulse 1.8s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.2; } }

.hero-inner { position: relative; max-width: 780px; }

.wordmark {
  display: block;
  width: min(460px, 80vw);
  height: auto;
  margin: 0 auto 1.8rem;
  color: var(--fg);
  overflow: visible;
}

.wordmark .wm-s,
.wordmark .wm-o,
.wordmark .wm-l,
.wordmark .wm-v { transform-box: fill-box; transform-origin: 50% 100%; }

.wordmark .wm-rays path { stroke-dasharray: 1; }

/* hidden until Source Serif 4 is ready, so the letters never jump;
   shows on its own after 3s if the script is missing */
.js .wordmark:not(.is-ready) { opacity: 0; animation: failsafe-show 0s 3s forwards; }

@keyframes failsafe-show { to { opacity: 1; } }

.hero-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.3rem, 3.4vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  text-wrap: balance;
}

.soul {
  position: relative;
  display: inline-block;
  font-style: normal;
  color: var(--cyan);
}

/* an ink plate that slips off register and settles back */
.soul::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  color: var(--fg);
  opacity: 0;
  mix-blend-mode: var(--ghost-blend);
  pointer-events: none;
}

.motion .soul.is-misregistered::after { animation: misregister 0.7s var(--ease); }

@media (hover: hover) {
  .motion .soul:hover::after { animation: misregister 0.7s var(--ease); }
}

@keyframes misregister {
  0% { opacity: 0.9; transform: translate(4px, -3px); }
  35% { transform: translate(-2px, 1px); }
  65% { opacity: 0.7; transform: translate(1px, -0.5px); }
  100% { opacity: 0; transform: none; }
}

.lede {
  max-width: 560px;
  margin: 0 auto 2.2rem;
  font-size: 1.06rem;
  color: var(--fg-soft);
}

@media (min-width: 600px) {
  .lede { font-size: 1.15rem; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* hero copy presses in after the wordmark; the 2.6s failsafe covers a
   missing script, .is-live restarts it on the sting's clock */
.motion .hero-step { animation: press 0.8s var(--ease) 2.6s both; }
.motion .hero.is-live .hero-step { animation: press-live 0.8s var(--ease) var(--d, 0s) both; }

@keyframes press {
  from { opacity: 0; transform: translateY(14px) scale(1.012); }
  to { opacity: 1; transform: none; }
}

@keyframes press-live {
  from { opacity: 0; transform: translateY(14px) scale(1.012); }
  to { opacity: 1; transform: none; }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px;
  color: var(--soft);
  text-decoration: none;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.scroll-cue i { display: block; width: 1px; height: 26px; background: currentColor; transform-origin: top; }

.motion .scroll-cue i { animation: cue 2.2s var(--ease) infinite; }

@keyframes cue {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

@media (min-width: 760px) {
  .scroll-cue { display: flex; }
}

/* ---------- engraved tone bands between grounds ---------- */
.band { display: block; height: 40px; line-height: 0; }
.band svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.band-hero { background: var(--bg); color: var(--game-bg); }
.band-game { background: var(--game-bg); color: var(--bg); }
.band-team { background: var(--bg-dim); color: var(--ink); }

@media (min-width: 900px) {
  .band { height: 48px; }
}

/* ---------- sections ---------- */
.kicker {
  display: flex;
  align-items: baseline;
  gap: 0.9em;
  margin-bottom: 0.8rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--cyan-text);
}

.idx {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--soft);
}

.kicker .idx { flex: none; padding-right: 0.9em; border-right: 1px solid currentColor; line-height: 1.2; }

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 4.4vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  text-wrap: balance;
}

/* scroll reveal: `translate` (not transform) so hover transforms still work */
.motion [data-reveal] { opacity: 0; }
.motion [data-reveal].is-in { animation: reveal 0.9s var(--ease) var(--d, 0s) both; }

@keyframes reveal {
  from { opacity: 0; translate: 0 18px; }
  to { opacity: 1; translate: none; }
}

/* ---------- game section (ink ground) ---------- */
.game {
  background: var(--game-bg);
  color: var(--paper);
  padding: 64px 0 80px;
}

@media (min-width: 900px) {
  .game { padding: 88px 0 104px; }
}

.game .kicker { color: #4fc3e0; }
.game .kicker .idx { color: rgba(243, 242, 242, 0.55); }
.game p { color: rgba(243, 242, 242, 0.82); margin-bottom: 1rem; }
.game strong { color: var(--paper); }
.game .btn { margin-top: 0.75rem; }

.game-grid { display: grid; gap: 44px; align-items: center; }

@media (min-width: 960px) {
  .game-grid { grid-template-columns: 1.05fr 0.95fr; gap: 56px; }
}

/* the world log, set as a proof sheet with crop marks */
.world-log {
  position: relative;
  margin: 12px;
  padding: 16px 16px 20px;
  background: rgba(243, 242, 242, 0.035);
  border: 1px solid rgba(243, 242, 242, 0.14);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.65;
  color: rgba(243, 242, 242, 0.88);
}

@media (min-width: 600px) {
  .world-log { padding: 20px 24px 24px; font-size: 0.84rem; }
}

.crop {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 0 solid rgba(243, 242, 242, 0.45);
}

.crop-tl { top: -14px; left: -14px; border-right-width: 1px; border-bottom-width: 1px; }
.crop-tr { top: -14px; right: -14px; border-left-width: 1px; border-bottom-width: 1px; }
.crop-bl { bottom: -14px; left: -14px; border-right-width: 1px; border-top-width: 1px; }
.crop-br { bottom: -14px; right: -14px; border-left-width: 1px; border-top-width: 1px; }

.wl-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(243, 242, 242, 0.2);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4fc3e0;
}

.wl-lines { list-style: none; display: grid; gap: 7px; }

.wl-lines li { display: grid; grid-template-columns: 6.5ch 1fr; column-gap: 1.2ch; }

.wl-t { color: #4fc3e0; }

/* typing: the untyped rest stays in the flow, transparent, so nothing shifts */
.wl-rest { color: transparent; }
.wl-lines li.is-pending .wl-t { opacity: 0; }

.wl-typed.has-caret::after {
  content: "";
  display: inline-block;
  width: 0.6ch;
  height: 1.05em;
  margin-right: -0.6ch;
  vertical-align: -0.18em;
  background: #4fc3e0;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* systems: farm → village → forest → farm, wired together */
.systems { position: relative; margin-top: 56px; }

.systems-wires {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.wire { fill: none; stroke-width: 1; }
.wire-fwd { stroke: rgba(243, 242, 242, 0.28); }
.wire-ret { stroke: rgba(79, 195, 224, 0.5); stroke-dasharray: 4 5; }
.pulses circle { fill: #4fc3e0; }

.pillars {
  position: relative;
  z-index: 1;
  list-style: none;
  display: grid;
  gap: 22px;
  padding-left: 34px;
}

.pillar {
  position: relative;
  padding: 22px 20px 24px;
  background: var(--game-bg);
  border: 1px solid rgba(243, 242, 242, 0.16);
  transition: border-color 0.3s, transform 0.35s var(--ease);
}

@media (hover: hover) {
  .pillar:hover { border-color: rgba(79, 195, 224, 0.55); transform: translateY(-3px); }
}

.pillar-plate {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  border: 1px solid rgba(243, 242, 242, 0.3);
  border-radius: 50%;
  background: var(--game-bg);
  color: var(--paper);
}

.pillar-plate svg { width: 36px; height: 36px; overflow: visible; }
.pillar-plate .lit,
.pillar-plate .ff { fill: #4fc3e0; }

.motion .pillar-plate .ff { animation: firefly 2.8s ease-in-out infinite; }
.motion .pillar-plate .ff-2 { animation-delay: 0.9s; }
.motion .pillar-plate .ff-3 { animation-delay: 1.7s; }
.motion .pillar-plate .lit-2 { animation: flicker 4.2s steps(1) infinite; }

@keyframes firefly {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

@keyframes flicker {
  0%, 62%, 70%, 100% { opacity: 1; }
  64%, 68% { opacity: 0.2; }
}

.pillar.ping .pillar-plate { animation: ping 0.7s var(--ease); }

@keyframes ping {
  0% { border-color: #4fc3e0; box-shadow: 0 0 0 0 rgba(79, 195, 224, 0.45); }
  100% { border-color: rgba(243, 242, 242, 0.3); box-shadow: 0 0 0 12px rgba(79, 195, 224, 0); }
}

.pillar h3 {
  margin-bottom: 0.5rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #4fc3e0;
}

.pillar p { font-size: 0.93rem; margin: 0; }

.pillar .pillar-line {
  margin-bottom: 0.6rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--paper);
}

.game .systems-caption {
  margin: 22px 0 0;
  padding-left: 34px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(243, 242, 242, 0.55);
}

@media (min-width: 900px) {
  .systems { margin-top: 64px; }
  .pillars { grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 44px 0 0; }
  .game .systems-caption { padding-left: 0; text-align: center; }
}

/* ---------- studio ---------- */
.studio { padding: 64px 0 80px; }

@media (min-width: 900px) {
  .studio { padding: 96px 0; }
}

.studio-grid { display: grid; gap: 28px; align-items: center; }

@media (min-width: 900px) {
  .studio-grid { grid-template-columns: 0.95fr 1.05fr; gap: 48px; }
}

.studio-copy p:not(.kicker) { margin-bottom: 1rem; color: var(--fg-soft); }

.principles { list-style: none; display: grid; margin-top: 0.25rem; }

.principles li {
  display: grid;
  grid-template-columns: 3.2ch 1fr;
  gap: 1ch;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--fg);
}

.principles li:last-child { border-bottom: 1px solid var(--line); }

.principles .idx { padding-top: 0.4em; color: var(--cyan-text); }

/* exploded mark: four printing plates on a 3D stack, driven by --e (0..1) */
.mark-explode {
  --e: 0;
  --lift: 44px;
  --lab: 0;
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 480 / 420;
  margin: 0 auto;
}

.me-stage {
  position: absolute;
  top: 0;
  left: calc((1 - var(--e)) * 20%);
  width: 60%;
  height: 100%;
  perspective: 1100px;
}

.me-stack {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76%;
  aspect-ratio: 1;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%) translateY(calc(var(--e) * 12%))
             rotateX(calc(var(--e) * 56deg)) rotateZ(calc(var(--e) * -38deg));
}

.me-plate { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.p2 { transform: translateZ(calc(var(--e) * var(--lift) + 0.5px)); }
.p3 { transform: translateZ(calc(var(--e) * var(--lift) * 2 + 1px)); }
.p4 { transform: translateZ(calc(var(--e) * var(--lift) * 3 + 1.5px)); }

.me-frame,
.me-ghost {
  fill: none;
  stroke: var(--soft);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: var(--e);
}

.me-frame { stroke-dasharray: 4 4; }
.me-ghost { stroke-dasharray: 3 4; }
.me-ink { fill: var(--fg); }
.me-hatch-cut path,
.me-hatch-lift path { stroke-width: 1.5; }
.me-hatch-cut { stroke: var(--bg); opacity: calc(0.9 * (1 - var(--e))); }
.me-hatch-lift { stroke: var(--cyan); opacity: var(--e); }
.me-dot { fill: var(--fg); }
.me-dot-cut { stroke: var(--bg); stroke-width: 1.1; }
.me-rays { fill: none; stroke: var(--fg); stroke-width: 3.6; }
.me-ring { fill: none; stroke: var(--magenta); stroke-width: 1.3; opacity: 0.8; }

.me-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.me-leaders path { fill: none; stroke: var(--soft); stroke-width: 1; opacity: var(--lab); }

.me-labels {
  position: absolute;
  top: 0;
  left: 66%;
  right: 0;
  height: 100%;
  list-style: none;
  pointer-events: none;
}

.me-labels li {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: grid;
  gap: 2px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--soft);
  opacity: var(--lab);
  transform: translateY(var(--y, 0px));
}

.me-labels b { font-weight: 500; color: var(--fg); }

/* ---------- team ---------- */
.team { background: var(--bg-dim); padding: 64px 0 80px; }

@media (min-width: 900px) {
  .team { padding: 96px 0 104px; }
}

.founders {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 36px;
}

@media (min-width: 900px) {
  .founders { gap: 28px; }
}

.person {
  position: relative;
  flex: 1 1 260px;
  max-width: 350px;
  padding: 30px 22px 26px;
  background: var(--bg);
  border: 1px solid var(--line);
  text-align: center;
}

.portrait { position: relative; width: 144px; height: 144px; margin: 0 auto 20px; border-radius: 50%; }

/* engraved duotone: ink to paper, with the hatch over it; colour on hover */
.portrait img,
.id-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(0.78) brightness(1.07);
  transition: filter 0.6s var(--ease);
}

.portrait img { border-radius: 50%; border: 3px solid var(--fg); }

.portrait::after,
.id-photo::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: repeating-linear-gradient(-18deg, rgba(32, 30, 29, 0.2) 0 1px, transparent 1px 4px);
  mix-blend-mode: multiply;
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
}

/* the cyan plate: lands one hair off register when the photo wakes up */
.portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s var(--ease), opacity 0.3s;
}

@media (hover: hover) {
  .person:hover .portrait img,
  .dossier:hover .id-photo img { filter: none; }
  .person:hover .portrait::after,
  .dossier:hover .id-photo::after { opacity: 0; }
  .person:hover .portrait::before { opacity: 1; transform: translate(4px, -4px); }
}

.is-lit .portrait img,
.is-lit .id-photo img { filter: none; }
.is-lit .portrait::after,
.is-lit .id-photo::after { opacity: 0; }
.is-lit .portrait::before { opacity: 1; transform: translate(4px, -4px); }

.person h3,
.dossier h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.role {
  margin: 0.35rem 0 1rem;
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan-text);
}

.person p:not(.role),
.dossier p:not(.role) { font-size: 0.95rem; color: var(--fg-soft); }

.social { display: inline-block; margin-top: 0.5rem; padding: 8px 4px; font-size: 0.95rem; }

.board-label {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.9em;
  margin: 60px 0 34px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
}

.board-label .idx { color: var(--cyan-text); }

.board {
  list-style: none;
  display: grid;
  gap: 48px 28px;
  max-width: 920px;
  margin: 0 auto;
}

@media (min-width: 760px) {
  .board { grid-template-columns: 1fr 1fr; }
}

.dossier {
  position: relative;
  padding: 26px 20px 60px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.dossier-tab {
  position: absolute;
  top: 0;
  left: 16px;
  transform: translateY(-100%);
  padding: 6px 12px 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom: 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--soft);
}

.dossier-body { display: grid; grid-template-columns: 84px 1fr; gap: 16px; align-items: start; }

@media (min-width: 420px) {
  .dossier-body { grid-template-columns: 104px 1fr; gap: 20px; }
}

.id-photo { position: relative; aspect-ratio: 1; border: 2px solid var(--fg); }
.id-photo::after { inset: 0; }

.stamp {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 3px 10px 2px;
  border: 3px double currentColor;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan-text);
  opacity: 0.85;
  transform: rotate(-8deg);
  pointer-events: none;
}

.motion .dossier[data-reveal] .stamp { opacity: 0; }
.motion .dossier.is-in .stamp { animation: stamp 0.55s var(--ease) 0.45s both; }

@keyframes stamp {
  0% { opacity: 0; transform: rotate(-8deg) scale(1.8); }
  60% { opacity: 0.9; transform: rotate(-8deg) scale(0.95); }
  100% { opacity: 0.85; transform: rotate(-8deg) scale(1); }
}

/* never seen in the same room: the alter ego steps out */
.left-room {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

.person > :not(.left-room),
.dossier > :not(.left-room) { transition: opacity 0.45s var(--ease), filter 0.45s var(--ease); }

.is-away { border-style: dashed; }
.is-away > :not(.left-room) { opacity: 0.07; filter: blur(1.5px) grayscale(1); }
.is-away .stamp { visibility: hidden; }
.is-away .left-room { opacity: 1; }

/* ---------- footer ---------- */
.site-footer {
  position: relative;
  padding: 56px 0 32px;
  background: var(--ink);
  color: rgba(243, 242, 242, 0.7);
}

.site-footer .reg { color: rgba(243, 242, 242, 0.4); }

.footer-top { display: grid; justify-items: start; gap: 10px; }

.footer-brand { display: block; color: var(--paper); }

.wordmark-footer { width: min(340px, 72vw); margin: 0; color: var(--paper); }

.footer-tag {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(243, 242, 242, 0.55);
}

.footer-cols { display: grid; gap: 28px; margin: 44px 0 36px; }

@media (min-width: 600px) {
  .footer-cols { grid-template-columns: repeat(3, 1fr); }
}

.f-h {
  margin-bottom: 6px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4fc3e0;
}

.footer-cols a {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 9px 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.84rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(243, 242, 242, 0.8);
  transition: color 0.15s;
}

.footer-cols a small {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: none;
  color: rgba(243, 242, 242, 0.45);
}

.footer-cols a:hover { color: var(--paper); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(243, 242, 242, 0.14);
}

.fine { font-size: 0.82rem; }

.colophon {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(243, 242, 242, 0.45);
}

.to-top {
  padding: 10px 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(243, 242, 242, 0.7);
}

.to-top:hover { color: var(--paper); }
