/* ============================================================
   ICONDUSK — Golden Hour theme.
   The single, fixed theme for the whole site: gold, coral and
   ember fading into twilight purple and deep dusk navy.
   Every page reads these variables; there is no theme picker.
   ============================================================ */
:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --surface-2: #f3ece4;
  --peek-bg: #ffffff;
  --peek-ink: #221a2e;
  --ink: #221a2e;
  --muted: #6b5f74;
  --line: #e7ddd2;
  --accent: #e8490f;
  --accent-dark: #c53c0a;
  /* Primary-button colours are darker than the accent on purpose:
     white button text on --accent only reaches 3.90:1, below the
     WCAG AA 4.5:1 for normal text. --btn gives 5.22:1 and
     --btn-hover 6.72:1 with white text (check 19 recomputes the
     ratios, in both colour schemes). */
  --btn: #c53c0a;
  --btn-hover: #a83208;
  --gold: #f6a821;
  --dusk: #17132b;
  --on-accent: #ffffff;
  --accent-soft: #fdeee6;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --good: #177245;
  --bad: #b3372a;
  --checker: rgba(20, 20, 20, 0.08);
  /* Set-card style pill: solid light-grey chip in light mode. */
  --pill-bg: #f3f4f6;
  --pill-ink: #6b7280;
  --pill-line: transparent;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --btn-radius: 10px;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  --header-h: 60px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* After sunset — deep dusk navy surfaces, warm ember accent. */
    --bg: #12101f;
    --surface: #1c1930;
    --surface-2: #262240;
    --peek-bg: #262240;
    --peek-ink: #f4efe8;
    --ink: #f4efe8;
    --muted: #aaa0b8;
    --line: #332e52;
    --accent: #ff7a45;
    --accent-dark: #ff7a45;
    /* Same AA rule after dark: white on the bright dark-scheme
       accent is only 2.59:1, so the button background darkens to
       a deep ember — 5.99:1 for --btn, 7.22:1 for --btn-hover. */
    --btn: #b23a0c;
    --btn-hover: #9c3409;
    --good: #4cc084;
    --bad: #ef7d6e;
    --checker: rgba(255, 255, 255, 0.09);
    /* After dark the pill drops its solid fill and becomes an
       outline chip: transparent background, thin light border,
       light text, so it sits inside the dusk theme. */
    --pill-bg: transparent;
    --pill-ink: #f4efe8;
    --pill-line: #aaa0b8;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, [role="button"], select, summary, input:not([type="checkbox"], [type="radio"]), textarea { min-height: 2.25rem; }
button { font: inherit; cursor: pointer; }
/* Every interactive control gets a visible keyboard focus ring:
   one global :focus-visible rule, so a control added later is
   covered without remembering to opt it in. The ring colour is
   --accent-dark (AA on both backgrounds) with an offset, so it
   reads on cards, panels and the page background alike. */
:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
/* Body-text links use --accent-dark, not --accent: the ember is
   3.62:1 on the cream background (below AA 4.5:1), while
   --accent-dark reaches 4.85:1 there and 5.22:1 on white panels.
   In dark mode --accent-dark is the bright accent itself (7.25:1). */
a { color: var(--accent-dark); }
.mono { font-family: var(--font-mono); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; width: 100%; }
h1, h2, h3, p, .lede, .crumb { overflow-wrap: break-word; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--btn-radius); padding: 8px 16px; font-weight: 600; font-size: 14.5px;
  text-decoration: none; min-height: 40px;
  transition: border-color .15s, background .15s, transform .1s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--on-accent); }
.btn.primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13.5px; }

