/* ==========================================================================
   Swarm Palace · design tokens
   Primitives are named by hue, semantic tokens by role. Components only
   reference semantic tokens. Palette pulled from logos/logo-1.png:
   violet #7800ff, lime #a8f030, gold #ffd818, ink #180030.
   ========================================================================== */
:root {
  /* primitives */
  --violet-300: #b57bff;
  --violet-500: #7800ff;
  --violet-700: #4a0a9c;
  --violet-800: #2a0a4f;
  --violet-900: #1a0633;
  --ink-950: #0d0418;
  --ink-900: #180030;
  --lime-300: #c8ff66;
  --lime-400: #a8f030;
  --lime-600: #78a818;
  --gold-300: #ffe766;
  --gold-400: #ffd818;
  --gold-600: #f0a800;
  --white: #ffffff;
  --cream-100: #f5efff;
  --cream-300: #cdbde6;

  /* semantic: colour */
  --color-bg: var(--ink-950);
  --color-bg-alt: var(--violet-900);
  --color-surface: var(--violet-800);
  --color-surface-raised: var(--violet-700);
  --color-text: var(--cream-100);
  --color-text-muted: var(--cream-300);
  --color-text-on-accent: var(--ink-950);
  --color-outline: var(--ink-900);
  --color-accent: var(--lime-400);
  --color-accent-hover: var(--lime-300);
  --color-gold: var(--gold-400);
  --color-gold-deep: var(--gold-600);
  --color-violet: var(--violet-500);
  --color-violet-deep: var(--violet-800);
  --color-violet-soft: var(--violet-300);
  --color-palace: var(--violet-700);
  --color-palace-brick: var(--violet-500);
  --color-focus: var(--gold-400);
  --color-border: rgb(255 255 255 / 0.12);
  --color-link: var(--lime-300);

  /* spacing scale (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* radii: outer = inner + padding */
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.75rem;
  --radius-pill: 999px;

  /* outlines and shadows */
  --outline-w: 3px;
  --shadow-sticker: 6px 6px 0 var(--color-outline);
  --shadow-card: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 20px 40px -24px rgb(0 0 0 / 0.8);
  --shadow-float: 0 30px 60px -30px rgb(0 0 0 / 0.9);

  /* typography */
  --font-display: "Bangers", "Impact", "Arial Black", sans-serif;
  --font-text: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  --text-3xl: clamp(2.25rem, 1.5rem + 3.5vw, 4rem);
  --text-display: clamp(3.5rem, 2rem + 11vw, 10rem);
  --leading-tight: 1.05;
  --leading-snug: 1.25;
  --leading-body: 1.55;
  --measure: 62ch;

  /* motion */
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 600ms;

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --nav-h: 4.25rem;
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-text);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  overflow-x: clip;
  position: relative;
}

/* grain texture over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 400; line-height: var(--leading-tight); letter-spacing: 0.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--font-mono); }
a { color: var(--color-link); text-underline-offset: 0.15em; text-decoration-thickness: from-font; }
a:hover { color: var(--color-accent-hover); }
button { font: inherit; color: inherit; }
::selection { background: var(--color-accent); color: var(--color-text-on-accent); }

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-4);
  top: -100%;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.skip-link:focus { top: var(--space-4); }

/* ==========================================================================
   Buttons, badges, stickers
   ========================================================================== */
.btn {
  --btn-bg: var(--color-surface);
  --btn-fg: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-5);
  border: var(--outline-w) solid var(--color-outline);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--color-outline);
  transition-property: translate, box-shadow, background-color, color, scale;
  transition-duration: var(--dur-fast);
  transition-timing-function: var(--ease-out);
  user-select: none;
  will-change: translate;
}
.btn:hover { color: var(--btn-fg); translate: -2px -2px; box-shadow: 6px 6px 0 var(--color-outline); }
.btn:active { scale: 0.96; translate: 0 0; box-shadow: 2px 2px 0 var(--color-outline); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; box-shadow: none; translate: 0 0; }
.btn--primary { --btn-bg: var(--color-accent); --btn-fg: var(--color-text-on-accent); }
.btn--primary:hover { --btn-bg: var(--color-accent-hover); }
.btn--ghost { --btn-bg: var(--color-surface); --btn-fg: var(--color-text); }
.btn--ghost:hover { --btn-bg: var(--color-surface-raised); }
.btn--share { --btn-bg: var(--color-gold); --btn-fg: var(--color-text-on-accent); font-family: var(--font-text); font-weight: 700; font-size: var(--text-sm); letter-spacing: 0; }
.btn--share:hover { --btn-bg: var(--gold-300); }
.btn--sm { min-height: 2.5rem; padding: var(--space-1) var(--space-4); font-size: var(--text-base); }
.btn--lg { min-height: 3.5rem; padding: var(--space-3) var(--space-6); font-size: var(--text-xl); }

