:root {
  --paper: #f7f6f2;
  --ink: #2b2a27;
  --muted: #8b8980;
  --line: #e6e4dc;
  --card: #fdfcf9;
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --gutter: clamp(16px, 5vw, 48px);
  --measure: 1100px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* Phones tint the status bar from the page background (newer iOS) or from the
   theme-color tag (Android, older iOS). On the home page both start as the
   hero's sky and switch to paper once the hero has scrolled away. */
html { background: var(--page-top, var(--paper)); }
html.home { --page-top: #2a78c0; }
html.home.past-hero { --page-top: var(--paper); }
html:has(.app-page--grimm) { --page-top: #00161b; }
html:has(.app-page--loop) { --page-top: #4f63d2; }
html.home main, html.home .footer { background: var(--paper); }
body {
  margin: 0;
  background: var(--page-top, var(--paper));
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 6px; }

.scene {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  contain: paint;
}
.scene canvas {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  image-rendering: pixelated;
}

.wordmark {
  font: 400 26px/1 var(--serif);
  letter-spacing: -0.01em;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  color: #fff;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
  border-bottom: 1px solid transparent;
}
.nav__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav__links { display: flex; gap: 8px; }
.pill-group {
  display: flex;
  padding: 3px;
  border-radius: 9px;
  background: rgba(20, 40, 70, 0.28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition: background-color 0.25s, box-shadow 0.25s;
}
.pill-group a {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.15s;
}
.pill-group a:hover { background: rgba(255, 255, 255, 0.18); }
.nav--solid {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ink);
  border-color: var(--line);
}
.nav--solid .pill-group { background: transparent; box-shadow: none; }
.nav--solid .pill-group a:hover { background: rgba(0, 0, 0, 0.06); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: transform 0.15s, background-color 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn--light { background: #fff; color: #1d1c1a; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), 0 6px 16px -8px rgba(0, 0, 0, 0.4); }
.btn--glass {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.btn--glass:hover { background: rgba(255, 255, 255, 0.28); }
.btn--brand { background: var(--brand); color: var(--brand-ink); text-shadow: none; }
.btn--static, .btn--static:hover { transform: none; cursor: default; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  height: 100svh;
  min-height: 560px;
  background: var(--paper);
}
.hero .scene { position: absolute; inset: 0; }
.hero__copy {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(110px, 17vh, 170px) var(--gutter) 0;
  color: #fff;
  text-shadow: 0 1px 14px rgba(12, 62, 140, 0.55);
}
/* A sky-coloured haze behind the copy: invisible on open sky, but it tints
   any cloud drifting behind the text so the white type stays readable. */
.hero__copy::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: clamp(40px, 6vh, 70px);
  left: calc(var(--gutter) - 90px);
  width: min(760px, 100% + 60px);
  height: clamp(380px, 46vh, 460px);
  background: radial-gradient(ellipse 50% 50% at 46% 52%, rgba(40, 116, 190, 0.92) 0%, rgba(40, 116, 190, 0.8) 55%, rgba(40, 116, 190, 0) 100%);
  pointer-events: none;
}
.hero h1 {
  max-width: 13em;
  font-size: clamp(30px, 4.2vw, 44px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero p {
  max-width: 30em;
  margin-top: 18px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.92);
  text-wrap: pretty;
}
.hero__actions { text-shadow: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

/* ---------- lab statement ---------- */
.eyebrow {
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.statement {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(72px, 12vw, 140px) var(--gutter) clamp(56px, 8vw, 96px);
  text-align: center;
  scroll-margin-top: 40px;
}
.statement h2 {
  margin-top: 22px;
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.statement h2 span { color: var(--muted); }
.statement__body { max-width: 34em; margin: 22px auto 0; color: #6a685f; text-wrap: pretty; }

/* ---------- people ---------- */
.people {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(64px, 9vw, 112px);
  scroll-margin-top: 80px;
}
.people__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 5vw, 56px);
  padding-top: 28px;
}
.person { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 22px; align-items: start; }
.person__art {
  aspect-ratio: 1;
  padding: 6px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 14px 30px -18px rgba(40, 36, 20, 0.35);
}
.person__art .scene { border-radius: 8px; }
.person { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.person__art { transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1); }
.person:hover .person__art { transform: translateY(-4px) rotate(-2.5deg); }
.person:nth-child(even):hover .person__art { transform: translateY(-4px) rotate(2.5deg); }
.person:active .person__art { transform: translateY(-1px) scale(0.97); }
.person h3 { margin-top: 10px; font: 400 34px/1 var(--serif); letter-spacing: -0.01em; }
.person p:last-child { margin-top: 10px; color: #6a685f; text-wrap: pretty; }

/* ---------- work ---------- */
.work {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(72px, 10vw, 128px);
  scroll-margin-top: 80px;
}
.work__head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.product {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 40px);
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 80px;
}
.product__art {
  aspect-ratio: 3 / 2;
  padding: 8px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 14px 30px -18px rgba(40, 36, 20, 0.35);
  transition: transform 0.25s;
}
.product__art .scene { border-radius: 7px; }
a.product:hover .product__art { transform: translateY(-3px) rotate(-0.6deg); }
.product__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.status {
  padding: 4px 7px;
  border-radius: 5px;
  background: #e9f3dc;
  color: #3f7a1f;
}
.product h3 {
  margin-top: 14px;
  font: 400 40px/1 var(--serif);
  letter-spacing: -0.01em;
}
.arrow {
  display: inline-block;
  font: 400 18px/1 var(--sans);
  color: var(--muted);
  vertical-align: 0.5em;
  transition: transform 0.2s, color 0.2s;
}
a.product:hover .arrow { transform: translate(2px, -2px); color: var(--ink); }
.product p { max-width: 32em; margin-top: 12px; color: #6a685f; text-wrap: pretty; }

/* ---------- footer ---------- */
.footer { position: relative; }
.footer__inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--gutter) 56px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  color: #6a685f;
  font-size: 13px;
}
.footer__inner .wordmark { color: var(--ink); }
.footer__fine { margin-left: auto; font: 400 11px/1 var(--mono); letter-spacing: 0.06em; color: var(--muted); }
.footer__grass { height: 96px; }

/* ---------- product pages (Grimm, Loop) ---------- */
.app-page {
  min-height: 100svh;
  background: var(--sky);
  color: #fff;
  overflow: hidden;
}
.app-page--grimm { --sky: #00161b; --brand: #8cc63f; --brand-ink: #00242a; --halo: rgba(0, 22, 27, 0.75); }
.app-page--loop { --sky: #4f63d2; --brand: #fff; --brand-ink: #3b3470; --halo: rgba(40, 36, 110, 0.75); }
.app-page > .scene { position: fixed; inset: 0; }
.app-page__home { position: fixed; top: 16px; left: var(--gutter); z-index: 2; opacity: 0.9; }
.app-page__home:hover { opacity: 1; }
.app {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  padding: clamp(96px, 20vh, 220px) var(--gutter) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-shadow: 0 1px 12px var(--halo);
}
.app__icon {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 12px 28px -10px rgba(0, 0, 0, 0.6);
}
.app__icon--pixel { image-rendering: pixelated; }
.app h1 { margin-top: 12px; font: 400 34px/1 var(--serif); }
.app p { max-width: 22em; margin-top: 14px; font-size: 14px; color: rgba(255, 255, 255, 0.9); text-wrap: balance; }
.app .btn { margin-top: 18px; }

@media (max-width: 820px) {
  .people__grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pill-group a { padding: 5px 9px; }
  .product { grid-template-columns: 1fr; }
  .people__grid { grid-template-columns: 1fr; }
  .person { grid-template-columns: 132px minmax(0, 1fr); gap: 18px; }
  .footer__fine { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
