/* ============================================================
 * pwwritings.com — catalog stylesheet
 *
 * Six display styles share the literary-paper foundation from
 * styles.css (palette, fonts) and layer on their own composition
 * underneath a single .catalog container. Only one style is
 * active at a time via the `catalog--<name>` modifier class.
 *
 * Style index:
 *   01  Editorial Index    — typographic table of contents
 *   02  Library Stacks     — vertical book spines on a shelf
 *   03  Manuscript Archive — rotated index cards with tape
 *   04  Cinema Marquee     — full-bleed horizontal scroll
 *   05  Newspaper          — broadsheet front-page columns
 *   06  Periodical Timeline— vertical timeline by date
 * ============================================================ */

:root {
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    /* Library spine palette — leather and paper hues */
    --spine-1: #6b2b1d;   /* oxblood */
    --spine-2: #2e3b30;   /* moss */
    --spine-3: #4a3a28;   /* tan leather */
    --spine-4: #5a3a52;   /* aubergine */
    --spine-5: #2e3a5a;   /* navy */
    --spine-6: #663318;   /* burnt sienna */
    --spine-7: #3d4a3a;   /* sage */
    --spine-8: #5a3422;   /* cordovan */

    /* Manuscript-archive surfaces */
    --card-paper: #f7f0df;
    --card-paper-shadow: rgba(40, 30, 20, 0.18);
    --tape: rgba(216, 196, 144, 0.55);
}

.catalog-page {
    /* Slight texture under the entire page — sits under everything. */
    background:
        radial-gradient(circle at 20% 0%, rgba(107, 43, 29, 0.04) 0, transparent 60%),
        radial-gradient(circle at 80% 100%, rgba(46, 58, 90, 0.04) 0, transparent 60%),
        var(--paper);
}

/* ============================================================
 * MASTHEAD
 * ============================================================ */
.masthead {
    padding: 2.4rem 2rem 1.2rem;
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
}

.masthead-inner {
    max-width: 76rem;
    margin: 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2rem;
}

.masthead-brand {
    text-decoration: none;
    color: var(--ink);
    display: inline-flex;
    align-items: baseline;
    gap: 0.55rem;
    font-family: var(--font-display);
}

.masthead-mark {
    display: inline-block;
    font-weight: 900;
    font-size: 1.7rem;
    letter-spacing: -0.02em;
    line-height: 1;
    padding: 0.15rem 0.45rem 0.2rem;
    background: var(--ink);
    color: var(--paper);
}

.masthead-name {
    font-style: italic;
    font-weight: 500;
    font-size: 1.5rem;
    font-variation-settings: "opsz" 24;
    letter-spacing: -0.01em;
}

.masthead-nav {
    display: flex;
    gap: 2rem;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}
.masthead-nav a {
    color: var(--ink-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: color 200ms ease, border-color 200ms ease;
}
.masthead-nav a:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

.masthead-tagline {
    max-width: 76rem;
    margin: 1.4rem auto 0;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.05rem;
    color: var(--ink-muted);
    letter-spacing: 0.005em;
}
.masthead-tagline span {
    color: var(--ink-faint);
}

/* ============================================================
 * SUBSCRIPTION STRIP
 * The site's primary offer. Sits between masthead and switcher.
 * ============================================================ */
.sub-strip {
    background: var(--paper-darker);
    border-bottom: 1px solid var(--rule);
    padding: 3.4rem 1.5rem 3.6rem;
    text-align: center;
    position: relative;
}
/* A pair of decorative hairlines flanking the strip — barely-there. */
.sub-strip::before,
.sub-strip::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4rem;
    height: 1px;
    background: var(--ink-faint);
    opacity: 0.5;
}
.sub-strip::before { top: 1.4rem; }
.sub-strip::after  { bottom: 1.4rem; }

.sub-strip-inner {
    max-width: 56rem;
    margin: 0 auto;
}

.sub-eyebrow {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 1.1rem;
}

.sub-headline {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.8rem, 4.2vw, 2.7rem);
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0 0 0.6rem;
    color: var(--ink);
    font-variation-settings: "opsz" 36;
}
.sub-headline em {
    font-style: italic;
    font-weight: 600;
    color: var(--accent);
}

