/* ==========================================================================
   SCRIPT KIDDY — stylesheet
   Tokens → base → layout → components → the CSS-only effects
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --hue: 165;
  --bg: #0a0c10;
  --bg-2: #0f1218;
  --card: #12161e;
  --card-2: #171c26;
  --fg: #e9edf3;
  --muted: #8d97a8;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: oklch(80% 0.17 var(--hue));
  --accent-soft: oklch(80% 0.17 var(--hue) / 0.14);
  --accent-ink: #0a0c10;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", sans-serif;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

html.light {
  --bg: #f4f5f8;
  --bg-2: #eaecf1;
  --card: #ffffff;
  --card-2: #f6f7fa;
  --fg: #14171d;
  --muted: #5d6675;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.22);
  --accent: oklch(58% 0.19 var(--hue));
  --accent-soft: oklch(58% 0.19 var(--hue) / 0.12);
  --accent-ink: #ffffff;
  --shadow: 0 10px 40px rgba(20, 23, 29, 0.12);
  color-scheme: light;
}

/* :has() — the accent hue of the WHOLE page is driven by radio buttons
   that live halfway down the document. No JavaScript involved. */
html:has(#hue-violet:checked) { --hue: 290; }
html:has(#hue-amber:checked)  { --hue: 75;  }
html:has(#hue-pink:checked)   { --hue: 350; }
html:has(#hue-sky:checked)    { --hue: 235; }

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font: 16px/1.6 var(--sans);
  color: var(--fg);
  background:
    radial-gradient(1200px 600px at 50% -200px, var(--accent-soft), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 48px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 48px 100%,
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: clip;
}

h1, h2, h3 { font-family: var(--mono); letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code, kbd, pre { font-family: var(--mono); }
code:not(pre code), kbd {
  font-size: 0.85em;
  padding: 0.1em 0.4em;
  border-radius: 6px;
  background: var(--card-2);
  border: 1px solid var(--line);
}
kbd { border-bottom-width: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- scroll progress bar (CSS scroll-driven, JS fallback) ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(var(--scroll, 0));
  z-index: 200;
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .progress { transform: none; animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.brand {
  font: 700 0.95rem var(--mono);
  color: var(--fg);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.brand .cursor {
  display: inline-block; width: 0.55em; height: 1.1em; background: var(--accent);
  animation: blink 1s steps(2, jump-none) infinite; vertical-align: -0.2em;
}
@keyframes blink { to { opacity: 0; } }
.nav-links { display: flex; gap: 0.25rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-links a {
  font: 500 0.85rem var(--mono);
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--fg); background: var(--accent-soft); }
.pill {
  font: 500 0.75rem var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  white-space: nowrap;
}
.pill b { color: var(--accent); font-weight: 700; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  display: inline-grid; place-items: center;
  font-size: 1rem;
  transition: transform 0.2s, border-color 0.2s;
}
.icon-btn:hover { transform: rotate(-20deg) scale(1.08); border-color: var(--line-strong); }
@media (max-width: 720px) { .nav-links { display: none; } }

/* ---------- layout ---------- */
.wrap { width: min(1180px, 100% - 2 * clamp(1rem, 4vw, 2.5rem)); margin-inline: auto; }
.section { padding: clamp(3rem, 8vw, 6rem) 0; }
.section-head { max-width: 62ch; margin-bottom: 2.25rem; }
.eyebrow {
  font: 600 0.8rem var(--mono);
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: block;
}
.section-head p { color: var(--muted); margin-top: 0.75rem; font-size: 1.05rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 1.25rem;
}
.span-2 { grid-column: 1 / -1; }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(2, 1fr); } .span-2 { grid-column: span 2; } }

/* ---------- hero ---------- */
.hero { padding: clamp(3rem, 10vw, 7rem) 0 clamp(2rem, 6vw, 4rem); }
.hero h1 {
  font-size: clamp(2.6rem, 9vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  white-space: nowrap;
  margin-bottom: 1rem;
  background: linear-gradient(120deg, var(--fg) 30%, var(--accent));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero .lede { max-width: 58ch; font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--muted); }
.hero .lede strong { color: var(--fg); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

/* fake browser chrome that mirrors the REAL tab title / favicon / URL */
.browser {
  margin-top: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
  box-shadow: var(--shadow);
  overflow: clip;
  max-width: 720px;
}
.tabbar { display: flex; align-items: flex-end; gap: 4px; padding: 8px 10px 0; background: var(--bg-2); }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: 10px 10px 0 0;
  font: 500 0.82rem var(--sans);
  color: var(--muted);
  max-width: 260px;
  min-width: 0;
}
.tab.active { background: var(--card); color: var(--fg); }
.tab img, .tab .dot { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.tab .dot { border-radius: 50%; background: var(--line-strong); }
.tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .x { margin-left: auto; opacity: 0.5; }
.omnibar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--card);
  border-top: 1px solid var(--line);
}
.omnibar .traffic { display: flex; gap: 6px; }
.omnibar .traffic i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); display: block; }
.omnibar .url {
  flex: 1;
  font: 0.82rem var(--mono);
  color: var(--muted);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 6px 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.omnibar .url b { color: var(--fg); font-weight: 500; }
.browser-note { font: 0.78rem var(--mono); color: var(--muted); padding: 8px 12px; border-top: 1px dashed var(--line); }

.scroll-hint {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 2rem;
  font: 0.8rem var(--mono); color: var(--muted);
}
.scroll-hint i { display: inline-block; animation: bob 1.4s ease-in-out infinite; font-style: normal; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: clip;            /* clip, not hidden — hidden would become a scroll container */
  min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.badge {
  flex: none;
  font: 600 0.68rem var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  margin-top: 2px;
}
.badge.css { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.card-desc { color: var(--muted); font-size: 0.95rem; }
.card-desc kbd { color: var(--fg); }
.demo {
  background: var(--bg-2);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 1.25rem;
  min-height: 120px;
  display: grid;
  place-items: center;
  gap: 0.75rem;
  text-align: center;
  position: relative;
}
.demo.left { place-items: stretch; text-align: left; }
.readout { font: 500 0.85rem var(--mono); color: var(--muted); }
.readout b { color: var(--fg); font-weight: 600; }
.big { font: 700 clamp(1.4rem, 3vw, 2rem) var(--mono); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.controls .grow { flex: 1 1 180px; }

/* scroll-driven entrance for every card — zero JS */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal { animation: fadeup linear both; animation-timeline: view(); animation-range: entry 0% entry 45%; }
    @keyframes fadeup { from { opacity: 0; translate: 0 28px; } }
  }
}

/* segmented control */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 9px;
  font: 500 0.82rem var(--mono);
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: 0.92rem; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 42px; height: 24px; border-radius: 999px;
  background: var(--line-strong);
  position: relative; flex: none;
  transition: background 0.25s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff;
  transition: translate 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { translate: 18px 0; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 3px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  font: 500 0.88rem var(--mono);
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.text-input {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  font: 0.9rem var(--mono);
  min-width: 0;
}
.text-input:focus { border-color: var(--accent); outline: none; }
input[type="range"] { accent-color: var(--accent); }

/* code blocks */
.code { border-top: 1px solid var(--line); padding-top: 0.75rem; margin-top: auto; }
.code summary {
  cursor: pointer; font: 600 0.8rem var(--mono); color: var(--muted);
  list-style: none; display: flex; align-items: center; gap: 0.5rem;
}
.code summary::-webkit-details-marker { display: none; }
.code summary::before { content: "▸"; color: var(--accent); transition: rotate 0.2s; }
.code[open] summary::before { rotate: 90deg; }
.code summary:hover { color: var(--fg); }
.code-wrap { position: relative; margin-top: 0.75rem; }
.code pre {
  margin: 0;
  padding: 1rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  line-height: 1.55;
  overflow-x: auto;
  tab-size: 2;
}
.copy {
  position: absolute; top: 8px; right: 8px;
  font: 600 0.7rem var(--mono);
  padding: 0.25rem 0.55rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  opacity: 0.7;
}
.copy:hover { opacity: 1; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  translate: -50% 0;
  z-index: 300;
  background: var(--fg);
  color: var(--bg);
  font: 500 0.88rem var(--mono);
  padding: 0.7rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, translate 0.3s;
}
.toast.show { opacity: 1; translate: -50% -8px; }

/* ==========================================================================
   The CSS-only effects
   ========================================================================== */

/* --- reading highlight: each word lights up as it crosses the middle of the viewport --- */
.reader {
  font: 600 clamp(1.25rem, 2.6vw, 1.85rem) / 1.5 var(--sans);
  letter-spacing: -0.01em;
  margin: 0;
}
.reader .w { display: inline-block; color: var(--muted); opacity: 0.32; }
@supports (animation-timeline: view()) {
  .reader .w { animation: lightup linear both; animation-timeline: view(); animation-range: cover 38% cover 52%; }
  @keyframes lightup { to { color: var(--fg); opacity: 1; } }
}
html.no-sda .reader .w { color: var(--fg); opacity: 1; }

/* --- :has() swatches --- */
.swatches { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatches span {
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: oklch(78% 0.17 var(--h));
  border: 3px solid transparent;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  font: 700 0.7rem var(--mono); color: #0a0c10;
}
.swatches input:checked + span { transform: scale(1.12); border-color: var(--fg); box-shadow: 0 0 0 3px var(--card); }
.swatches input:focus-visible + span { outline: 2px solid var(--fg); outline-offset: 3px; }

/* --- @property: an animatable custom property drives a conic-gradient border --- */
@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.glow {
  --angle: 0deg;
  position: relative;
  padding: 1.5rem 2rem;
  border-radius: 14px;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    conic-gradient(from var(--angle), var(--accent) 0%, transparent 25%, transparent 50%, var(--accent) 75%, transparent 100%) border-box;
  animation: spin 3.5s linear infinite;
  font: 600 1.05rem var(--mono);
}
.glow::after {
  content: ""; position: absolute; inset: -14px; z-index: -1; border-radius: 22px;
  background: conic-gradient(from var(--angle), var(--accent), transparent 25%, transparent 50%, var(--accent) 75%, transparent);
  filter: blur(22px); opacity: 0.35;
  animation: spin 3.5s linear infinite;
}
@keyframes spin { to { --angle: 360deg; } }
.glow.paused, .glow.paused::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .glow, .glow::after { animation-play-state: paused; } }

/* --- popover + @starting-style: a toast with no JavaScript at all --- */
[popover].toast-pop {
  position: fixed;
  inset: auto 0 28px 0;
  margin: 0 auto;
  width: max-content;
  max-width: min(90vw, 420px);
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--card);
  color: var(--fg);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  opacity: 0;
  translate: 0 16px;
  transition: opacity 0.35s, translate 0.35s, display 0.35s allow-discrete, overlay 0.35s allow-discrete;
}
[popover].toast-pop:popover-open { opacity: 1; translate: 0 0; }
@starting-style { [popover].toast-pop:popover-open { opacity: 0; translate: 0 16px; } }
[popover].toast-pop::backdrop { background: transparent; }

/* --- <details name>: one-open-at-a-time accordion, no JS --- */
.acc { width: 100%; text-align: left; display: grid; gap: 0.5rem; }
.acc details { border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.acc summary { cursor: pointer; padding: 0.65rem 0.9rem; font: 600 0.88rem var(--mono); list-style: none; display: flex; justify-content: space-between; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: "+"; color: var(--accent); }
.acc details[open] summary::after { content: "–"; }
.acc details p { padding: 0 0.9rem 0.8rem; color: var(--muted); font-size: 0.9rem; }

/* --- view transitions: circular reveal when the theme flips --- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }
::view-transition-old(root) { z-index: 1; }

/* --- glitch text: two clipped copies of the text, jittering --- */
.glitch {
  position: relative;
  display: inline-block;
  font: 800 clamp(2rem, 6vw, 3.6rem) / 1 var(--mono);
  letter-spacing: -0.03em;
  color: var(--fg);
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  pointer-events: none;
}
.glitch::before { color: oklch(72% 0.22 350); left: 3px; clip-path: inset(0 0 60% 0); animation: g1 2.4s steps(1) infinite; }
.glitch::after  { color: oklch(84% 0.16 200); left: -3px; clip-path: inset(50% 0 0 0); animation: g2 1.9s steps(1) infinite; }
@keyframes g1 {
  0%   { clip-path: inset(12% 0 70% 0); translate: 2px 0; }
  10%  { clip-path: inset(60% 0 8% 0);  translate: -3px 0; }
  20%  { clip-path: inset(30% 0 50% 0); translate: 1px 0; }
  30%  { clip-path: inset(80% 0 2% 0);  translate: -1px 0; }
  40%  { clip-path: inset(5% 0 88% 0);  translate: 3px 0; }
  50%  { clip-path: inset(45% 0 40% 0); translate: -2px 0; }
  60%  { clip-path: inset(0 0 0 0);     translate: 0 0; opacity: 0; }
  100% { clip-path: inset(0 0 0 0);     translate: 0 0; opacity: 0; }
}
@keyframes g2 {
  0%   { clip-path: inset(70% 0 10% 0); translate: -2px 0; }
  15%  { clip-path: inset(10% 0 75% 0); translate: 3px 0; }
  30%  { clip-path: inset(50% 0 30% 0); translate: -1px 0; }
  45%  { clip-path: inset(20% 0 65% 0); translate: 2px 0; }
  55%  { clip-path: inset(85% 0 0 0);   translate: -3px 0; }
  65%  { clip-path: inset(0 0 0 0);     opacity: 0; }
  100% { clip-path: inset(0 0 0 0);     opacity: 0; }
}
.glitch.paused::before, .glitch.paused::after { animation-play-state: paused; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .glitch::before, .glitch::after { animation: none; opacity: 0; } }

/* ==========================================================================
   Pointer effects (JS drives the numbers, CSS draws)
   ========================================================================== */

/* --- spotlight: a fixed disc that inverts whatever is beneath it --- */
.spotlight {
  position: fixed; top: 0; left: 0;
  width: var(--size, 160px); height: var(--size, 160px);
  margin: calc(var(--size, 160px) / -2) 0 0 calc(var(--size, 160px) / -2);
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 250;
  opacity: 0;
  transition: opacity 0.3s;
}
.spotlight.on { opacity: 1; }
@media (hover: none) { .spotlight { display: none; } }

/* --- tilt card --- */
.tilt {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 50%;
  width: min(100%, 320px);
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--card-2), var(--card));
  border: 1px solid var(--line-strong);
  transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.12s ease-out;
  transform-style: preserve-3d;
  position: relative;
  display: grid; place-items: center;
  font: 700 1.1rem var(--mono);
  overflow: clip;
  box-shadow: var(--shadow);
  touch-action: none;
}
.tilt.settle { transition: transform 0.6s cubic-bezier(0.2, 1.3, 0.4, 1); }
.tilt::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(240px circle at var(--gx) var(--gy), rgba(255, 255, 255, 0.28), transparent 60%);
  pointer-events: none;
}
.tilt > * { transform: translateZ(30px); }

/* --- magnetic buttons --- */
.magnet-zone { padding: 22px; display: inline-block; }
.magnet { transition: translate 0.2s ease-out; will-change: translate; }
.magnet.release { transition: translate 0.55s cubic-bezier(0.2, 1.5, 0.4, 1); }

/* ==========================================================================
   Easter eggs
   ========================================================================== */
.konami-keys { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.konami-keys kbd {
  min-width: 34px; text-align: center; padding: 0.3rem 0.5rem;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.konami-keys kbd.hit { background: var(--accent); color: var(--accent-ink); border-color: transparent; transform: translateY(-2px); }

body.editing { outline: 3px dashed var(--accent); outline-offset: -3px; }
.edit-pill {
  position: fixed; top: 70px; left: 50%; translate: -50% 0; z-index: 300;
  display: none;
}
body.editing .edit-pill { display: inline-flex; }

.console-preview {
  width: 100%;
  text-align: left;
  font: 0.82rem/1.6 var(--mono);
  background: #0b0d12;
  color: #cfd6e3;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
}
.console-preview .tag { background: oklch(80% 0.17 var(--hue)); color: #0a0c10; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.console-preview .dim { color: #7b8596; }

/* print surprise — only visible on paper */
.print-only { display: none; }
@media print {
  body > *:not(.print-only) { display: none !important; }
  body { background: #fff; color: #000; }
  .print-only { display: block; font: 12px/1.35 var(--mono); white-space: pre; padding: 2rem; }
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }

/* fallback message shown only where a feature is unsupported */
.unsupported { display: none; color: var(--muted); font: 0.8rem var(--mono); }
html.no-sda .needs-sda .unsupported { display: block; }
html.no-vt .needs-vt .unsupported { display: block; }
html.no-popover .needs-popover .unsupported { display: block; }

/* ==========================================================================
   Custom cursor
   ========================================================================== */
html.custom-cursor, html.custom-cursor * { cursor: none !important; }
.cursor-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 260;
  display: none;
  transition: opacity 0.2s;
}
.cursor-layer.on { display: block; }
.cursor-layer.hidden { opacity: 0; }          /* pointer left the window */
.cursor-layer > * { display: none; position: absolute; top: 0; left: 0; }
.cur-dot { width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); }
.cur-ring {
  width: 36px; height: 36px; margin: -18px 0 0 -18px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  transition: scale 0.25s cubic-bezier(0.2, 1.2, 0.4, 1), background 0.25s;
}
.cursor-layer.hover .cur-ring { scale: 1.8; background: var(--accent-soft); }
.cursor-layer.down .cur-ring { scale: 0.75; }
.cur-x { left: 0; right: 0; height: 0; border-top: 1px dashed var(--accent); opacity: 0.7; }
.cur-y { top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--accent); opacity: 0.7; }
.cur-label {
  font: 600 0.7rem var(--mono);
  color: var(--accent);
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}
.cur-emoji { font-size: 34px; line-height: 1; margin: -17px 0 0 -17px; }
.cur-canvas { inset: 0; width: 100%; height: 100%; }
.cursor-layer[data-mode="ring"]      :is(.cur-dot, .cur-ring) { display: block; }
.cursor-layer[data-mode="crosshair"] :is(.cur-x, .cur-y, .cur-label, .cur-dot) { display: block; }
.cursor-layer[data-mode="trail"]     :is(.cur-canvas, .cur-dot) { display: block; }
.cursor-layer[data-mode="emoji"]     .cur-emoji { display: block; }

/* CSS-only: an SVG data URL as the cursor image. "4 3" is the hotspot (the arrow tip). */
html.cursor-svg, html.cursor-svg * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><path d='M4 3 L4 25 L10 19.5 L14 28.5 L18.5 26.5 L14.5 17.5 L22.5 17.5 Z' fill='%2360e0b0' stroke='%230a0c10' stroke-width='2' stroke-linejoin='round'/></svg>") 4 3, auto !important;
}
@media (hover: none) { .cursor-layer { display: none !important; } }
