/*
Theme Name: MythBytes
Theme URI: https://mythbytestv.com
Author: Mike Johnson
Description: Custom theme for MythBytesTV — stories, character bible, timeline, and trading cards. Built to pair with the MythBytes Content Types plugin. No page builder, no bloat.
Version: 2.0.0
Requires PHP: 7.4
Text Domain: mythbytes
*/

/* =========================================================
 * MYTHBYTES DESIGN TOKENS — v3.0.0, the manuscript-and-archive palette.
 *
 * Phase 4 replaced the gold-forward palette with a dark-archive /
 * aged-manuscript family. Gold is retired as the default signal for
 * headings, borders and buttons — bronze does that job now, more quietly.
 * Gold is not deleted from the codebase (a couple of legacy custom-property
 * names remain as aliases below so nothing silently breaks), it is simply
 * no longer what anything reaches for by default.
 *
 *   ink         archive black — the site shell, always dark
 *   charcoal    raised dark surface (cards, panels, the masthead plate)
 *   parchment   the ONE warm surface — founder note, excerpts, source
 *               notes, full-story reading surface. Not a full-site skin.
 *   bronze      the new default accent: nav, links, rules, focus, YouTube
 *   oxblood     sparing manuscript-style emphasis only — never a second
 *               brand colour, never a large fill
 * ========================================================= */

:root {
    --ink:        #090c0e;
    --ink-raised: #111619;
    --slate:      #0d1113;
    --slate-soft: #161d21;

    --stone:      #e4dbc8;
    --stone-dim:  #aea690;
    --stone-faint:#6c6558;

    /* The manuscript surface. Kept as its own small scale rather than one
       flat colour so text-on-parchment has room to breathe (a hairline,
       a caption, a heading each need a slightly different value). */
    --parchment:      #d8c9a7;
    --parchment-hi:   #e8dec7;
    --parchment-line: rgba(41, 36, 28, 0.16);
    --ink-on-parchment: #29241c;
    --ink-on-parchment-dim: #4a4234;

    /* Bronze — the site's one working accent now. Still a metal, so still
       a shallow gradient rather than a flat swatch, but far less saturated
       and far less frequent than the old gold fill. */
    --bronze:      #a88132;
    --bronze-hi:   #c9a457;
    --bronze-deep: #6e5420;
    --leaf: linear-gradient(177deg, var(--bronze-hi) 0%, var(--bronze) 55%, var(--bronze-deep) 100%);

    /* Oxblood — sparing manuscript emphasis. Pull-quote marks, a source
       marker, a rare editorial accent. Never a border default, never a
       button fill. */
    --oxblood:      #6e2828;
    --oxblood-dim:  #8a3d3d;

    --slate-accent: #59656a;

    /* Legacy aliases: a few older component rules still reference these
       names. Pointed at the new bronze scale so nothing needs a second
       pass, but new work should reach for --bronze directly. */
    --gold:       var(--bronze);
    --gold-hi:    var(--bronze-hi);
    --gold-deep:  var(--bronze-deep);
    --amber:      var(--bronze-hi);

    /* Hairlines and engraving. Neutral stone-tinted now rather than
       gold-tinted — a divider should read as "archive," not "brand." */
    --rule:        rgba(228, 219, 200, 0.14);
    --rule-strong: rgba(228, 219, 200, 0.28);
    --rule-dim:    rgba(228, 219, 200, 0.09);
    --engrave:     inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 1px 0 rgba(0, 0, 0, 0.65);

    /* Per-culture accent. Set on a wrapper by the templates; everything
       downstream reads --accent, so a Norse page is cold and an Egyptian
       page is warm without duplicating a single rule. Desaturated from
       Phase 3's set to sit quietly against the new neutral rules instead
       of competing with them. */
    --accent:      var(--bronze);
    --accent-soft: rgba(168, 129, 50, 0.14);

    --measure: 68ch;
    --measure-article: 66ch;
    --gutter: clamp(1.15rem, 3.5vw, 2.75rem);
    --shell: 1180px;

    --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
    --step-0:  clamp(1.02rem, 0.98rem + 0.2vw, 1.14rem);
    --step-1:  clamp(1.24rem, 1.15rem + 0.45vw, 1.5rem);
    --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
    --step-3:  clamp(1.95rem, 1.5rem + 2.2vw, 3.1rem);
    --step-4:  clamp(2.4rem, 1.6rem + 4vw, 4.6rem);
}

