/* The Wizly journey. Colours are Wizly's own: Prism (light) and Halo (dark), one swatch per era. */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('fonts/atkinson.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --page: #f4f5fc;
  --surface: #ffffff;
  --ink: #15161f;
  --muted: #535a75;
  --faint: #8a90aa;
  --line: #dde0ef;
  --line-strong: #c3c8de;
  --focus: #3a45e8;

  --orchid: #7d37bd;   --orchid-field: #f1e8fe;
  --cobalt: #1f5bd8;   --cobalt-field: #e4edff;
  --marigold: #7c5f00; --marigold-field: #fbecc7; --marigold-dot: #e2b000;
  --jade: #0b7a5c;     --jade-field: #dbf4e9;
  --coral: #b9361c;    --coral-field: #ffe7e1;
  --plum: #8e2b78;     --plum-field: #fbe6f4;
  --rose: #ad1b6c;     --rose-field: #fee5ee;
  --iris: #3a45e8;     --iris-field: #e6ecff;

  --display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --text: 'Atkinson Hyperlegible Next', 'Segoe UI', system-ui, sans-serif;
  --measure: 66ch;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --page: #0f1016;
    --surface: #171926;
    --ink: #eceefb;
    --muted: #a6abc6;
    --faint: #757b98;
    --line: #262a40;
    --line-strong: #3a3f5c;
    --focus: #a8b0ff;
    --orchid: #c8a4f6;   --orchid-field: #22172e;
    --cobalt: #8fb1ff;   --cobalt-field: #131c32;
    --marigold: #f8c73e; --marigold-field: #261b01; --marigold-dot: #f8c73e;
    --jade: #4fd6a8;     --jade-field: #022318;
    --coral: #ff8d73;    --coral-field: #2f140e;
    --plum: #e394da;     --plum-field: #291527;
    --rose: #f793bf;     --rose-field: #2d131f;
    --iris: #a8b0ff;     --iris-field: #181a32;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --page: #0f1016;
  --surface: #171926;
  --ink: #eceefb;
  --muted: #a6abc6;
  --faint: #757b98;
  --line: #262a40;
  --line-strong: #3a3f5c;
  --focus: #a8b0ff;
  --orchid: #c8a4f6;   --orchid-field: #22172e;
  --cobalt: #8fb1ff;   --cobalt-field: #131c32;
  --marigold: #f8c73e; --marigold-field: #261b01; --marigold-dot: #f8c73e;
  --jade: #4fd6a8;     --jade-field: #022318;
  --coral: #ff8d73;    --coral-field: #2f140e;
  --plum: #e394da;     --plum-field: #291527;
  --rose: #f793bf;     --rose-field: #2d131f;
  --iris: #a8b0ff;     --iris-field: #181a32;
  color-scheme: dark;
}

/* Each era sets --era / --era-field from its swatch. */
[data-swatch='orchid'] { --era: var(--orchid); --era-field: var(--orchid-field); --era-dot: var(--orchid); }
[data-swatch='cobalt'] { --era: var(--cobalt); --era-field: var(--cobalt-field); --era-dot: var(--cobalt); }
[data-swatch='marigold'] { --era: var(--marigold); --era-field: var(--marigold-field); --era-dot: var(--marigold-dot); }
[data-swatch='jade'] { --era: var(--jade); --era-field: var(--jade-field); --era-dot: var(--jade); }
[data-swatch='coral'] { --era: var(--coral); --era-field: var(--coral-field); --era-dot: var(--coral); }
[data-swatch='plum'] { --era: var(--plum); --era-field: var(--plum-field); --era-dot: var(--plum); }
[data-swatch='rose'] { --era: var(--rose); --era-field: var(--rose-field); --era-dot: var(--rose); }
[data-swatch='iris'] { --era: var(--iris); --era-field: var(--iris-field); --era-dot: var(--iris); }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--text);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 12px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0; letter-spacing: -0.02em; }

/* ------------------------------------------------------------------ top bar */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px var(--gutter);
}
.logo { width: 150px; height: auto; }
.logo-dark { display: none; }
:root[data-theme='dark'] .logo-light { display: none; }
:root[data-theme='dark'] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .logo-light { display: none; }
  :root:not([data-theme='light']) .logo-dark { display: block; }
}
.top-nav { display: flex; align-items: center; gap: 4px; }
.top-nav a, .theme-toggle {
  text-decoration: none; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 0.95rem;
}
.top-nav a:hover, .theme-toggle:hover { color: var(--ink); background: var(--surface); }
.theme-toggle { border: 0; background: none; cursor: pointer; display: inline-grid; place-items: center; }

