/* ==========================================================================
   Base layout - shared by every theme.

   This file owns structure only: grids, spacing, states, responsive
   behaviour. Every colour, font and border radius comes from a custom
   property that the active theme's stylesheet defines, once for light mode
   and again under [data-theme="dark"].

   The contract a theme must fill:
     --bg --surface --surface-2 --ink --ink-soft --accent --accent-deep
     --line --line-soft --font-display --font-body --radius
     --k1..--k6 (cover swatch backgrounds) and --k1-ink..--k6-ink

   Optional, with sensible defaults below:
     --section-y (vertical rhythm)  --gutter (horizontal padding)
     --measure (container width)
   ========================================================================== */

:root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f4f4f4;
    --ink: #111;
    --ink-soft: #666;
    --accent: #d9381e;
    --accent-deep: #b02714;
    --line: rgba(0, 0, 0, .16);
    --line-soft: rgba(0, 0, 0, .07);
    --font-display: Georgia, serif;
    --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
    --radius: 3px;
    --measure: 1140px;

    /* Vertical padding on every top-level block. Doubled between adjacent
       sections, so 36px here reads as a ~72px gap. */
    --section-y: clamp(22px, 3vh, 36px);
    --gutter: clamp(20px, 5vw, 64px);

    --k1: #39496b; --k1-ink: #f2f4f9;
    --k2: #b02714; --k2-ink: #fbeeea;
    --k3: #5f6e4e; --k3-ink: #f0f3eb;
    --k4: #b98b2f; --k4-ink: #faf3e3;
    --k5: #6b5874; --k5-ink: #f4f0f6;
    --k6: #37585c; --k6-ink: #edf3f3;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.lbl {
    font-size: .68rem; font-weight: 600; letter-spacing: .26em;
    text-transform: uppercase; color: var(--ink-soft);
}

.accent { color: var(--accent); }

h1 {
    font-family: var(--font-display); font-weight: 500;
    font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.14;
}

h2 {
    font-family: var(--font-display); font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
}

h3 { font-family: var(--font-display); font-weight: 500; }

/* ---------- NAV ---------- */

.site-nav {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 18px var(--gutter);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 80;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
    width: 32px; height: 32px; flex-shrink: 0;
    background: var(--accent); color: #fff; border-radius: var(--radius);
    display: grid; place-items: center;
    font-family: var(--font-display); font-size: 1rem; font-weight: 600;
}

/* Stands in for .brand-mark when a site supplies a logo. Height-bound so a
   logo of any proportion sits on the same line as the lettered mark. */
.brand-logo {
    height: 32px; width: auto; max-width: 180px; flex-shrink: 0;
    display: block; object-fit: contain;
}

.brand-name {
    font-family: var(--font-display); font-weight: 600;
    font-size: 1.25rem; letter-spacing: .04em; display: block; line-height: 1.1;
}

.brand-tagline {
    font-size: .6rem; letter-spacing: .24em; text-transform: uppercase;
    color: var(--ink-soft); display: block;
}

.nav-links { display: flex; gap: 28px; font-size: .88rem; font-weight: 500; }
.nav-links a { position: relative; padding-bottom: 3px; }

.nav-links a::after {
    content: ""; position: absolute; left: 50%; right: 50%; bottom: 0;
    height: 1px; background: var(--accent); transition: left .25s, right .25s;
}

.nav-links a:hover::after { left: 0; right: 0; }

/* The section the visitor is currently in keeps its underline. */
.nav-links a.is-active { color: var(--accent); }
.nav-links a.is-active::after { left: 0; right: 0; }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.nav-cta {
    background: var(--ink); color: var(--bg); border: none; border-radius: var(--radius);
    padding: 10px 22px; font-weight: 500; font-size: .82rem; letter-spacing: .12em;
    transition: background .25s;
}