[data-culture="greek"]    { --accent: #b7ac8a; --accent-soft: rgba(183, 172, 138, 0.12); }
[data-culture="norse"]    { --accent: #7e97a0; --accent-soft: rgba(126, 151, 160, 0.12); }
[data-culture="egyptian"] { --accent: #b98f52; --accent-soft: rgba(185, 143, 82, 0.13); }
[data-culture="celtic"]   { --accent: #7c9679; --accent-soft: rgba(124, 150, 121, 0.12); }
[data-culture="japanese"] { --accent: #a97878; --accent-soft: rgba(169, 120, 120, 0.12); }
[data-culture="slavic"]   { --accent: #8f81a0; --accent-soft: rgba(143, 129, 160, 0.12); }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background-color: var(--ink);
    color: var(--stone-dim);
    font-family: 'EB Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
    font-size: var(--step-0);
    line-height: 1.68;
    /* Two layers, both cheap: a woven grain so large dark areas aren't dead
       flat, and a vignette that pulls the eye inward the way the banner
       art does. Deliberately NOT a centred glow behind the content. */
    background-image:
        radial-gradient(circle at 50% -12%, rgba(168, 129, 50, 0.04), transparent 58%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    background-attachment: fixed, fixed;
}

.wrap {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

main.wrap { padding-block: clamp(2.2rem, 5vw, 4rem) 0; }

/* ---------- type ----------
 * Phase 4: heading case and tracking were the single biggest repeated
 * "fantasy template" tell — every h1 through h4, sitewide, was tracked
 * uppercase Cinzel. Uppercase+tracking is now reserved for what it's
 * actually for — short labels, eyebrows, nav, metadata (see .tracked and
 * .tag below) — and headings read as an editor's title case instead of a
 * shouted banner. Only h1/h2 keep the Cinzel display face; h3/h4 (used
 * for card titles, list items, repeated dozens of times per page) move to
 * the reading serif so they stop competing with real section headings. */

h1, h2,
.display {
    font-family: 'Cinzel', 'Trajan Pro', 'Optima', Georgia, serif;
    font-weight: 600;
    color: var(--stone);
    line-height: 1.14;
    letter-spacing: 0.01em;
    margin: 0 0 0.5em;
    text-wrap: balance;
}
h3, h4 {
    font-family: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
    font-weight: 600;
    color: var(--stone);
    line-height: 1.25;
    margin: 0 0 0.4em;
    text-wrap: balance;
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); color: var(--stone-dim); font-style: italic; font-weight: 500; }

p { margin: 0 0 1.15em; max-width: var(--measure); }

a {
    color: var(--bronze-hi);
    text-decoration: none;
    text-underline-offset: 0.22em;
    text-decoration-thickness: 1px;
    transition: color 0.16s ease;
}
a:hover { color: var(--stone); text-decoration: underline; }

strong { color: var(--stone); font-weight: 600; }

::selection { background: rgba(232, 185, 60, 0.26); color: #fff; }

:where(a, button, select, input, summary):focus-visible {
    outline: 2px solid var(--gold-hi);
    outline-offset: 3px;
}

/* The banner sets the voice for small text: wide-tracked caps with
   flanking rules. Used for eyebrows, meta lines, nav and buttons. */
.tracked {
    font-family: 'Cinzel', Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    font-size: var(--step--1);
    color: var(--bronze);
}

/* ---------- ornaments ---------- */

/* The banner flanks its tagline with a thin rule and an arrowhead. This
   is that device, reusable as a section divider. */
.flourish {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 0 0 1.6rem;
}
.flourish::before,
.flourish::after {
    content: '';
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, transparent, var(--rule), transparent);
}
.flourish > * { margin: 0; flex: 0 0 auto; }

/* Corner ticks — cut corners instead of rounded ones. Applied to framed
   things (portraits, art windows, the masthead plate). */
.ticked { position: relative; }
.ticked::before,
.ticked::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
    border-color: var(--rule-strong);
    border-style: solid;
}
.ticked::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.ticked::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

hr, .rule {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--rule), transparent);
    margin: 2.5rem 0;
}

/* =========================================================
 * MASTHEAD — v3.0.0: one small strip, every page, no exceptions.
 *
 * Phase 3 gave the homepage a full-bleed, near-300px illustrated banner —
 * exactly the "symmetrical lineup of mythological figures around a giant
 * stone title" that reads as generated fantasy-game branding. It is now a
 * single unified treatment at a fraction of that height, everywhere,
 * cropped to the top edge of the artwork (the rune-ring texture) rather
 * than the figures-and-title band, so what survives is ambient texture,
 * not a second logo. The wordmark stays legible and small, over it, on
 * every page — home included. No new artwork was generated; this is a
 * smaller window onto the same file. */

.site-header {
    position: relative;
    background: var(--ink);
    border-bottom: 1px solid var(--rule);
}

.masthead {
    position: relative;
    display: block;
    min-height: clamp(64px, 6.5vw, 84px);
    background-image: url('assets/brand/banner-1920.jpg');
    background-size: 200% auto;
    background-position: center top;
    isolation: isolate;
}
/* Fade the banner's own edges into the page so it reads as one surface
   rather than a photo pasted on top of a dark box. */
.masthead::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, rgba(9, 12, 14, 0.35) 0%, var(--ink) 100%),
        linear-gradient(to right, var(--ink) 0%, transparent 22%, transparent 78%, var(--ink) 100%);
    pointer-events: none;
}
.masthead .wrap { position: relative; z-index: 1; }

.masthead-inner {
    min-height: inherit;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-block: clamp(0.6rem, 1.6vw, 1rem);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}
.brand-mark img {
    display: block;
    height: clamp(36px, 4.4vw, 50px);
    width: auto;
    filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.75));
}

