/* =====================================================================
   AIFUB — clean light surface (Apple-ish).

   One token layer drives the whole site: changing :root at night is a
   re-theme. The creature's own colours are NOT here — they come from the
   genome in js/pet.js (PALETTES) and must stay meaningful.

   The pet is a dark slate "device" on a near-white stage on purpose: it
   gives the neon core something to glow against and keeps the 768 shapes
   legible. Everything around it is light.
   ===================================================================== */

/* author display rules must never beat [hidden] (learned the hard way) */
[hidden] { display: none !important; }

:root {
  color-scheme: light;

  /* surfaces */
  --bg0: #f5f5f7;                 /* page */
  --bg1: #ffffff;                 /* raised */
  --bg2: #fbfbfd;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.16);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-2: rgba(0, 0, 0, 0.04);

  /* ink — all three levels clear WCAG AA (4.5:1) on both #f5f5f7 and white.
     Apple's own secondary/tertiary greys (#6e6e73 / #86868b) do not: #86868b is
     3.3:1, which is where most of this game's small metadata lives. */
  --text: #1d1d1f;                /* 16.6:1 on the page */
  --muted: #5f5f66;               /*  5.7:1 */
  --dim: #6c6c71;                 /*  4.6:1 — must clear AA on the pet bubble too */

  /* accents — the interactive colour is the accent, not a neon */
  --neon: #0066cc;                /* 5.1:1 as text; white on it is 5.6:1 */
  --violet: #5e5ce6;
  --magenta: #ff375f;
  --lime: #248a3d;
  --good: #16703f;                /* 5.6:1 as text */
  --bad: #d70015;                 /* 5.0:1 as text */
  --warn: #b25000;                /* 4.8:1 as text */

  --grad: linear-gradient(100deg, #0071e3 0%, #5e5ce6 55%, #bf5af2 100%);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -14px rgba(0, 0, 0, .18);
  --glow: 0 0 0 1px rgba(0, 113, 227, .22), 0 12px 32px -14px rgba(0, 113, 227, .45);

  /* the system stack IS the Apple look, and it removes two network requests */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --wrap: 1160px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* nothing may scroll the page sideways. `clip` (not `hidden`) because `hidden`
     would make body a scroll container and break `position: sticky` on the nav. */
  overflow-x: clip;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--display); line-height: 1.08; margin: 0; letter-spacing: -0.022em; }
h1 { font-size: clamp(2.4rem, 6.4vw, 4.4rem); font-weight: 700; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.skip {
  position: absolute; left: -999px; top: 0; z-index: 999;
  background: var(--neon); color: #ffffff; padding: 10px 16px; border-radius: 0 0 12px 0; font-weight: 600;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; border-radius: 6px; }

/* ---------- background: soft pastel wash, no dark aurora ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg0); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px) saturate(120%); opacity: .55; }
.orb-1 { width: 60vw; height: 60vw; left: -14vw; top: -22vw; background: radial-gradient(circle, #cfe6ff, transparent 68%); }
.orb-2 { width: 54vw; height: 54vw; right: -16vw; top: 6vh; background: radial-gradient(circle, #e4def9, transparent 68%); opacity: .5; }
.orb-3 { width: 62vw; height: 62vw; left: 22vw; bottom: -34vw; background: radial-gradient(circle, #ffe1ea, transparent 70%); opacity: .4; }
.grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, .028) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(120% 80% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 20%, transparent 78%);
}
.noise {
  position: absolute; inset: 0; opacity: .018; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
section { padding: clamp(64px, 9vw, 118px) 0; position: relative; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .74rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--neon); border: 1px solid rgba(0, 113, 227, .22);
  background: rgba(0, 113, 227, .06);
  padding: 7px 13px; border-radius: 999px;
}
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 10px rgba(0, 113, 227, .6); }

/* ---------- nav: frosted, like a title bar ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.nav.stuck { border-bottom-color: var(--line); background: rgba(255, 255, 255, .86); }
.nav-in { display: flex; align-items: center; gap: 18px; height: 68px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); font-family: var(--display); font-weight: 700; font-size: 1.16rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 26px; margin-left: auto; }
.nav-links a { color: var(--muted); font-size: .93rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--display); font-weight: 600; font-size: .96rem;
  padding: 12px 21px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--bg1); color: var(--text); cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  transition: transform .18s, box-shadow .25s, background .25s, border-color .25s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(0, 0, 0, .26); box-shadow: 0 4px 14px rgba(0, 0, 0, .1); text-decoration: none; }
.btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.btn-primary {
  background: var(--neon); color: #ffffff; border: 0; font-weight: 600;
  box-shadow: 0 10px 26px -12px rgba(0, 113, 227, .75);
}
.btn-primary:hover { background: #0077ed; box-shadow: 0 14px 32px -12px rgba(0, 113, 227, .8); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(0, 0, 0, .04); }
.btn[disabled], .btn[aria-disabled='true'] {
  opacity: .55; cursor: not-allowed; transform: none; box-shadow: none;
  background: var(--bg0); border: 1px solid var(--line); color: var(--dim);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-sm { padding: 9px 16px; font-size: .88rem; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .nav-links { display: none; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .bg, .nav { display: none; }
  body { background: #fff; color: #000; }
}