.sub-detail {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-muted);
    margin: 0 0 1.7rem;
    font-size: 1.06rem;
    line-height: 1.4;
}

.sub-actions {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sub-or {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-faint);
    font-size: 1rem;
}

@media (max-width: 520px) {
    .sub-actions { flex-direction: column; gap: 1rem; }
}

/* ============================================================
 * STYLE SWITCHER
 * ============================================================ */
.switcher {
    max-width: 76rem;
    margin: 0 auto;
    padding: 2.5rem 2rem 0;
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.switcher-label {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.switcher-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.chip {
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--rule);
    padding: 0.55rem 0.9rem;
    display: inline-flex;
    align-items: baseline;
    gap: 0.55rem;
    font-family: var(--font-ui);
    color: var(--ink-muted);
    font-size: 0.78rem;
    transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.chip:hover {
    background: var(--paper-darker);
    color: var(--ink);
}
.chip[aria-selected="true"] {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}
.chip[aria-selected="true"] .chip-num { color: var(--paper-darker); }
.chip-num {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-faint);
    letter-spacing: 0;
}
.chip-name {
    letter-spacing: 0.06em;
}

/* ============================================================
 * SHARED — loading, banner, container reset
 * ============================================================ */
.catalog {
    min-height: 50vh;
    padding: 4rem 0;
}

.catalog-loading {
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-faint);
    padding: 5rem 1rem;
}

/* Stagger animation reused by several styles. Items add
   `data-stagger="N"` and pick up the delay automatically. */
@keyframes catalogReveal {
    from { opacity: 0; transform: translateY(0.6rem); }
    to   { opacity: 1; transform: translateY(0); }
}
[data-stagger] {
    animation: catalogReveal 700ms ease-out both;
}
[data-stagger="0"] { animation-delay:   0ms; }
[data-stagger="1"] { animation-delay:  90ms; }
[data-stagger="2"] { animation-delay: 180ms; }
[data-stagger="3"] { animation-delay: 270ms; }
[data-stagger="4"] { animation-delay: 360ms; }
[data-stagger="5"] { animation-delay: 450ms; }
[data-stagger="6"] { animation-delay: 540ms; }
[data-stagger="7"] { animation-delay: 630ms; }


/* ============================================================
 * 01  EDITORIAL INDEX
 * Typographic table of contents. Hairline rules, big italic
 * numerals. The quiet authority of a literary masthead.
 * ============================================================ */
.catalog--editorial {
    max-width: 64rem;
    margin: 0 auto;
    padding: 5rem 2rem 6rem;
}

.editorial-eyebrow {
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 4rem;
}
.editorial-eyebrow::before,
.editorial-eyebrow::after {
    content: '— ';
    color: var(--rule);
    margin: 0 0.6em;
}

.editorial-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.editorial-row {
    display: grid;
    grid-template-columns: 5rem 1fr 12rem;
    gap: 2.5rem;
    padding: 2.8rem 0;
    border-bottom: 1px solid var(--rule);
    align-items: start;
}
.editorial-row:first-child { border-top: 1px solid var(--rule); }

.editorial-num {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 3.5rem;
    line-height: 1;
    color: var(--ink-faint);
    font-variation-settings: "opsz" 144;
}

.editorial-body h2 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 2rem;
    line-height: 1.05;
    margin: 0 0 0.45rem;
    letter-spacing: -0.015em;
    font-variation-settings: "opsz" 36;
}
.editorial-body h2 em {
    color: var(--ink-muted);
    font-weight: 400;
}
.editorial-body .editorial-author {
    font-family: var(--font-ui);
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.editorial-body p {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--ink-muted);
    max-width: 32em;
    margin: 0.9rem 0 0;
    font-size: 1.02rem;
}