/* ---------- navigation ----------
 * A native <details>/<summary> disclosure that starts OPEN in the markup
 * (see header.php for why forcing a CLOSED one open via CSS turned out to
 * be unreliable in Chromium). Above the nav breakpoint it simply stays
 * open — a plain horizontal bar, exactly like a normal <nav>. Below it,
 * site.js collapses it on load and the browser's own native toggle
 * behaviour becomes the mobile menu; without JavaScript the full nav
 * stays visible and expanded at every width, which is a strictly safe
 * fallback rather than a broken one. site.js also adds Escape-to-close, a
 * scroll lock, and closing on navigation — all enhancements layered on
 * top of behaviour that already works without them. */

.site-nav {
    border-top: 1px solid var(--rule-dim);
    background: linear-gradient(to bottom, rgba(12, 16, 20, 0.92), rgba(7, 9, 12, 0.98));
}
.site-nav .wrap { min-height: 56px; display: flex; align-items: stretch; }
.nav-disclosure { width: 100%; }

.nav-toggle {
    display: none; /* shown only below the breakpoint, see media query */
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.95rem 0;
    background: none;
    border: 0;
    color: var(--stone);
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.92rem;
    letter-spacing: 0.06em;
    cursor: pointer;
    list-style: none; /* hide the default disclosure triangle */
}
.nav-toggle::-webkit-details-marker { display: none; }
.nav-toggle::marker { content: ''; }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 20px;
    height: 1px;
    background: var(--gold);
    content: '';
}
.nav-toggle-bars { position: relative; flex: none; }
.nav-toggle-bars::before { position: absolute; top: -6px; }
.nav-toggle-bars::after  { position: absolute; top: 6px; }
/* Native open state re-draws the bars as a close mark — a real state
   change, not decoration, so the control never lies about what it does. */