.nav-cta:hover { background: var(--accent); color: #fff; }

/* mode toggle */

.mode-toggle button {
    width: 38px; height: 38px; display: grid; place-items: center;
    background: transparent; border: 1px solid var(--line);
    border-radius: var(--radius); color: var(--ink);
    font-size: .95rem; line-height: 1; transition: border-color .2s, color .2s;
}

.mode-toggle button:hover { border-color: var(--accent); color: var(--accent); }
.mode-icon { display: none; }
[data-theme="light"] .mode-icon-moon { display: block; }
[data-theme="dark"] .mode-icon-sun { display: block; }

/* burger + mobile menu */

.burger {
    display: none; width: 42px; height: 42px;
    background: transparent; border: 1px solid var(--line); border-radius: var(--radius);
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}

.burger span { display: block; width: 17px; height: 1.5px; background: var(--ink); transition: transform .3s, opacity .3s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mmenu {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); z-index: 90;
    background: var(--bg); border-left: 1px solid var(--line);
    transform: translateX(102%); transition: transform .35s cubic-bezier(.3, .9, .3, 1);
    padding: 84px 28px 28px; display: flex; flex-direction: column;
    box-shadow: -30px 0 60px rgba(0, 0, 0, .14);
}

.mmenu.open { transform: translateX(0); }

.mmenu a {
    font-family: var(--font-display); font-weight: 500; font-size: 1.25rem;
    padding: 14px 4px; border-bottom: 1px solid var(--line-soft);
    display: flex; align-items: baseline; gap: 14px;
    transition: color .2s, padding-left .2s;
}

.mmenu a:hover { color: var(--accent); padding-left: 8px; }
.mmenu a .n { font-family: var(--font-body); font-size: .6rem; letter-spacing: .2em; color: var(--accent); }

.mmenu .mm-cta {
    margin-top: auto; background: var(--ink); color: var(--bg);
    border-radius: var(--radius); padding: 15px; justify-content: center;
    letter-spacing: .14em; font-size: .9rem; border-bottom: none;
}

.mmenu .mm-cta:hover { background: var(--accent); color: #fff; padding-left: 15px; }

.scrim {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 85;
    opacity: 0; pointer-events: none; transition: opacity .3s;
}

.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- LAYOUT ---------- */

/* Sections stack, so the gap a visitor sees between two of them is this value
   doubled - the single dial for the page's vertical rhythm. A theme can
   override --section-y to run tighter or looser than the default. */
.hero, .page-head, section, .book-detail, .prose-page {
    max-width: var(--measure); margin: 0 auto;
    padding: var(--section-y) var(--gutter);
}

/* The hero sits under the nav and carries the search panel, so it gets a
   little more room above than a mid-page section. */
.hero { padding-top: clamp(32px, 5vh, 56px); }

/* A page head runs straight into its own results, not into a new section. */
.page-head { padding-bottom: clamp(14px, 1.8vh, 22px); }

/* A head and the listing under it are one unit, so their boundary should not
   read as a full gap between two separate sections. */
.page-head + section { padding-top: calc(var(--section-y) / 2); }

/* Trailing margins inside a head are dead space: `.lede` carries 36px below
   it for the homepage, where a search panel follows, but on a listing page it
   is the last thing before the results. */
.hero-in > :last-child { margin-bottom: 0; }

/* The hero column spans the container so the search panel lines up with the
   section grids below it. Running text is capped separately, since a headline
   or lede set across the full 1140px would be hard to read. */
.hero-in { max-width: none; }

.hero-in > .crumbs,
.hero-in > .eyebrow,
.hero-in > h1,
.hero-in > .lede { max-width: 780px; }

.eyebrow { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.eyebrow .dot, .kicker .dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }

.lede { margin: 20px 0 36px; max-width: 56ch; color: var(--ink-soft); font-size: 1.02rem; }
.page-head h1 { margin-top: 8px; }

.s-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; margin-bottom: 30px; flex-wrap: wrap;
}

.s-head .hgroup { display: flex; align-items: baseline; gap: 14px; }
.s-head .num { font-family: var(--font-display); font-size: .9rem; color: var(--accent); }

.more {
    font-size: .76rem; font-weight: 600; letter-spacing: .14em; color: var(--ink-soft);
    border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: color .2s, border-color .2s;
}

.more:hover { color: var(--accent); border-color: var(--accent); }

.crumbs { display: flex; gap: 8px; font-size: .78rem; color: var(--ink-soft); margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--accent); }

