/* ==========================================================================
   Coloring Pages — base stylesheet
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

a { color: var(--accent); }
img { max-width: 100%; height: auto; }
p { margin: 0 0 var(--s2); }

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

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: var(--s1) var(--s2); border-radius: 0 0 var(--r-sm) 0;
}
.skip:focus { left: 0; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--s3);
}

.muted { color: var(--ink-soft); }

/* ------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s1); flex-direction: row;
  padding: 12px 24px;
  border-radius: var(--r-btn);
  font-family: var(--font-display);
  font-weight: 600; font-size: var(--step-0);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  border: 2px solid transparent;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent; color: var(--accent);
  border-color: var(--accent);
}
.btn-ghost:hover { background: var(--accent-wash); }
/* The bundle CTA stacks its size sub-label under the label. */
.btn-lg { padding: 16px 32px; font-size: var(--step-1); flex-direction: column; gap: 2px; }
.btn-sm { padding: 8px 16px; font-size: var(--step--1); }
.btn-sub {
  font-family: var(--font-body);
  font-size: var(--step--1); font-weight: 400; opacity: .85;
}

/* -------------------------------------------------------------- header --- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s1);
  text-decoration: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-1);
}
.brand-mark { font-size: 1.4em; line-height: 1; }

.primary-nav { margin-inline-end: auto; }
.nav-list {
  display: flex; align-items: center; gap: var(--s1);
  list-style: none; margin: 0; padding: 0;
}
.nav-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 14px; border-radius: var(--r-btn);
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-body); font-size: var(--step-0); font-weight: 600;
  color: var(--ink); text-decoration: none;
}
.nav-link:hover { background: var(--sunk); }
.nav-link.is-current { color: var(--accent); }
.caret { font-size: .7em; }

/* Mega panel spans the header; the small menu anchors to its own trigger. */
.has-drop { position: relative; }
.drop { background: var(--card); box-shadow: var(--shadow-card); }
.drop[hidden] { display: none; }

.drop--mega {
  position: absolute; inset-inline: 0; top: 100%;
  border-bottom: 1px solid var(--rule);
}
.has-drop:has(.drop--mega) { position: static; }

.drop--menu {
  position: absolute; top: calc(100% + 6px); inset-inline-start: 0;
  min-width: 210px; padding: 6px;
  border: 1px solid var(--rule); border-radius: var(--r-card);
  z-index: 45;
}
.drop--menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.drop--menu a {
  display: block; padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--ink); text-decoration: none; font-size: var(--step--1); font-weight: 600;
}
.drop--menu a:hover { background: var(--sunk); color: var(--accent); }
.mega-inner {
  display: grid; grid-template-columns: 1fr; gap: var(--s4);
  padding-block: var(--s4);
}
@media (min-width: 900px) { .mega-inner { grid-template-columns: 3fr 1fr; } }
.mega-cats {
  display: grid; gap: 2px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.mega-cat {
  display: flex; align-items: center; gap: var(--s1);
  padding: 10px 12px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--ink); font-weight: 600;
}
.mega-cat:hover { background: var(--sunk); }
.mega-emoji { font-size: 1.15em; }
.mega-label { flex: 1; }
.mega-count {
  font-size: var(--step--1); color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.mega-heading {
  font-size: var(--step--1); text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-faint); margin-bottom: var(--s1);
}
.mega-popular ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mega-popular a { color: var(--ink); text-decoration: none; font-weight: 600; }
.mega-popular a:hover { color: var(--accent); }

.header-tools { display: flex; align-items: center; gap: var(--s1); }

.search { display: flex; align-items: center; }
.search input {
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  border-radius: var(--r-btn) 0 0 var(--r-btn);
  padding: 9px 16px; font: inherit; font-size: var(--step--1);
  min-width: 0;
}
.search button {
  border: 1px solid var(--rule); border-inline-start: 0;
  background: var(--sunk); color: var(--ink);
  border-radius: 0 var(--r-btn) var(--r-btn) 0;
  padding: 9px 14px; cursor: pointer; font-size: var(--step--1);
}
.search--lg { max-width: 520px; margin-inline: auto; }
.search--lg input { flex: 1; width: auto; padding: 13px 20px; }
.search--lg button { padding: 13px 22px; }