.nav-disclosure[open] .nav-toggle-bars { background: transparent; }
.nav-disclosure[open] .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.nav-disclosure[open] .nav-toggle-bars::after  { top: 0; transform: rotate(-45deg); }

.nav-panel {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1.6rem);
    width: 100%;
}

#primary-nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}
#primary-nav li + li { border-left: 1px solid var(--rule-dim); }
#primary-nav a {
    display: block;
    padding: 0.95rem clamp(0.65rem, 1.7vw, 1.25rem);
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.86rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--stone-dim);
    position: relative;
}
#primary-nav a:hover { color: var(--gold-hi); text-decoration: none; }
/* Underline grows from the centre — a drawn rule, not a background swap. */
#primary-nav a::after {
    content: '';
    position: absolute;
    left: 50%;
    right: 50%;
    bottom: 11px;
    height: 1px;
    background: var(--leaf);
    transition: left 0.22s ease, right 0.22s ease;
}
#primary-nav a:hover::after,
#primary-nav .is-current a::after { left: clamp(0.65rem, 1.7vw, 1.25rem); right: clamp(0.65rem, 1.7vw, 1.25rem); }
#primary-nav .is-current a { color: var(--gold); }

.social-links { display: flex; gap: 1.1rem; list-style: none; margin: 0; padding: 0; }
.social-links a {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.74rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--stone-faint);
}
.social-links a:hover { color: var(--bronze); text-decoration: none; }

/* ---------- buttons ----------
 * .btn is the shared ghost/bordered base used throughout the whole site
 * (story pages, character pages, archives) — untouched here on purpose.
 * The modifiers below are additions layered on top of it, not replacements. */

.btn {
    display: inline-block;
    padding: 0.72em 1.9em;
    font-family: 'Cinzel', Georgia, serif;
    font-size: var(--step--1);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bronze-hi);
    background: transparent;
    border: 1px solid var(--rule-strong);
    box-shadow: var(--engrave);
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.btn:hover {
    background: rgba(232, 185, 60, 0.1);
    color: #fff;
    text-decoration: none;
}
.btn-solid {
    color: var(--ink);
    background: var(--leaf);
    border-color: transparent;
    font-weight: 700;
}
.btn-solid:hover { color: var(--ink); filter: brightness(1.1); }
.btn-lg { padding: 0.85em 2.4em; font-size: var(--step-0); letter-spacing: 0.15em; }
.btn-sm { padding: 0.5em 1.05em; font-size: 0.76rem; letter-spacing: 0.13em; }

/* The page's one non-gold, non-ghost action — reserved for "Begin With a
   Story" in the hero. Gold stays exclusively a YouTube/brand-accent colour
   on this page; the site's OWN primary action is ivory instead, so the two
   never compete for the same visual meaning. */
.btn-primary {
    color: var(--ink);
    background: var(--stone);
    border-color: transparent;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.85em 2.2em;
}
.btn-primary:hover { background: #fff; color: var(--ink); }

/* A plain icon+text link — no border, no fill. Used wherever "Watch on
   YouTube" needs to sit quietly beside a stronger action instead of
   competing with it (hero secondary action, story cards). */
.btn-youtube-text {
    display: inline-flex;
    align-items: center;
    gap: 0.55em;
    color: var(--gold);
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.86rem;
    letter-spacing: 0.06em;
    padding: 0.6em 0.2em;
}
.btn-youtube-text:hover { color: var(--gold-hi); text-decoration: underline; }
.btn-youtube-text--lg { font-size: var(--step--1); }
.btn-youtube-text .icon-youtube { width: 22px; height: auto; flex: none; fill: currentColor; }

/* The header's persistent CTA: .btn's ghost treatment plus the icon. Gold
   as an accent (text + border), never a filled gradient block — that
   treatment is reserved for the ONE strong invitation at the end of the
   homepage, so the chrome doesn't out-shout the brand on every page. */
.btn-youtube-header { display: inline-flex; align-items: center; gap: 0.5em; white-space: nowrap; }
.btn-youtube-header .icon-youtube { width: 16px; height: auto; fill: currentColor; }

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.3rem;
    align-items: center;
    max-width: none;
}