.editorial-meta {
    text-align: right;
    font-family: var(--font-ui);
}
.editorial-prices {
    font-size: 0.92rem;
}
.editorial-prices .price-buy {
    display: block;
    color: var(--ink);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.editorial-prices .price-rent {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}
.editorial-cta-row {
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
}
.editorial-cta {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink);
    padding: 0 0 3px;
    border-bottom: 1px solid var(--ink);
    transition: letter-spacing 240ms ease, color 200ms ease, border-color 200ms ease;
}
.editorial-cta:hover {
    letter-spacing: 0.3em;
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.editorial-cta--ghost {
    color: var(--ink-faint);
    border-bottom-color: var(--ink-faint);
}
.editorial-cta--ghost:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

@media (max-width: 640px) {
    .editorial-row { grid-template-columns: 3rem 1fr; }
    .editorial-num { font-size: 2.4rem; }
    .editorial-meta { grid-column: 2; text-align: left; }
    .editorial-cta-row { align-items: flex-start; }
}


/* ============================================================
 * 02  LIBRARY STACKS
 * Vertical book spines on a shelf. Hover lifts a spine; click
 * scrolls a detail panel below the shelf into view.
 * ============================================================ */
.catalog--stacks {
    padding: 5rem 1.5rem 6rem;
}

.stacks-eyebrow {
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 2rem;
}

.stacks-shelf {
    max-width: 70rem;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.55rem;
    padding: 1.5rem 1.5rem 0;
    min-height: 26rem;
    position: relative;
    /* The shelf itself: a thick wooden plank rendered with gradients. */
    border-bottom: 12px solid #3a2a1d;
    box-shadow:
        0 12px 0 -2px #2b1f15,
        0 22px 24px -10px rgba(40, 25, 15, 0.45);
}

.spine {
    position: relative;
    width: 3.4rem;
    height: 22rem;
    cursor: pointer;
    background-color: var(--spine-color, var(--spine-1));
    background-image:
        linear-gradient(to right,
            rgba(0,0,0,0.22) 0%,
            transparent 6%,
            transparent 94%,
            rgba(255,255,255,0.06) 100%),
        repeating-linear-gradient(to bottom,
            rgba(255,255,255,0.025) 0px,
            rgba(255,255,255,0.025) 1px,
            transparent 1px,
            transparent 4px);
    box-shadow: -1px 0 0 rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 0.35rem 1.3rem;
    transition: transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-origin: bottom center;
}
.spine:hover, .spine:focus-visible {
    transform: translateY(-2.2rem);
    box-shadow:
        -1px 0 0 rgba(0,0,0,0.2),
        0 18px 30px -8px rgba(0, 0, 0, 0.45);
    outline: none;
    z-index: 4;
}
.spine[aria-pressed="true"] {
    transform: translateY(-3.6rem);
    box-shadow:
        -1px 0 0 rgba(0,0,0,0.2),
        0 24px 40px -10px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.spine-rule {
    width: 70%;
    height: 1px;
    background: rgba(255,255,255,0.18);
}

.spine-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    color: rgba(255, 248, 232, 0.94);
    letter-spacing: 0.02em;
    text-shadow: 0 1px 0 rgba(0,0,0,0.25);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-height: 18rem;
}

.spine-author {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: var(--font-ui);
    font-size: 0.6rem;
    color: rgba(255, 248, 232, 0.55);
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

/* The detail card revealed below the shelf when a spine is selected. */
.stacks-detail {
    max-width: 42rem;
    margin: 5rem auto 0;
    padding: 2.2rem 2.4rem;
    background: var(--paper-darker);
    border: 1px solid var(--rule);
    box-shadow: 0 1px 0 var(--paper-darker);
    position: relative;
    min-height: 0;
    display: none;
}
.stacks-detail[data-shown="true"] {
    display: block;
    animation: catalogReveal 480ms ease-out both;
}
.stacks-detail-eyebrow {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 0.6rem;
}
.stacks-detail h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 2.2rem;
    line-height: 1.1;
    margin: 0 0 0.4rem;
    letter-spacing: -0.015em;
    font-variation-settings: "opsz" 36;
}
.stacks-detail .author {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.stacks-detail .desc {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--ink-muted);
    margin: 1.2rem 0 1.5rem;
    line-height: 1.55;
}
.stacks-detail-actions {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

/* Reusable solid CTA button for several styles below. */
.btn-solid {
    cursor: pointer;
    background: var(--ink);
    color: var(--paper);
    border: 1px solid var(--ink);
    padding: 0.75rem 1.4rem;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: background 200ms ease, color 200ms ease;
}
.btn-solid:hover {
    background: var(--accent);
    border-color: var(--accent);
}
.btn-ghost {
    cursor: pointer;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink);
    padding: 0.75rem 1.4rem;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: background 200ms ease, color 200ms ease;
}
.btn-ghost:hover {
    background: var(--ink);
    color: var(--paper);
}


/* ============================================================
 * 03  MANUSCRIPT ARCHIVE
 * A grid of slightly rotated index cards, each held by a strip
 * of masking tape. Typewriter type. Casual but careful.
 * ============================================================ */
.catalog--archive {
    max-width: 76rem;
    margin: 0 auto;
    padding: 5rem 2rem 7rem;
    /* Subtle corkboard texture under the cards */
    background-image:
        radial-gradient(circle at 30% 40%, rgba(140, 100, 60, 0.05) 0, transparent 50%),
        radial-gradient(circle at 75% 70%, rgba(140, 100, 60, 0.04) 0, transparent 55%);
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: 3.2rem 2.4rem;
    padding: 1rem;
}

.card-archive {
    position: relative;
    background: var(--card-paper);
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 1.55rem,
            rgba(80, 40, 20, 0.07) 1.55rem,
            rgba(80, 40, 20, 0.07) calc(1.55rem + 1px)
        );
    padding: 2.2rem 1.6rem 1.6rem;
    box-shadow:
        0 2px 4px var(--card-paper-shadow),
        0 10px 22px -8px var(--card-paper-shadow);
    transform: rotate(var(--rot, -1.5deg));
    transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 420ms ease;
    cursor: pointer;
}
.card-archive:hover {
    transform: rotate(0deg) translateY(-4px);
    box-shadow:
        0 4px 8px var(--card-paper-shadow),
        0 18px 36px -10px var(--card-paper-shadow);
    z-index: 4;
}