/* ---------- Header ---------- */
header.site {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
header.site::after { content: ""; display: block; height: 3px; background: #e8490f; }
.nav { display: flex; align-items: center; gap: 14px; min-height: var(--header-h); flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.brand .mark {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--dusk); color: var(--gold);
  display: grid; place-items: center; flex: none;
}
.brand .mark svg { width: 22px; height: 22px; }
.brand .tagline { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .01em; line-height: 1.25; }
@media (max-width: 560px) { .brand .tagline { display: none; } }
.nav nav { gap: 2px; margin-left: 4px; flex-wrap: wrap; }
/* The main nav lives inside a <details class="navmenu"> so phones
   get a hamburger menu that opens and closes with no JavaScript —
   the <summary> is a real, keyboard-focusable button. Above phone
   width the summary is hidden and the nav is shown inline even
   though the details is closed: browsers that hide closed-details
   content through the ::details-content pseudo-element are told
   to keep it visible, and main.js additionally holds the details
   open at these widths, so the wider header is unchanged. At
   phone width the closed details hides the nav until tapped. */
.navmenu { margin: 0; }
.menubtn { list-style: none; }
.menubtn::-webkit-details-marker { display: none; }
@media (min-width: 761px) { .menubtn { display: none; } .navmenu > nav { display: flex; } .navmenu::details-content { content-visibility: visible; } }
.nav nav a {
  color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500;
  padding: 8px 10px; border-radius: var(--radius-sm);
}
.nav nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav nav a.on { color: var(--ink); background: var(--surface-2); }
.nav .spacer { flex: 1; }
@media (max-width: 760px) { .nav .btn.primary { padding: 6px 10px; font-size: 13px; min-height: 36px; } .brand { font-size: 17px; gap: 8px; } .brand .mark { width: 32px; height: 32px; } }
/* Tablet and below: brand + support button share the first row and
   the menu gets a full-width row of its own, instead of the links
   wrapping awkwardly between the brand and the button. (At phone
   width the phone block further down overrides this: the menu
   collapses into the hamburger button instead.) */
@media (max-width: 1024px) { .navmenu { order: 3; width: 100%; } .nav nav { margin-left: 0; } }

/* ---------- Hero / page heads ---------- */
.hero { padding: 52px 0 30px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 36px; align-items: center; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  /* Single column now: let the hero text breathe across the width
     it has instead of hugging the desktop measures. The hero
     visual stacks under the text as a normal grid item; its
     compact small-screen size lives further down, AFTER the base
     .hero-art rules, so it wins the cascade at equal
     specificity. */
  .hero h1 { max-width: 24ch; }
  .hero p.lede { max-width: 62ch; }
  .searchbar { max-width: 680px; }
}
.hero h1, .pagehead h1 {
  font-size: clamp(30px, 5vw, 44px); line-height: 1.1; letter-spacing: -0.02em;
  margin: 0 0 14px; font-weight: 700;
}
.hero h1 { max-width: 15ch; }
.hero h1 .hl { color: var(--accent); }
.hero p.lede, .pagehead p.lede { color: var(--muted); font-size: 17.5px; margin: 0 0 24px; max-width: 56ch; }
.pagehead { padding: 44px 0 8px; }
.crumb { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent-dark); }
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 6px 14px 6px 16px; max-width: 560px;
}
/* The search input itself has outline: 0, so focus is announced
   on the bar: an ink ring (15.5:1 on the light background, and
   the dark-scheme ink is near-white on navy) — not just the old
   accent border tint, which only reached 3.62:1. */
.searchbar:focus-within { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4.5px var(--ink); }
.searchbar svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.searchbar input {
  border: 0; outline: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 16px; flex: 1; min-width: 0; min-height: 40px;
}
.search-note { color: var(--muted); font-size: 14px; margin-top: 10px; }
.tour-link { color: var(--muted); font-size: 15px; margin-top: 14px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 22px; color: var(--muted); font-size: 14px; }
.hero-stats b { color: var(--ink); font-weight: 600; }
/* The hero visual: the Icondusk sun ALONE — the header logo's
   exact geometry, large and centred in the hero grid's right
   column, linking to the Sets page. There are no small icons
   around it any more. That is ALL there is: no box, no border,
   no background layer, no glow and no gradient — the mark sits
   directly on the hero's own plain background, which is exactly
   the page background, unchanged. The visual is a normal
   in-flow grid item, so it can never overlap the hero text,
   search or stats. */