.eyebrow { margin-bottom: 0.9rem; }
.lede {
    font-size: var(--step-1);
    color: var(--stone-dim);
    max-width: 60ch;
}

.section { padding-block: clamp(2rem, 4.5vw, 3.4rem); }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.6rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--rule);
}
.section-head h2 { margin: 0; }
.section-head .more {
    font-size: var(--step--1);
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-family: 'Cinzel', Georgia, serif;
    white-space: nowrap;
    flex: none;
}

/* =========================================================
 * CODEX LIST — the default listing shape
 * A ruled index, like the contents page of an old volume. This is the
 * deliberate alternative to a uniform grid of rounded cards.
 * ========================================================= */

.codex { list-style: none; margin: 0; padding: 0; }
.codex > li { border-top: 1px solid var(--rule-dim); }
.codex > li:last-child { border-bottom: 1px solid var(--rule-dim); }

.codex-row {
    display: grid;
    grid-template-columns: clamp(76px, 11vw, 128px) 1fr;
    gap: clamp(1rem, 2.5vw, 2rem);
    align-items: start;
    padding: clamp(1.1rem, 2.4vw, 1.7rem) 0.35rem;
    color: inherit;
    transition: background-color 0.18s ease, padding-left 0.18s ease;
}
.codex-row:hover {
    background: linear-gradient(90deg, var(--accent-soft), transparent 72%);
    text-decoration: none;
    padding-left: 1rem;
}
.codex-row:hover .codex-title { color: var(--gold-hi); }

/* These wrappers are <span>s inside an <a>, so they must be blockified
   explicitly — aspect-ratio is ignored on inline boxes. */
.codex-text, .codex-title, .codex-excerpt { display: block; }

.codex-figure {
    display: block;
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--slate);
    border: 1px solid var(--rule-dim);
}
.codex-figure img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.9) contrast(1.04); }
/* No image yet? Show the monogram rather than an empty hole. */
.codex-figure.is-empty {
    background-image: url('assets/brand/monogram-flat.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 42%;
    opacity: 0.4;
}

.codex-title {
    /* A Story or Character title is a real title, not a label — it now
       reads in the same case an editor would set it in print, instead of
       shouting every entry in an archive listing. */
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 600;
    font-size: var(--step-1);
    color: var(--stone);
    margin: 0 0 0.35rem;
    transition: color 0.16s ease;
}
.codex-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.55rem;
}
.codex-excerpt { margin: 0; color: var(--stone-dim); max-width: 62ch; }

/* Small caps label with a leading lozenge — the taxonomy chip. Square,
   hairline, no pill shapes. */
.tag {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    padding: 0.25em 0.7em;
    border: 1px solid currentColor;
    opacity: 0.85;
    white-space: nowrap;
}
.tag-plain { border: 0; padding: 0; opacity: 1; color: var(--stone-faint); }
.sep { color: var(--stone-faint); opacity: 0.6; }

/* =========================================================
 * PORTRAIT GRID — characters
 * Arched frames, not rounded rectangles. The arch is the one curve in
 * the whole theme and it is load-bearing: temple niche, icon panel.
 * ========================================================= */