/* ---------- SEARCH ---------- */

.z-search {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px 24px 20px; position: relative;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .06);
}

.zs-main {
    display: flex; gap: 14px; align-items: flex-end;
    border-bottom: 1px solid var(--ink); padding-bottom: 12px;
}

.zs-main input[type=search] {
    flex: 1; min-width: 0; background: transparent; border: none; color: var(--ink);
    font-family: var(--font-display); font-size: clamp(1rem, 2vw, 1.25rem); padding: 6px 2px;
}

.zs-main input[type=search]:focus { outline: none; }
.zs-main input[type=search]::placeholder { color: var(--ink-soft); opacity: .7; }

.zs-main button {
    flex-shrink: 0; background: var(--ink); color: var(--bg); border: none;
    border-radius: var(--radius); padding: 12px 26px;
    font-weight: 600; font-size: .82rem; letter-spacing: .16em; text-transform: uppercase;
    transition: background .25s;
}

.zs-main button:hover { background: var(--accent); color: #fff; }

.zs-filters {
    display: grid; grid-template-columns: 1fr 1fr 1.3fr auto;
    gap: 24px; padding-top: 18px; align-items: end;
}

.zf label {
    display: block; font-size: .58rem; font-weight: 700; letter-spacing: .24em;
    text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px;
}

.zf input, .zf select {
    width: 100%; background: transparent; border: none;
    border-bottom: 1px solid var(--line); color: var(--ink);
    padding: 5px 1px; font-size: .92rem; transition: border-color .25s;
}

.zf input:hover, .zf select:hover { border-color: var(--ink-soft); }
.zf input:focus, .zf select:focus { outline: none; border-color: var(--accent); }
.zf select { cursor: pointer; }
.zf select option { background: var(--surface); color: var(--ink); }

.zf.exact { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; padding-bottom: 4px; }
.zf.exact input { position: absolute; opacity: 0; pointer-events: none; }

.zf.exact .sq {
    width: 19px; height: 19px; flex-shrink: 0;
    border: 1.5px solid var(--ink); border-radius: 2px;
    display: grid; place-items: center; color: transparent;
    font-size: .7rem; font-weight: 700; transition: all .2s;
}

.zf.exact input:checked + .sq { background: var(--accent); border-color: var(--accent); color: #fff; }
.zf.exact input:checked + .sq::after { content: "✓"; }
.zf.exact input:focus-visible + .sq { outline: 2px solid var(--accent); outline-offset: 3px; }
.zf.exact .xl { font-size: .86rem; font-weight: 500; white-space: nowrap; }

.tries { margin-top: 18px; display: flex; gap: 16px; flex-wrap: wrap; font-size: .84rem; color: var(--ink-soft); }
.tries a { border-bottom: 1px solid var(--line); transition: color .2s, border-color .2s; }
.tries a:hover { color: var(--accent); border-color: var(--accent); }

.sorts { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; }
.sort-link { color: var(--ink-soft); border-bottom: 1px solid transparent; padding-bottom: 2px; }
.sort-link:hover { color: var(--accent); }
.sort-link.is-active { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ---------- COVERS ---------- */

.cover {
    position: relative; border-radius: 2px; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    background: var(--k1); color: var(--k1-ink);
}

.cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.cover-rule { width: 22px; height: 2px; background: currentColor; opacity: .8; flex-shrink: 0; }
.cover-title { font-family: var(--font-display); font-weight: 500; line-height: 1.22; }
.cover-author { font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; opacity: .75; }

.cover-sm { width: 44px; height: 64px; padding: 6px; }
.cover-sm .cover-rule, .cover-sm .cover-author { display: none; }
.cover-sm .cover-title { font-size: .45rem; line-height: 1.15; }

.cover-md { aspect-ratio: 2/3; padding: 12px; }
.cover-md .cover-title { font-size: .92rem; }

.cover-lg { aspect-ratio: 2/3; padding: 14px; }
.cover-lg .cover-title { font-size: .95rem; }

.cover-xl { aspect-ratio: 2/3; padding: 22px; width: min(240px, 60vw, 100%); }
.cover-xl .cover-title { font-size: 1.5rem; }
.cover-xl .cover-author { font-size: .66rem; }

.k1 { background: var(--k1); color: var(--k1-ink); }
.k2 { background: var(--k2); color: var(--k2-ink); }
.k3 { background: var(--k3); color: var(--k3-ink); }
.k4 { background: var(--k4); color: var(--k4-ink); }
.k5 { background: var(--k5); color: var(--k5-ink); }
.k6 { background: var(--k6); color: var(--k6-ink); }

.stampline {
    position: absolute; top: 9px; right: 9px; z-index: 2;
    font-size: .5rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
    color: #fff; background: var(--accent); border-radius: 2px; padding: 3px 8px;
}

/* ---------- FEATURED ---------- */

.featured {
    display: grid; grid-template-columns: minmax(200px, 260px) 1fr;
    gap: clamp(28px, 5vw, 64px); align-items: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(26px, 4vw, 48px); position: relative;
}

.feat-cover {
    justify-self: center; z-index: 1;
    box-shadow: 14px 14px 0 var(--surface-2), 14px 14px 0 1px var(--line);
    transition: transform .35s;
}

.featured:hover .feat-cover { transform: translate(-3px, -3px); }
.feat-body { position: relative; z-index: 1; }
.kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.feat-body h3 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); line-height: 1.18; margin-bottom: 14px; }
.feat-body p { color: var(--ink-soft); max-width: 58ch; margin-bottom: 10px; }

.meta { font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 24px; }
.meta b { color: var(--accent); font-weight: 700; }

.btn-ink, .btn-ghost {
    display: inline-block; border-radius: var(--radius); padding: 12px 28px;
    font-weight: 600; font-size: .84rem; letter-spacing: .12em; transition: all .25s;
}

.btn-ink { background: var(--ink); color: var(--bg); border: 1px solid var(--ink); margin-right: 8px; }
.btn-ink:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- CATEGORIES ---------- */

.cat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px; background: var(--line); border: 1px solid var(--line);
}