/* --------------------------------------------------------------------- hero */
.hero { padding: clamp(24px, 6vw, 72px) var(--gutter) 0; }
.hero h1 {
  font-size: clamp(2.6rem, 6.6vw, 5.6rem);
  font-weight: 800;
  font-stretch: 82%;
  letter-spacing: -0.035em;
  line-height: 0.95;
  max-width: 16ch;
}
.hero-sub { max-width: 52ch; font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); margin: 22px 0 0; }

/* The strip: every build as a dot, stacked by week. */
.strip { position: relative; margin: clamp(28px, 5vw, 56px) 0 0; }
.strip-scroll { overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 6px; }
.strip-scroll:focus-visible { outline-offset: 6px; }
.strip-svg { display: block; width: 100%; min-width: 760px; height: auto; overflow: visible; }
.strip figcaption { color: var(--faint); font-size: 0.9rem; margin-top: 8px; max-width: 70ch; }
.strip .dot { cursor: pointer; transition: r 0.15s ease; }
.strip .dot-link:focus-visible { outline: none; }
.strip .dot-link:focus-visible .dot, .strip .dot-link:hover .dot { stroke: var(--ink); stroke-width: 2; }
.strip .dot.later { fill-opacity: 0.38; }
.strip .axis line { stroke: var(--line-strong); }
.strip .axis text { fill: var(--faint); font: 500 11px var(--text); }
.strip .axis .year { fill: var(--muted); font-weight: 700; }
.strip .band text { font: 700 11.5px var(--display); }
.strip .gap text { fill: var(--faint); font: italic 11px var(--text); }
@media (prefers-reduced-motion: no-preference) {
  .strip.animate .dot { opacity: 0; animation: dot-in 0.5s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: var(--d, 0s); }
  @keyframes dot-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
.strip-tip {
  position: absolute; z-index: 5; pointer-events: none; width: max-content; max-width: 280px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 0.875rem; line-height: 1.4; box-shadow: 0 10px 30px rgba(10, 12, 40, 0.14);
}
.strip-tip strong { display: block; font-family: var(--display); font-size: 1rem; }
.strip-tip .when { color: var(--era); font-weight: 700; }

/* --------------------------------------------------------------------- eras */
.eras { padding: clamp(48px, 8vw, 110px) var(--gutter) 0; display: grid; gap: clamp(64px, 10vw, 140px); }
.era { scroll-margin-top: 24px; }
.era-head { display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(0, 3fr); gap: clamp(20px, 4vw, 64px); }
.era-mark { position: sticky; top: 24px; align-self: start; color: var(--era); }
.era-n {
  font-family: var(--display); font-weight: 800; font-stretch: 75%; line-height: 0.8;
  font-size: clamp(5rem, 13vw, 10rem); letter-spacing: -0.05em; display: block;
}
.era-when { font-weight: 700; font-size: 0.95rem; margin-top: 10px; display: block; }
.era-count { color: var(--muted); font-size: 0.9rem; display: block; }
.era h2 { font-size: clamp(2rem, 4.4vw, 3.5rem); font-stretch: 88%; max-width: 18ch; }
.era-lede { font-family: var(--display); font-size: clamp(1.15rem, 2vw, 1.45rem); font-weight: 500; line-height: 1.3; margin: 14px 0 0; max-width: 40ch; color: var(--muted); }
.era-body { max-width: var(--measure); margin-top: 24px; }
.era-body p { margin: 0 0 1em; }
.era-lesson {
  max-width: var(--measure); margin: 8px 0 0; padding: 16px 20px;
  background: var(--era-field); border-left: 4px solid var(--era); border-radius: 4px 14px 14px 4px;
}
.era-lesson p { margin: 0; }
.era-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; margin-top: 28px; max-width: 980px; }
.era-images figure:only-child { max-width: 560px; }
.era-images figure { margin: 0; }
.era-images img { border-radius: 12px; border: 1px solid var(--line); }
.era-images figcaption { font-size: 0.85rem; color: var(--faint); margin-top: 6px; }

/* The builder's own words: the one place the page speaks in the first person. */
.era-voice {
  margin: 34px 0 30px; padding: 0 0 0 clamp(18px, 3vw, 34px); max-width: 30ch; position: relative;
  font-family: var(--display); font-weight: 600; font-stretch: 90%; letter-spacing: -0.015em;
  font-size: clamp(1.45rem, 2.7vw, 2.1rem); line-height: 1.18; color: var(--ink);
}
.era-voice::before {
  content: '\201C'; position: absolute; left: -0.08em; top: -0.32em; font-size: 2.6em; line-height: 1;
  color: var(--era); opacity: 0.85;
}
.era-voice p { margin: 0; }

