/* Homepage: mobile-first editorial layout with dark sacred subtlety */

.home-page {
    max-width: none;
    margin-inline: 0;
}

.gap-md-6 {
    gap: clamp(2.5rem, 5vw, 4.5rem);
}

.home-kicker {
    letter-spacing: 0.08em;
    font-size: var(--sv-meta-size);
    line-height: 1.3;
    color: var(--color-text-muted);
}

.home-lead {
    max-width: 48ch;
    line-height: var(--sv-line-height);
    font-size: var(--sv-font-size-base);
}

/* Today's Scroll — vertical editorial card (full-width image band, copy below) */

.home-hero.home-hero--daily-feature {
    border-color: color-mix(in srgb, var(--color-border) 78%, var(--color-heading) 22%);
    background: linear-gradient(
        168deg,
        color-mix(in srgb, var(--color-surface) 97%, var(--color-heading) 3%),
        color-mix(in srgb, var(--color-surface-alt) 94%, var(--color-accent) 6%)
    );
}

/* Today's Scroll — compact editorial overlay hero (image + gradient + foreground copy) */

/* ── Home feature card (editorial split layout) ──────────────────────────── */

.home-feature-card {
    min-width: 0;
}

/*
 * Mobile: stacked column — image fills width naturally, body flows below.
 * No fixed aspect-ratio on the frame; the image drives its own height so
 * tall portrait artwork (e.g. 1122×1402) is never cropped.
 */
.home-feature-card__frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    border-radius: var(--sv-radius-block, 0.5rem);
    overflow: hidden;
    background: var(--color-surface);
}

/* Image zone — neutral background fills any letterbox space */
.home-feature-card__media {
    position: relative;
    width: 100%;
    background: color-mix(in srgb, var(--color-surface-alt) 88%, var(--color-heading) 12%);
}

.home-feature-card__media-hit {
    display: block;
    text-decoration: none;
    outline: none;
}

.home-feature-card__media-hit:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.home-feature-card__image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    object-position: center top;
}

/* Body: clean flow panel below the image */
.home-feature-card__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.25rem, 4cqi, 1.75rem) clamp(1.1rem, 3.5cqi, 1.5rem)
        max(clamp(1.25rem, 4cqi, 1.75rem), env(safe-area-inset-bottom, 0px));
    background: var(--color-surface);
}

.home-feature-card__body-inner {
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* Editorial tag scale */
.home-feature-card--editorial .home-feature-card__body-inner {
    --sv-editorial-tag-font-size: clamp(0.68rem, 0.62rem + 0.14cqi, 0.74rem);
    --sv-editorial-tag-padding-y: 0.14rem;
    --sv-editorial-tag-padding-x: 0.4rem;
    --sv-editorial-tag-letter-spacing: 0.055em;
    --sv-editorial-tag-line-height: 1.12;
}

/* Section kicker */
.home-feature-card--editorial .home-feature-card__body-inner > .home-kicker {
    margin-top: 0;
    color: var(--color-accent, var(--color-text-muted));
    letter-spacing: 0.088em;
    font-size: clamp(
        calc(0.72rem * var(--sv-font-scale)),
        calc(0.64rem + 0.15cqi),
        calc(0.8rem * var(--sv-font-scale))
    );
    line-height: 1.32;
    margin-bottom: clamp(0.45rem, 1.1cqi, 0.65rem);
}

/* Topic / series pill inherits surface tokens — no colour override needed */
.home-feature-card--editorial .home-topic-label {
    flex-shrink: 0;
}

/* Meta row */
.home-feature-card__meta {
    font-size: var(--sv-meta-size);
    letter-spacing: 0.04em;
    line-height: 1.3;
    color: var(--color-text-muted);
}

.home-feature-card--editorial .home-feature-card__meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: clamp(0.28rem, 0.75cqi, 0.42rem);
    row-gap: 0.1rem;
    margin-top: clamp(0.45rem, 1.1cqi, 0.65rem) !important;
    margin-bottom: 0 !important;
}

.home-feature-card--editorial .home-feature-card__meta-row time {
    letter-spacing: 0.035em;
}

.home-feature-card__meta-sep {
    margin-inline: 0;
    opacity: 0.55;
    user-select: none;
}

/* Hero headline */
.home-feature-card__title.home-hero-title {
    font-family: var(--sv-font-family-heading);
    font-size: clamp(
        calc(1.08rem * var(--sv-heading-scale)),
        calc(0.62rem + 1.55cqi * var(--sv-heading-scale)),
        calc(1.72rem * var(--sv-heading-scale))
    );
    line-height: 1.16;
    letter-spacing: 0.005em;
    margin: 0;
    text-wrap: balance;
}

.home-feature-card--editorial .home-feature-card__title a {
    color: var(--color-heading);
    text-decoration: none;
}

.home-feature-card--editorial .home-feature-card__title a:hover,
.home-feature-card--editorial .home-feature-card__title a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 0.14em;
}