/* Search lives behind an icon; the panel drops below the bar when opened. */
.search-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px; cursor: pointer; font-size: 1.05rem;
  border: 1px solid var(--rule); border-radius: var(--r-btn);
  background: var(--paper); color: var(--ink);
}
.search-toggle:hover { background: var(--sunk); }
.search-panel {
  border-top: 1px solid var(--rule); background: var(--card);
  padding-block: var(--s2);
}
.search-panel[hidden] { display: none; }

/* Pill switch — track + knob, moon glyph on the knob when dark. */
.theme-switch {
  border: 0; background: none; padding: 0; cursor: pointer;
  display: grid; place-items: center;
}
.theme-switch-track {
  display: block; position: relative;
  width: 46px; height: 26px; border-radius: 999px;
  background: var(--rule); transition: background-color .18s ease;
}
.theme-switch-knob {
  position: absolute; top: 3px; inset-inline-start: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.28);
  transition: transform .18s ease;
}
.theme-switch-knob::after {
  content: "☀"; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 11px; line-height: 1;
}
.theme-switch[aria-checked="true"] .theme-switch-track { background: var(--accent-2); }
.theme-switch[aria-checked="true"] .theme-switch-knob { transform: translateX(20px); }
.theme-switch[aria-checked="true"] .theme-switch-knob::after { content: "🌙"; }
.theme-switch:focus-visible .theme-switch-track { outline: 3px solid var(--accent); outline-offset: 3px; }

.nav-toggle { display: none; }

/* ---------------------------------------------------------------- hero --- */
.hero {
  background: var(--accent-wash);
  border-bottom: 1px solid var(--rule);
  padding-block: var(--s6);
  text-align: center;
}
.hero h1 { font-size: var(--step-4); margin-bottom: var(--s2); }
.hero-sub {
  font-size: var(--step-1); color: var(--ink-soft);
  max-width: 60ch; margin-inline: auto; margin-bottom: var(--s3);
}
.hero-actions { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; margin: 0; }

/* ------------------------------------------------------------ sections --- */
.section { padding-block: var(--s5); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3);
}
.section-title { font-size: var(--step-2); margin-bottom: var(--s3); }
.section-head .section-title { margin-bottom: 0; }
.section-more { font-weight: 600; text-decoration: none; }

/* --------------------------------------------------------- category grid - */
.cat-grid {
  display: grid; gap: var(--s2);
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  list-style: none; margin: 0; padding: 0;
}
.cat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--s3) var(--s2);
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r-card); box-shadow: var(--shadow-card);
  text-decoration: none; color: var(--ink); text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.cat-emoji { font-size: 1.9rem; line-height: 1; }
.cat-name { font-family: var(--font-display); font-weight: 600; }
.cat-count { font-size: var(--step--1); color: var(--ink-faint); }

/* ----------------------------------------------------------- post cards --- */
.card-grid {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.card-grid--compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s2); }