/* The "tape" holding the card */
.card-archive::before {
    content: '';
    position: absolute;
    top: -0.7rem;
    left: 50%;
    transform: translateX(-50%) rotate(-1.5deg);
    width: 4.8rem;
    height: 1.4rem;
    background: var(--tape);
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
    /* Torn tape edges */
    clip-path: polygon(
        2% 12%, 8% 0%, 18% 8%, 30% 2%, 42% 14%, 54% 0%,
        66% 10%, 78% 4%, 88% 16%, 96% 6%, 100% 92%,
        92% 88%, 80% 100%, 68% 90%, 56% 96%, 44% 86%,
        32% 98%, 20% 88%, 10% 96%, 0% 84%
    );
}

.card-archive .filing {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
    letter-spacing: 0.1em;
    margin: 0 0 1rem;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
}

.card-archive h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.55rem;
    line-height: 1.1;
    margin: 0 0 0.4rem;
    letter-spacing: -0.01em;
    font-variation-settings: "opsz" 36;
}
.card-archive .author {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-muted);
    letter-spacing: 0.05em;
    margin: 0 0 1.1rem;
}

.card-archive .desc {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--ink-muted);
    margin: 0 0 1.4rem;
}

.card-archive .stamp {
    display: inline-block;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    padding: 0.25rem 0.55rem;
    text-transform: uppercase;
    transform: rotate(-3deg);
    margin: 0 0 1rem;
    opacity: 0.85;
}

.card-archive .actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    border-top: 1px dashed rgba(80, 40, 20, 0.25);
    padding-top: 1rem;
}
.card-archive .archive-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--ink);
}
.card-archive .archive-btn:hover { color: var(--accent); border-bottom-color: var(--accent); }


/* ============================================================
 * 04  CINEMA MARQUEE
 * Full-bleed horizontal scroll-snap. Each book gets a viewport.
 * The biggest typography on the site.
 * ============================================================ */
.catalog--marquee {
    padding: 0;
    /* Reset the shared catalog padding to take the whole stripe. */
}

