:root {
  color-scheme: light;
  --bg: #f6f5f1; --panel: #fff; --ink: #1d2330; --muted: #5f6778; --line: #d9dce3;
  --accent: #d69e2e; --accent-ink: #8a5a00; --on-accent: #111; --link: #1f6fb2; --ok: #15803d; --bad: #b91c1c;
  --nocover-from: #dde5f2; --nocover-to: #eadcef;
  --logo-ink: #1d2330; --logo-gold: #a87b2c; --logo-planet: #8fa3b8; --logo-ring: #4f6f8f;
}
/* Dark palette: follows the OS unless the visitor picked a theme (data-theme comes from the theme cookie) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --bg: #0d1117; --panel: #161b26; --ink: #e6e8ee; --muted: #9aa3b5; --line: #333c4f;
    --accent: #f0b429; --accent-ink: #f0b429; --on-accent: #111; --link: #7cc4ff; --ok: #4ade80; --bad: #f87171;
    --nocover-from: #23304a; --nocover-to: #3a1f4a;
    --logo-ink: #fbefd9; --logo-gold: #c9a35c; --logo-planet: #384551; --logo-ring: #6b7f8e;
  }
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #0d1117; --panel: #161b26; --ink: #e6e8ee; --muted: #9aa3b5; --line: #333c4f;
  --accent: #f0b429; --accent-ink: #f0b429; --on-accent: #111; --link: #7cc4ff; --ok: #4ade80; --bad: #f87171;
  --nocover-from: #23304a; --nocover-to: #3a1f4a;
  --logo-ink: #fbefd9; --logo-gold: #c9a35c; --logo-planet: #384551; --logo-ring: #6b7f8e;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, sans-serif; }
a { color: var(--link); }
main { max-width: 1200px; margin: 0 auto; padding: 1rem; }
header.site { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: .75rem 1rem; background: var(--panel); border-bottom: 2px solid var(--accent); }
/* Logos: inline SVG symbols (header mark in layouts/default, full logo on the home page) coloured by the theme */
svg.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.lk-cream { fill: var(--logo-ink); }
.lk-gold { fill: var(--logo-gold); }
.lk-planet { fill: var(--logo-planet); }
.lk-ring { fill: var(--logo-ring); }
.brand { display: block; line-height: 0; }
.brand .logo { display: block; height: 56px; width: auto; }
nav.main { display: flex; gap: 1.2rem; align-items: center; }
nav.main > a, .books .menu-button { color: var(--muted); text-decoration: none; }
nav.main a[aria-current=page], .books .menu-button.in-section { color: var(--ink); }
/* Drop-down menus (Böcker, language): HTML popovers, so a click outside or Esc closes them without JavaScript.
   Anchor positioning puts each panel under its button; without it the panels sit under the header. */