.card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r-card); box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-thumb { background: #fff; aspect-ratio: 400 / 518; }
.card-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-thumb-empty {
  display: grid; place-items: center; height: 100%;
  font-size: 2.5rem; background: var(--sunk);
}
.card-body { padding: var(--s2); }
.card-title { font-family: var(--font-display); font-size: var(--step-0); margin: 0; }
.card-meta { font-size: var(--step--1); color: var(--ink-faint); margin: 4px 0 0; }

/* ------------------------------------------------------------- listings --- */
.layout-with-sidebar {
  display: grid; grid-template-columns: 1fr; gap: var(--s5);
  padding-block: var(--s4);
}
@media (min-width: 1100px) {
  .layout-with-sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
}

.listing-title { font-size: var(--step-3); margin-bottom: var(--s1); }
.listing-emoji { margin-inline-end: 4px; }
.listing-standfirst { color: var(--ink-soft); font-size: var(--step-1); margin-bottom: var(--s4); }
.listing--full { padding-block: var(--s4); }

.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: var(--s3); margin-top: var(--s5);
}
.page-link {
  padding: 10px 20px; border: 2px solid var(--accent);
  border-radius: var(--r-btn); text-decoration: none; font-weight: 600;
}
.page-link:hover { background: var(--accent-wash); }
.page-status { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- search --- */
.search--inline { margin: 0 0 var(--s3); max-width: 560px; }
.search--inline input { border-radius: var(--r-btn) 0 0 var(--r-btn); }

.results { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); }
.result {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r-card); padding: var(--s3);
}
.result-link { text-decoration: none; }
.result-title { font-size: var(--step-1); margin: 0 0 6px; color: var(--ink); }
.result-link:hover .result-title { color: var(--accent); }
.result-excerpt { margin: 0 0 8px; color: var(--ink-soft); font-size: var(--step--1); }
.result-excerpt mark {
  background: var(--highlight); color: #2F2A24;
  padding: 0 3px; border-radius: 3px;
}
.result-meta { margin: 0; font-size: var(--step--1); color: var(--ink-faint); }
.result-meta a { font-weight: 600; }

.search-browse { margin-top: var(--s5); }
.empty-state--start { text-align: start; }

/* ---------------------------------------------------------- static pages --- */
.static .prose { max-width: 68ch; }
.static .prose h2 { font-size: var(--step-2); margin: var(--s4) 0 var(--s2); }
.static .prose table {
  width: 100%; border-collapse: collapse; margin: 0 0 var(--s2);
  font-size: var(--step--1);
}
.static .prose th, .static .prose td {
  text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--rule);
}
.static .prose th { background: var(--sunk); font-weight: 700; }
.static .prose ol { padding-inline-start: 22px; }
.static .prose li { margin-bottom: 6px; }
.static .prose code {
  background: var(--sunk); padding: .1em .4em; border-radius: 3px;
  font-size: .9em; word-break: break-word;
}

/* Unmissable on purpose: these pages ship as templates and must not go live
   with placeholders still in them. */
.draft-flag {
  border: 2px dashed var(--accent);
  background: var(--accent-wash); color: var(--ink);
  border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: var(--s3);
  font-size: var(--step--1);
}

/* ------------------------------------------------------------------ hub --- */
.hub-block { margin-bottom: var(--s5); }
.hub-heading {
  display: flex; align-items: center; gap: var(--s1);
  font-size: var(--step-2); padding-bottom: var(--s1);
  border-bottom: 2px solid var(--rule); margin-bottom: var(--s2);
}
.hub-heading a { color: var(--ink); text-decoration: none; }
.hub-heading a:hover { color: var(--accent); }
.hub-count {
  font-family: var(--font-body); font-size: var(--step--1);
  color: var(--ink-faint); font-variant-numeric: tabular-nums;
}
.hub-links {
  display: grid; gap: 4px; list-style: none; margin: 0; padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.hub-links li { display: flex; justify-content: space-between; gap: var(--s1); padding: 4px 0; }
.hub-links a { text-decoration: none; color: var(--ink); }
.hub-links a:hover { color: var(--accent); text-decoration: underline; }
.hub-meta { color: var(--ink-faint); font-size: var(--step--1); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ post page --- */
.breadcrumbs { margin-bottom: var(--s2); font-size: var(--step--1); }
.breadcrumbs ol {
  display: flex; flex-wrap: wrap; gap: 6px;
  list-style: none; margin: 0; padding: 0; color: var(--ink-soft);
}
.breadcrumbs li + li::before { content: "›"; margin-inline-end: 6px; color: var(--ink-faint); }
.breadcrumbs a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; }

.post-title { font-size: var(--step-3); margin-bottom: var(--s1); }
.post-byline {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  color: var(--ink-soft); font-size: var(--step--1); margin-bottom: var(--s3);
}
.byline-avatar {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-wash); font-size: 14px;
}
.byline-sep { color: var(--ink-faint); }