/* Excerpt */
.home-hero .home-feature-card__excerpt.home-lead {
    margin-top: clamp(0.55rem, 1.2cqi, 0.75rem);
    margin-bottom: clamp(0.45rem, 1cqi, 0.65rem);
    max-width: min(44ch, 100%);
    font-size: clamp(
        calc(0.88rem * var(--sv-font-scale)),
        calc(0.8rem + 0.22cqi),
        calc(0.98rem * var(--sv-font-scale))
    );
    line-height: 1.55;
    color: var(--color-text-muted, var(--color-text));
}

.home-feature-card__actions {
    margin-top: clamp(0.75rem, 1.6cqi, 1rem);
}

.home-feature-card--editorial .home-hero-cta-btn {
    padding-block: 0.62rem;
    padding-inline: max(1.1rem, var(--sv-btn-padding-x, 1rem));
    min-height: 2.75rem;
}

.home-hero .btn {
    font-family: var(--sv-font-family);
    font-size: var(--sv-font-size-base);
    line-height: 1.4;
}

.home-daily-scroll {
    border: 1px solid color-mix(in srgb, var(--color-border) 75%, var(--color-heading) 25%);
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--color-surface-alt) 94%, var(--color-heading) 6%),
        color-mix(in srgb, var(--color-surface) 92%, var(--color-accent) 8%)
    );
}

.home-daily-media {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: var(--sv-radius-block, 0.5rem);
    background: color-mix(in srgb, var(--color-surface-alt) 78%, var(--color-heading) 22%);
}

.home-daily-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.home-card-media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-card-media {
    --sv-card-media-aspect-ratio: 4 / 5;
    --sv-card-media-fit: contain;
}

.home-card-media img {
    object-fit: var(--sv-card-media-fit, contain);
}

.home-topic-card {
    border: 1px solid var(--color-border);
    border-radius: var(--sv-radius-block, 0.5rem);
}

.home-quote-block {
    max-width: 52ch;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: calc(1.08rem * var(--sv-font-scale));
    line-height: 1.9;
    font-family: "Literata", "Georgia", "Times New Roman", serif;
    letter-spacing: 0.02em;
}

.home-display-title {
    font-size: var(--sv-h1-size);
    letter-spacing: 0.01em;
    line-height: var(--sv-heading-line-height);
}

/* Section + sidebar widget titles: one stack (color/type) from theme tokens. */
:is(.home-section-heading, .home-sidebar-heading) {
    color: var(--sv-heading);
    font-family: var(--sv-font-family-heading);
    line-height: var(--sv-heading-line-height);
}

.home-daily-heading {
    font-size: var(--sv-h3-size);
}

.home-daily-title {
    font-size: var(--sv-h2-size);
    line-height: var(--sv-heading-line-height);
}

.home-daily-title a {
    font-family: var(--sv-font-family-heading);
}

.home-daily-excerpt {
    max-width: 52ch;
    font-size: var(--sv-font-size-base);
    line-height: var(--sv-line-height);
}

.home-daily-meta {
    font-family: var(--sv-font-family);
    font-size: var(--sv-meta-size);
    line-height: 1.4;
    letter-spacing: 0.05em;
}

.home-daily-cta {
    font-family: var(--sv-font-family);
    font-size: var(--sv-font-size-s);
    line-height: 1.4;
}

.home-section-intro {
    max-width: 42rem;
}

.letter-spacing-heading {
    letter-spacing: 0.12em;
    font-weight: 600;
}

.topic-card-minimal:hover,
.topic-card-minimal:focus-visible {
    border-color: var(--color-border);
    background: color-mix(in srgb, var(--color-surface-alt) 88%, var(--color-heading) 12%);
}

.home-series-cover {
    --sv-card-media-aspect-ratio: 4 / 5;
    --sv-card-media-fit: contain;
    border-top-left-radius: var(--sv-card-media-radius, var(--sv-radius-block, var(--bs-card-inner-border-radius, 0.4375rem)));
    border-top-right-radius: var(--sv-card-media-radius, var(--sv-radius-block, var(--bs-card-inner-border-radius, 0.4375rem)));
}

.home-series-cover img {
    object-fit: var(--sv-card-media-fit, contain);
}

.home-blog-secondary-item:last-child article {
    border-bottom: none;
    padding-bottom: 0;
}

/* From the blog (homepage): equal card height + aligned copy band — flex chain + fixed excerpt depth */
.home-blog-secondary > .row {
    align-items: stretch;
}

.home-blog-secondary > .row > article {
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.home-blog-secondary > .row > article > .card {
    flex: 1 1 auto;
    min-height: 0;
}

.home-blog-secondary .post-card-excerpt-region {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--sv-editorial-support-font-size);
    line-height: var(--sv-editorial-support-line-height);
    /* Reserve three lines when excerpt is absent; pairs with line-clamp below */
    min-height: calc(3 * var(--sv-editorial-support-line-height) * var(--sv-editorial-support-font-size));
}