.hero-art { justify-self: center; width: 100%; max-width: 320px; display: grid; place-items: center; }
.hero-art .sun-link {
  width: 84%; line-height: 0; display: block; text-decoration: none;
  transition: transform .2s;
}
.hero-art .sun-link svg { width: 100%; height: auto; display: block; }
.hero-art .sun-link:hover { transform: scale(1.03); }
.hero-art .sun-link:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 4px; border-radius: var(--radius-sm); }
/* Small screens (≤860px): the hero grid is one column here, so
   the sun simply stacks under the hero text as the grid's
   second item — no reserved strip and no absolute placement
   against the hero. It only shrinks a step: a narrower column,
   so the sun gets smaller and stays well inside the viewport.
   This block MUST stay after the base .hero-art rules above: at
   equal specificity the later rule wins. */
@media (max-width: 860px) {
  .hero-art { max-width: 210px; margin-top: 8px; }
}
/* Phones (≤760px): the hero visual is hidden entirely — the
   hero shows only its text, search and stats, with no image.
   Desktop and tablet keep the sun exactly as above. This block
   stays after the ≤860px rule so display:none wins at phone
   width. */
@media (max-width: 760px) {
  .hero-art { display: none; }
}

/* ---------- Toolbar ---------- */
.toolbar { padding: 14px 0 12px; border-bottom: 1px solid var(--line); margin-top: 18px; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 500; min-height: 36px;
  display: inline-flex; align-items: center; text-decoration: none;
}
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.toolbar .spacer { flex: 1; }
.ctl { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); position: relative; }
.swatches { display: flex; gap: 6px; align-items: center; }
/* The border is --muted, not --line: the White swatch on a light
   surface was white against #e7ddd2 (1.34:1 — nearly invisible).
   --muted reaches ~6:1 on the light surface and stays clearly
   visible on the dark one, so every swatch, White included, can
   be told apart from the surface behind it. */
.sw { width: 26px; height: 26px; min-height: 26px; border-radius: 50%; border: 2px solid var(--muted); padding: 0; flex: none; cursor: pointer; }
.sw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
/* Custom-colour button: a small square showing the colour in
   use. It opens the site's own colour panel (.cpanel, below)
   instead of the operating system's picker, which the native
   colour input it replaces used to open. */
.colorbtn {
  width: 34px; height: 34px; min-height: 34px; padding: 3px; flex: none;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
}
.colorbtn-chip {
  display: block; width: 100%; height: 100%; border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, .18);
}
select, input[type="text"], input[type="email"], textarea {
  font: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px;
}
textarea { width: 100%; min-height: 130px; resize: vertical; }
label.flabel { display: block; font-size: 13.5px; font-weight: 600; margin: 14px 0 6px; }
.finput { width: 100%; }
/* Hex code field: lives inside the custom colour panel (below),
   in the set-page toolbar and the icon dialog, so a visitor can
   type or paste their own colour code. Mono type on the shared
   input chrome. The invalid state uses --bad, which is defined
   per colour scheme, so a bad code reads as an error in light
   and dark mode alike; the field's text itself is never
   recoloured. */
input.hex-input {
  width: 102px; height: 34px; min-height: 34px;
  font-family: var(--font-mono); font-size: 13.5px; padding: 6px 9px;
}
input.hex-input.invalid { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }

/* ---------- Custom colour panel ----------
   The site's own colour panel, opened by the .colorbtn button in
   the set-page toolbar and in the icon dialog. It replaces the
   native colour input, whose picker belongs to the operating
   system (device language, no hex code field): this panel is in
   English on every device and carries the hex field inside it.
   It hangs below its colour control, right-aligned to it, and
   follows the colour scheme through the shared variables. The
   saturation/value area and the hue track are functional colour
   surfaces — the gradients ARE the control, not decoration. */