/* Hero: line art alone, or paired with a coloured example when one exists. */
.post-hero { margin: 0 0 var(--s4); max-width: 460px; }
.post-hero--pair {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s2); max-width: 100%;
}
.hero-shot {
  margin: 0; display: flex; flex-direction: column; gap: 6px;
}
.hero-shot picture {
  display: block; background: #fff;
  border: 1px solid var(--rule); border-radius: var(--r-card);
  overflow: hidden;
}
.hero-shot img { display: block; width: 100%; height: auto; }
.hero-shot figcaption {
  font-size: 12px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: var(--ink-faint); text-align: center;
}
@media (max-width: 520px) {
  .post-hero--pair { grid-template-columns: 1fr; max-width: 460px; }
}

.prose { max-width: 68ch; }
.prose h2 { font-size: var(--step-2); margin: var(--s4) 0 var(--s2); }
.prose h3 { font-size: var(--step-1); margin: var(--s3) 0 var(--s1); }
.prose ul, .prose ol { margin: 0 0 var(--s2); padding-inline-start: 22px; }

/* Inline help line — an aside, not a boxed callout, so it doesn't compete
   with the download CTA immediately below it. */
.note-line {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px 16px; margin: var(--s3) 0 0;
  background: var(--accent-2-wash); border-radius: var(--r-sm);
  font-size: var(--step--1); color: var(--ink-soft);
  max-width: 68ch;
}
.note-line a { font-weight: 600; }

.grid-heading { font-size: var(--step-2); margin: var(--s5) 0 var(--s2); }
.bundle-cta { margin: 0 0 var(--s3); }

.filter-chips { display: flex; flex-wrap: wrap; gap: var(--s1); margin-bottom: var(--s3); }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 15px; border-radius: var(--r-chip);
  background: var(--sunk); border: 1px solid transparent;
  color: var(--ink); text-decoration: none;
  font-size: var(--step--1); font-weight: 600; cursor: pointer;
  font-family: var(--font-body);
}
.chip:hover { background: var(--rule); }
.chip-filter.is-active {
  background: var(--accent); color: var(--accent-ink);
}

/* coloring page grid */
/* Wider tracks than a bare thumbnail grid — each card carries a title, a
   caption and a download button, so 250px is the floor before text crowds. */
/* Fixed two-up at every width. The main column is already capped by --wrap
   minus the sidebar, so cards top out around 420px rather than ballooning
   on wide screens. */
.cp-grid {
  display: grid; gap: var(--s2);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px) { .cp-grid { gap: var(--s3); } }
/* Two-up on phones needs a smaller title and tighter padding to stay readable. */
@media (max-width: 639px) {
  .cp-card figcaption { padding: 12px 10px 14px; gap: 5px; }
  .cp-title { font-size: var(--step-0); }
  .cp-desc  { font-size: 12px; }
  .cp-btn   { padding: 7px 12px; font-size: 12px; }
}

.cp-card {
  margin: 0; background: var(--card);
  border: 1px solid var(--rule); border-radius: var(--r-card);
  overflow: hidden; box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease;
}
.cp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.cp-card[hidden] { display: none; }
/* Image runs edge to edge — inner padding was costing ~32px of thumbnail width
   on every card for no visual benefit; the card border already frames it. */
.cp-open {
  display: block; width: 100%; padding: 0;
  border: 0; border-bottom: 1px solid var(--rule);
  background: #fff; cursor: zoom-in;
}
/* contain, not cover: a coloring page must never be cropped in the grid. */
.cp-open img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 400 / 518; object-fit: contain;
  background: #fff;
}