.badge {
  display: inline-block;
  padding: 0.2em 0.7em;
  border: 2px solid var(--color-outline);
  border-radius: var(--radius-pill);
  font-family: var(--font-text);
  font-weight: 700;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--color-outline);
}
.badge--lime { background: var(--color-accent); color: var(--color-text-on-accent); }
.badge--gold { background: var(--color-gold); color: var(--color-text-on-accent); }
.badge--violet { background: var(--color-violet-soft); color: var(--color-text-on-accent); }

.sticker {
  position: absolute;
  padding: var(--space-2) var(--space-4);
  background: var(--color-gold);
  color: var(--color-text-on-accent);
  border: var(--outline-w) solid var(--color-outline);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sticker);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-transform: uppercase;
  pointer-events: none;
}
.sticker--a { top: 4%; inset-inline-start: -2%; rotate: -8deg; background: var(--color-accent); }
.sticker--b { bottom: 10%; inset-inline-end: -4%; rotate: 6deg; }
.sticker--c { top: 2%; inset-inline-end: 2%; rotate: 12deg; background: var(--color-violet-soft); font-size: var(--text-base); }

.eyebrow {
  display: inline-block;
  margin-block-end: var(--space-3);
  padding: 0.25em 0.8em;
  border: 2px solid var(--color-outline);
  border-radius: var(--radius-pill);
  background: var(--color-gold);
  color: var(--color-text-on-accent);
  font-family: var(--font-display);
  font-size: var(--text-base);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  rotate: -2deg;
  box-shadow: 3px 3px 0 var(--color-outline);
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--color-bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-block-end: var(--outline-w) solid var(--color-outline);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--nav-h); }
.nav__brand { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--color-text); text-decoration: none; }
.nav__brand:hover { color: var(--color-text); }
.nav__logo { border-radius: 50%; border: 2px solid var(--color-outline); }
.nav__name { font-family: var(--font-display); font-size: var(--text-xl); letter-spacing: 0.04em; }
.nav__name-accent { color: var(--color-accent); }
.nav__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: var(--outline-w) solid var(--color-outline);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
}
.nav__toggle-bar {
  width: 22px; height: 3px; background: currentColor; border-radius: 2px;
  box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor;
}
.nav__toggle[aria-expanded="true"] .nav__toggle-bar { box-shadow: none; rotate: 45deg; }
.nav__menu { display: flex; align-items: center; gap: var(--space-4); }
.nav__links { display: flex; gap: var(--space-1); }
.nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  color: var(--color-text);
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav__links a:hover { background: var(--color-surface); color: var(--color-accent); }