/* The builds: a grid of cards under each era, the full width of the page. */
.era-builds { margin-top: clamp(28px, 4vw, 48px); }
.era-builds h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.era-later { color: var(--muted); max-width: var(--measure); margin: 0 0 14px; }
.card-grid {
  display: grid; gap: clamp(14px, 1.8vw, 22px); margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr));
}
.card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  scroll-margin: 90px;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), border-color 0.25s, box-shadow 0.35s;
}
.card[hidden] { display: none; }
.card.feature { grid-column: span 2; }
.card:hover, .card:focus-within {
  transform: translateY(-4px); border-color: var(--era);
  box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--era) 45%, transparent);
}
.card:target { border-color: var(--era); box-shadow: 0 0 0 3px var(--era-field), 0 0 0 4px var(--era); }

/* The preview: a small browser window whose page scrolls through on hover. */
.card-frame { display: block; position: relative; background: #0f1016; text-decoration: none; color: inherit; }
.card-chrome {
  display: flex; align-items: center; gap: 10px; height: 26px; padding: 0 10px;
  background: #1b1d2b; color: #8d93b3; font-size: 11px; font-weight: 600;
}
.chrome-dots { width: 34px; height: 8px; flex: none;
  background: radial-gradient(circle at 4px 4px, #ff6b6b 3.2px, transparent 3.6px),
              radial-gradient(circle at 17px 4px, #ffd166 3.2px, transparent 3.6px),
              radial-gradient(circle at 30px 4px, #4fd6a8 3.2px, transparent 3.6px); }
.chrome-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-shot { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.card.feature .card-shot { aspect-ratio: 16 / 9.4; }
.card-shot img {
  width: 100%; height: auto; display: block; will-change: transform;
  transition: transform 1.1s cubic-bezier(.45,0,.2,1);
}
.card-shot::after { /* a soft fade at the bottom edge hints there is more page below */
  content: ''; position: absolute; inset: auto 0 0 0; height: 28%;
  background: linear-gradient(to bottom, transparent, rgba(15,16,22,.55)); pointer-events: none; transition: opacity .4s;
}
.card:hover .card-shot img, .card:focus-within .card-shot img, .card.playing .card-shot img {
  transform: translateY(var(--shift, 0px)); transition-duration: var(--dur, 3s); transition-timing-function: cubic-bezier(.4,0,.3,1);
}
.card:hover .card-shot::after, .card:focus-within .card-shot::after, .card.playing .card-shot::after { opacity: 0; }

/* Builds with nothing to show: the date, set large in the era's colour. */
.card-glyph {
  aspect-ratio: 16 / 10; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px 20px;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--era) 26%, transparent), transparent 60%),
    var(--era-field);
  color: var(--era);
}
.card.feature .card-glyph { aspect-ratio: 16 / 9.4; }
.glyph-day { font-family: var(--display); font-weight: 800; font-stretch: 78%; letter-spacing: -0.04em; font-size: clamp(2.6rem, 5vw, 3.6rem); line-height: 0.9; }
.glyph-year { font-weight: 700; opacity: 0.75; margin-top: 4px; }
.card:not(.has-shot) .card-body time { display: none; } /* the date is already the card's picture */

.card-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; flex: 1; }
.card-body time { color: var(--era); font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-body h4 { margin: 0; font-family: var(--display); font-size: 1.18rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.card.feature .card-body h4 { font-size: 1.45rem; }
.card-body p { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: auto; padding-top: 12px; }
.build-flag { font-size: 0.8rem; color: var(--faint); font-weight: 600; white-space: nowrap; }
.open {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap;
  font-weight: 700; font-size: 0.92rem; color: var(--era); background: var(--era-field);
  padding: 7px 14px; border-radius: 999px; border: 1px solid transparent;
}
.open:hover { border-color: var(--era); }
.more { margin-top: 18px; background: none; border: 1px solid var(--line-strong); color: var(--ink); border-radius: 999px; padding: 8px 16px; font: 600 0.92rem var(--text); cursor: pointer; }
.more:hover { border-color: var(--era); color: var(--era); }

/* Cards rise in once, in order, when their grid first comes into view. */
@media (prefers-reduced-motion: no-preference) {
  .card-grid:not(.shown) .card { opacity: 0; transform: translateY(18px); }
  .card-grid.shown .card { animation: card-in 0.6s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 60ms); }
  @keyframes card-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card-shot img { transition: none; }
  .card:hover, .card:focus-within { transform: none; }
}

/* --------------------------------------------------------------------- outro */
/* Every screen at once, oldest first, under the closing words. */
.outro { position: relative; margin-top: clamp(90px, 14vw, 180px); padding: clamp(70px, 10vw, 140px) var(--gutter); overflow: hidden; isolation: isolate; }
.wall {
  position: absolute; inset: -12% -6%; z-index: -2; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); grid-auto-rows: 84px; align-content: center;
  opacity: 0.5; transform: rotate(-4deg);
  -webkit-mask-image: radial-gradient(ellipse 85% 80% at 50% 50%, #000 45%, transparent 85%);
          mask-image: radial-gradient(ellipse 85% 80% at 50% 50%, #000 45%, transparent 85%);
}
.wall img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 8px; outline: 2px solid var(--era-dot); outline-offset: -2px; }
.outro::before { /* the words sit on a calm pool in the middle of the wall */
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 46% 52% at 50% 50%, var(--page) 62%, color-mix(in srgb, var(--page) 80%, transparent) 78%, transparent 100%);
}
.outro-text { max-width: 44rem; margin: 0 auto; text-align: center; }
.outro h2 { font-size: clamp(2.2rem, 5.6vw, 4.4rem); font-weight: 800; font-stretch: 82%; letter-spacing: -0.03em; line-height: 0.98; }
.outro p { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted); margin: 18px auto 0; max-width: 40rem; }
.outro-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.cta {
  display: inline-flex; align-items: center; text-decoration: none; font-weight: 700; border-radius: 999px; padding: 12px 22px;
  background: var(--iris); color: #fff; border: 1.5px solid var(--iris);
}
.cta:hover { filter: brightness(1.08); }
.cta.ghost { background: var(--page); color: var(--ink); border-color: var(--line-strong); }
.cta.ghost:hover { border-color: var(--ink); }
:root[data-theme='dark'] .cta:not(.ghost) { color: #0f1016; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .cta:not(.ghost) { color: #0f1016; } }

/* -------------------------------------------------------------------- index */
.index { padding: clamp(80px, 12vw, 160px) var(--gutter) 40px; }
.index-head h2 { font-size: clamp(2rem, 4.4vw, 3.5rem); font-stretch: 88%; }
.index-note { color: var(--muted); max-width: var(--measure); margin: 12px 0 0; }
.index-tools { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-top: 28px; }
.search input {
  width: min(420px, 100%); font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 14px;
}
.search { flex: 1 1 260px; max-width: 420px; }
.only-open { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 600; cursor: pointer; }
.only-open input { width: 18px; height: 18px; accent-color: var(--iris); }
.era-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  font: 600 0.9rem var(--text); cursor: pointer; border-radius: 999px; padding: 6px 13px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--muted);
}
.chip[aria-pressed='true'] { background: var(--era-field, var(--surface)); border-color: var(--era, var(--ink)); color: var(--era, var(--ink)); }
.chip .swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--era-dot); margin-right: 7px; vertical-align: 1px; }