.cat { background: var(--bg); padding: 24px 22px; position: relative; transition: background .25s; }
.cat:hover { background: var(--surface); }
.cat .ki { font-family: var(--font-display); font-size: 1.1rem; color: var(--accent); display: block; margin-bottom: 10px; }
.cat h3 { font-size: 1.1rem; margin-bottom: 2px; transition: color .2s; }
.cat:hover h3 { color: var(--accent); }
.cat p { font-size: .72rem; letter-spacing: .14em; color: var(--ink-soft); text-transform: uppercase; }
.cat .arr { position: absolute; right: 18px; bottom: 18px; color: var(--line); transition: color .25s, transform .25s; }
.cat:hover .arr { color: var(--accent); transform: translateX(4px); }

.cat-index { display: grid; gap: 34px; }
.cat-group h2 { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.cat-group h2 a:hover { color: var(--accent); }
.cat-group .c { font-family: var(--font-body); font-size: .7rem; letter-spacing: .14em; color: var(--ink-soft); }

.cat-children, .subcats { display: flex; flex-wrap: wrap; gap: 8px; }
.subcats { margin: 18px 0 28px; }

.cat-children a, .subcats a {
    font-size: .84rem; padding: 6px 14px; border: 1px solid var(--line);
    border-radius: 999px; color: var(--ink-soft); transition: all .2s;
}

.cat-children a:hover, .subcats a:hover { border-color: var(--accent); color: var(--accent); }
.cat-children .c, .subcats .c { opacity: .6; font-size: .74rem; }

/* ---------- POPULAR LIST ---------- */

.pop-list { border-top: 1px solid var(--ink); }

.pop {
    display: grid; grid-template-columns: 46px 44px 1fr auto auto;
    gap: 18px; align-items: center; padding: 18px 4px;
    border-bottom: 1px solid var(--line); transition: padding-left .25s, background .25s;
}

.pop:hover { background: var(--surface); padding-left: 14px; }
.pop .no { font-family: var(--font-display); font-size: 1.2rem; color: var(--accent); }
.pop h3 { font-size: 1.05rem; }
.pop .a { font-size: .82rem; color: var(--ink-soft); }
.pop .g { font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.pop .r { font-size: .82rem; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ---------- BOOKLISTS ---------- */

.bl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }

.bl {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; transition: transform .25s, box-shadow .25s;
}

.bl:hover { transform: translateY(-5px); box-shadow: 0 18px 40px rgba(0, 0, 0, .1); }
.bl .band { display: flex; gap: 6px; margin-bottom: 18px; height: 84px; align-items: flex-end; }
.bl .band span { flex: 1; border-radius: 2px 2px 0 0; transition: height .35s; }
.bl .band span:nth-child(1) { height: 72%; }
.bl .band span:nth-child(2) { height: 100%; }
.bl .band span:nth-child(3) { height: 58%; }
.bl .band span:nth-child(4) { height: 84%; }
.bl:hover .band span { height: 100%; }
.bl h3 { font-size: 1.25rem; margin-bottom: 6px; }
.bl p { font-size: .88rem; color: var(--ink-soft); }
.bl .lm { display: block; margin-top: 12px; font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }

/* ---------- BOOK GRID ---------- */

.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 22px; }

.book-card { display: block; transition: transform .25s; }
.book-card:hover { transform: translateY(-5px); }

.book-card .cover {
    box-shadow: 8px 8px 0 var(--surface-2), 8px 8px 0 1px var(--line);
    margin-bottom: 12px;
}

.bc-title { font-family: var(--font-display); font-weight: 500; font-size: .95rem; line-height: 1.3; }
.bc-author { font-size: .74rem; letter-spacing: .06em; color: var(--ink-soft); }
.bc-rating { font-size: .74rem; font-weight: 700; color: var(--accent); margin-top: 2px; }

/* ---------- BOOK DETAIL ---------- */

.bd-main { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: clamp(28px, 5vw, 60px); align-items: start; }
/*
 * `1fr` is `minmax(auto, 1fr)`, and that `auto` floor is the column's
 * min-content width. Signed in, this column carries the "Add to a booklist"
 * select, and a select will not shrink below its widest option - so the floor
 * grew, the grid took the difference out of the cover's track, and the cover
 * (a hard 240px) spilled out of its own column. `.cover` is positioned, so it
 * painted over the title, the author and the rating. Letting this column
 * shrink keeps the cover's track at its full width.
 */
.bd-body { min-width: 0; }

.bd-cover { box-shadow: 14px 14px 0 var(--surface-2), 14px 14px 0 1px var(--line); }
.bd-body h1 { font-size: clamp(1.8rem, 4vw, 3rem); }
.bd-author { font-size: 1.05rem; color: var(--ink-soft); margin: 8px 0 16px; }
.bd-description { margin-bottom: 28px; }
.bd-description p { margin-bottom: 12px; color: var(--ink-soft); max-width: 62ch; }

.bd-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 24px; border-top: 1px solid var(--line); padding-top: 22px; }
.bd-facts dt { font-size: .6rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 3px; }
.bd-facts dd { font-size: .95rem; }
.bd-facts dd a:hover { color: var(--accent); }