@media (max-width: 64rem) {
  .nav__toggle { display: inline-flex; }
  .nav__menu {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    padding: var(--space-4) var(--gutter) var(--space-5);
    background: var(--color-bg);
    border-block-end: var(--outline-w) solid var(--color-outline);
    box-shadow: var(--shadow-float);
  }
  .nav__menu.is-open { display: flex; }
  .nav__links { flex-direction: column; gap: var(--space-1); }
  .nav__links a { min-height: 2.75rem; font-size: var(--text-lg); }
}
@media (min-width: 64.01rem) {
  .nav__toggle { display: none; }
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section { position: relative; padding-block: var(--space-9); scroll-margin-top: var(--nav-h); }
.section--legend { background: var(--color-bg-alt); }
.section--enter { background: var(--color-bg-alt); }
.section--wall { background: var(--color-bg-alt); }
.section--build { background: var(--color-bg-alt); }
.section__title { font-size: var(--text-3xl); max-width: 22ch; margin-block-end: var(--space-4); }
.section__lead { max-width: var(--measure); color: var(--color-text-muted); font-size: var(--text-lg); margin-block-end: var(--space-6); }

.card {
  position: relative;
  padding: var(--space-5);
  background: var(--color-surface);
  border: var(--outline-w) solid var(--color-outline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), 6px 6px 0 var(--color-outline);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { position: relative; overflow: hidden; padding-block: var(--space-7) 0; scroll-margin-top: var(--nav-h); }
.hero__bg { position: absolute; inset: 0; z-index: 0; color: var(--color-violet-soft); pointer-events: none; }
.hero__palace { position: absolute; bottom: 0; inset-inline: 0; width: 100%; height: 55%; opacity: 0.55; }
.hero__halftone { opacity: 0.18; }
.hero__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--space-6);
  align-items: center;
  padding-block-end: var(--space-8);
}
.hero__kicker { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-end: var(--space-4); }
.hero__title { display: grid; gap: var(--space-1); }
.hero__name {
  font-size: var(--text-2xl);
  color: var(--color-gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero__ticker {
  font-size: var(--text-display);
  line-height: 0.9;
  color: var(--color-accent);
  -webkit-text-stroke: 2px var(--color-outline);
  text-shadow: 6px 6px 0 var(--color-outline), 12px 12px 0 var(--color-violet);
  overflow-wrap: anywhere;
}
.hero__line { max-width: 44ch; margin-block: var(--space-5); font-size: var(--text-xl); font-weight: 500; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.hero__status { display: flex; align-items: center; gap: var(--space-2); margin-block-start: var(--space-4); color: var(--color-text-muted); font-family: var(--font-mono); font-size: var(--text-sm); }
.hero__status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-gold); box-shadow: 0 0 0 3px rgb(255 216 24 / 0.25); }
.hero__status.is-live .hero__status-dot { background: var(--color-accent); box-shadow: 0 0 0 3px rgb(168 240 48 / 0.3); }

.hero__stage { position: relative; aspect-ratio: 1; max-width: 30rem; margin-inline: auto; width: 100%; }
.throne { position: absolute; inset: 6% 8% 0; }
.throne__svg { width: 100%; height: 100%; filter: drop-shadow(0 20px 30px rgb(0 0 0 / 0.5)); }
.hero__sticker {
  position: absolute;
  top: 18%;
  inset-inline-start: 22%;
  width: 56%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 20%;
  border: 5px solid var(--white);
  outline: var(--outline-w) solid var(--color-outline);
  box-shadow: var(--shadow-sticker);
  background: var(--color-violet);
  overflow: hidden;
  rotate: -4deg;
  animation: bounce 2.2s var(--ease-out) infinite;
}
.hero__sticker.is-dragging { cursor: grabbing; animation: none; z-index: 5; }
.hero__sticker:focus-visible { outline-color: var(--color-focus); }
.hero__logo { width: 100%; height: auto; }

/* bounce uses transform so the drag offset in `translate` is never overridden */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5%); }
}

.marquee {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border-block: var(--outline-w) solid var(--color-outline);
  rotate: -1deg;
  scale: 1.03 1;
  margin-block-start: var(--space-4);
}
.marquee__track {
  display: flex;
  gap: var(--space-6);
  width: max-content;
  padding-block: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: marquee 28s linear infinite;
}
.marquee__track span { padding-inline-end: var(--space-6); white-space: nowrap; }
.marquee__track span:nth-child(even) { color: var(--color-violet); }
@keyframes marquee { to { translate: -50% 0; } }

/* ==========================================================================
   Legend beats
   ========================================================================== */
.beats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); counter-reset: beat; }
.beat { display: grid; gap: var(--space-3); rotate: -1deg; }
.beat:nth-child(2) { rotate: 1deg; }
.beat:nth-child(3) { rotate: -0.5deg; }
.beat__art { width: 100%; border-radius: var(--radius-md); border: var(--outline-w) solid var(--color-outline); }
.beat__num { font-family: var(--font-display); font-size: var(--text-2xl); color: var(--color-gold); line-height: 1; }
.beat__title { font-size: var(--text-xl); letter-spacing: 0.04em; }
.beat p:last-child { color: var(--color-text-muted); }