.home-blog-secondary .post-card-excerpt-region .card-excerpt,
.home-blog-secondary .post-card-excerpt-region .card-text.card-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.home-blog-thumb {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: var(--sv-radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.home-blog-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tiny-meta {
    font-size: var(--sv-meta-size);
    letter-spacing: 0.02em;
}

@media (min-width: 768px) {
    .home-quote-block {
        font-size: calc(1.2rem * var(--sv-font-scale));
        padding: 2rem 1rem;
    }
}

/*
 * Wider main rail: side-by-side layout — image left (58%), body right.
 * Image fills its flex cell with object-fit: contain so no cropping occurs.
 * A hairline border-left is the only visual separator.
 */
@container home-main (min-width: 47.5rem) {
    .home-feature-card__frame {
        flex-direction: row;
        min-height: clamp(22rem, 52cqi, 34rem);
    }

    .home-feature-card__media {
        flex: 0 0 58%;
        max-width: 58%;
        overflow: hidden;
        /* In row layout the media cell has a defined height from the flex row.
           Use position:relative so the media-hit can fill it with inset:0. */
        position: relative;
    }

    /* Fill the cell with an absolutely-positioned link so height:100% on the
       image has a real reference — no circular dependency, no cropping. */
    .home-feature-card__media-hit {
        inset: 0;
    }

    .home-feature-card__image {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center top;
    }

    .home-feature-card__body {
        flex: 1 1 0;
        min-width: 0;
        padding: clamp(1.5rem, 3.2cqi, 2.25rem) clamp(1.35rem, 3cqi, 2rem);
        /* No border-left — zone separation comes from padding + background difference */
    }

    .home-feature-card__body-inner {
        hyphens: manual;
        word-break: normal;
        overflow-wrap: normal;
    }

    .home-feature-card__title.home-hero-title {
        font-size: clamp(
            calc(1.14rem * var(--sv-heading-scale)),
            calc(0.5rem + 1.85cqi * var(--sv-heading-scale)),
            calc(1.88rem * var(--sv-heading-scale))
        );
        line-height: 1.1;
        text-wrap: unset;
    }

    .home-hero .home-feature-card__excerpt.home-lead {
        max-width: min(46ch, 100%);
        font-size: clamp(
            calc(0.9rem * var(--sv-font-scale)),
            calc(0.82rem + 0.26cqi),
            calc(1.02rem * var(--sv-font-scale))
        );
        line-height: 1.5;
    }

    .home-feature-card--editorial .home-hero-cta-btn {
        padding-block: 0.58rem;
        min-height: unset;
    }
}

/* Larger desktop: slightly wider image share */
@container home-main (min-width: 62rem) {
    .home-feature-card__media {
        flex: 0 0 60%;
        max-width: 60%;
    }

    .home-feature-card__frame {
        min-height: clamp(26rem, 48cqi, 38rem);
    }

    .home-feature-card__title.home-hero-title {
        font-size: clamp(
            calc(1.18rem * var(--sv-heading-scale)),
            calc(0.52rem + 1.9cqi * var(--sv-heading-scale)),
            calc(2rem * var(--sv-heading-scale))
        );
    }
}

@media (min-width: 992px) {
    .home-editorial-sidebar {
        position: sticky;
        top: 1.25rem;
    }
}

/* Editorial homepage: sidebar (secondary rail) */

.home-editorial-main {
    min-width: 0;
    container-name: home-main;
    container-type: inline-size;
}

.home-editorial-sidebar-col {
    min-width: 0;
}

.home-editorial-sidebar {
    --sv-sidebar-radius: clamp(0.38rem, 0.95vw, var(--sv-radius-block));
    --sv-sidebar-pad: clamp(0.78rem, 1.85vw, 1.02rem);
    --sv-sidebar-edge: color-mix(in srgb, var(--color-border) 86%, transparent);
    --sv-sidebar-surface-a: color-mix(in srgb, var(--color-surface-alt) 36%, var(--color-bg) 64%);
    --sv-sidebar-surface-b: color-mix(in srgb, var(--color-surface-alt) 20%, var(--color-bg) 80%);
    /*
     * Reading prefs (data-reading-size / data-reading-font + inline --sv-font-*) apply on `html`.
     * Mirror the reading typography token names here so the rail tracks the same preferences live,
     * with a damped step so XL modes do not blow out the narrow column.
     */
    --sv-sidebar-reading-strength: 0.52;
    --sv-sidebar-meta-strength: 0.4;
    --sv-sidebar-font-mult: calc(1 + (var(--sv-font-scale) - 1) * var(--sv-sidebar-reading-strength));
    --sv-sidebar-meta-mult: calc(1 + (var(--sv-font-scale) - 1) * var(--sv-sidebar-meta-strength));
    /*
     * Supporting copy (muted, hooks, subheads): same tokens as .card-excerpt / p.text-muted-soft,
     * scaled down slightly so the narrow rail stays compact while tracking reading prefs.
     */
    --sv-sidebar-editorial-support-scale: 0.91;
    --sv-sidebar-font-support: calc(var(--sv-editorial-support-font-size) * var(--sv-sidebar-editorial-support-scale));
    --sv-reading-font: var(--sv-font-family);
    --sv-reading-body-size: calc(var(--sv-font-size-m) * var(--sv-sidebar-font-mult));
    --sv-reading-meta-size: calc(0.82rem * var(--sv-sidebar-meta-mult));
    --sv-sidebar-font-base: var(--sv-reading-body-size);
    --sv-sidebar-font-meta: var(--sv-reading-meta-size);
    font-family: var(--sv-reading-font);
}

.home-sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: clamp(0.85rem, 2.1vw, 1.2rem);
}

.home-sidebar-widget {
    position: relative;
    padding: var(--sv-sidebar-pad);
    border-radius: var(--sv-sidebar-radius);
    background: linear-gradient(165deg, var(--sv-sidebar-surface-a) 0%, var(--sv-sidebar-surface-b) 100%);
    border: 1px solid var(--sv-sidebar-edge);
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, rgb(var(--color-text-rgb)) 7%, transparent),
        0 10px 26px -20px color-mix(in srgb, rgb(0, 0, 0) 14%, transparent),
        var(--color-shadow-soft);
    transition:
        border-color var(--theme-transition-duration) ease,
        box-shadow var(--theme-transition-duration) ease;
    font-family: var(--sv-reading-font);
    font-size: var(--sv-sidebar-font-meta);
}