/* ---------- BLOG + PROSE ---------- */

.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; }

.post {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column;
    transition: transform .25s, box-shadow .25s;
}

.post:hover { transform: translateY(-5px); box-shadow: 0 18px 40px rgba(0, 0, 0, .1); }
.post .banner { height: 118px; position: relative; display: block; }

.post .banner .tag {
    position: absolute; left: 16px; bottom: -11px;
    background: var(--ink); color: var(--bg);
    font-size: .58rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
    padding: 4px 12px; border-radius: 2px;
}

.post .body { padding: 24px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post h3 { font-size: 1.18rem; line-height: 1.35; }
.post h3 a:hover { color: var(--accent); }
.post p { font-size: .88rem; color: var(--ink-soft); flex: 1; }
.post .pm { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); border-top: 1px solid var(--line-soft); padding-top: 12px; display: flex; justify-content: space-between; gap: 10px; }
.post .pm b { color: var(--accent); font-weight: 700; }

/* Spans the container like every other block, and the text runs the full
   width with it - no reading-measure cap, so there is no unused column on
   the right. Lines are long at this width; the paragraph spacing and slightly
   raised line-height below are what keep them trackable. */
.prose-page { max-width: var(--measure); }

.prose-page h1 { margin: 10px 0 14px; }
.prose { margin-top: 24px; }