.cp-card figcaption {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: var(--s2) 14px 18px; text-align: center;
}
.cp-title {
  font-family: var(--font-display);
  font-size: var(--step-1); font-weight: 700; line-height: 1.2;
  margin: 0; text-wrap: balance;
}
.cp-desc {
  font-size: var(--step--1); color: var(--ink-soft);
  line-height: 1.45; margin: 0; text-wrap: pretty;
}
.cp-btn { margin-top: 6px; }
.cp-alt {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-faint);
}
.cp-alt a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.cp-alt a:hover { color: var(--accent); text-decoration: underline; }

/* ------------------------------------------------------------ lightbox --- */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: var(--s2); padding: var(--s3);
  background: rgba(25, 23, 20, .88);
}
.lightbox[hidden] { display: none; }
.lb-stage {
  margin: 0; justify-self: center; max-height: 90vh;
  display: flex; flex-direction: column; gap: var(--s2); align-items: center;
}
.lb-stage img {
  max-height: 74vh; width: auto; background: #fff;
  border-radius: var(--r-sm); box-shadow: var(--shadow-pop);
}
.lb-stage figcaption {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  justify-content: center; color: #FDFBF7; font-weight: 600;
}
.lb-actions { display: flex; gap: var(--s1); }
.lightbox .btn-ghost { color: #FDFBF7; border-color: rgba(253,251,247,.5); }
.lightbox .btn-ghost:hover { background: rgba(253,251,247,.12); }
.lb-close, .lb-prev, .lb-next {
  background: rgba(253,251,247,.12); color: #FDFBF7;
  border: 0; border-radius: var(--r-btn);
  width: 44px; height: 44px; cursor: pointer; font-size: 1.4rem; line-height: 1;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(253,251,247,.24); }
.lb-close { position: absolute; top: var(--s3); right: var(--s3); }

/* --------------------------------------------------------------- FAQ ----- */
.faq { margin-top: var(--s5); }
.faq h2 { font-size: var(--step-2); margin-bottom: var(--s2); }
.faq-item {
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: var(--card); padding: var(--s2); margin-bottom: var(--s1);
}
.faq-item summary { cursor: pointer; font-weight: 700; font-family: var(--font-display); }
.faq-item[open] summary { margin-bottom: var(--s1); }

.related { margin-top: var(--s5); }
.related h2 { font-size: var(--step-2); margin-bottom: var(--s3); }

/* ------------------------------------------------------------- sidebar --- */
.sidebar { display: grid; gap: var(--s4); align-content: start; }
@media (min-width: 1100px) { .sidebar { position: sticky; top: 88px; } }

.widget-title {
  font-size: var(--step-1); margin-bottom: var(--s2);
  padding-bottom: var(--s1); border-bottom: 2px solid var(--rule);
}
/* Filled bar variant — used for Popular, where the module needs to read as a
   distinct block rather than another section heading. */
.widget-title--bar {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent-2); color: #fff;
  border-bottom: 0; border-radius: var(--r-sm);
  padding: 11px var(--s2); margin-bottom: var(--s2);
  font-size: var(--step-1);
}

.widget-posts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.widget-posts a {
  display: flex; gap: var(--s2); align-items: center;
  text-decoration: none; color: var(--ink);
}
.widget-thumbs { display: flex; gap: 3px; flex-shrink: 0; }
.widget-thumbs img {
  width: 56px; height: 72px; object-fit: contain; display: block;
  background: #fff; border: 1px solid var(--rule); border-radius: var(--r-sm);
}
.widget-thumbs.is-pair img { width: 48px; }
.widget-thumb-empty {
  display: grid; place-items: center; width: 56px; height: 72px;
  background: var(--sunk); border-radius: var(--r-sm);
}
.widget-text { display: grid; gap: 2px; min-width: 0; }
.widget-name { font-weight: 600; font-size: var(--step--1); line-height: 1.35; }
.widget-posts a:hover .widget-name { color: var(--accent); }
.widget-meta { font-size: 12px; color: var(--ink-faint); }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }

