/* Fonts: self-hosted, open-licensed. Licences are in assets/fonts/licenses. */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-display: swap; src: url("fonts/bricolage-grotesque-700.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 800; font-display: swap; src: url("fonts/bricolage-grotesque-800.woff2") format("woff2"); }
@font-face { font-family: "Bowlby One"; font-weight: 400; font-display: swap; src: url("fonts/bowlby-one.woff2") format("woff2"); }
@font-face { font-family: "Titan One"; font-weight: 400; font-display: swap; src: url("fonts/titan-one.woff2") format("woff2"); }
@font-face { font-family: "Luckiest Guy"; font-weight: 400; font-display: swap; src: url("fonts/luckiest-guy.woff2") format("woff2"); }
@font-face { font-family: "Bangers"; font-weight: 400; font-display: swap; src: url("fonts/bangers.woff2") format("woff2"); }
@font-face { font-family: "Anton"; font-weight: 400; font-display: swap; src: url("fonts/anton.woff2") format("woff2"); }
@font-face { font-family: "Russo One"; font-weight: 400; font-display: swap; src: url("fonts/russo-one.woff2") format("woff2"); }
@font-face { font-family: "Black Ops One"; font-weight: 400; font-display: swap; src: url("fonts/black-ops-one.woff2") format("woff2"); }
@font-face { font-family: "Bungee"; font-weight: 400; font-display: swap; src: url("fonts/bungee.woff2") format("woff2"); }
@font-face { font-family: "Pirata One"; font-weight: 400; font-display: swap; src: url("fonts/pirata-one.woff2") format("woff2"); }
@font-face { font-family: "Mr Dafoe"; font-weight: 400; font-display: swap; src: url("fonts/mr-dafoe.woff2") format("woff2"); }
@font-face { font-family: "Yellowtail"; font-weight: 400; font-display: swap; src: url("fonts/yellowtail.woff2") format("woff2"); }
@font-face { font-family: "Monoton"; font-weight: 400; font-display: swap; src: url("fonts/monoton.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P"; font-weight: 400; font-display: swap; src: url("fonts/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "Permanent Marker"; font-weight: 400; font-display: swap; src: url("fonts/permanent-marker.woff2") format("woff2"); }

/* Tokens */
:root {
  --bg: #F2F7FF;
  --surface: #FFFFFF;
  --ink: #0E1B3D;
  --muted: #55628A;
  --line: #D5DFF5;
  --cobalt: #2450FF;
  --tangerine: #FF6A1A;
  --lemon: #FFE45C;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --glyph: system-ui, -apple-system, "Segoe UI", "Segoe UI Symbol", "Noto Sans Math", "Noto Sans Symbols 2", "Apple Symbols", sans-serif;
  --wrap: 46rem;
}
[data-theme="dark"] {
  --bg: #0B1430;
  --surface: #132048;
  --ink: #EEF3FF;
  --muted: #9FB0DE;
  --line: #26376E;
  --cobalt: #8FA6FF;
  --lemon: #FFE45C;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 6rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.6 var(--body);
}
a { color: var(--cobalt); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tangerine); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header */
.top { display: flex; align-items: center; gap: 1rem; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.brand {
  font: 800 1.25rem/1 var(--display);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
  margin-right: auto;
}
.brand span { color: var(--tangerine); }
.top nav { display: flex; gap: 1rem; }
.top nav a { color: var(--ink); font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; }
.theme {
  width: 2.5rem; height: 2.5rem;
  border: 1.5px solid var(--ink); border-radius: 50%;
  background: var(--surface); color: var(--ink);
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.theme::before {
  content: ""; width: 1.05rem; height: 1.05rem; border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: linear-gradient(90deg, var(--ink) 50%, transparent 50%);
}

/* Hero */
.hero { padding-top: 1.5rem; padding-bottom: 1rem; }
h1 {
  font: 800 clamp(2rem, 8.5vw, 3.6rem)/1.02 var(--display);
  letter-spacing: -0.035em;
  margin: 0 0 0.75rem;
  max-width: 14ch;
}
.lede { margin: 0; max-width: 34rem; color: var(--muted); font-size: 1.05rem; }

/* Input bar: stays in reach while the results scroll */
.bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 0.75rem 0;
}
.field { position: relative; }
.field input {
  width: 100%;
  font: 600 1.15rem/1.3 var(--body);
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 0.9rem;
  padding: 0.95rem 3.2rem 0.95rem 1.1rem;
  box-shadow: 0.3rem 0.3rem 0 var(--cobalt);
}
.field input::placeholder { color: var(--muted); font-weight: 400; }
.field input:focus { outline: none; box-shadow: 0.3rem 0.3rem 0 var(--tangerine); }
.clear {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  width: 2.25rem; height: 2.25rem;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}

/* Style links */
.chips {
  display: flex; gap: 0.5rem;
  overflow-x: auto;
  padding: 0.85rem 0 0.25rem;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips a, .more a {
  flex: none;
  padding: 0.4rem 0.85rem;
  border: 1.5px solid var(--ink); border-radius: 999px;
  color: var(--ink); background: var(--surface);
  font-size: 0.9rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.chips a:hover, .more a:hover { background: var(--lemon); color: #0E1B3D; }
.chips a[aria-current] { background: var(--ink); color: var(--bg); }

/* Results */
.group { margin-top: 1.75rem; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.group-head h2 { font: 700 1.2rem/1.2 var(--display); letter-spacing: -0.01em; margin: 0; }
.group-head a { font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.sheet {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 0.9rem;
  overflow: hidden;
}
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name copy" "out copy";
  align-items: center;
  column-gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 0; border-top: 1.5px solid var(--line);
  background: transparent; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.row:first-child { border-top: 0; }
.row:hover { background: color-mix(in srgb, var(--lemon) 22%, transparent); }
.row:focus-visible { outline-offset: -3px; border-radius: 0; }
.row-name { grid-area: name; font-size: 0.8rem; color: var(--muted); }
.row-out {
  grid-area: out;
  font: 400 1.3rem/1.5 var(--glyph);
  overflow-wrap: anywhere;
  min-width: 0;
}
.row-copy {
  grid-area: copy;
  padding: 0.35rem 0.8rem;
  border: 1.5px solid var(--ink); border-radius: 999px;
  font-size: 0.82rem; font-weight: 700;
  min-width: 4.4rem; text-align: center;
}
.row.is-copied .row-copy { background: var(--lemon); color: #0E1B3D; border-color: #0E1B3D; }
.glitchy .row { padding-top: 1.4rem; padding-bottom: 1.4rem; }

/* Reading content */
.prose { margin-top: 3rem; max-width: 38rem; }
.prose h2 { font: 700 1.5rem/1.2 var(--display); letter-spacing: -0.02em; margin: 2.25rem 0 0.6rem; }
.prose h3 { font: 700 1.05rem/1.3 var(--body); margin: 1.5rem 0 0.3rem; }
.prose p, .prose li { margin: 0 0 0.9rem; }
.prose ul { padding-left: 1.2rem; }
.page h1 { max-width: none; font-size: clamp(1.9rem, 7vw, 2.8rem); }
.prose .more { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0.75rem 0 0; list-style: none; }
.more li { margin: 0; display: flex; }

/* Footer */
.foot {
  margin-top: 4rem;
  border-top: 2px solid var(--ink);
  padding: 1.5rem 0 2.5rem;
  font-size: 0.9rem; color: var(--muted);
}
.foot ul { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; list-style: none; padding: 0; margin: 0 0 0.9rem; }
.foot a { color: var(--ink); font-weight: 600; }
.foot p { margin: 0; max-width: 38rem; }

@media (min-width: 40rem) {
  .row { grid-template-columns: 9.5rem 1fr auto; grid-template-areas: "name out copy"; padding: 0.95rem 1.25rem; }
  .row-out { font-size: 1.45rem; }
  .hero { padding-top: 2.5rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .row-copy { transition: background-color 0.15s; }
}

/* Image maker */
.maker { margin-top: 0.5rem; }
.stage {
  border: 2px solid var(--ink); border-radius: 0.9rem; overflow: hidden;
  background-color: #C9D2E6;
  background-image: linear-gradient(45deg, #AEB9D4 25%, transparent 25%, transparent 75%, #AEB9D4 75%), linear-gradient(45deg, #AEB9D4 25%, transparent 25%, transparent 75%, #AEB9D4 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px;
}
.stage[data-bg="black"] { background: #000; }
.stage[data-bg="white"] { background: #fff; }
.stage canvas { display: block; width: 100%; height: auto; }
.opts { margin-top: 1rem; display: grid; gap: 1rem; }
.opts fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.opts legend { padding: 0; margin-bottom: 0.4rem; font-weight: 700; font-size: 0.9rem; }
.picks { display: flex; gap: 0.5rem; overflow-x: auto; padding: 2px 2px 0.4rem; scrollbar-width: thin; }
.picks.wrapping { flex-wrap: wrap; overflow: visible; }
.pick {
  flex: none;
  padding: 0.5rem 0.9rem;
  border: 1.5px solid var(--ink); border-radius: 0.6rem;
  background: var(--surface); color: var(--ink);
  font: 400 1.05rem/1.2 var(--body); white-space: nowrap; cursor: pointer;
}
.pick[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pick.plain { font-weight: 600; font-size: 0.9rem; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.95rem; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--tangerine); }
.primary {
  justify-self: start;
  padding: 0.85rem 1.4rem;
  border: 2px solid #0E1B3D; border-radius: 0.9rem;
  background: var(--tangerine); color: #0E1B3D;
  font: 800 1.05rem/1 var(--display); cursor: pointer;
  box-shadow: 0.25rem 0.25rem 0 var(--ink);
}
.primary:active { transform: translate(0.15rem, 0.15rem); box-shadow: 0.1rem 0.1rem 0 var(--ink); }

/* Link rows and tables */
a.row { text-decoration: none; grid-template-columns: 1fr auto; grid-template-areas: "out copy"; }
a.row .row-out { font: 600 1.05rem/1.4 var(--body); }
a.row .row-copy { border: 0; min-width: 0; padding: 0; color: var(--cobalt); }
.spec { width: 100%; border-collapse: collapse; margin: 1rem 0 0; font-size: 0.95rem; }
.spec th, .spec td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1.5px solid var(--line); }
.spec th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.spec td:nth-child(2) { font-weight: 700; }
.note { font-size: 0.88rem; color: var(--muted); }
@media (min-width: 40rem) {
  a.row { grid-template-columns: 1fr auto; grid-template-areas: "out copy"; }
}

/* Wide tables and colour swatches */
.scroll { overflow-x: auto; margin-top: 1rem; border: 2px solid var(--ink); border-radius: 0.9rem; background: var(--surface); }
.scroll .spec { min-width: 44rem; margin: 0; }
.scroll .spec th, .scroll .spec td { padding: 0.65rem 0.9rem; }
.scroll .spec tr:last-child td { border-bottom: 0; }
.scroll .spec td:nth-child(2) { font-weight: 400; }
.scroll .spec td:first-child { font-weight: 700; white-space: nowrap; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.25rem 0 1rem; padding: 0; list-style: none; }
.swatches li { display: flex; align-items: center; gap: 0.45rem; margin: 0; font: 600 0.85rem/1 ui-monospace, Menlo, Consolas, monospace; }
.swatches i { width: 1.6rem; height: 1.6rem; border-radius: 0.4rem; border: 1.5px solid var(--ink); }
.byline { margin: 0.6rem 0 0; font-size: 0.88rem; color: var(--muted); }
a.row .row-name { grid-area: name; }
a.row.rich { grid-template-areas: "out copy" "name copy"; }
a.row.rich .row-name { font-size: 0.88rem; margin-top: 0.15rem; }

.prose .swatches { padding-left: 0; }
