/* VENDWORLD site pages (home, lore, roadmap, docs). Shares the game's chunky cartoon look. */
:root {
  --ink: #34324d;
  --ink-soft: #5d5a7a;
  --cream: #fff1cf;
  --paper: #fffaf0;
  --page: #fdf3e1;
  --line: #e4dccb;
  --pink: #f25c7a;
  --pink-soft: #f3a1cb;
  --lime: #b8e65a;
  --grass: #79c965;
  --sky: #73d9e8;
  --blue: #3e8de0;
  --gold: #f4c542;
  --peach: #f8a76d;
  --violet: #a35be0;
  --night: #262438;
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; } }
body { margin: 0; background: var(--page); line-height: 1.55; font-size: 17px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--blue); }
h1, h2, h3, h4 { line-height: 1.12; margin: 0 0 .4em; }
h1 { font-size: clamp(40px, 7vw, 76px); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: clamp(30px, 4.4vw, 46px); font-weight: 700; }
h3 { font-size: 22px; font-weight: 600; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-soft); }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.eyebrow { display: inline-block; font-weight: 600; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--pink); margin-bottom: 10px; }
.lead { font-size: clamp(18px, 2vw, 21px); color: var(--ink-soft); max-width: 640px; }

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(253, 243, 225, .9); backdrop-filter: blur(10px); border-bottom: 3px solid var(--ink); }
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 70px; }
.brand { display: inline-flex; font-weight: 700; font-size: 26px; text-decoration: none; letter-spacing: .02em; }
.brand span:nth-child(odd) { color: var(--pink); } .brand span:nth-child(even) { color: var(--blue); }
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--ink); text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: 10px; }
.nav-links a:hover { background: var(--cream); }
.nav-links a[aria-current="page"] { background: var(--ink); color: #fff; }
.nav-toggle { display: none; margin-left: auto; width: 44px; height: 44px; border-radius: 12px; border: 2.5px solid var(--ink); background: #fff; font-size: 20px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 14px; border: 3px solid var(--ink); background: var(--lime); color: var(--ink); font: 600 17px 'Fredoka', sans-serif; text-decoration: none; box-shadow: 0 4px 0 var(--ink); transition: transform .08s; cursor: pointer; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn.pink { background: var(--pink); color: #fff; }
.btn.ghost { background: #fff; }
.btn.small { padding: 7px 14px; font-size: 15px; box-shadow: 0 3px 0 var(--ink); }
.btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* ---------- Generic blocks ---------- */
section { padding: 84px 0; }
.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 5px 0 var(--ink); padding: 22px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; border: 2px solid var(--ink); font-size: 13px; font-weight: 600; background: #fff; }
.pill.done { background: var(--lime); }
.pill.now { background: var(--gold); }
.pill.next { background: var(--sky); }
.pill.later { background: #e9e2f5; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #fff; border: 2px solid var(--ink); }
.callout { background: #fff; border: 2.5px dashed var(--ink-soft); border-radius: 16px; padding: 14px 18px; color: var(--ink-soft); font-size: 15.5px; }
.callout b { color: var(--ink); }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; overflow: hidden; font-size: 15.5px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1.5px solid var(--line); vertical-align: top; }
th { background: var(--cream); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .88em; background: #f3ebdb; padding: 1px 6px; border-radius: 6px; }
pre { background: var(--night); color: #f4f1e1; border-radius: 16px; padding: 16px 18px; overflow: auto; font-size: 14px; line-height: 1.5; border: 3px solid var(--ink); }
pre code { background: none; padding: 0; color: inherit; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 70px 0 0; background: linear-gradient(#bfe9f5 0%, #dff4ea 55%, var(--page) 100%); border-bottom: 3px solid var(--ink); }
.hero .wrap { position: relative; z-index: 2; display: grid; grid-template-columns: 1.1fr .9fr; gap: 30px; align-items: center; }
.hero-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; transform: rotate(-3deg); }
.hero-art a { display: block; }
.hero-art img { width: 100%; aspect-ratio: 1; image-rendering: pixelated; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink); background: #fff; }
.hero-art img:nth-child(2n) { transform: translateY(18px); }
.skyline { position: relative; z-index: 1; height: 120px; margin-top: 40px; background:
  radial-gradient(circle at 8% 100%, #f3a1cb 0 38px, transparent 39px),
  radial-gradient(circle at 92% 100%, #f3a1cb 0 44px, transparent 45px),
  radial-gradient(circle at 70% 100%, #58b84e 0 34px, transparent 35px),
  linear-gradient(transparent 70%, var(--grass) 70%);
}
.skyline i { position: absolute; bottom: 36px; width: 70px; border: 3px solid var(--ink); border-bottom: 0; border-radius: 6px 6px 0 0; background: repeating-linear-gradient(transparent 0 10px, rgba(255,255,255,.55) 10px 16px), var(--c); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: -40px; position: relative; z-index: 3; }
.stat { background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 16px 18px; box-shadow: 0 5px 0 var(--ink); }
.stat b { display: block; font-size: 34px; line-height: 1.05; }
.stat span { color: var(--ink-soft); font-size: 15px; }

/* ---------- Steps / districts ---------- */
.step-num { width: 44px; height: 44px; border-radius: 14px; border: 3px solid var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 20px; margin-bottom: 12px; }
.district { position: relative; overflow: hidden; }
.district .emoji { font-size: 34px; }
.meter { height: 12px; border-radius: 6px; background: #eadfca; border: 2px solid var(--ink); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--lime); }
.collections { display: flex; flex-wrap: wrap; gap: 8px; }
.collections span { padding: 4px 12px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-weight: 600; font-size: 14px; }
.collections span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); border: 1.5px solid var(--ink); vertical-align: -1px; }
.machine-strip { display: flex; gap: 12px; overflow: hidden; padding: 6px 0 14px; }
.machine-strip a { flex: none; }
.machine-strip img { width: 92px; height: 92px; flex: none; image-rendering: pixelated; border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); }
.samples img { height: auto; aspect-ratio: 1; image-rendering: pixelated; object-fit: cover; }
.hero-art.samples { grid-template-columns: repeat(2, 1fr); max-width: 420px; justify-self: center; }
.machine-strip.samples { flex-wrap: wrap; overflow: visible; }
.machine-strip.samples img { width: 190px; height: 190px; }
.samples-note { grid-column: 1 / -1; flex-basis: 100%; margin: 26px 0 0; font-size: 13px; color: var(--muted, #6b6880); text-align: center; }
.hero-art.samples a:nth-child(2n) { transform: translateY(18px); }
.hero-art .samples-note { transform: rotate(3deg); }
@media (max-width: 640px) { .machine-strip.samples img { width: calc((100vw - 56px) / 2); height: auto; aspect-ratio: 1; } }

details.faq { background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 4px 20px; box-shadow: 0 4px 0 var(--ink); }
details.faq + details.faq { margin-top: 12px; }
details.faq summary { cursor: pointer; font-weight: 600; font-size: 19px; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::after { content: '+'; font-size: 24px; line-height: 1; }
details.faq[open] summary::after { content: '−'; }
details.faq p { color: var(--ink-soft); }

/* ---------- Page header ---------- */
.page-head { padding: 64px 0 44px; background: linear-gradient(#ffe0ea, var(--page)); border-bottom: 3px solid var(--ink); }
.page-head.night { background: linear-gradient(#262438, #4b3f78); color: #fff; }
.page-head.night .lead { color: #d8d3f5; }

/* ---------- Lore ---------- */
.chapter { display: grid; grid-template-columns: 120px 1fr; gap: 28px; padding: 40px 0; border-bottom: 2px dashed var(--line); }
.chapter:last-child { border-bottom: 0; }
.chapter .no { font-size: 64px; font-weight: 700; color: var(--pink-soft); line-height: 1; -webkit-text-stroke: 2px var(--ink); }
.chapter p { font-size: 18.5px; max-width: 720px; }
.chapter blockquote { margin: 18px 0; padding: 14px 20px; border-left: 6px solid var(--pink); background: #fff; border-radius: 0 14px 14px 0; font-size: 19px; font-style: italic; }
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 4px; background: var(--ink); border-radius: 2px; }
.timeline li { list-style: none; position: relative; margin-bottom: 18px; }
.timeline li::before { content: ''; position: absolute; left: -26px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--gold); border: 3px solid var(--ink); }
.timeline b { display: block; }

/* ---------- Roadmap ---------- */
.phase { display: grid; grid-template-columns: 70px 1fr; gap: 20px; position: relative; padding-bottom: 34px; }
.phase::before { content: ''; position: absolute; left: 33px; top: 64px; bottom: 0; width: 4px; background: var(--ink); opacity: .2; }
.phase:last-child::before { display: none; }
.phase-dot { width: 70px; height: 70px; border-radius: 22px; border: 3px solid var(--ink); display: grid; place-items: center; font-size: 26px; font-weight: 700; box-shadow: 0 4px 0 var(--ink); background: #fff; }
.phase.done .phase-dot { background: var(--lime); }
.phase.now .phase-dot { background: var(--gold); }
.phase.next .phase-dot { background: var(--sky); }
.checks { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.checks li { padding-left: 30px; position: relative; }
.checks li::before { content: ''; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 6px; border: 2.5px solid var(--ink); background: #fff; }
.checks li.ok::before { background: var(--lime); content: '✓'; font-size: 13px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.checks li.wip::before { background: var(--gold); }

/* ---------- Docs ---------- */
.docs { display: grid; grid-template-columns: 250px 1fr; gap: 40px; padding: 40px 0 80px; }
.toc { position: sticky; top: 90px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; }
.toc a { display: block; padding: 6px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15.5px; border-left: 3px solid transparent; }
.toc a:hover { background: var(--cream); }
.toc a.active { background: var(--ink); color: #fff; }
.toc .group { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; margin: 16px 12px 4px; }
.doc { min-width: 0; }
.doc section { padding: 0 0 54px; }
.doc h2 { font-size: 34px; padding-top: 10px; }
.doc h3 { margin-top: 26px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin-bottom: 6px; }
figure.diagram { margin: 20px 0 26px; background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 18px; box-shadow: 0 5px 0 var(--ink); }
figure.diagram svg { width: 100%; height: auto; display: block; }
figure.diagram figcaption { margin-top: 12px; font-size: 14.5px; color: var(--ink-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; margin-top: 10px; color: var(--ink-soft); }
.legend span::before { content: ''; display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--ink); margin-right: 6px; vertical-align: -2px; background: var(--c); }
.formula { background: var(--night); color: #f4f1e1; border: 3px solid var(--ink); border-radius: 16px; padding: 14px 18px; font-family: ui-monospace, Consolas, monospace; font-size: 14.5px; overflow: auto; }

/* SVG diagram tokens */
.dg text { font-family: 'Fredoka', system-ui, sans-serif; fill: var(--ink); }
.dg .t { font-size: 15px; font-weight: 600; }
.dg .s { font-size: 12.5px; fill: var(--ink-soft); font-weight: 500; }
.dg .box { stroke: var(--ink); stroke-width: 2.5; rx: 14; }
.dg .zone { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-dasharray: 7 6; rx: 18; }
.dg .zl { font-size: 12px; font-weight: 600; letter-spacing: .08em; fill: var(--ink-soft); }
.dg .ar { stroke: var(--ink); stroke-width: 2.4; fill: none; marker-end: url(#arrow); }
.dg .ar.dash { stroke-dasharray: 6 5; }
.dg .lab { font-size: 12px; fill: var(--ink); font-weight: 600; }
.dg .lifeline { stroke: var(--ink-soft); stroke-width: 2; stroke-dasharray: 4 5; }

/* ---------- Footer ---------- */
footer { background: var(--night); color: #d8d3f5; padding: 50px 0 40px; border-top: 3px solid var(--ink); font-size: 15px; }
footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
footer a { color: #fff; text-decoration: none; display: block; margin-bottom: 6px; }
footer a:hover { text-decoration: underline; }
footer h4 { color: #fff; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 12px; }
footer .fine { grid-column: 1 / -1; border-top: 1px solid #4d4a6b; padding-top: 18px; font-size: 13.5px; color: #a9a4c9; }

@media (max-width: 900px) {
  .hero .wrap, .g2, .g3, .g4, .stats, footer .wrap { grid-template-columns: 1fr; }
  .g3.keep2, .g4 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; margin-top: 20px; }
  .hero-art { max-width: 420px; }
  .docs { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .toc .group { display: none; }
  .chapter { grid-template-columns: 1fr; gap: 6px; }
  .nav-toggle { display: grid; place-items: center; }
  .nav-links { display: none; position: absolute; top: 70px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--page); border-bottom: 3px solid var(--ink); padding: 10px 16px; }
  .nav-links.open { display: flex; }
  section { padding: 60px 0; }
}
@media (max-width: 520px) {
  .g4, .stats { grid-template-columns: 1fr; }
  body { font-size: 16px; }
}

/* ---------- Collection & machine pages ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.filter select, .filter input { font: 500 15px 'Fredoka', sans-serif; padding: 8px 10px; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); min-width: 150px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.mcard { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 16px; padding: 8px; box-shadow: 0 4px 0 var(--ink); text-decoration: none; color: var(--ink); transition: transform .1s; }
.mcard:hover { transform: translateY(-3px); }
.mcard img { width: 100%; aspect-ratio: 1; image-rendering: pixelated; border-radius: 10px; border: 2px solid var(--line); }
.mcard small { color: var(--ink-soft); font-size: 12.5px; }
.mcard .tag { font-size: 11px; padding: 0 8px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 26px; }
.machine-hero { width: 100%; aspect-ratio: 1; image-rendering: pixelated; border-radius: 14px; display: block; }
@media (max-width: 900px) { #raritySummary { grid-template-columns: repeat(3, 1fr) !important; } }

/* ---------- Leaderboard / stats ---------- */
.lb-thumb { width: 36px; height: 36px; image-rendering: pixelated; border-radius: 8px; border: 2px solid var(--line); vertical-align: middle; margin-right: 6px; }
.lb-machine { white-space: nowrap; color: var(--ink); text-decoration: none; font-weight: 600; }
.stat-line { padding: 7px 0; border-bottom: 1.5px dashed var(--line); font-size: 15px; }
.stat-line:last-child { border-bottom: 0; }
@media (max-width: 720px) { table { display: block; overflow-x: auto; } }