.portrait-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
    gap: clamp(1.1rem, 2.6vw, 2rem);
    list-style: none;
    margin: 0;
    padding: 0;
}

.portrait-card { display: block; color: inherit; text-align: center; }
.portrait-frame {
    display: block;
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--slate);
    border: 1px solid var(--rule);
    border-radius: 48% 48% 0 0 / 22% 22% 0 0;
    box-shadow: var(--engrave);
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.portrait-frame img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(0.88) contrast(1.05);
    transition: transform 0.4s ease, filter 0.3s ease;
}
.portrait-card:hover .portrait-frame { border-color: var(--rule-strong); }
.portrait-card:hover .portrait-frame img { transform: scale(1.045); filter: saturate(1) contrast(1.08); }
.portrait-frame.is-empty {
    background-image: url('assets/brand/monogram-flat.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 38%;
    opacity: 0.45;
}
/* Light rakes across the frame from the top, like the banner's lighting. */
.portrait-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(252, 215, 95, 0.09), transparent 38%, rgba(7, 9, 12, 0.72));
    pointer-events: none;
}
.portrait-card h3 { margin: 0.85rem 0 0.2rem; font-size: var(--step-0); }
.portrait-card .epithet { font-size: var(--step--1); font-style: italic; color: var(--stone-faint); display: block; }

/* =========================================================
 * SINGLE ENTRIES
 * ========================================================= */

.entry { padding-bottom: clamp(2rem, 5vw, 3.5rem); }
.entry-head { margin-bottom: 2rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--rule); }
.entry-head .codex-meta { margin-bottom: 0; }
.entry-head h1 { margin-bottom: 0.45rem; }

.entry-body { max-width: var(--measure); font-size: 1.06em; }
.entry-body.is-plain { white-space: pre-line; }

/* The illuminated initial is reserved for full Stories now — it was
   previously on the shared .entry-body class, so every Character bio,
   Timeline event and Card description got one too. "A restrained device
   at the start of full stories," not a drop cap on every archive entry. */
.manuscript-body p:first-of-type::first-letter {
    float: left;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 3.3em;
    line-height: 0.82;
    padding: 0.06em 0.1em 0 0;
    color: var(--oxblood);
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 0 0 2rem;
    border: 1px solid var(--rule);
    box-shadow: var(--engrave);
    background: #000;
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.entry-aside {
    margin-top: 2.5rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--rule);
}

/* Character detail: portrait plate beside the text, not floated into it. */
.character-detail {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: start;
}
@media (max-width: 720px) {
    .character-detail { grid-template-columns: 1fr; }
}
/* No border, no frame — the portrait is presented, not filed in a box.
   A soft shadow gives it depth against the dark page without drawing a
   rectangle around it. */
.character-plate {
    position: relative;
    background: transparent;
}
.character-plate img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
}
.character-plate figcaption {
    padding-top: 0.8rem;
    font-size: var(--step--1);
    font-style: italic;
    color: var(--stone-faint);
    text-align: center;
}

/* The reference block (epithets, tradition, domains, family…) reads as a
   card of source material now, on the manuscript surface — not a plain
   dark definition list. */
.stat-list { margin: 0 0 1.6rem; }
.stat-list dt {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.72rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--stone-faint);
    margin-bottom: 0.2rem;
}
.stat-list dd { margin: 0 0 1rem; color: var(--stone); }
.stat-list .epithets { color: var(--bronze-hi); font-style: italic; }

.parchment .stat-list dt { color: var(--ink-on-parchment-dim); }
.parchment .stat-list dd { color: var(--ink-on-parchment); }
.parchment .stat-list .epithets { color: var(--oxblood); }

/* =========================================================
 * TIMELINE
 * ========================================================= */