/* ==========================================================================
   Throne room stats
   ========================================================================== */
.plaques { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
.plaque {
  padding: var(--space-5);
  background: linear-gradient(160deg in oklab, var(--gold-300), var(--gold-600));
  color: var(--color-text-on-accent);
  border: var(--outline-w) solid var(--color-outline);
  border-radius: var(--radius-md);
  box-shadow: 6px 6px 0 var(--color-outline), inset 0 0 0 4px rgb(255 255 255 / 0.35);
  min-width: 0;
}
.plaque:nth-child(1) { rotate: -1.5deg; }
.plaque:nth-child(3) { rotate: 1.5deg; }
.plaque__label { font-family: var(--font-display); font-size: var(--text-lg); letter-spacing: 0.1em; text-transform: uppercase; }
.plaque__value {
  margin-block: var(--space-2);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
  min-height: 1.1em;
}
.plaque__note { font-size: var(--text-sm); font-weight: 500; opacity: 0.85; }
.stats__meta { margin-block-start: var(--space-5); color: var(--color-text-muted); font-family: var(--font-mono); font-size: var(--text-sm); }

/* ==========================================================================
   How to enter
   ========================================================================== */
.contract { margin-block-end: var(--space-6); }
.contract__label { font-family: var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-gold); }
.contract__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-block: var(--space-3); }
.contract__addr {
  flex: 1 1 18rem;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
  color: var(--color-accent);
}
.contract__hint { color: var(--color-text-muted); font-size: var(--text-sm); max-width: var(--measure); }
.contract__hint a { color: var(--color-link); }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
.step { padding: 0; overflow: hidden; }
.step__details { height: 100%; }
.step__summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  letter-spacing: 0.04em;
  cursor: pointer;
  list-style: none;
}
.step__summary::-webkit-details-marker { display: none; }
.step__summary::after {
  content: "+";
  margin-inline-start: auto;
  font-family: var(--font-text);
  font-weight: 900;
  color: var(--color-gold);
  transition: rotate var(--dur-base) var(--ease-out);
}
.step__details[open] .step__summary::after { rotate: 45deg; }
.step__num {
  display: inline-grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  flex: none;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border: 2px solid var(--color-outline);
  font-size: var(--text-lg);
}
.step__body { display: grid; gap: var(--space-4); padding: 0 var(--space-5) var(--space-5); color: var(--color-text-muted); }
.step__body .btn { justify-self: start; }

/* ==========================================================================
   Treasury
   ========================================================================== */
.treasury { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: var(--space-7); align-items: center; }
.alloc { display: grid; gap: var(--space-3); }
.alloc__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "swatch name pct" "swatch desc desc";
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 2px solid var(--color-outline);
  border-radius: var(--radius-md);
}
.alloc__swatch { grid-area: swatch; width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--color-outline); }
.alloc__swatch--pool { background: var(--color-accent); }
.alloc__swatch--swarm { background: var(--color-gold); }
.alloc__swatch--team { background: var(--color-violet-soft); }
.alloc__name { grid-area: name; font-weight: 700; }
.alloc__pct { grid-area: pct; font-family: var(--font-display); font-size: var(--text-xl); color: var(--color-gold); }
.alloc__desc { grid-area: desc; color: var(--color-text-muted); font-size: var(--text-sm); }