/* Extra leading and paragraph spacing: at the full container width a line runs
   long, and generous vertical rhythm is what stops the eye losing its place on
   the return sweep. */
.prose p { margin-bottom: 24px; line-height: 1.9; color: var(--ink-soft); }

/* ---------- FOOTER ---------- */

.site-footer {
    border-top: 1px solid var(--line); margin-top: 40px;
    padding: 32px var(--gutter);
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 16px; font-size: .82rem; color: var(--ink-soft);
}

.footer-brand { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--accent); }
.footer-fine { font-size: .68rem; letter-spacing: .1em; }

/* ---------- STATES ---------- */

.empty { padding: 60px 0; text-align: center; color: var(--ink-soft); }
.empty-title { font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); margin-bottom: 8px; }
.empty a { color: var(--accent); border-bottom: 1px solid var(--accent); }

/* ---------- PAGINATION ---------- */

.pager {
    margin-top: 48px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
}

.pager-list {
    display: flex; align-items: center; justify-content: center;
    flex-wrap: wrap; gap: 6px; list-style: none;
}

.pager-num, .pager-step, .pager-gap {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 42px; height: 42px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: var(--radius);
    font-size: .88rem; font-weight: 500; color: var(--ink-soft);
    transition: color .2s, border-color .2s, background .2s;
}

.pager-step { padding: 0 18px; }

a.pager-num:hover, a.pager-step:hover {
    color: var(--accent); border-color: var(--accent);
}

.pager-num.is-current {
    background: var(--ink); color: var(--bg);
    border-color: var(--ink); font-weight: 700;
}

/* The ellipsis is a gap marker, not a control. */
.pager-gap { border-color: transparent; min-width: 24px; padding: 0 4px; }

.pager-step.is-disabled { opacity: .35; }

.pager-count {
    font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
    color: var(--ink-soft);
}

@media (max-width: 600px) {
    /* Arrows alone on narrow screens; the numbers still carry the labels. */
    .pager-step-label { display: none; }
    .pager-step { padding: 0 14px; min-width: 42px; }
}

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s, transform .6s; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- RESPONSIVE ---------- */

@media (max-width: 960px) {
    .nav-links, .nav-cta { display: none; }
    .burger { display: flex; }
    .featured { grid-template-columns: 1fr; text-align: center; }
    .feat-body p { margin-left: auto; margin-right: auto; }
    .bd-main { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .bd-description p, .bd-facts { text-align: left; }
    .zs-filters { grid-template-columns: 1fr 1fr; }
    .pop { grid-template-columns: 36px 44px 1fr; }
    .pop .g { display: none; }
    .pop .r { grid-column: 3; justify-self: start; }
    .news { grid-template-columns: 1fr; text-align: center; }
    .nl { justify-content: center; }
}

@media (max-width: 600px) {
    .zs-main { flex-wrap: wrap; }
    .zs-main button { width: 100%; }
    .zs-filters { grid-template-columns: 1fr; }
    .rec-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .reveal { opacity: 1; transform: none; }
}

/* ---------- ACCOUNTS ---------- */

.auth-page {
    max-width: var(--measure); margin: 0 auto;
    padding: clamp(40px, 7vh, 80px) var(--gutter);
    display: grid; place-items: center;
}

.auth-card {
    width: min(460px, 100%);
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: clamp(24px, 4vw, 40px);
}

.auth-card h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 6px 0 10px; }
.auth-card .lede { margin-bottom: 26px; }