.marquee-rail {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.marquee-rail::-webkit-scrollbar { display: none; }

.marquee-slide {
    flex: 0 0 100vw;
    height: 78vh;
    min-height: 36rem;
    scroll-snap-align: start;
    position: relative;
    padding: 4rem 5vw;
    display: grid;
    /* Two rows: a tall content row (text + pullquote bottom-aligned),
     * and a short footer row (actions + counter on the same baseline).
     * Before round 11 this was a single-row grid with actions/counter
     * absolute-positioned over the bottom of the slide; the absolute
     * children were technically out of grid flow but the .marquee-pullquote
     * carried a `margin-bottom: 4rem` to manually clear them, which broke
     * `align-items: end` between text and pullquote. Now the footer row
     * holds them naturally. */
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
        "text     pull"
        "actions  counter";
    column-gap: 3rem;
    row-gap: 1.5rem;
    align-items: end;
    background: var(--paper);
    border-right: 1px solid var(--rule);
    overflow: hidden;
}
.marquee-slide:last-child { border-right: none; }

/* A monolithic numeral in the back, half-cropped */
.marquee-slide::before {
    content: attr(data-num);
    position: absolute;
    top: -1rem;
    right: -1rem;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 900;
    font-size: clamp(18rem, 38vw, 32rem);
    line-height: 0.85;
    color: var(--paper-darker);
    z-index: 0;
    letter-spacing: -0.05em;
    pointer-events: none;
    font-variation-settings: "opsz" 144;
}

.marquee-text {
    grid-area: text;
    position: relative;
    z-index: 1;
    max-width: 32rem;
}

.marquee-meta {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 1.5rem;
}
.marquee-meta span + span::before {
    content: ' · ';
    color: var(--rule);
    margin: 0 0.4em;
}

.marquee-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3.5rem, 9vw, 7rem);
    line-height: 0.92;
    letter-spacing: -0.03em;
    margin: 0 0 1.2rem;
    font-variation-settings: "opsz" 144;
    color: var(--ink);
}
.marquee-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    color: var(--ink-muted);
    font-size: clamp(1.15rem, 2.4vw, 1.6rem);
    line-height: 1.3;
    margin: 0 0 2rem;
    max-width: 32rem;
}

.marquee-pullquote {
    grid-area: pull;
    position: relative;
    z-index: 1;
    align-self: end;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1.18rem;
    line-height: 1.55;
    color: var(--ink-muted);
    border-left: 2px solid var(--accent);
    padding: 0.4rem 1rem 0.4rem 1.5rem;
    max-width: 30rem;
    margin: 0;
    /* V25.2 — long descriptions used to overflow the slide's
     * `overflow: hidden` and silently disappear below the fold.
     * Give the pullquote an internal max-height tied to the slide
     * height; overflow-y: auto lets the reader scroll the full text
     * inside the cell without breaking the cinema-poster aesthetic.
     * The fade-mask at the bottom hints that more text is available
     * when content overflows. */
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rule) transparent;
    -webkit-mask-image: linear-gradient(
        to bottom,
        black 0,
        black calc(100% - 2rem),
        transparent 100%);
            mask-image: linear-gradient(
        to bottom,
        black 0,
        black calc(100% - 2rem),
        transparent 100%);
}
.marquee-pullquote::-webkit-scrollbar { width: 6px; }
.marquee-pullquote::-webkit-scrollbar-thumb {
    background: var(--rule);
    border-radius: 3px;
}
.marquee-pullquote::-webkit-scrollbar-track { background: transparent; }

.marquee-actions {
    grid-area: actions;
    position: relative;
    z-index: 2;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}
.marquee-counter {
    grid-area: counter;
    justify-self: end;
    align-self: center;
    position: relative;
    z-index: 2;
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-faint);
    font-size: 1.1rem;
}
.marquee-counter strong {
    color: var(--ink);
    font-weight: 600;
    font-variation-settings: "opsz" 36;
}

@media (max-width: 720px) {
    .marquee-slide {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "text"
            "pull"
            "actions"
            "counter";
        height: auto;
        min-height: 100vh;
        row-gap: 1.6rem;
        padding-bottom: 4rem;
    }
    .marquee-counter {
        justify-self: start;
    }
}


/* ============================================================
 * 05  NEWSPAPER (BROADSHEET)
 * Multi-column front page. First book gets the lead; the rest
 * step down in importance through column treatment.
 * ============================================================ */
.catalog--press {
    max-width: 76rem;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
}