.timeline { position: relative; margin: 2rem 0 0; padding: 0 0 0 clamp(1.6rem, 4vw, 2.6rem); list-style: none; }
.timeline::before {
    content: '';
    position: absolute;
    top: 6px; bottom: 6px; left: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--rule), var(--rule), transparent);
}
.timeline-item { position: relative; padding-bottom: clamp(2rem, 4vw, 3rem); }
/* A plain manuscript marker — a filled diamond, flat bronze, no metallic
   shine or glow. Annotation, not a game-map waypoint. */
.timeline-item::before {
    content: '';
    position: absolute;
    left: calc(clamp(1.6rem, 4vw, 2.6rem) * -1 - 4px);
    top: 0.55em;
    width: 7px; height: 7px;
    background: var(--bronze);
    transform: rotate(45deg);
    box-shadow: 0 0 0 4px var(--ink);
}
.timeline-date {
    font-family: 'Cinzel', Georgia, serif;
    font-size: var(--step--1);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bronze-hi);
    margin-bottom: 0.3rem;
}
.timeline-item h3 { margin-bottom: 0.4rem; }

/* =========================================================
 * FILTERS
 * ========================================================= */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
    margin: 0 0 1.8rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--rule-dim);
}
.filters label {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--stone-faint);
    margin-right: 0.3rem;
}
.filters select {
    appearance: none;
    background-color: var(--slate);
    background-image: linear-gradient(45deg, transparent 50%, var(--bronze) 50%), linear-gradient(135deg, var(--bronze) 50%, transparent 50%);
    background-position: calc(100% - 17px) center, calc(100% - 12px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    color: var(--stone);
    border: 1px solid var(--rule-dim);
    border-radius: 0;
    padding: 0.55em 2.4em 0.55em 0.9em;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: var(--step--1);
    box-shadow: var(--engrave);
}
.filters select:hover { border-color: var(--rule); }
.filters button { cursor: pointer; }

/* =========================================================
 * EMPTY STATES / PAGINATION / FOOTER
 * ========================================================= */

.empty-state {
    padding: clamp(2rem, 5vw, 3.5rem);
    text-align: center;
    border: 1px solid var(--rule-dim);
    background: rgba(15, 20, 22, 0.5);
    color: var(--stone-faint);
    font-style: italic;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 2.5rem 0 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule-dim);
}
.pagination .page-numbers {
    display: inline-block;
    min-width: 2.4em;
    padding: 0.45em 0.7em;
    text-align: center;
    font-family: 'Cinzel', Georgia, serif;
    font-size: var(--step--1);
    letter-spacing: 0.1em;
    color: var(--stone-dim);
    border: 1px solid var(--rule-dim);
}
.pagination .page-numbers:hover { border-color: var(--rule-strong); color: var(--gold-hi); text-decoration: none; }
.pagination .page-numbers.current { color: var(--ink); background: var(--leaf); border-color: transparent; font-weight: 700; }

.site-footer {
    margin-top: clamp(3rem, 7vw, 5.5rem);
    padding-block: clamp(2rem, 4vw, 3rem);
    border-top: 1px solid var(--rule);
    background: linear-gradient(to bottom, transparent, rgba(15, 20, 22, 0.55));
    color: var(--stone-faint);
    font-size: var(--step--1);
}
.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
}
.site-footer .footer-mark { display: flex; align-items: center; gap: 0.8rem; }
.site-footer .footer-mark img { height: 42px; width: auto; opacity: 0.85; }
.site-footer .footer-tag { font-style: italic; }

/* ---------- 404 ---------- */
.not-found {
    padding-block: clamp(3rem, 9vw, 7rem);
    text-align: center;
}
.not-found h1 { font-size: var(--step-3); }
.not-found p { margin-inline: auto; }

/* ---------- utilities ---------- */
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}
.skip-link:focus {
    position: fixed;
    top: 8px; left: 8px;
    z-index: 999;
    width: auto; height: auto;
    clip: auto;
    padding: 0.7em 1.2em;
    background: var(--gold);
    color: var(--ink);
}

img { max-width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