.cpanel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  width: 300px; max-width: calc(100vw - 28px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; color: var(--ink); text-align: left;
}
.cpanel[hidden] { display: none; }
.cpanel-head { display: flex; align-items: center; margin-bottom: 12px; }
.cpanel-title { font-size: 15px; font-weight: 600; }
.cpanel-x {
  margin-left: auto; width: 40px; height: 40px; min-height: 40px; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--btn-radius); display: grid; place-items: center; cursor: pointer;
}
.cpanel-x svg { width: 18px; height: 18px; }
.cp-sv {
  position: relative; height: 150px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; touch-action: none;
  background:
    linear-gradient(to top, #000, rgba(0, 0, 0, 0)),
    linear-gradient(to right, #fff, rgba(255, 255, 255, 0)),
    hsl(var(--cp-h, 264), 100%, 50%);
}
.cp-thumb {
  position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #fff; transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 1px 4px rgba(0, 0, 0, .3);
  pointer-events: none;
}
.cp-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.cp-lab { font-size: 13.5px; color: var(--muted); width: 32px; flex: none; }
.cp-hue {
  flex: 1; min-width: 0; height: 40px; min-height: 40px; margin: 0; padding: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.cp-hue::-webkit-slider-runnable-track {
  height: 14px; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .18);
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.cp-hue::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: -5px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--muted);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.cp-hue::-moz-range-track {
  height: 14px; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .18);
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.cp-hue::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--muted);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.cpanel input.hex-input { flex: 1; width: auto; min-width: 0; height: 40px; min-height: 40px; }

/* ---------- Icon grid & cards ---------- */
.grid-section { padding: 26px 0 8px; }
.set-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin-bottom: 16px; }
.set-head h2 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.set-head .meta { color: var(--muted); font-size: 14px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 8px 8px; text-align: center;
  transition: border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink);
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
/* White icons (the White swatch) are invisible on the light card
   surface (white on white is 1.08:1), so while white is the picked
   colour main.js flags every card .is-white and the card flips to
   the dusk-navy surface, where the white artwork reads clearly —
   the same dusk-navy surface as the brand mark. The name and set label
   follow onto the dark surface colours. */