.home-sidebar-widget-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.28rem;
    margin: 0 0 clamp(0.62rem, 1.35vw, 0.82rem);
    padding-bottom: clamp(0.48rem, 1.05vw, 0.65rem);
    border-bottom: 1px solid color-mix(in srgb, var(--color-border) 64%, transparent);
}

.home-sidebar-heading {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
}

.home-sidebar-heading-icon {
    --sv-sidebar-heading-icon-size: 0.82rem;
    /* Bind palette vars from html[data-theme] to locals (never reassign --sv-sidebar-heading-icon-* here). */
    --_sv-sidebar-heading-icon-fill: var(
        --sv-sidebar-heading-icon-color,
        color-mix(in srgb, var(--sv-heading) 90%, var(--color-text-muted) 10%)
    );
    --_sv-sidebar-heading-icon-fill-hover: var(
        --sv-sidebar-heading-icon-hover-color,
        rgb(var(--color-heading-rgb))
    );
    width: var(--sv-sidebar-heading-icon-size);
    height: var(--sv-sidebar-heading-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transform: translateY(-0.01em);
}

.home-sidebar-heading-icon-glyph.home-sidebar-heading-icon-theme {
    display: block;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    background-color: var(--_sv-sidebar-heading-icon-fill);
    -webkit-mask-image: var(--sv-sidebar-heading-icon-mask);
    mask-image: var(--sv-sidebar-heading-icon-mask);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    transition: background-color var(--theme-transition-duration) ease;
}

.home-sidebar-heading:hover .home-sidebar-heading-icon-glyph.home-sidebar-heading-icon-theme,
.home-sidebar-heading:focus-within .home-sidebar-heading-icon-glyph.home-sidebar-heading-icon-theme {
    background-color: var(--_sv-sidebar-heading-icon-fill-hover);
}

.home-sidebar-heading-icon .home-sidebar-heading-icon-theme {
    display: none !important;
}

html[data-theme="light"] .home-sidebar-heading-icon .home-sidebar-heading-icon-theme--light,
html[data-theme="sepia"] .home-sidebar-heading-icon .home-sidebar-heading-icon-theme--sepia,
html[data-theme="dark"] .home-sidebar-heading-icon .home-sidebar-heading-icon-theme--dark {
    display: block !important;
}

.home-sidebar-heading-icon--fallback-rail {
    width: 2px;
    height: 0.9em;
    border-radius: var(--sv-radius-circle);
    background-color: var(--_sv-sidebar-heading-icon-fill);
    transform: none;
    transition: background-color var(--theme-transition-duration) ease;
}

.home-sidebar-heading:hover .home-sidebar-heading-icon--fallback-rail,
.home-sidebar-heading:focus-within .home-sidebar-heading-icon--fallback-rail {
    background-color: var(--_sv-sidebar-heading-icon-fill-hover);
}

.home-sidebar-heading > span:last-child {
    min-width: 0;
}

/* Narrow-rail widget titles (Topics, Active reading plan, Active scroll series): compact scale vs main column h4 sections. */
.home-sidebar-heading.home-sidebar-heading--rail {
    font-size: clamp(
        calc(0.9rem * var(--sv-heading-scale)),
        calc(0.8rem + 0.16vw),
        calc(1.02rem * var(--sv-heading-scale))
    );
}

.home-sidebar-muted {
    color: var(--color-text-muted);
}

.home-editorial-sidebar :is(.small, small):not(.home-sidebar-cta-link) {
    font-size: calc(var(--sv-sidebar-font-meta) * 0.96);
}

/* Muted body + soft links: rail-scaled editorial support tokens (see --sv-sidebar-font-support). */
.home-editorial-sidebar .home-sidebar-muted,
.home-editorial-sidebar .home-sidebar-soft-link {
    font-family: var(--sv-reading-font);
    font-size: var(--sv-sidebar-font-support);
    line-height: var(--sv-editorial-support-line-height);
}

.home-editorial-sidebar .home-sidebar-soft-link {
    font-size: calc(var(--sv-sidebar-font-support) * 0.97);
}

/* Series description line: same tier as card excerpts / muted rail copy. */
.home-editorial-sidebar .home-sidebar-series-hook {
    font-family: var(--sv-reading-font);
    font-size: var(--sv-sidebar-font-support);
    line-height: var(--sv-editorial-support-line-height);
    overflow-wrap: anywhere;
}

.home-sidebar-soft-link {
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition:
        color var(--theme-transition-duration) ease,
        border-color var(--theme-transition-duration) ease;
}

.home-sidebar-soft-link:hover,
.home-sidebar-soft-link:focus-visible {
    color: var(--color-heading);
    border-bottom-color: color-mix(in srgb, var(--color-accent) 55%, var(--color-border) 45%);
}

.home-sidebar-soft-link:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 3px;
    border-radius: var(--sv-radius-xs);
}

