/* spaikid.com provisional layout (SPEC site skeleton R-20 to R-26).
   Mobile first: this file is the phone layout, wider layouts are added with min-width breakpoints.
   Breakpoints (custom properties cannot be used inside media queries, so they are written out):
     --bp-wide   760px   two columns, larger type
     --bp-max   1040px   content width limit
   Class names follow BEM (.claude/rules/code-web.md section 4). */

/* ---------- fonts: self-hosted, Latin subset, SIL OFL (R-26) ---------- */
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/jetbrains-mono-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/literata-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/literata-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/literata-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }

/* ---------- design tokens ---------- */
:root {
  color-scheme: light dark;

  --paper: #f5f6f8;
  --surface: #ffffff;
  --ink: #14181d;
  --muted: #5a6570;
  --line: #d8dde3;
  --accent: #1f45c4;
  --block: #c8402f;

  --f-read: "Literata", Georgia, "Times New Roman", serif;
  --f-head: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --f-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --reading-width: 680px;
  --content-width: 1040px;
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1318;
    --surface: #151c23;
    --ink: #e7ecf1;
    --muted: #94a1ae;
    --line: #27323c;
    --accent: #8eabff;
    --block: #ff7d69;
  }
}

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-read);
  font-size: 18px;
  line-height: 1.65;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.18em; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#main:focus { outline: none; } /* filter.js parks the focus on the content when the activated control is gone (R-80.3) */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 10;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--ink);
  font-family: var(--f-ui);
  font-size: 14px;
}
.skip-link:focus { top: var(--space-2); }

.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

main.wrap { padding-block: var(--space-5) var(--space-7); }

/* ---------- meta line, set like a drawing title block ---------- */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0;
  color: var(--muted);
}
.meta a { color: inherit; text-decoration: none; }
.meta a:hover { color: var(--accent); text-decoration: underline; }
.meta__lang {
  padding: 0 4px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- header and panels ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; }
.site-header__brand {
  margin-right: auto;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: 0;
  color: var(--ink);
  text-decoration: none;
}
.site-header__brand b { color: var(--accent); font-weight: 500; }
.site-header__button {
  min-height: 36px;
  padding: 6px 10px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--f-ui);
  font-size: 14px;
}
.site-header__button[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

.panel { background: var(--surface); border-bottom: 1px solid var(--line); }
.panel .wrap { padding-block: 14px; }
.panel__list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; font-family: var(--f-ui); font-size: 14.5px; }
.panel__link { display: block; padding: 5px 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); text-decoration: none; }
.panel__link:hover { border-color: var(--accent); color: var(--accent); }
.panel__link--included { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.panel__link--included:hover { color: var(--paper); }
.panel__link--included::after { content: " ✓"; }
.panel__link--excluded { border-color: var(--block); color: var(--block); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.panel__link--excluded:hover { border-color: var(--block); color: var(--block); }

.search-form { display: flex; gap: var(--space-2); }
.search-form__input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--f-ui);
  font-size: 16px;
}

/* ---------- home, archives, search ---------- */
.intro { max-width: 60ch; margin: 0 0 18px; font-size: 17px; color: var(--muted); }

.lang-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  font-family: var(--f-ui);
  font-size: 14px;
}
.lang-filter__label { margin-right: var(--space-1); color: var(--muted); }
.lang-filter__option {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
}
.lang-filter__option:hover { border-color: var(--accent); }
.lang-filter__option--active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Category chips (R-80.1): every control is a link. The row sits right under the language filter. */
.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -10px 0 var(--space-3);
  font-family: var(--f-ui);
  font-size: 14px;
}
.chips__label { margin-right: var(--space-1); color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--paper);
}
.chip a { color: inherit; text-decoration: none; }
.chip__neg {
  margin: 3px 0 3px 4px;
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--paper) 55%, transparent);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  opacity: 0.85;
}
.chip__neg:hover { opacity: 1; }
.chip__name { padding: 4px 6px; font-weight: 600; }
.chip__remove { padding: 4px 10px 4px 6px; font-size: 15px; line-height: 1; }
.chip--not { background: var(--paper); border-color: var(--block); color: var(--block); }
.chip--not .chip__neg { background: var(--block); border-color: var(--block); color: var(--paper); opacity: 1; }
.chip--not .chip__name { text-decoration: line-through; text-decoration-thickness: 1.5px; }

.mode { display: inline-flex; margin-left: var(--space-1); overflow: hidden; border: 1px solid var(--line); border-radius: 999px; }
.mode__option { padding: 3px 10px; color: var(--muted); font-family: var(--f-mono); font-size: 12.5px; text-decoration: none; }
.mode__option:hover { color: var(--accent); }
.mode__option--active,
.mode__option--active:hover { background: var(--ink); color: var(--paper); }
.chips__clear { padding: 4px 6px; color: var(--muted); text-decoration: underline; text-underline-offset: 0.2em; }
.count { margin: 0 0 6px; font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }

.lead { display: grid; gap: 14px; margin-bottom: 6px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.lead__image { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.lead__title {
  margin: 6px 0 8px;
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
  text-wrap: balance;
}
.lead__title a,
.post-row__title a { color: var(--ink); text-decoration: none; }
.lead__title a:hover,
.post-row__title a:hover { color: var(--accent); }
.lead__excerpt { margin: 0 0 10px; color: var(--muted); }

.post-list { display: grid; grid-template-columns: 1fr; column-gap: 40px; }
.post-row {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 14px;
  align-items: start;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.post-row__image { width: 92px; height: 92px; object-fit: cover; border-radius: var(--radius); }
.post-row__title {
  margin: 5px 0 0;
  font-family: var(--f-head);
  font-weight: 500;
  font-size: 16.5px;
  line-height: 1.4;
  letter-spacing: 0;
  text-wrap: balance;
}
.post-row__excerpt { display: none; margin: 6px 0 0; font-size: 16px; line-height: 1.5; color: var(--muted); }
.empty { padding: var(--space-5) 0; color: var(--muted); }

.page-head { margin: 0 0 var(--space-5); }
.page-head__kind { margin: 0; font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0; color: var(--muted); }
.page-head__title { margin: 4px 0 0; font-family: var(--f-head); font-weight: 800; font-size: 27px; line-height: 1.2; letter-spacing: 0; }
.page-head__count { margin: var(--space-2) 0 0; font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  margin-top: 26px;
  font-family: var(--f-ui);
  font-size: 15px;
}
.pager__link--older { text-align: right; }
.pager__status { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }

.error__message { max-width: 60ch; color: var(--muted); }
.error__search { max-width: 480px; margin-top: var(--space-5); }

/* ---------- article ---------- */
.article {
  display: grid;
  grid-template-columns: minmax(var(--space-4), 1fr) minmax(0, var(--reading-width)) minmax(var(--space-4), 1fr);
  padding-block: 22px var(--space-7);
}
.article > *,
.article__body > * { grid-column: 2; }
/* Wide slot: the full content width, used by the cover and, later, by scroll-driven scenes (R-21, R-60).
   .article__body takes no box of its own so its children sit in the article grid. */
.article__body { display: contents; }
.article > .article__wide,
.article__body > .article__wide {
  grid-column: 1 / -1;
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
}

.article__back { font-family: var(--f-ui); font-size: 14px; text-decoration: none; }
.article__title {
  margin: 12px 0 14px;
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: 0;
  text-wrap: balance;
}
.article__cover { margin: 22px 0 6px; }
.article__cover-image { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

.article__body > p:first-child { margin-top: 18px; font-size: 20px; line-height: 1.5; }
.article__body h2,
.article__body h3 { font-family: var(--f-head); font-weight: 800; letter-spacing: 0; text-wrap: balance; }
.article__body h2 { margin: 38px 0 4px; font-size: 20px; line-height: 1.3; }
.article__body h3 { margin: 28px 0 2px; font-size: 17px; line-height: 1.35; }
.article__body p { margin: 14px 0; }
.article__body ul,
.article__body ol { margin: 14px 0; padding-left: 1.4em; }
.article__body li { margin: 4px 0; }
.article__body blockquote { margin: 18px 0; padding-left: var(--space-4); border-left: 3px solid var(--line); color: var(--muted); }
.article__body hr { margin: 30px 0; border: 0; border-top: 1px solid var(--line); }
.article__body code { padding: 1px 5px; background: color-mix(in srgb, var(--ink) 7%, transparent); border-radius: var(--radius); font-family: var(--f-mono); font-size: 0.86em; }
.article__body pre { margin: 18px 0; padding: var(--space-3) var(--space-4); overflow-x: auto; background: color-mix(in srgb, var(--ink) 7%, transparent); border-radius: var(--radius); line-height: 1.5; }
.article__body pre code { padding: 0; background: none; font-size: 0.85em; }
.article__body img { border: 1px solid var(--line); border-radius: var(--radius); }
.article__body figure { margin: 24px 0; }
.article__body figcaption { margin-top: var(--space-2); font-family: var(--f-ui); font-size: 13.5px; line-height: 1.45; color: var(--muted); }

/* Image link with the expand icon in its bottom-right corner (R-81). The icon is a file because the CSP allows no
   data: images. The link shrinks to the image, so the icon sits on the picture and not at the column edge. */
.zoom { position: relative; display: block; width: fit-content; max-width: 100%; cursor: zoom-in; }
.zoom::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 34px;
  height: 34px;
  background: rgba(10, 14, 20, 0.66) url("../img/expand.svg") center / 18px no-repeat;
  border-radius: 4px;
}
.article__cover .zoom { width: 100%; }

/* Full-screen viewer, built by assets/js/viewer.js. Always dark, whatever the colour scheme. */
.viewer-open { overflow: hidden; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #06090d;
  color: #f2f5f8;
  font-family: var(--f-ui);
  animation: viewer-in 0.15s ease-out;
}
.viewer :focus-visible { outline-color: #ffffff; }
.viewer__bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.viewer__count { margin-right: auto; font-family: var(--f-mono); font-size: 13px; color: #b9c3cd; }
.viewer__button {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  color: #ffffff;
  font-size: 15px;
}
.viewer__button:hover { background: rgba(255, 255, 255, 0.2); }
.viewer__stage { position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; }
.viewer__image { max-width: 100%; max-height: 100%; object-fit: contain; border: 0; border-radius: 0; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
/* The arrows sit on the picture, which may be white: a dark backing keeps them visible. */
.viewer__nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(10, 14, 20, 0.66); font-size: 22px; }
.viewer__nav:hover { background: rgba(10, 14, 20, 0.85); }
.viewer__nav--prev { left: 10px; }
.viewer__nav--next { right: 10px; }
.viewer--actual .viewer__stage { place-items: start; overflow: auto; touch-action: auto; }
.viewer--actual .viewer__image { max-width: none; max-height: none; cursor: zoom-out; }
.viewer--actual .viewer__nav { display: none; }
.viewer__caption { min-height: 1.5em; margin: 0; padding: 10px 16px 16px; font-size: 14px; line-height: 1.45; text-align: center; color: #d6dde4; }
.viewer__hint { display: block; margin-top: 4px; font-family: var(--f-mono); font-size: 11.5px; color: #8995a1; }
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }

.tablebox { margin: 22px 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-family: var(--f-ui); font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 13px; font-weight: 600; color: var(--muted); }
.tablebox .align-left { text-align: left; }
.tablebox .align-center { text-align: center; }
.tablebox .align-right { text-align: right; }

.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 34px 0 0; padding: 0; list-style: none; font-family: var(--f-mono); font-size: 13px; letter-spacing: 0; }
.tags__link { padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.tags__link:hover { color: var(--accent); border-color: var(--accent); }

.neighbours { display: grid; gap: 14px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.3; }
.neighbours__link { font-family: var(--f-head); font-weight: 500; font-size: 16.5px; line-height: 1.4; letter-spacing: 0; color: var(--ink); text-decoration: none; }
.neighbours__link:hover { color: var(--accent); }
.neighbours__link small { display: block; margin-bottom: 3px; font-family: var(--f-mono); font-size: 12px; font-weight: 400; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0; color: var(--muted); }
.colophon { display: grid; grid-template-columns: 1fr 1fr; margin-block: 22px; border: 1px solid var(--line); }
.colophon__cell { padding: 8px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.colophon__cell:nth-child(2n) { border-right: 0; }
.colophon__cell:nth-last-child(-n + 2) { border-bottom: 0; }
.colophon__cell small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.colophon__cell span,
.colophon__cell a { color: var(--ink); }
.colophon__links { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
.link-button { padding: 0; background: none; border: 0; color: var(--ink); font-family: inherit; font-size: inherit; text-decoration: underline; text-underline-offset: 0.18em; }

/* ---------- consent banner (R-50), first in the page so it is first in tab order ---------- */
.consent {
  position: fixed;
  inset: auto 0 0;
  z-index: 5;
  background: var(--surface);
  border-top: 2px solid var(--ink);
  font-family: var(--f-ui);
  font-size: 14.5px;
  line-height: 1.45;
}
.consent__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-block: var(--space-3); }
.consent__text { flex: 1 1 240px; margin: 0; }
.consent__link { color: var(--ink); text-decoration: underline; white-space: nowrap; }
.consent__buttons { display: flex; gap: var(--space-2); }
.consent__button {
  min-height: 40px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-weight: 600;
}
.consent__button:hover { background: var(--ink); color: var(--paper); }

/* ---------- wider than a phone ---------- */
@media (min-width: 760px) {
  .wrap { padding-inline: 28px; }
  main.wrap { padding-block: 34px 64px; }

  .lead { grid-template-columns: 1.15fr 1fr; gap: 30px; align-items: center; }
  .lead__title { font-size: 30px; }

  .post-list { grid-template-columns: 1fr 1fr; }
  .post-row { grid-template-columns: 120px 1fr; }
  .post-row__image { width: 120px; height: 120px; order: -1; }
  .post-row__excerpt {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .page-head__title { font-size: 34px; }
  .article__title { font-size: 36px; }
  .article__body > p:first-child { font-size: 22px; }
  .article__body h2 { font-size: 27px; }
  .article__body h3 { font-size: 21px; }

  .neighbours { grid-template-columns: 1fr 1fr; }
  .neighbours--single { grid-template-columns: 1fr; }
  .neighbours__link--list { text-align: right; }

  .colophon { grid-template-columns: repeat(4, 1fr); }
  .colophon__cell { border-bottom: 0; }
  .colophon__cell:nth-child(2n) { border-right: 1px solid var(--line); }
  .colophon__cell:last-child { border-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