.card.is-white { background: var(--dusk); border-color: var(--dusk); }
.card.is-white .nm { color: #f4efe8; }
.card.is-white .st { color: #aaa0b8; }
.card.is-white .mini { background: transparent; border-color: #332e52; color: #aaa0b8; }
.card.is-white .mini:hover { color: #ff7a45; border-color: #ff7a45; }
.card-main {
  background: none; border: 0; padding: 0; color: inherit; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0;
}
/* The artwork fills its tile (30 Nov 2026 density pass): the SVG
   renders at 64px in a tightened tile instead of floating small
   in empty space — the files stay 24px viewBox, vectors scale. */
.card .ic { display: grid; place-items: center; height: 70px; }
.card .ic svg { width: 64px; height: 64px; }
.card .nm { font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.card .st { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.mini {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 7px 10px; min-height: 34px; display: inline-flex; align-items: center;
  text-decoration: none; cursor: pointer;
}
.mini:hover { color: var(--accent-dark); border-color: var(--accent); }
@media (max-width: 560px) {
  .card { padding: 8px 5px 7px; }
  .card .ic { height: 52px; }
  .card .ic svg { width: 48px; height: 48px; }
  .card .nm { font-size: 12.5px; }
  /* The set name stays on phone cards — home search results
     would otherwise lose which set each icon belongs to — just
     set smaller and tighter. */
  .card .st { font-size: 9.5px; line-height: 1.25; }
  /* All three quick actions stay on the card at phone width —
     hiding PNG and Copy left no hint they exist — so the buttons
     just get smaller and wrap instead. */
  .card-actions { gap: 5px; }
  .mini { font-size: 10.5px; padding: 6px 7px; min-height: 32px; }
}
.empty {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 44px 20px;
  text-align: center; color: var(--muted); display: none;
}
.empty b { color: var(--ink); display: block; font-size: 16px; margin-bottom: 4px; }

/* Load more (30 Nov 2026): long icon grids open on a first page
   of results and this centred button reveals the rest, page by
   page — never numbered pagination. The row starts hidden and
   main.js unhides it only while more results remain; with
   JavaScript off the js-only class hides it entirely and every
   icon and card stays visible, exactly as rendered. */
.loadmore-row { display: flex; justify-content: center; padding: 20px 0 8px; }
.loadmore-row[hidden] { display: none; }
.loadmore { min-width: 220px; }

/* ---------- Set / category / guide cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1024px) { .cards-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .cards-grid { grid-template-columns: 1fr; } }
.cards-grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .cards-grid.three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .cards-grid.three { grid-template-columns: 1fr; } }
.setcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 0; overflow: hidden; text-decoration: none; color: var(--ink); display: block;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
a.setcard:hover { border-color: var(--muted); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14); transform: translateY(-3px); }
/* Flaticon-style set cards (30 Nov 2026, Option A): the preview
   panel IS the card — six real icons at 60px in a 3x2 grid, and
   below it a single footer line: the title on the left, the
   set's style pill on the right (the pill replaced the icon
   count on 30 Nov 2026; the count still shows on the set page).
   No description on the card; the full description lives on
   the set page. The panel follows the colour scheme through
   --peek-bg / --peek-ink: white with dark ink in light mode,
   a dark dusk surface (--surface-2 after dark) with light
   icons in dark mode, so the card blends into the page theme
   instead of sitting on it as a bright white box after dark.
   Guide cards carry no preview panel, so they keep the old
   all-over padding. */
.setcard .peek {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 12px;
  background: var(--peek-bg); color: var(--peek-ink); padding: 26px 24px; margin: 0;
  border-bottom: 1px solid var(--line);
}
.setcard .peek span { display: grid; place-items: center; padding: 4px 0; }
.setcard .peek svg { width: 60px; height: 60px; }
.setcard .setcard-body { padding: 14px 18px 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; }
.setcard .setcard-body h2, .setcard .setcard-body h3 { font-size: 16.5px; margin: 0; }
.setcard .setcard-body .meta { font-family: var(--font-sans); font-size: 12.5px; letter-spacing: .02em; white-space: nowrap; }
/* Style pill in the set-card footer: small chip naming the
   set's style (Line / Filled / Duotone / Colour). It follows
   the colour scheme through the --pill-* variables: a solid
   light-grey chip in light mode, an outline-only chip
   (transparent fill, thin light border, light text) in dark
   mode, so it blends with the dusk theme instead of glowing
   as a pale solid blob on the dark card footer. */
.style-pill { background: var(--pill-bg); color: var(--pill-ink); border: 1px solid var(--pill-line); font-size: 11px; line-height: 1; border-radius: 12px; padding: 4px 8px; white-space: nowrap; }
.setcard.guidecard { padding: 22px; }
.setcard h2, .setcard h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.01em; }
.setcard p { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; }
.setcard .meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.setcard .meta b { color: var(--accent-dark); font-weight: 500; }
.guidecard h2, .guidecard h3 { font-size: 17px; }
.guidecard .meta { margin-top: 4px; }

/* Category rows: one slim horizontal row per category — a single
   representative icon in a soft sunset-tinted box on the left, the
   category name with its icon count stacked on the right of it,
   and an arrow at the far end. No top rule: the icon box carries
   the visual identity, and the tight padding keeps all ten rows
   compact and easy to scan. The grid steps down with the viewport
   — 4 across on desktop, 3 on tablet, 2 on phone — so a row card
   never stretches into a wide, mostly-empty strip. */
.cards-grid.cat-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 1024px) { .cards-grid.cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .cards-grid.cat-grid { grid-template-columns: 1fr 1fr; } }
.catcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; text-decoration: none; color: var(--ink);
  display: flex; align-items: center; gap: 14px; min-height: 68px;
  transition: border-color .15s, box-shadow .15s;
}
a.catcard:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.catcard .cat-ic {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.catcard .cat-ic svg { width: 24px; height: 24px; }
.catcard .cat-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.catcard .cat-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.catcard .cat-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ---------- Content sections ---------- */
section.block { padding: 44px 0; border-top: 1px solid var(--line); margin-top: 40px; }
section.block h2 { font-size: 26px; letter-spacing: -0.015em; margin: 0 0 8px; }
section.block .sub { color: var(--muted); margin: 0 0 26px; max-width: 62ch; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel h2, .panel h3 { margin: 0 0 12px; font-size: 16.5px; display: flex; align-items: center; gap: 9px; }
.panel h2 svg, .panel h3 svg { width: 19px; height: 19px; flex: none; }
.panel ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; font-size: 15px; }
.panel li { display: flex; gap: 10px; align-items: flex-start; }
.panel li svg { width: 17px; height: 17px; flex: none; margin-top: 3px; }
.panel p { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.panel p:last-child { margin-bottom: 0; }
.ok { color: var(--good); } .no { color: var(--bad); }
.prose { max-width: 68ch; }
.prose h2 { font-size: 22px; margin: 30px 0 8px; letter-spacing: -0.01em; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--muted); margin: 0 0 14px; font-size: 15.5px; }
.prose p b, .prose li b { color: var(--ink); }
.prose ul { color: var(--muted); margin: 0 0 14px; padding-left: 20px; font-size: 15.5px; display: grid; gap: 6px; }
.codebox-lg {
  background: var(--surface-2); border-radius: var(--radius); padding: 16px 18px;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; color: var(--muted);
  white-space: pre; overflow-x: auto; margin: 0 0 14px;
}
.codebox-lg b { color: var(--ink); font-weight: 500; }

/* Donate */
.donate-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1024px) { .donate-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .donate-grid { grid-template-columns: 1fr; } }
.donate-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.donate-card h2, .donate-card h3 { margin: 0; font-size: 17px; }
.donate-card .fee { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.donate-card p { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }
.donate-card .btn { align-self: flex-start; margin-top: 6px; }

/* About: structure rows + roadmap */
.arch { display: grid; gap: 0; }
.arch-row { display: grid; grid-template-columns: 170px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.arch-row:last-child { border-bottom: 0; }
@media (max-width: 560px) { .arch-row { grid-template-columns: 1fr; gap: 2px; } }
.arch-row .fname { font-family: var(--font-mono); font-size: 13px; color: var(--accent-dark); padding-top: 2px; }
.arch-row p { margin: 0; color: var(--muted); font-size: 14.5px; }
.arch-row p b { color: var(--ink); }
.note {
  background: var(--accent-soft); border-radius: var(--radius); padding: 16px 18px;
  font-size: 15px; margin-top: 22px; display: flex; gap: 12px; align-items: flex-start;
}
.note svg { width: 19px; height: 19px; flex: none; margin-top: 2px; color: var(--accent); }
.note p { margin: 0; }

/* ---------- Footer ---------- */
footer.site { border-top: 1px solid var(--line); padding: 30px 0 40px; margin-top: 44px; }
.foot { display: flex; flex-wrap: wrap; gap: 12px 30px; align-items: flex-start; color: var(--muted); font-size: 14px; }
.foot nav { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.foot nav a { color: var(--muted); text-decoration: none; padding: 6px 2px; }
.foot nav a:hover { color: var(--ink); }
.foot .spacer { flex: 1; }
.foot .cols-foot { display: flex; gap: 44px; flex-wrap: wrap; width: 100%; margin-top: 8px; }
.foot .fcol { display: grid; gap: 4px; align-content: start; }
.foot .fcol b { color: var(--ink); font-size: 13.5px; margin-bottom: 4px; }
.foot .fcol a { color: var(--muted); text-decoration: none; padding: 3px 0; }
.foot .fcol a:hover { color: var(--accent-dark); }

/* ---------- Icon dialog ---------- */
dialog.icon-dialog {
  border: 0; padding: 0; background: transparent;
  max-width: calc(100vw - 24px); width: 620px;
}
dialog.icon-dialog::backdrop { background: rgba(10, 10, 10, .55); }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%;
  max-height: calc(100vh - 36px); overflow: auto; padding: 24px; color: var(--ink);
}
.modal-top { display: flex; align-items: flex-start; gap: 14px; }
.modal-top h3 { margin: 0; font-size: 21px; letter-spacing: -0.01em; }
.modal-top .tags { color: var(--muted); font-size: 13.5px; font-family: var(--font-mono); margin-top: 3px; overflow-wrap: anywhere; }
.x {
  margin-left: auto; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--btn-radius);
  display: grid; place-items: center; color: var(--ink);
}
.x svg { width: 18px; height: 18px; }
.preview {
  margin: 18px 0; border: 1px solid var(--line); border-radius: var(--radius);
  height: 210px; display: grid; place-items: center;
  background-image: conic-gradient(var(--checker) 25%, transparent 0 50%, var(--checker) 0 75%, transparent 0);
  background-size: 18px 18px;
}
.preview svg { width: 104px; height: 104px; }
.modal .ctl-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 14px; }
.modal .row { display: flex; flex-wrap: wrap; gap: 9px; }
.modal .row .btn { flex: 1; min-width: 130px; }
.codebox {
  margin-top: 14px; background: var(--surface-2); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5;
  padding: 12px 14px; overflow-x: auto; white-space: pre; color: var(--muted);
  max-height: 110px; overflow-y: auto;
}
.modal .lic { margin-top: 14px; font-size: 13.5px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 80px);
  background: var(--ink); color: var(--bg); border-radius: 999px;
  padding: 11px 20px; font-size: 14.5px; font-weight: 500; z-index: 80;
  transition: transform .25s ease; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Responsive: tablet & phone ---------- */
@media (max-width: 760px) {
  .nav { gap: 8px; flex-wrap: nowrap; }
  /* Phone header is one slim row: brand, the compact donate
     button, then the hamburger. The nav links leave the header
     row entirely and drop down as a panel under the header when
     the menu is opened. */
  .nav .btn.primary { order: 2; }
  .navmenu { order: 3; width: auto; }
  /* Closed menu: remove the links from layout entirely. The
     browser's own closed-details hiding only makes them invisible
     (content-visibility), which would leave phantom boxes stacked
     inside the hamburger's slot. */
  .navmenu:not([open ]) > nav { display: none; }
  .menubtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; min-height: 40px; padding: 0; cursor: pointer;
    color: var(--ink); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--btn-radius);
  }
  .menubtn svg { width: 22px; height: 22px; }
  .menubtn .ic-close { display: none; }
  .navmenu[open ] .menubtn .ic-menu { display: none; }
  .navmenu[open ] .menubtn .ic-close { display: block; }
  .menubtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .navmenu[open ] > nav {
    display: flex; position: absolute; top: 100%; left: 0; right: 0; z-index: 41;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow); padding: 8px 14px 12px; margin-left: 0;
  }
  .navmenu nav a { min-height: 44px; display: flex; align-items: center; font-size: 15px; padding: 10px 12px; }
  .wrap.hero { padding: 44px 14px 22px; }
  .pagehead { padding: 30px 0 6px; }
  .hero h1, .pagehead h1 { font-size: clamp(26px, 7.4vw, 34px); }
  .hero p.lede, .pagehead p.lede { font-size: 16px; }
  section.block { padding: 32px 0; margin-top: 28px; }
  section.block h2 { font-size: 22px; }
  .searchbar { max-width: 100%; }
  .toolbar-row .btn { flex: 1 1 auto; min-height: 44px; }
  .chip { min-height: 40px; padding: 8px 14px; }
  .sw { width: 32px; height: 32px; min-height: 32px; }
  .colorbtn { width: 40px; height: 40px; min-height: 40px; }
  input.hex-input { height: 40px; min-height: 40px; font-size: 14px; }
  select { min-height: 40px; }
  .modal { padding: 18px; }
  .preview { height: 170px; }
  .foot .cols-foot { gap: 26px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .hero-stats { gap: 6px 14px; font-size: 13.5px; }
  .setcard .setcard-body { padding: 13px 16px 15px; }
  .setcard.guidecard { padding: 17px; }
  /* Two category cards share a phone row (~174px each at 390px, ~139px
     at 320px), so the row card tightens up: smaller icon box, and the
     category name wraps instead of truncating — a name like
     "Notifications" must stay fully readable at 320px, never cut off
     with an ellipsis. */
  .catcard { padding: 10px 12px; gap: 10px; min-height: 58px; }
  .catcard .cat-ic { width: 36px; height: 36px; border-radius: 9px; }
  .catcard .cat-ic svg { width: 20px; height: 20px; }
  .catcard .cat-name { font-size: 14px; white-space: normal; overflow-wrap: break-word; }
  .setcard .peek { padding: 18px 16px; gap: 12px 8px; }
  .setcard .peek svg { width: 48px; height: 48px; }
  .modal .row .btn { flex: 1 1 100%; min-height: 46px; }
  .donate-card .btn { min-height: 44px; }
  .toast { width: calc(100vw - 24px); border-radius: var(--radius); }
  .codebox-lg { font-size: 11.5px; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  /* The colour row (label + six swatches + custom-colour button)
     must fit the narrowest phones on one line — the hex field
     lives inside the colour panel now, so the row is just these
     three parts; swatches and gaps tighten a step under 380px. */
  .ctl { gap: 6px; }
  .swatches { gap: 5px; }
  .sw { width: 28px; height: 28px; min-height: 28px; }
  /* Very narrow phones (~320px): brand + full "Keep the light
     on" button + hamburger measure wider than the viewport, so
     the donate button shortens to heart icon + "Support" — the
     real label text is collapsed (font-size: 0) and the short
     label is drawn by ::after at a readable size. */
  .nav .btn.primary { font-size: 0; padding: 6px 9px; gap: 6px; }
  .nav .btn.primary::after { content: "Support"; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* Robust by construction: every element's transitions and
     animations are switched off, not a hand-kept list of the
     selectors that happen to animate today — a transition added
     tomorrow is covered automatically. */
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Print ---------- */
/* Paper gets the content, not the chrome: no header nav, no
   toolbars or buttons, no dialog or toast — and surfaces print
   as plain ink on white so nothing is lost to a dark or tinted
   background. */
@media print {
  header.site, footer.site, .toolbar, .btn, .card-actions, .toast,
  dialog.icon-dialog, .navmenu, .searchbar, .hero-art, .loadmore-row { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap { max-width: none; padding: 0; }
  .card, .setcard, .catcard, .panel, .donate-card { border-color: #999; box-shadow: none; break-inside: avoid; }
  .setcard .peek { background: #fff; color: #000; }
  a { color: #000; text-decoration: none; }
}

/* ---------- Forced colours (Windows high contrast) ---------- */
/* In forced-colors mode the browser overrides the palette, so
   anything whose meaning lives only in colour — the selected
   swatch ring, the checkerboard preview, chip and card borders —
   is restated with system colours and outlines. */
@media (forced-colors: active) {
  .sw { border: 2px solid ButtonText; forced-color-adjust: none; }
  .sw.on { outline: 3px solid Highlight; outline-offset: 2px; }
  .chip { border: 1px solid ButtonText; }
  .chip.on { outline: 2px solid Highlight; outline-offset: 1px; }
  .card, .setcard, .catcard, .panel, .donate-card { border: 1px solid CanvasText; }
  .preview { background-image: none; border: 1px solid CanvasText; }
  .hex-input.invalid { outline: 2px solid Highlight; outline-offset: 1px; }
  .cpanel { border: 1px solid CanvasText; }
  .cp-sv { outline: 1px solid CanvasText; outline-offset: -1px; }
  .cp-thumb { border-color: ButtonText; }
  .colorbtn-chip { border: 1px solid ButtonText; }
}