.treasury__donut { display: grid; gap: var(--space-5); justify-items: center; }
.donut { width: min(100%, 18rem); }
.donut__track { fill: none; stroke: var(--color-surface); stroke-width: 28; }
.donut__seg { fill: none; stroke-width: 28; stroke-linecap: butt; transform: rotate(-90deg); transform-origin: 50% 50%; stroke-dasharray: 0 100; transition: stroke-dasharray 1.6s var(--ease-out); }
.donut__seg--pool { stroke: var(--color-accent); }
.donut__seg--swarm { stroke: var(--color-gold); stroke-dashoffset: -90; }
.is-visible .donut__seg--pool { stroke-dasharray: 90 100; }
.is-visible .donut__seg--swarm { stroke-dasharray: 10 100; }
.donut__big { font-family: var(--font-display); font-size: 44px; fill: var(--color-text); }
.donut__small { font-family: var(--font-text); font-size: 14px; font-weight: 700; fill: var(--color-text-muted); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); width: 100%; margin: 0; }
.fact { padding: var(--space-3); background: var(--color-surface); border: 2px solid var(--color-outline); border-radius: var(--radius-md); text-align: center; }
.fact dt { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); }
.fact dd { margin: var(--space-1) 0 0; font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ==========================================================================
   Meme wall
   ========================================================================== */
.wall { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); }
.wall__item { display: grid; gap: var(--space-3); padding: var(--space-3); }
.wall__item:nth-child(odd) { rotate: -1.2deg; }
.wall__item:nth-child(even) { rotate: 1.2deg; }
.wall__art { width: 100%; min-width: 0; aspect-ratio: 1; border-radius: var(--radius-md); border: var(--outline-w) solid var(--color-outline); background: var(--color-bg); overflow: hidden; }
.wall__art svg { width: 100%; height: auto; }
.wall__title { font-family: var(--font-display); font-size: var(--text-lg); letter-spacing: 0.04em; }
.wall__item .btn { justify-self: start; }

/* ==========================================================================
   Meme forge
   ========================================================================== */
.forge { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.forge__form { display: grid; gap: var(--space-4); }
.forge__templates { margin: 0; padding: 0; border: 0; min-width: 0; }
.forge__legend { padding: 0; margin-block-end: var(--space-2); font-weight: 700; font-size: var(--text-sm); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.forge__chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: var(--space-1) var(--space-3);
  border: 2px solid var(--color-outline);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.chip:hover { background: var(--color-surface-raised); }
.chip[aria-pressed="true"] { background: var(--color-accent); color: var(--color-text-on-accent); }
.field { display: grid; gap: var(--space-1); }
.field__label { font-weight: 700; font-size: var(--text-sm); }
.field__input {
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  color: var(--color-text);
  border: 2px solid var(--color-outline);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base);
}
.field__input:focus-visible { outline-offset: 2px; }
.forge__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.forge__status { min-height: 1.5em; color: var(--color-text-muted); font-size: var(--text-sm); }
.forge__preview { position: sticky; top: calc(var(--nav-h) + var(--space-4)); }
.forge__preview { min-width: 0; }
.forge__preview svg { width: 100%; height: auto; border-radius: var(--radius-lg); border: var(--outline-w) solid var(--color-outline); box-shadow: 8px 8px 0 var(--color-outline); background: var(--color-bg); }

/* ==========================================================================
   Build the palace (signature)
   ========================================================================== */
.build { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-7); align-items: center; }
.build__controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin-block-end: var(--space-4); }
.build__count { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--color-text-muted); }
.meter {
  position: relative;
  height: 2.5rem;
  background: var(--color-bg);
  border: var(--outline-w) solid var(--color-outline);
  border-radius: var(--radius-pill);
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--color-outline);
}
.meter__fill {
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(135deg, var(--color-accent) 0 12px, var(--lime-600) 12px 24px);
  transition: width var(--dur-slow) var(--ease-out);
}
.meter__text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--color-text);
  text-shadow: 2px 2px 0 var(--color-outline);
  pointer-events: none;
}
.build__msg { min-height: 1.5em; margin-block-start: var(--space-3); color: var(--color-gold); font-weight: 700; }
.wall-svg { width: min(100%, 26rem); margin-inline: auto; filter: drop-shadow(0 20px 30px rgb(0 0 0 / 0.5)); }
.wall-svg .brick { fill: var(--color-palace-brick); stroke: var(--color-outline); stroke-width: 2; transform-origin: center; }
.wall-crown { opacity: 0.25; transition: opacity var(--dur-slow) var(--ease-out); }
.wall-crown.is-lit { opacity: 1; filter: drop-shadow(0 0 10px var(--color-gold)); }
.is-complete .meter__fill { background: repeating-linear-gradient(135deg, var(--color-gold) 0 12px, var(--color-gold-deep) 12px 24px); }

/* ==========================================================================
   Court / share
   ========================================================================== */