.home-sidebar-topic-list {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}

.home-sidebar-topic-link {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    padding: 0.38rem 0.42rem;
    margin-inline: -0.42rem;
    text-decoration: none;
    color: var(--color-text);
    border-radius: calc(var(--sv-sidebar-radius, var(--sv-radius-block)) - 0.18rem);
    border: 1px solid transparent;
    transition:
        background-color var(--theme-transition-duration) ease,
        border-color var(--theme-transition-duration) ease,
        color var(--theme-transition-duration) ease;
}

.home-sidebar-topic-link > * {
    min-width: 0;
}

.home-sidebar-topic-link:hover,
.home-sidebar-topic-link:focus-visible {
    color: var(--color-heading);
    background-color: color-mix(in srgb, var(--color-surface-alt) 72%, var(--color-bg) 28%);
    border-color: color-mix(in srgb, var(--color-border) 45%, transparent);
}

.home-sidebar-topic-link:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 1px;
}

.home-sidebar-topic-name {
    font-family: var(--sv-reading-font);
    font-size: var(--sv-sidebar-font-base);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.home-sidebar-topic-meta {
    font-size: var(--sv-sidebar-font-meta);
    white-space: normal;
    text-align: end;
    overflow-wrap: anywhere;
}

.home-sidebar-series-list {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.home-sidebar-series-link {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.48rem 0.42rem;
    margin-inline: -0.42rem;
    text-decoration: none;
    color: var(--color-text);
    border-radius: calc(var(--sv-sidebar-radius, var(--sv-radius-block)) - 0.15rem);
    border: 1px solid transparent;
    transition:
        background-color var(--theme-transition-duration) ease,
        border-color var(--theme-transition-duration) ease,
        color var(--theme-transition-duration) ease,
        box-shadow var(--theme-transition-duration) ease;
}

.home-sidebar-series-link:hover,
.home-sidebar-series-link:focus-visible {
    background-color: color-mix(in srgb, var(--color-surface-alt) 68%, var(--color-bg) 32%);
    border-color: color-mix(in srgb, var(--color-border) 48%, transparent);
    color: var(--color-heading);
    box-shadow: inset 0 1px 0 color-mix(in srgb, rgb(var(--color-text-rgb)) 5%, transparent);
}

.home-sidebar-series-link:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 1px;
}

.home-sidebar-series-title {
    font-family: var(--sv-reading-font);
    font-size: calc(var(--sv-sidebar-font-base) * 0.93);
    line-height: 1.35;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.home-sidebar-series-meta {
    font-size: var(--sv-sidebar-font-meta);
}

.home-sidebar-cta-link {
    display: inline-block;
    font-weight: 500;
    font-family: var(--sv-reading-font);
    font-size: var(--sv-sidebar-font-base);
    color: var(--color-heading);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--color-accent) 40%, transparent);
}

.home-sidebar-cta-link:hover,
.home-sidebar-cta-link:focus-visible {
    border-bottom-color: var(--color-accent);
}

.home-sidebar-cta-link:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 3px;
    border-radius: var(--sv-radius-xs);
}

.home-sidebar-footnote {
    padding-top: clamp(0.52rem, 1.1vw, 0.68rem);
    margin-top: clamp(0.5rem, 1.05vw, 0.65rem);
    border-top: 1px solid color-mix(in srgb, var(--color-border) 58%, transparent);
}