.auth-form { display: grid; gap: 16px; }

.field label {
    display: block; font-size: .6rem; font-weight: 700; letter-spacing: .22em;
    text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px;
}

.field input {
    width: 100%; background: transparent; color: var(--ink);
    border: none; border-bottom: 1px solid var(--line);
    padding: 9px 2px; font-size: 1rem; transition: border-color .2s;
}

.field input:hover { border-color: var(--ink-soft); }
.field input:focus { outline: none; border-color: var(--accent); }

.field-hint { font-size: .76rem; color: var(--ink-soft); margin-top: 5px; }
.field-error { font-size: .78rem; color: var(--accent); margin-top: 5px; font-weight: 600; }

.field-check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.field-check input { position: absolute; opacity: 0; pointer-events: none; }
.field-check .sq {
    width: 18px; height: 18px; flex-shrink: 0;
    border: 1.5px solid var(--ink); border-radius: 2px;
    display: grid; place-items: center; color: transparent; font-size: .7rem; font-weight: 700;
    transition: all .2s;
}
.field-check input:checked + .sq { background: var(--accent); border-color: var(--accent); color: #fff; }
.field-check input:checked + .sq::after { content: "y"; }
.field-check input:focus-visible + .sq { outline: 2px solid var(--accent); outline-offset: 3px; }

.auth-form .btn-ink { border: none; cursor: pointer; width: 100%; text-align: center; margin: 6px 0 0; }

.auth-alt { margin-top: 22px; font-size: .88rem; color: var(--ink-soft); }
.auth-alt a { color: var(--accent); border-bottom: 1px solid var(--accent); }

.auth-note {
    margin: 14px 0 0; padding: 10px 14px; font-size: .86rem; font-weight: 600;
    color: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius);
}

/* Signed-in chrome in the site nav. */
.nav-account { display: flex; align-items: center; gap: 10px; }
.nav-account form { display: flex; }
.nav-signout {
    background: transparent; border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--ink-soft); padding: 9px 14px; font-size: .78rem; letter-spacing: .1em;
    transition: border-color .2s, color .2s;
}
.nav-signout:hover { border-color: var(--accent); color: var(--accent); }

/* Book detail actions and the booklist picker. */

.bd-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0 26px; }
.bd-actions form { display: flex; gap: 8px; align-items: center; }
.bd-actions button { border: none; cursor: pointer; }
.bd-actions .btn-ink.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

.add-to-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }

.add-to-list select, .add-to-list input[type=text] {
    background: transparent; color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 11px 12px; max-width: 100%;

    /* A flex item will not shrink past its content without this, so a long
       booklist name would push the control out of the column. */
    min-width: 0;
}

.add-to-list select { cursor: pointer; }
.add-to-list select option { background: var(--surface); color: var(--ink); }
.add-to-list select:focus, .add-to-list input:focus { outline: none; border-color: var(--accent); }
.add-to-list button { border: none; cursor: pointer; }

/* Reader booklist management. */

.list-form { max-width: 620px; }
.list-form textarea {
    width: 100%; background: transparent; color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 12px; font-family: inherit; font-size: 1rem; resize: vertical;
}
.list-form textarea:focus { outline: none; border-color: var(--accent); }

.bl-actions { display: flex; gap: 8px; margin-top: 14px; }
.bl-actions .btn-ghost { padding: 8px 16px; font-size: .78rem; }