.press-masthead {
    text-align: center;
    border-top: 4px double var(--ink);
    border-bottom: 1px solid var(--ink);
    padding: 1.4rem 0 1.1rem;
    margin: 0 0 0.4rem;
}
.press-masthead h1 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.2rem, 5.5vw, 4rem);
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1;
    font-variation-settings: "opsz" 144;
    text-transform: uppercase;
}
.press-dateline {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--ink-muted);
    padding: 0.7rem 0 0.5rem;
    border-bottom: 1px solid var(--rule);
    margin: 0 0 2.5rem;
    display: flex;
    justify-content: space-between;
}

.press-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

.press-lead h2 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.6rem, 5.5vw, 4rem);
    line-height: 0.98;
    letter-spacing: -0.025em;
    margin: 0 0 0.7rem;
    font-variation-settings: "opsz" 144;
}
.press-lead .deck {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-muted);
    font-size: 1.3rem;
    line-height: 1.35;
    margin: 0 0 1.6rem;
    max-width: 36rem;
}
.press-lead .byline {
    font-family: var(--font-ui);
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem 0;
    margin: 0 0 1.4rem;
}
.press-lead-body {
    column-count: 2;
    column-gap: 2rem;
    column-rule: 1px solid var(--rule);
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--ink);
    text-align: justify;
    hyphens: auto;
}
.press-lead-body p {
    margin: 0 0 1em;
    text-indent: 1.4em;
}
.press-lead-body p:first-child { text-indent: 0; }
.press-lead-body p:first-child::first-letter {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 4em;
    float: left;
    line-height: 0.85;
    padding: 0.05em 0.08em 0 0;
    color: var(--ink);
}
.press-lead .actions {
    margin-top: 1.6rem;
    display: flex;
    gap: 1rem;
}

.press-rail {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}
.press-rail .also-eyebrow {
    font-family: var(--font-ui);
    font-size: 0.66rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 0.4rem;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 0.5rem;
}
.press-side {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 1.4rem;
    cursor: pointer;
}
.press-side:last-child { border-bottom: none; }
.press-side h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.3rem;
    line-height: 1.15;
    margin: 0 0 0.35rem;
    letter-spacing: -0.01em;
}
.press-side:hover h3 { color: var(--accent); }
.press-side .author {
    font-family: var(--font-ui);
    font-size: 0.62rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 0 0 0.5rem;
}
.press-side p {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--ink-muted);
    margin: 0;
    line-height: 1.5;
}
.press-side .price {
    display: inline-block;
    margin-top: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--ink);
    text-transform: uppercase;
}

@media (max-width: 720px) {
    .press-grid { grid-template-columns: 1fr; }
    .press-lead-body { column-count: 1; }
}


/* ============================================================
 * 06  PERIODICAL TIMELINE
 * Vertical timeline by publish date. Books alternate sides of
 * a thin centerline. Date marginalia at the rule.
 * ============================================================ */
.catalog--timeline {
    max-width: 64rem;
    margin: 0 auto;
    padding: 5rem 2rem 7rem;
    position: relative;
}

.timeline-eyebrow {
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 4rem;
}

.timeline-rail {
    position: relative;
    margin: 0 auto;
    padding: 1rem 0 3rem;
}
.timeline-rail::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--rule);
    transform: translateX(-0.5px);
}

.timeline-entry {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 5rem 1fr;
    gap: 0;
    margin: 0 0 4.5rem;
    align-items: start;
}
.timeline-entry:last-child { margin-bottom: 0; }

.timeline-date {
    grid-column: 2;
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--ink-faint);
    background: var(--paper);
    padding: 0.4rem 0;
    position: relative;
    z-index: 2;
    line-height: 1.2;
}
.timeline-date::before {
    content: '';
    position: absolute;
    top: 0.4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--paper);
    border: 1px solid var(--ink);
    z-index: 3;
}
.timeline-date span.year {
    display: block;
    font-style: normal;
    font-weight: 600;
    color: var(--ink);
    font-size: 1.1rem;
    margin-top: 1.2rem;
    font-variation-settings: "opsz" 36;
}

.timeline-card {
    background: var(--paper);
    padding: 0.5rem 0;
}
.timeline-card.left  { grid-column: 1; text-align: right; padding-right: 2rem; }
.timeline-card.right { grid-column: 3; text-align: left;  padding-left: 2rem; }