/* ------------------------------------------------------------ ad slots --- */
/* Heights reserved so ads never shift layout. Phase 5 fills these. */
.ad-slot { background: var(--sunk); border-radius: var(--r-sm); }
.ad-slot--sidebar { min-height: 600px; }
.ad-slot--ingrid  { min-height: 250px; grid-column: 1 / -1; }

/* --------------------------------------------------------- empty/error --- */
.empty-state {
  background: var(--card); border: 1px dashed var(--rule);
  border-radius: var(--r-card); padding: var(--s4); text-align: center;
}
.empty-state pre {
  background: var(--sunk); border-radius: var(--r-sm);
  padding: var(--s2); overflow-x: auto; text-align: start;
  font-size: var(--step--1);
}

.error-page { padding-block: var(--s6); text-align: center; }
.error-code {
  font-family: var(--font-display); font-size: 4rem; font-weight: 700;
  color: var(--accent); line-height: 1; margin: 0 0 var(--s1);
}
.error-page h1 { font-size: var(--step-3); margin-bottom: var(--s2); }
.error-help { color: var(--ink-soft); max-width: 52ch; margin-inline: auto; margin-bottom: var(--s3); }
.error-actions { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; margin-bottom: var(--s6); }

/* -------------------------------------------------------------- footer --- */
.site-footer {
  background: var(--card); border-top: 1px solid var(--rule);
  margin-top: var(--s7); padding-top: var(--s5);
}
.footer-grid {
  display: grid; gap: var(--s4);
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  padding-bottom: var(--s5);
}
.footer-col--wide { grid-column: span 2; min-width: 0; }
.brand--footer { margin-bottom: var(--s2); }
.footer-blurb { color: var(--ink-soft); font-size: var(--step--1); max-width: 40ch; }
.footer-heading {
  font-size: var(--step--1); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-faint); margin-bottom: var(--s2); font-family: var(--font-body);
}
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.footer-links a { color: var(--ink); text-decoration: none; font-size: var(--step--1); }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }

.newsletter { display: flex; gap: var(--s1); flex-wrap: wrap; }
.newsletter input {
  flex: 1; min-width: 160px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  border-radius: var(--r-btn); padding: 10px 16px; font: inherit; font-size: var(--step--1);
}
.newsletter button {
  border: 0; border-radius: var(--r-btn); cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 20px; font-family: var(--font-display); font-weight: 600;
}
.newsletter button:hover { background: var(--accent-hover); }

.footer-base {
  border-top: 1px solid var(--rule); padding-block: var(--s3);
  font-size: var(--step--1); color: var(--ink-faint);
}
.footer-base p { margin: 0; }

/* --------------------------------------------------------------- mobile -- */
@media (max-width: 899px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    order: 3; width: 40px; height: 40px; cursor: pointer;
    background: var(--sunk); border: 1px solid var(--rule);
    border-radius: var(--r-sm);
  }
  .nav-toggle-bar,
  .nav-toggle-bar::before,
  .nav-toggle-bar::after {
    content: ""; display: block;
    width: 18px; height: 2px; background: var(--ink); border-radius: 2px;
  }
  .nav-toggle-bar { position: relative; }
  .nav-toggle-bar::before { position: absolute; top: -6px; }
  .nav-toggle-bar::after  { position: absolute; top: 6px; }

  .header-inner { flex-wrap: wrap; gap: var(--s2); }
  .brand { margin-inline-end: auto; }
  .primary-nav {
    order: 4; flex-basis: 100%; margin: 0;
    display: none; padding-bottom: var(--s2);
  }
  .primary-nav.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; }
  .nav-link { justify-content: space-between; }

  /* Dropdowns become inline accordions rather than floating panels. */
  .drop--mega, .drop--menu {
    position: static; box-shadow: none; border: 0;
    min-width: 0; padding: 0;
  }
  .drop--menu { padding-inline-start: var(--s2); }
  .mega-inner { padding-block: var(--s2); }

  .footer-col--wide { grid-column: span 1; }
  .hero { padding-block: var(--s5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.pixel { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
