/* Design tokens + layout — see frontend/DESIGN.md. Self-hosted woff2 go in
   public/fonts/ with matching @font-face rules; until then the stacks fall back. */

:root {
  --font-display: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --font-body: "Newsreader", Georgia, "Times New Roman", serif;

  --paper: #e6e5e0;
  --surface: #ffffff;
  --ink: #000000;
  --ink-muted: #6b6a64;
  --accent: #4a2e7f;
  --rule: #c9c7c0;

  --measure: 640px;
  --spine: 180px;
  --margin-col: 380px;
  --gap: 40px;
  --space: 4px;

  --logo-filter: none; /* black-ink wordmark; inverted to white in dark mode */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14140f;
    --surface: #1e1e17;
    --ink: #edece6;
    --ink-muted: #8a897f;
    --accent: #a48bd6;
    --rule: #3a3a31;
    --logo-filter: invert(1);
  }
}
:root[data-theme="dark"] {
  --paper: #14140f;
  --surface: #1e1e17;
  --ink: #edece6;
  --ink-muted: #8a897f;
  --accent: #a48bd6;
  --rule: #3a3a31;
  --logo-filter: invert(1);
}

* { 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: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .card-headline, .wordmark, .lede-display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
}
h1 { font-size: 52px; line-height: 1.08; }
h2 { font-size: 30px; line-height: 1.2; margin: 64px 0 20px; }
h3 { font-size: 22px; line-height: 1.3; }

p { margin: 0 0 24px; max-width: var(--measure); }
.lede {
  font-family: var(--font-body);
  font-size: 24px;
  line-height: 1.5;
  max-width: var(--measure);
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.skip, .visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip:focus {
  position: fixed; top: 8px; left: 8px; width: auto; height: auto;
  clip: auto; background: var(--surface); padding: 8px 12px; z-index: 10;
}

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

/* ---- header ---- */
.site {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; height: 64px; padding: 0 80px;
}
.wordmark { display: inline-flex; align-items: center; text-decoration: none; position: relative; z-index: 5; }
.wordmark img {
  display: block;
  height: 38px;
  width: auto;
  filter: var(--logo-filter);
}
@media (max-width: 640px) { .wordmark img { height: 30px; } }

/* Landing intro: big left-aligned masthead that animates up into the header
   corner on the first scroll. `html.hero` is set inline (home only); app.js
   adds `.scrolled`. */
html.hero .wordmark img { transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1); }
.hero-space { height: 0; transition: height 1s cubic-bezier(0.22, 1, 0.36, 1); }

html.hero:not(.scrolled) .wordmark img {
  transform-origin: left top;
  transform: translateY(30vh) scale(3.6);
}
html.hero:not(.scrolled) .hero-space { height: calc(30vh + 100px); }

@media (max-width: 640px) {
  html.hero:not(.scrolled) .wordmark img { transform: translateY(20vh) scale(2.3); }
  html.hero:not(.scrolled) .hero-space { height: calc(20vh + 50px); }
}

@media (prefers-reduced-motion: reduce) {
  html.hero .wordmark img, .hero-space { transition: none; }
  html.hero:not(.scrolled) .wordmark img { transform: none; }
  html.hero:not(.scrolled) .hero-space { height: 0; }
}
.site-search input {
  font: inherit; font-size: 16px; padding: 6px 10px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  min-width: 220px;
}

/* ---- main / grid ---- */
main { padding: 48px 80px 96px; }
.col, .home, .search, .topic, .region, .about { max-width: var(--measure); }

.article, .obec {
  display: grid;
  grid-template-columns: var(--spine) var(--gap) var(--measure) var(--gap) var(--margin-col);
  align-items: start;
}
.article > .col, .obec > .col { grid-column: 3; }
.article > .spine, .obec > .spine { grid-column: 1; position: sticky; top: 24px; }
.article > .margin, .obec > .margin { grid-column: 5; }

.spine .cat { font-family: var(--font-display); font-size: 14px; margin-bottom: 8px; }
.spine .cat a { color: var(--accent); text-decoration: none; }
.meta, .card-meta, .src-note, .results-head {
  font-family: var(--font-display);
  font-size: 14px; line-height: 1.3; color: var(--ink-muted);
}

/* ---- feed / cards ---- */
.feed { display: grid; gap: 48px; margin: 32px 0; }
@media (min-width: 1100px) {
  .home .feed, .topic .feed, .region .feed { grid-template-columns: repeat(2, 1fr); }
}
.card-link { text-decoration: none; display: block; }
.card-headline { font-size: 22px; margin: 6px 0; }
.card-standfirst { color: var(--ink); margin: 0; }
.card + .card, .card { border: 0; }

.topics { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; }
.topics a {
  font-family: var(--font-display); font-size: 14px; text-decoration: none;
  border: 1px solid var(--rule); padding: 2px 10px;
}

/* ---- source panel ---- */
.source-panel {
  background: var(--surface); border: 1px solid var(--rule);
  padding: 16px 20px; margin: 8px 0 32px;
}
.src-list { list-style: none; padding: 0; margin: 0; font-size: 16px; }
.src-list li { display: flex; gap: 10px; padding: 4px 0; border-top: 1px solid var(--rule); }
.src-num { font-family: var(--font-display); }

/* ---- search results ---- */
.reslist { list-style: none; padding: 0; }
.reslist li { padding: 12px 0; border-top: 1px solid var(--rule); max-width: var(--measure); }
.reslist .snip { display: block; color: var(--ink-muted); font-size: 16px; }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; }
.empty { color: var(--ink-muted); }

/* ---- progress rule ---- */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 20; transition: width 0.1s linear;
}
@media (prefers-reduced-motion: reduce) { #progress { transition: none; } }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--rule); padding: 24px 80px 64px;
  font-size: 16px; line-height: 1.6; color: var(--ink-muted);
}
.site-footer p { max-width: none; margin: 0 0 8px; }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .article, .obec { display: block; }
  .article > .spine, .obec > .spine { position: static; margin-bottom: 16px; }
  .article > .spine { display: flex; gap: 16px; flex-wrap: wrap; }
  main { padding: 32px 24px 64px; }
  .site, .site-footer { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 640px) {
  body { font-size: 18px; }
  h1 { font-size: 34px; line-height: 1.1; }
  .lede { font-size: 20px; }
  main { padding: 24px 16px 48px; }
  .site { padding: 0 16px; }
  .site-search input { min-width: 0; width: 40vw; }
}