.home-sidebar-reading-plan-active {
    padding: clamp(0.52rem, 1.05vw, 0.68rem) clamp(0.55rem, 1.1vw, 0.72rem);
    border-radius: calc(var(--sv-sidebar-radius, var(--sv-radius-block)) - 0.14rem);
    background: color-mix(in srgb, var(--color-surface-alt) 42%, var(--color-bg) 58%);
    border: 1px solid color-mix(in srgb, var(--color-border) 52%, transparent);
    box-shadow: inset 0 1px 0 color-mix(in srgb, rgb(var(--color-text-rgb)) 5%, transparent);
}

.home-sidebar-reading-plan-title {
    font-family: var(--sv-reading-font);
    font-size: calc(var(--sv-sidebar-font-base) * 0.93);
    font-weight: 600;
    line-height: 1.38;
    color: var(--color-heading);
    letter-spacing: 0.01em;
}

/* Homepage editorial carousels (Latest Scrolls, Popular Series) — shared shell + scrollport */

#home-latest-scrolls-section,
#home-popular-series-section {
    --home-editorial-carousel-gap: 1rem;
    width: 100%;
    min-width: 0;
}

#home-latest-scrolls-section .home-editorial-carousel-header,
#home-popular-series-section .home-editorial-carousel-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

#home-latest-scrolls-section .home-editorial-carousel-nav,
#home-popular-series-section .home-editorial-carousel-nav {
    display: inline-flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

#home-latest-scrolls-section .home-editorial-carousel-nav[hidden],
#home-popular-series-section .home-editorial-carousel-nav[hidden] {
    display: none !important;
}

#home-latest-scrolls-section .home-carousel-arrow,
#home-popular-series-section .home-carousel-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    margin: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--sv-radius-circle);
    background: color-mix(in srgb, var(--color-surface-alt) 90%, var(--color-heading) 10%);
    color: var(--color-heading);
    cursor: pointer;
    pointer-events: auto;
    z-index: 1;
    transition:
        background-color var(--theme-transition-duration) ease,
        border-color var(--theme-transition-duration) ease,
        color var(--theme-transition-duration) ease;
}

#home-latest-scrolls-section .home-carousel-arrow:hover,
#home-latest-scrolls-section .home-carousel-arrow:focus-visible,
#home-popular-series-section .home-carousel-arrow:hover,
#home-popular-series-section .home-carousel-arrow:focus-visible {
    background: color-mix(in srgb, var(--color-surface-alt) 80%, var(--color-heading) 20%);
    border-color: color-mix(in srgb, var(--color-border) 60%, var(--color-heading) 40%);
}

#home-latest-scrolls-section .home-carousel-arrow:focus-visible,
#home-popular-series-section .home-carousel-arrow:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

#home-latest-scrolls-section .home-carousel-arrow:disabled,
#home-popular-series-section .home-carousel-arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#home-latest-scrolls-section .home-editorial-carousel-shell,
#home-popular-series-section .home-editorial-carousel-shell {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

#home-latest-scrolls-section .home-editorial-carousel-viewport,
#home-popular-series-section .home-editorial-carousel-viewport {
    container-name: home-editorial;
    container-type: inline-size;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-padding-inline: 0;
    -webkit-overflow-scrolling: touch;
    /* Allow vertical scroll to chain to the page; horizontal still scrolls this scrollport (pan-x alone blocked page scroll). */
    touch-action: pan-x pan-y pinch-zoom;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#home-latest-scrolls-section .home-editorial-carousel-viewport::-webkit-scrollbar,
#home-popular-series-section .home-editorial-carousel-viewport::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

#home-latest-scrolls-section .home-editorial-carousel-viewport:focus-visible,
#home-popular-series-section .home-editorial-carousel-viewport:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: var(--sv-radius-block, 0.5rem);
}

#home-latest-scrolls-section .home-editorial-carousel-track,
#home-popular-series-section .home-editorial-carousel-track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: var(--home-editorial-carousel-gap);
    width: max-content;
    min-height: min-content;
}

#home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item,
#home-popular-series-section .home-editorial-carousel-track > .home-editorial-carousel-item {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 100cqw;
    max-width: 100cqw;
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
    display: flex;
}

#home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item > [class*="col-"],
#home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item > article {
    min-width: 0;
    width: auto;
    max-width: none;
    flex: 1 1 auto;
    padding: 0;
    display: flex;
}

#home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item > [class*="col-"] > .card,
#home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item > article.card {
    width: 100%;
}

#home-popular-series-section .home-popular-series-item.home-editorial-carousel-item > .home-series-card {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

/* Card-media is flush against the card body — no extra bottom gap needed */
#home-latest-scrolls-section .home-latest-scrolls-item .card-media,
#home-popular-series-section .home-popular-series-item .card-media {
    margin-bottom: 0;
}