.timeline-card h2 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.7rem;
    line-height: 1.1;
    margin: 0 0 0.4rem;
    letter-spacing: -0.015em;
    font-variation-settings: "opsz" 36;
}
.timeline-card .author {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.timeline-card .desc {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--ink-muted);
    margin: 0.8rem 0 0;
    line-height: 1.55;
    font-size: 1rem;
}
.timeline-card .meta {
    margin-top: 1rem;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.timeline-card .meta button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink);
    border-bottom: 1px solid var(--ink);
    padding: 0 0 2px;
    font-family: inherit;
    font-size: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
}
.timeline-card .meta button:hover { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 720px) {
    .timeline-rail::before { left: 1.5rem; }
    .timeline-entry { grid-template-columns: 3rem 1fr; gap: 1rem; }
    .timeline-date  { grid-column: 1; text-align: left; padding-left: 0; }
    .timeline-date::before { left: 0.5rem; transform: none; }
    .timeline-card.left,
    .timeline-card.right { grid-column: 2; text-align: left; padding: 0; }
}


/* ============================================================
 * Common: empty state shown when the API returns []
 * (only when the user has no demo-data fallback either).
 * ============================================================ */
.catalog-empty {
    text-align: center;
    padding: 6rem 1rem;
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-muted);
}

/* ============================================================
 * FOOTER — added in round 10. The catalog page uses its own
 * design language (`.footer` instead of the standard
 * `.site-footer`), so the footer styles live here, but they
 * mirror site-footer's vocabulary so visually the two are
 * indistinguishable as the visitor moves between catalog and
 * the other public pages.
 * ============================================================ */
.footer {
    border-top: 1px solid var(--rule);
    background: var(--paper);
    margin-top: 4rem;
    padding: 3rem 2rem 2.5rem;
}
.footer-inner {
    max-width: 76rem;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem 3rem;
}
.footer-brand {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.05rem;
    letter-spacing: -0.005em;
    color: var(--ink);
    margin: 0;
}
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4rem;
    justify-content: center;
}
.footer-nav a {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: color 200ms ease, border-color 200ms ease;
}
.footer-nav a:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}
.footer-copy {
    font-family: var(--font-ui);
    font-size: 0.74rem;
    color: var(--ink-faint);
    margin: 0;
    text-align: right;
}

@media (max-width: 760px) {
    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.2rem;
    }
    .footer-nav { justify-content: center; }
    .footer-copy { text-align: center; }
}

/* ============================================================
 * Genre filter banner — shown above the catalog when ?genre=<slug>
 * is present. Inserted by app.js applyGenreFilter() before
 * the catalog container.
 * ============================================================ */
.genre-filter-banner {
    max-width: 76rem;
    margin: 0 auto 1.4rem;
    padding: 0 2rem;
}
.genre-filter-banner p {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ink-muted);
    margin: 0;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.7rem;
}
.genre-filter-banner strong {
    color: var(--ink);
    font-weight: 500;
    font-style: normal;
}
.genre-filter-count {
    color: var(--ink-faint);
    font-size: 0.85em;
}
.genre-filter-banner a {
    color: var(--ink-muted);
    text-decoration: underline;
    text-decoration-color: var(--ink-faint);
    text-underline-offset: 3px;
    margin-left: 0.4em;
    font-style: normal;
    font-size: 0.85em;
}
.genre-filter-banner a:hover {
    color: var(--ink);
    text-decoration-color: var(--ink);
}

/* ============================================================
 * V18 — Rating display on catalog cards.
 * Used by every renderer (editorial / stacks / archive / etc.)
 * via the shared ratingBadge() and recentReviewSnippet() helpers
 * in app.js. Compact stars + average + count, optionally followed
 * by a single recent review snippet with reviewer name and date.
 * ============================================================ */
.card-rating {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4em;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--ink-muted);
}
.card-rating-stars {
    color: var(--accent, #b8853a);
    letter-spacing: 0.04em;
}
.card-rating-num {
    font-weight: 500;
    color: var(--ink);
}
.card-rating-count {
    font-size: 0.85em;
    color: var(--ink-faint);
}

.editorial-rating {
    margin: 0.4rem 0 0.2rem;
}

.card-review-snippet {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--rule);
}
.card-review-head {
    margin: 0 0 0.2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6em;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.card-review-stars {
    color: var(--accent, #b8853a);
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: none;
}
.card-review-by {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--ink);
}
.card-review-date {
    color: var(--ink-faint);
}
.card-review-text {
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--ink-muted);
    line-height: 1.5;
}