.pop form { display: flex; }
.pop .btn-ghost { padding: 8px 14px; font-size: .76rem; border: 1px solid var(--line); cursor: pointer; }

/* ---------- USER MENU ---------- */

.user-menu { position: relative; }

.user-trigger {
    display: flex; align-items: center; gap: 9px;
    padding: 6px 10px 6px 6px;
    background: transparent; color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .2s;
}

.user-trigger:hover,
.user-trigger[aria-expanded="true"] { border-color: var(--accent); }

.user-avatar {
    width: 28px; height: 28px; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--accent); color: #fff; border-radius: var(--radius);
    font-size: .68rem; font-weight: 700; letter-spacing: .04em;
}

.user-name { font-size: .84rem; font-weight: 500; white-space: nowrap; }

/* A chevron drawn in CSS, so no icon font or SVG is needed. */
.user-caret {
    width: 6px; height: 6px; flex-shrink: 0; margin-left: 2px;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .2s;
}

.user-trigger[aria-expanded="true"] .user-caret { transform: translateY(1px) rotate(-135deg); }

.user-panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 95;
    min-width: 230px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .18);
    display: flex; flex-direction: column;
}

.user-panel[hidden] { display: none; }

.user-panel-head {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--line-soft); margin-bottom: 6px;
}

.user-panel-head b { display: block; font-size: .92rem; }

.user-email {
    display: block; font-size: .74rem; color: var(--ink-soft);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-badge {
    display: inline-block; margin-top: 7px; padding: 2px 8px;
    font-size: .58rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
    color: var(--accent); border: 1px solid var(--accent); border-radius: 999px;
}

.user-panel a,
.user-panel button {
    display: block; width: 100%; text-align: left;
    padding: 9px 12px; border: none; background: transparent;
    color: var(--ink); font-size: .86rem; border-radius: var(--radius);
    transition: background .15s, color .15s;
}

.user-panel a:hover,
.user-panel button:hover { background: var(--surface-2); color: var(--accent); }

.user-panel form { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); }

/* Signed-in header inside the mobile menu. */
.mm-who {
    display: block; padding: 4px 4px 12px;
    font-size: .62rem; letter-spacing: .24em; text-transform: uppercase;
    color: var(--ink-soft); border-bottom: 1px solid var(--line-soft); margin-bottom: 4px;
}

.mm-signout { margin-top: auto; }
.mm-signout .mm-cta { width: 100%; border: none; }

@media (max-width: 960px) {
    /* The mobile menu carries the same links, so the dropdown would duplicate
       it and crowd a narrow bar. */
    .user-menu { display: none; }
}

/* Closing an account. Set apart from the rest of the page on purpose. */

.danger-zone {
    max-width: 620px; padding: 22px 24px;
    border: 1px solid var(--accent); border-radius: var(--radius);
    background: var(--surface);
}

.danger-lead { font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.danger-zone p { color: var(--ink-soft); margin-bottom: 12px; }
.danger-zone code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .88em; }

.danger-list { margin: 0 0 14px 18px; color: var(--ink-soft); }
.danger-list li { margin-bottom: 4px; }
.danger-list b { color: var(--ink); }

.danger-form { margin-top: 18px; }

.btn-danger {
    display: inline-block; border: 1px solid var(--accent); cursor: pointer;
    background: var(--accent); color: #fff; border-radius: var(--radius);
    padding: 12px 28px; font-weight: 600; font-size: .84rem; letter-spacing: .12em;
    transition: background .25s;
}

.btn-danger:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

/* Read-only account details on the profile page. */

.readonly-facts { max-width: 620px; display: grid; gap: 18px; margin-bottom: 16px; }

.readonly-facts dt {
    font-size: .6rem; font-weight: 700; letter-spacing: .22em;
    text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px;
}

.readonly-facts dd {
    font-size: 1.05rem; padding-bottom: 9px;
    border-bottom: 1px solid var(--line-soft);
}

.readonly-facts .field-hint { margin-top: 6px; }