#home-latest-scrolls-section .home-latest-scrolls-item .card-body,
#home-popular-series-section .home-popular-series-item .card-body,
.home-blog-secondary .editorial-card .card-body {
    padding: 0.85rem 0.95rem 0.9rem;
    gap: 0;
}

/*
 * Homepage editorial pills — Latest Scrolls + From the blog `.card-kicker` / `.home-topic-label`
 * (same tokens as Today's Scroll overlay; `cqi` uses nearest size container: carousel viewport vs main rail).
 */
#home-latest-scrolls-section .home-latest-scrolls-item article.editorial-card,
#home-popular-series-section .home-popular-series-item article.editorial-card,
.home-blog-secondary .editorial-card {
    --sv-editorial-tag-font-size: clamp(0.68rem, 0.62rem + 0.14cqi, 0.74rem);
    --sv-editorial-tag-padding-y: 0.14rem;
    --sv-editorial-tag-padding-x: 0.4rem;
    --sv-editorial-tag-letter-spacing: 0.055em;
    --sv-editorial-tag-line-height: 1.12;
    /* Title + excerpt stack: one scale for Latest Scrolls, Popular Series, From the blog (see .card-body rules below). */
    --sv-home-editorial-card-title-size: clamp(1rem, 0.93rem + 0.24vw, 1.1rem);
    --sv-home-editorial-card-title-line-height: 1.25;
    --sv-home-editorial-card-heading-margin-bottom: 0.45rem;
}

#home-latest-scrolls-section .home-latest-scrolls-item article.editorial-card .card-body :is(h2, h3).h5,
#home-popular-series-section .home-popular-series-item article.editorial-card .card-body :is(h2, h3).h5,
.home-blog-secondary .editorial-card .card-body :is(h2, h3).h5 {
    font-size: var(--sv-home-editorial-card-title-size);
    line-height: var(--sv-home-editorial-card-title-line-height);
    overflow-wrap: anywhere;
    margin-bottom: var(--sv-home-editorial-card-heading-margin-bottom) !important;
}

#home-latest-scrolls-section .home-latest-scrolls-item .card-title-link,
#home-popular-series-section .home-popular-series-item .card-title-link,
.home-blog-secondary .editorial-card .card-title-link {
    line-height: inherit;
}

#home-latest-scrolls-section .home-latest-scrolls-item .card-excerpt,
#home-popular-series-section .home-popular-series-item .card-excerpt,
.home-blog-secondary .editorial-card .card-excerpt {
    margin-bottom: 0 !important;
    font-size: var(--sv-editorial-support-font-size);
    line-height: var(--sv-editorial-support-line-height);
}

#home-latest-scrolls-section .home-latest-scrolls-item .card-body > .card-excerpt + .sv-card-footer,
#home-latest-scrolls-section .home-latest-scrolls-item .card-body > .card-text.card-excerpt + .sv-card-footer,
#home-popular-series-section .home-popular-series-item .card-body > .card-excerpt + .sv-card-footer,
#home-popular-series-section .home-popular-series-item .card-body > .card-text.card-excerpt + .sv-card-footer,
.home-blog-secondary .editorial-card .card-body > .card-excerpt + .sv-card-footer,
.home-blog-secondary .editorial-card .card-body > .card-text.card-excerpt + .sv-card-footer,
.home-blog-secondary .editorial-card .card-body > .post-card-excerpt-region + .sv-card-footer {
    margin-top: 0 !important;
}

#home-latest-scrolls-section .home-latest-scrolls-item .card-excerpt p:last-child,
#home-popular-series-section .home-popular-series-item .card-excerpt p:last-child,
.home-blog-secondary .editorial-card .card-excerpt p:last-child {
    margin-bottom: 0;
}

#home-latest-scrolls-section .home-latest-scrolls-item .card-footer,
.home-blog-secondary .editorial-card .card-footer {
    padding-top: 0.35rem;
    gap: 0.45rem;
}

#home-latest-scrolls-section .home-latest-scrolls-item .sv-card-read-more {
    font-size: 0.8rem;
    padding-inline: 0.55rem;
    padding-block: 0.22rem;
}

#home-latest-scrolls-section .home-latest-scrolls-item p,
#home-popular-series-section .home-popular-series-item p {
    margin-top: 0;
}

/*
 * Breakpoints are for the carousel scrollport (col-lg-9), not the full window.
 * Using 992px here left the rail stuck at 2 columns because the main column is narrower.
 */
@container home-editorial (min-width: 560px) {
    #home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item,
    #home-popular-series-section .home-editorial-carousel-track > .home-editorial-carousel-item {
        width: calc((100cqw - var(--home-editorial-carousel-gap)) / 2);
        max-width: calc((100cqw - var(--home-editorial-carousel-gap)) / 2);
    }
}