.index-table-wrap { margin-top: 22px; overflow-x: auto; }
.index-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.index-table th { text-align: left; font: 700 0.85rem var(--text); color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
.index-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.index-table td:first-child { white-space: nowrap; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.index-table td:nth-child(2) { font-weight: 700; white-space: nowrap; }
.index-table td:nth-child(2) .swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--era-dot); margin-right: 8px; vertical-align: 1px; }
.index-table td:nth-child(3) { color: var(--muted); }
.index-table td:last-child { text-align: right; white-space: nowrap; }
.index-empty { color: var(--muted); }

/* ------------------------------------------------------------------- footer */
.foot { padding: 32px var(--gutter) 56px; color: var(--faint); font-size: 0.9rem; border-top: 1px solid var(--line); margin-top: 40px; }
.foot p { max-width: var(--measure); margin: 0 0 8px; }

/* ------------------------------------------------------------------- narrow */
@media (max-width: 760px) {
  .era-head { grid-template-columns: 1fr; }
  .era-mark { position: static; display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
  .era-n { font-size: 4.5rem; }
  .era-when, .era-count { margin: 0; }
  .card.feature { grid-column: auto; }
  .card-glyph, .card.feature .card-glyph { aspect-ratio: auto; padding: 16px 18px 12px; }
  .glyph-day { font-size: 2.3rem; }
  .wall { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); grid-auto-rows: 64px; opacity: 0.35; }
  .outro::before { background: radial-gradient(ellipse 95% 62% at 50% 50%, var(--page) 60%, color-mix(in srgb, var(--page) 75%, transparent) 82%, transparent 100%); }
  .top-nav a { padding: 8px; }
}