.court__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-block-end: var(--space-6); }
.share { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.share__status { min-height: 1.5em; margin-block-start: var(--space-3); color: var(--color-text-muted); font-size: var(--text-sm); }

/* ==========================================================================
   Footer, toast, confetti
   ========================================================================== */
.footer { padding-block: var(--space-7); border-block-start: var(--outline-w) solid var(--color-outline); background: var(--color-bg); }
.footer__inner { display: grid; gap: var(--space-3); }
.footer__brand { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-size: var(--text-lg); letter-spacing: 0.04em; }
.footer__brand img { border-radius: 50%; border: 2px solid var(--color-outline); }
.footer__legal { color: var(--color-text); }
.footer__small { color: var(--color-text-muted); font-size: var(--text-sm); max-width: var(--measure); }

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: var(--space-5);
  z-index: 60;
  width: max-content;
  max-width: calc(100% - 2 * var(--gutter));
  margin-inline: auto;
  padding: var(--space-3) var(--space-5);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border: var(--outline-w) solid var(--color-outline);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sticker);
  font-weight: 700;
  opacity: 0;
  translate: 0 12px;
  transition: opacity var(--dur-base) var(--ease-out), translate var(--dur-base) var(--ease-out);
  pointer-events: none;
}
.toast.is-on { opacity: 1; translate: 0 0; }

.confetti-layer { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.confetti {
  position: absolute;
  width: 10px; height: 14px;
  border: 2px solid var(--color-outline);
  animation: confetti 1.4s var(--ease-out) forwards;
}
@keyframes confetti {
  0% { translate: 0 0; rotate: 0deg; opacity: 1; }
  100% { translate: var(--dx) var(--dy); rotate: var(--rot); opacity: 0; }
}

/* ==========================================================================
   Reveal + motion (opt-in)
   ========================================================================== */
.reveal { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; translate: 0 24px; transition: opacity var(--dur-slow) var(--ease-out), translate var(--dur-slow) var(--ease-out); transition-delay: var(--stagger, 0ms); }
  .reveal.is-visible { opacity: 1; translate: 0 0; }
  .js-magnet { transition: translate var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), scale var(--dur-fast) var(--ease-out); }
  @media (hover: hover) {
    .card:hover, .wall__item:hover, .plaque:hover { animation: wobble 0.5s var(--ease-out); }
    .nav__logo:hover, .footer__brand img:hover { animation: wobble 0.5s var(--ease-out); }
  }
}
@keyframes wobble {
  0% { rotate: 0deg; }
  25% { rotate: -2deg; }
  50% { rotate: 2deg; }
  75% { rotate: -1deg; }
  100% { rotate: 0deg; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__sticker, .marquee__track, .confetti { animation: none; }
  .donut__seg, .meter__fill, .reveal, .btn { transition-duration: 1ms; }
  .is-visible .donut__seg--pool { stroke-dasharray: 90 100; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 64rem) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__stage { max-width: 24rem; }
  .beats, .plaques, .steps { grid-template-columns: 1fr; }
  .treasury, .forge, .build { grid-template-columns: 1fr; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .forge__preview { position: static; }
}
@media (max-width: 40rem) {
  .section { padding-block: var(--space-8); }
  .wall { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticker--b { inset-inline-end: 0; }
  .sticker--a { inset-inline-start: 0; }
  .hero__ticker { text-shadow: 4px 4px 0 var(--color-outline), 8px 8px 0 var(--color-violet); }
  .btn--lg { width: 100%; }
  .share li, .share .btn { width: 100%; }
  .toast { width: auto; }
}
@media (max-width: 24rem) {
  .hero__stage { max-width: 20rem; }
  .sticker { font-size: var(--text-sm); }
}

/* 404 */
.notfound { min-height: calc(100vh - var(--nav-h)); display: grid; place-items: center; text-align: center; padding-block: var(--space-8); }
.notfound__code { font-size: var(--text-display); color: var(--color-accent); -webkit-text-stroke: 2px var(--color-outline); text-shadow: 6px 6px 0 var(--color-outline), 12px 12px 0 var(--color-violet); line-height: 0.9; }
.notfound img { width: 10rem; margin-inline: auto; border-radius: 20%; border: 5px solid var(--white); outline: var(--outline-w) solid var(--color-outline); rotate: -6deg; margin-block-end: var(--space-5); }
.notfound .section__lead { margin-inline: auto; }