@container home-editorial (min-width: 720px) {
    #home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item,
    #home-popular-series-section .home-editorial-carousel-track > .home-editorial-carousel-item {
        width: calc((100cqw - (var(--home-editorial-carousel-gap) * 2)) / 3);
        max-width: calc((100cqw - (var(--home-editorial-carousel-gap) * 2)) / 3);
    }
}

@media (min-width: 768px) {
    #home-latest-scrolls-section,
    #home-popular-series-section {
        --home-editorial-carousel-gap: 1.5rem;
    }

    #home-latest-scrolls-section .home-latest-scrolls-item .card-body,
    #home-popular-series-section .home-popular-series-item .card-body,
    .home-blog-secondary .editorial-card .card-body {
        padding: 0.5rem 1.05rem 1rem;
    }
}

/* -------------------------------------------------------------------------- */
/* Typography-driven carousel density                                          */
/* XL: cap at 2 cards; XS: allow 4 cards at wider containers                 */
/* -------------------------------------------------------------------------- */

@container home-editorial (min-width: 720px) {
    html[data-typography-size="xl"] #home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item,
    html[data-typography-size="xl"] #home-popular-series-section .home-editorial-carousel-track > .home-editorial-carousel-item,
    html[data-reading-size="xl"] #home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item,
    html[data-reading-size="xl"] #home-popular-series-section .home-editorial-carousel-track > .home-editorial-carousel-item {
        width: calc((100cqw - var(--home-editorial-carousel-gap)) / 2);
        max-width: calc((100cqw - var(--home-editorial-carousel-gap)) / 2);
    }
}

@container home-editorial (min-width: 820px) {
    html[data-typography-size="xs"] #home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item,
    html[data-typography-size="xs"] #home-popular-series-section .home-editorial-carousel-track > .home-editorial-carousel-item,
    html[data-reading-size="xs"] #home-latest-scrolls-section .home-editorial-carousel-track > .home-editorial-carousel-item,
    html[data-reading-size="xs"] #home-popular-series-section .home-editorial-carousel-track > .home-editorial-carousel-item {
        width: calc((100cqw - (var(--home-editorial-carousel-gap) * 3)) / 4);
        max-width: calc((100cqw - (var(--home-editorial-carousel-gap) * 3)) / 4);
    }
}

/* -------------------------------------------------------------------------- */
/* XL typography: trigger side-by-side layout at the narrower 44rem threshold */
/* At XL the column is 65% wide; 44rem fires before the base 47.5rem mark.   */
/* -------------------------------------------------------------------------- */

@container home-main (min-width: 44rem) {
    html[data-typography-size="xl"] .home-feature-card__frame,
    html[data-reading-size="xl"] .home-feature-card__frame {
        flex-direction: row;
        min-height: clamp(22rem, 52cqi, 34rem);
    }

    html[data-typography-size="xl"] .home-feature-card__media,
    html[data-reading-size="xl"] .home-feature-card__media {
        flex: 0 0 58%;
        max-width: 58%;
        overflow: hidden;
    }

    html[data-typography-size="xl"] .home-feature-card__image,
    html[data-reading-size="xl"] .home-feature-card__image {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center top;
    }

    html[data-typography-size="xl"] .home-feature-card__body,
    html[data-reading-size="xl"] .home-feature-card__body {
        flex: 1 1 0;
        min-width: 0;
        padding: clamp(1.5rem, 3.2cqi, 2.25rem) clamp(1.35rem, 3cqi, 2rem);
        /* No border-left — zone separation comes from padding + background difference */
    }

    html[data-typography-size="xl"] .home-feature-card__body-inner,
    html[data-reading-size="xl"] .home-feature-card__body-inner {
        hyphens: manual;
        word-break: normal;
        overflow-wrap: normal;
    }

    html[data-typography-size="xl"] .home-feature-card__title.home-hero-title,
    html[data-reading-size="xl"] .home-feature-card__title.home-hero-title {
        font-size: clamp(
            calc(1.14rem * var(--sv-heading-scale)),
            calc(0.5rem + 1.85cqi * var(--sv-heading-scale)),
            calc(1.88rem * var(--sv-heading-scale))
        );
        line-height: 1.1;
        text-wrap: unset;
    }

    html[data-typography-size="xl"] .home-hero .home-feature-card__excerpt.home-lead,
    html[data-reading-size="xl"] .home-hero .home-feature-card__excerpt.home-lead {
        max-width: min(46ch, 100%);
        font-size: clamp(
            calc(0.9rem * var(--sv-font-scale)),
            calc(0.82rem + 0.26cqi),
            calc(1.02rem * var(--sv-font-scale))
        );
        line-height: 1.5;
    }

    html[data-typography-size="xl"] .home-feature-card--editorial .home-hero-cta-btn,
    html[data-reading-size="xl"] .home-feature-card--editorial .home-hero-cta-btn {
        padding-block: 0.58rem;
        min-height: unset;
    }
}