/* ============================================================
 * V26.1 — Search-active header
 * Surfaces when /catalog?q=… is loaded so the reader knows the
 * catalog is filtered. Sits above the catalog grid, with a
 * "clear search" link that drops the query back to the full list.
 * ============================================================ */
.search-active-header {
    max-width: 76rem;
    margin: 0 auto 1.4rem;
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--rule);
    border-left: 4px solid var(--accent);
    background: var(--paper-darker);
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}
.search-active-eyebrow {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
}
.search-active-q {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--ink);
}
.search-active-q::before { content: '\201C'; }
.search-active-q::after  { content: '\201D'; }
.search-active-count {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--ink-muted);
}
.search-active-clear {
    margin-left: auto;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
.search-active-clear:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

/* ============================================================
 * MOBILE RESPONSIVENESS — V27 follow-up
 *
 * The catalog had partial breakpoints (subscribe strip, switcher
 * chip overflow). On phones ≤640px the masthead's three-column
 * flex (brand | search | nav) overflowed and the page lost its
 * left/right alignment, and several content blocks kept their
 * desktop 2rem horizontal padding which is too much at narrow
 * widths. This block stacks the masthead, reduces padding, and
 * lets long-form copy reflow tightly.
 * ============================================================ */

@media (max-width: 760px) {
    .masthead {
        padding: 1.6rem 1rem 1rem;
    }
    .masthead-inner {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
        align-items: stretch;
    }
    .masthead-brand {
        justify-self: start;
    }
    .site-search {
        width: 100%;
    }
    .site-search-input {
        width: 100%;
        min-width: 0;
    }
    .masthead-nav {
        flex-wrap: wrap;
        gap: 1rem 1.2rem;
        font-size: 0.72rem;
        letter-spacing: 0.14em;
    }
    .masthead-tagline {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-top: 0.8rem;
        padding: 0 0.2rem;
    }
    /* Switcher: chips need to be tappable, so shrink the label and
     * let the chips wrap onto multiple lines without going off-edge. */
    .switcher {
        padding: 1.6rem 1rem 0;
        gap: 0.8rem;
    }
    /* Subscribe strip already collapses; tighten padding so the
     * strip doesn't dwarf the catalogue grid on small screens. */
    .sub-strip {
        padding: 2.2rem 1rem 2.4rem;
    }
    .sub-strip-inner { max-width: 100%; }
    .sub-headline {
        font-size: 1.6rem;
        line-height: 1.25;
    }
    /* Active-search header: stack instead of side-by-side. */
    .search-active-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.9rem 1rem;
    }
    .search-active-clear {
        margin-left: 0;
    }
    /* Footer: keep the nav readable when it wraps. */
    .footer { padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 420px) {
    .masthead-nav {
        font-size: 0.68rem;
        gap: 0.8rem 1rem;
    }
    .switcher-chips .chip {
        flex: 1 1 calc(50% - 0.5rem);
        text-align: center;
    }
}

/* ============================================================
 * Catalog wrapper padding — shrink on phones so the content gets
 * the full reading width and the editorial number column doesn't
 * get squeezed. Targets every style variant; each has its own
 * internal breakpoints, but the wrapper-level padding wasn't
 * overridden anywhere.
 * ============================================================ */
@media (max-width: 640px) {
    .catalog--editorial,
    .catalog--archive,
    .catalog--press,
    .catalog--timeline {
        padding-left: 1.2rem;
        padding-right: 1.2rem;
        padding-top: 2.4rem;
        padding-bottom: 3.4rem;
    }
    .catalog--stacks {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 2.4rem;
    }
    .catalog--editorial .editorial-row {
        gap: 1rem;
        padding: 1.8rem 0;
    }
    .catalog--editorial .editorial-num {
        font-size: 2rem;
    }
    /* Editorial body h2 size: at 2rem it's still substantial on a
     * narrow column, especially with long titles. Bring down by a
     * notch so book titles like "Diary of an Addict: What He Didn't
     * Write" don't break to four lines. */
    .catalog--editorial .editorial-body h2 {
        font-size: 1.5rem;
    }
}