.menu-button { display: flex; align-items: center; gap: .4rem; padding: 0; border: 0; background: transparent; font: inherit; font-weight: normal; cursor: pointer; }
.menu-button::after { content: "\25BE"; }
.menu:has(.panel:popover-open) .menu-button::after { content: "\25B4"; }
.menu .panel { inset: auto; margin: 0; flex-direction: column; padding: .3rem; list-style: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgb(0 0 0 / .2); }
.menu .panel:popover-open { display: flex; }
.menu .panel a, .menu .panel button, .menu .current { display: block; font: inherit; padding: .35rem .6rem; border-radius: 4px; text-align: left; white-space: nowrap; color: var(--ink); text-decoration: none; }
.menu .panel a:hover, .menu .panel a:focus-visible, .menu .panel button:hover, .menu .panel button:focus-visible { background: var(--bg); }
.menu .panel a[aria-current], .menu .current { font-weight: 600; }
.books .menu-button { anchor-name: --menu-books; }
.books .panel { position-anchor: --menu-books; top: calc(anchor(bottom) + .3rem); left: calc(anchor(left) - .6rem); }
.language { font-size: .8333rem; }   /* same size as the browser's button text */
.language .menu-button { anchor-name: --menu-language; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.language .panel { position-anchor: --menu-language; top: calc(anchor(bottom) + .3rem); right: anchor(right); min-width: anchor-size(width); }
.language form button { background: transparent; font-weight: normal; }
.language .current::before { content: "\2713  "; }
.language form button::before { content: "\2713  "; visibility: hidden; }
@supports not (anchor-name: --a) {
  .books .panel { top: 4.5rem; left: 1rem; }
  .language .panel { top: 4.5rem; right: 1rem; }
}
svg.globe { fill: none; stroke: currentColor; stroke-width: 1.2; }
form.search { margin-left: auto; display: flex; gap: .4rem; flex: 1 1 14rem; max-width: 22rem; }
form.search input { flex: 1; min-width: 0; padding: .4rem .6rem; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
button { padding: .4rem .9rem; border: 0; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; }
form.theme button { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: normal; }
.hero { padding: 2rem 0 1rem; text-align: center; }
.hero .logo { display: block; max-width: 100%; height: auto; margin: 0 auto 1rem; }
.hero h1 { margin: 0; font-size: 2rem; }
.hero p { color: var(--muted); }
nav.genres { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
nav.genres a, p.tags a { padding: .2rem .7rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .9rem; }
nav.genres a.active { background: var(--accent); color: var(--on-accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; gap: .2rem; padding: .6rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); text-decoration: none; }
.card:hover { outline: 2px solid var(--accent); }
.card img, .nocover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; }
.nocover { display: flex; align-items: center; justify-content: center; padding: .5rem; text-align: center; background: linear-gradient(160deg, var(--nocover-from), var(--nocover-to)); color: var(--muted); font-size: .9rem; }
.card .title { font-weight: 600; line-height: 1.25; }
.card .by { color: var(--muted); font-size: .85rem; }
.card .price, .book .price { color: var(--accent-ink); font-weight: 700; }
.stock { font-size: .8rem; }
.stock.in { color: var(--ok); }
.stock.out { color: var(--bad); }
.book { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: 2rem; margin-top: 1rem; }
.book .cover { width: 100%; border-radius: 6px; }
.book .nocover.large { font-size: 1.2rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.thumbs img { width: 64px; height: 96px; object-fit: cover; border-radius: 3px; }
.book h1 { margin: 0; }
.subtitle { margin-top: .2rem; color: var(--muted); font-size: 1.1rem; }
ul.authors { list-style: none; padding: 0; margin: .5rem 0; }
.book .price { font-size: 1.5rem; margin: .5rem 0 0; }
.blurb, .bio { max-width: 70ch; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; color: var(--muted); }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 0; }
ul.index { columns: 16rem; column-gap: 2rem; padding: 0; list-style: none; }
ul.index li { break-inside: avoid; padding: .2rem 0; }
ul.index small { color: var(--muted); }
table.cookies { border-collapse: collapse; width: 100%; max-width: 60rem; margin: 1rem 0; }
table.cookies th, table.cookies td { padding: .5rem 1rem .5rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.cookies thead th { color: var(--muted); font-weight: 600; }
.lead { max-width: 60ch; }
main > p { max-width: 70ch; }
table.hours { border-collapse: collapse; min-width: min(24rem, 100%); }
table.hours th, table.hours td { padding: .45rem 1rem .45rem 0; border-bottom: 1px solid var(--line); text-align: left; }
table.hours th { font-weight: normal; }
table.hours tr.today th, table.hours tr.today td { font-weight: 700; }
table.hours small { color: var(--muted); font-weight: normal; }
.note { color: var(--muted); max-width: 60ch; }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 2rem 0; }
.count { color: var(--muted); }
footer.site { padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: .9rem; }
@media (max-width: 700px) {
  .book { grid-template-columns: 1fr; }
  .brand .logo { height: 44px; }
  form.search { margin-left: 0; width: 100%; max-width: none; flex-basis: 100%; }
}
