/* ── Homepage styles ──────────────────────────────
   Tokens: tokens.css · Base: base.css
   ──────────────────────────────────────────────── */

/* Page load fade-in */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
.container {
    animation: fadeIn 0.3s ease-out;
}

/* Skip link for keyboard/screen reader users */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--color-accent);
    color: var(--color-bg);
    padding: 8px 16px;
    text-decoration: none;
    font-size: 14px;
    z-index: 10000;
    border-radius: 0 0 4px 0;
}
.skip-link:focus {
    left: 0;
    outline: 2px solid var(--color-accent-hover);
    outline-offset: 2px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 40px);
}

/* Header */
header {
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 767px) {
    header {
        flex-wrap: wrap;
        gap: 12px;
    }
    .logo {
        flex: 1;
    }
    .header-controls {
        flex: 0 0 100%;
        order: 1;
        justify-content: flex-start;
    }
    .search-box {
        flex: 1;
    }
    .search-input {
        width: 100%;
    }
    .site-nav {
        gap: 16px;
    }
    .site-nav-link {
        font-size: 13px;
    }
}

.logo {
    flex: 1;
    font-family: "Financier Display", Georgia, "Times New Roman", Times, serif;
    font-size: clamp(25px, 1.73vw, 28px);
    font-weight: 340;
    font-style: italic;
    letter-spacing: 0.045em;
}
.logo a {
    color: var(--color-text);
    text-decoration: none;
}
.logo a:hover {
    color: var(--color-text);
}

.site-nav {
    display: flex;
    gap: 24px;
    align-items: baseline;
}
.site-nav-link {
    font-size: clamp(14px, 1.05vw, 15px);
    font-weight: 400;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition:
        color 0.15s ease,
        border-color 0.15s ease;
}
.site-nav-link:hover {
    color: var(--color-gold);
}
.site-nav-link:focus-visible {
    outline: none;
    border-bottom-color: var(--color-accent);
    color: var(--color-text);
}
.site-nav-link.active {
    color: var(--color-text);
    border-bottom-color: var(--color-gold);
}

.header-controls {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 20;
}

.search-input {
    width: 200px;
    min-width: 100px;
    flex: 1;
    padding: 8px 28px 8px 32px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: clamp(14px, 0.94vw, 15px);
    background-color: var(--color-input-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23727272' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    color: var(--color-text);
    transition:
        width 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}
[data-theme="dark"] .search-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .search-input {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    }
}
.search-input:focus {
    outline: none;
    border-color: var(--color-accent);
    width: 220px;
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}
.search-input::placeholder {
    color: var(--color-text-muted);
}

.search-clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0;
    width: 22px;
    height: 22px;
    display: none;
    line-height: 1;
    font-size: 16px;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}
.search-clear:hover {
    color: var(--color-text-secondary);
    background: var(--color-bg-hover);
}
.search-clear:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-focus-shadow);
    color: var(--color-text-secondary);
}
.search-input:not(:placeholder-shown) + .search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-count {
    font-size: clamp(12px, 0.85vw, 13px);
    color: var(--color-text-muted);
    padding: 0 6px;
    opacity: 0;
    transition: opacity 0.15s ease;
    white-space: nowrap;
    pointer-events: none;
    z-index: 11;
    display: none; /* Controlled by JS */
}
.search-count.visible {
    display: inline;
    opacity: 1;
    margin-right: auto;
}

/* Category filter bar */
.cat-bar-container {
    position: relative;
    margin-top: 10px;
    padding-bottom: 0;
    border-bottom: 1px solid var(--color-border);
}
/* Fading edges for horizontal scroll */
.cat-bar-container::before,
.cat-bar-container::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.cat-bar-container::before {
    left: 0;
    background: linear-gradient(to right, var(--color-bg), transparent);
}
.cat-bar-container::after {
    right: 0;
    background: linear-gradient(to left, var(--color-bg), transparent);
}
.cat-bar-container.has-scroll-left::before { opacity: 1; }
.cat-bar-container.has-scroll-right::after { opacity: 1; }

.cat-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cat-bar::-webkit-scrollbar {
    display: none;
}

.cat-item {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 0;
    margin-right: 24px;
    margin-bottom: -1px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
}
.cat-item:not(:last-child)::after {
    content: "/";
    position: absolute;
    right: -14px;
    color: var(--color-text-muted);
    opacity: 0.4;
    font-weight: 400;
}
.cat-item:hover {
    color: var(--color-gold);
}
.cat-item:focus-visible {
    outline: none;
    border-bottom-color: var(--color-accent);
    color: var(--color-text);
}
.cat-item.active {
    color: var(--color-gold);
    border-bottom-color: var(--color-gold);
}

/* Category clear × on active item */
.cat-item.active {
    gap: 6px;
}
.cat-x {
    display: none;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 11px;
    line-height: 1;
    color: var(--color-gold);
    border-radius: 50%;
    transition: background 0.15s ease;
    flex-shrink: 0;
}
.cat-item.active .cat-x {
    display: flex;
}
.cat-x:hover {
    background: var(--color-hover-overlay);
}

@media (max-width: 767px) {
    .search-clear {
        width: 28px;
        height: 28px;
        right: 2px;
        font-size: 18px;
    }
    .cat-item {
        margin-right: 18px;
        font-size: 10px;
        padding: 6px 0;
    }
    .cat-item:not(:last-child)::after {
        right: -11px;
    }
    .cat-x {
        width: 12px;
        height: 12px;
        font-size: 10px;
    }
}

.theme-toggle,
.listening-room-toggle {
    flex-shrink: 0;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: color 0.2s ease;
    padding: 13px;
    margin: -13px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.theme-toggle:hover {
    color: var(--color-gold);
}

/* Custom tooltips for header toggle buttons */
.theme-toggle::after,
.listening-room-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: var(--color-text);
    color: var(--color-bg);
    font-family: "Untitled Sans", sans-serif;
    font-size: 10px;
    font-weight: 480;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 10;
}
.theme-toggle::before,
.listening-room-toggle::before {
    content: '';
    position: absolute;
    top: calc(100% - 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 3px solid transparent;
    border-bottom-color: var(--color-text);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
}
@media (hover: hover) {
    .theme-toggle:hover::after,
    .listening-room-toggle:hover::after {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    .theme-toggle:hover::before,
    .listening-room-toggle:hover::before {
        opacity: 1;
    }
}
.theme-toggle .icon-sun {
    display: none;
}
.theme-toggle .icon-moon {
    display: block;
}

/* Main grid */
main {
    padding: 24px 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 40px;
}

@media (max-width: 1024px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 767px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Shelf divider — centered heading between two gold lines */
.shelf-divider {
    margin-top: 64px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.shelf-divider::before,
.shelf-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--color-gold), var(--color-gold-end));
}
.shelf-divider::before {
    background: linear-gradient(90deg, transparent, var(--color-gold));
}
.shelf-divider::after {
    background: linear-gradient(90deg, var(--color-gold-end), transparent);
}
.shelf-title {
    font-family: "Financier Display", Georgia, "Times New Roman", Times, serif;
    font-size: clamp(20px, 1.4vw, 23px);
    font-weight: var(--font-weight-heading);
    font-style: normal;
    letter-spacing: 0.045em;
    color: var(--color-text);
    white-space: nowrap;
}
/* Grid toolbar */
.grid-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    margin-bottom: -28px;
    padding: 0 4px;
}
.grid-toolbar.hidden { display: none; }
.grid-toolbar.hidden + .grid { margin-top: 16px; }

/* Sort toggle — icon-only, matches theme toggle pattern */
.sort-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 13px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    border-radius: 4px;
    position: relative;
}
.sort-toggle:hover { color: var(--color-gold); }
.sort-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-focus-shadow);
}
.sort-toggle[aria-pressed="true"] { color: var(--color-gold); }

/* Sort toggle tooltips — matches tracks page service-link pattern */
.sort-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: var(--color-text);
    color: var(--color-bg);
    font-size: 10px;
    font-weight: 400;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.sort-toggle::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 3px solid transparent;
    border-top-color: var(--color-text);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
@media (hover: hover) {
    .sort-toggle:hover::after {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    .sort-toggle:hover::before {
        opacity: 1;
    }
}

/* Grid dinkus — rhythmic breathing mark between source rows */
.grid-dinkus {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-text);
    font-size: 13px;
    letter-spacing: 0.35em;
    opacity: 0.55;
    padding: 8px 0;
    /* Extra whitespace (Option 1+2). Remove margin for Option 2 only. */
    margin: 12px 0;
}

/* Source blocks - ghost card on hover */
.source {
    margin-bottom: 24px;
    padding: 16px 12px 12px 12px;
    border-radius: 6px;
    transition:
        background 0.2s ease,
        box-shadow 0.2s ease;
}
.source:hover {
    background: var(--color-hover-overlay);
    box-shadow: 0 1px 3px var(--color-shadow-subtle);
}

.source-title {
    font-family: "Financier Text", Georgia, "Times New Roman", Times, serif;
    font-size: clamp(18px, 1.3vw, 21px);
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.045em;
    padding-bottom: 0;
    border-bottom: 1px solid var(--color-shadow-subtle);
    position: relative;
    margin-bottom: 12px;
}
.source-title::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--color-gold), var(--color-gold-end));
    opacity: 0;
    transition:
        opacity 0.15s ease,
        left 0.15s ease;
}
.source:hover .source-title::after {
    opacity: 1;
}
/* Only expand left for architectural connection when first article is hovered */
.source:has(.articles li:first-child:hover) .source-title::after {
    left: -12px;
}
.source-title a {
    color: var(--color-text);
    text-decoration: none;
    text-wrap: balance;
    transition: color 0.15s ease;
    display: block;
    padding-bottom: 10px;
}
.source-title a:hover {
    color: var(--color-gold);
}

/* Editorial voice profile — 3D card flip */
.source-content {
    perspective: 800px;
}
.source-flipper {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.source.profile-open .source-flipper {
    transform: rotateY(180deg);
}
.source-face {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.source-face-front {
    transform: rotateY(
        0deg
    ); /* Firefox requires explicit transform on both faces */
}
.source-face-back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    padding: 10px 2px 0;
    line-height: 1.45;
    color: var(--color-text);
    overflow: hidden;
}
/* .source-profile-author moved to base.css (shared with week page) */

/* ── Source stats (card back) ── */
.source-stats-bar {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-shadow-subtle);
}
.source-stats-bar-top {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-shadow-subtle);
}
.source-stats-bar .stats-window-label {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.category-bar {
    display: flex;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    gap: 1px;
}
.category-bar .seg {
    transition: opacity 0.15s ease;
}
.category-bar .seg-review { background: var(--color-gold); }
.category-bar .seg-news { background: var(--color-text-muted); }
.category-bar .seg-opinion { background: var(--color-text-secondary); opacity: 0.5; }
.category-bar .seg-show_report { background: var(--color-text-secondary); opacity: 0.35; }
.category-bar .seg-how_to { background: var(--color-text-secondary); opacity: 0.25; }
.category-bar .seg-interview { background: var(--color-text-secondary); opacity: 0.2; }
.category-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}
.category-legend span::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 1px;
    margin-right: 3px;
    vertical-align: middle;
}
.category-legend .leg-review::before { background: var(--color-gold); }
.category-legend .leg-news::before { background: var(--color-text-muted); }
.category-legend .leg-opinion::before { background: var(--color-text-secondary); opacity: 0.5; }
.category-legend .leg-show_report::before { background: var(--color-text-secondary); opacity: 0.35; }
.category-legend .leg-how_to::before { background: var(--color-text-secondary); opacity: 0.25; }
.category-legend .leg-interview::before { background: var(--color-text-secondary); opacity: 0.2; }
.source-stats-bar .stat-row {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 6px;
    line-height: 1.5;
}
.source-stats-collecting {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-shadow-subtle);
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.source-flip-trigger {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 0.15s ease;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}
.source-flip-trigger:hover {
    color: var(--color-gold);
}
.source-flip-trigger::after {
    content: " \2192";
}

/* Article list */
.articles {
    list-style: none;
}

.articles li {
    padding: 10px 12px;
    margin-left: -12px;
    margin-right: -12px;
    border-top: 1px solid var(--color-shadow-subtle);
    border-radius: 4px;
    position: relative;
    z-index: 1; /* Ensure text stays on top of background pseudo-element */
}
.articles li:first-child {
    border-top: none;
}

/* Combined Ghost Bar & Background for stability */
.articles li::before,
.articles li::after {
    content: "";
    position: absolute;
    left: 0;
    top: 8px; /* Start slightly more compact for expansion effect */
    bottom: 8px;
    opacity: 0;
    transition:
        opacity 0.15s cubic-bezier(0.2, 0, 0.2, 1),
        top 0.15s cubic-bezier(0.2, 0, 0.2, 1),
        bottom 0.15s cubic-bezier(0.2, 0, 0.2, 1);
    pointer-events: none;
}

/* The Darkened Hover Background */
.articles li::after {
    right: 0;
    background: linear-gradient(
        90deg,
        var(--color-gradient-start) 0%,
        transparent 100%
    );
    border-radius: 4px;
    z-index: -2;
}

/* The Gold Vertical Bar - Consistent Pill Shape */
.articles li::before {
    width: 2px;
    background: linear-gradient(
        180deg,
        var(--color-gold),
        var(--color-gold-end)
    );
    border-radius: 2px;
    z-index: -1;
}

.articles li:hover::before,
.articles li:hover::after {
    opacity: 1;
    top: 4px; /* Expand to standard breathing room */
    bottom: 4px;
}

/* Unified Reach-up for first article */
.articles li:first-child:hover::before,
.articles li:first-child:hover::after {
    top: -12px; /* Bridge the gap to title line */
}

/* Square off the top connection ONLY on reach-up for architectural lock-in */
.articles li:first-child:hover::after {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.articles li:first-child:hover::before {
    border-top-left-radius: 0;
}

.articles li:hover a {
    color: var(--color-text);
}

.articles a {
    color: var(--color-text-body);
    text-decoration: none;
    display: block;
    font-weight: var(--font-weight-body);
    line-height: 1.45;
    text-wrap: pretty;
    transition: color 0.15s ease;
}
.articles a:visited {
    color: var(--color-text-visited);
}
.articles a:hover {
    color: var(--color-text);
}
.articles li:has(.badge-gold, .badge-silver, .badge-bronze, .badge-new) > a {
    display: inline;
}
.badge-wrap {
    white-space: nowrap;
}
.badge-wrap::before {
    content: '\00A0'; /* non-breaking space glues badges to preceding text */
}
.badge-wrap .badge:first-child {
    margin-left: 0; /* ::before provides the gap */
}
.articles .badge-new {
    display: inline;
    margin-left: 5px;
}
.articles a:visited .badge-new,
.articles a:hover .badge-new {
    color: var(--color-text-muted);
}

/* Badge base — shared by NEW and relevance tier badges */
.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 6px;
    background: transparent;
}
.badge-new {
    background: rgba(160, 160, 168, 0.08);
    color: var(--color-text-muted);
    border: 1px solid rgba(160, 160, 168, 0.3);
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 8px;
    transition: opacity 0.3s ease;
}
/* Signal tier badges — inline bullseye icons */
.badge-gold, .badge-silver, .badge-bronze {
    font-size: 0;
    letter-spacing: 0;
    padding: 0;
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 0;
    background: none;
    background-size: 12px 12px;
    background-repeat: no-repeat;
}
.badge-gold {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='5.6' fill='%23d4a24e' opacity='0.12'/%3E%3Ccircle cx='6' cy='6' r='3.9' fill='%23d4a24e' opacity='0.22'/%3E%3Ccircle cx='6' cy='6' r='2.4' fill='%23d4a24e' opacity='0.55'/%3E%3Ccircle cx='6' cy='6' r='1.3' fill='%23d4a24e'/%3E%3C/svg%3E");
}
.badge-silver {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='5.6' fill='%23a0a0a8' opacity='0.14'/%3E%3Ccircle cx='6' cy='6' r='3.2' fill='%23a0a0a8' opacity='0.3'/%3E%3Ccircle cx='6' cy='6' r='1.5' fill='%23a0a0a8'/%3E%3C/svg%3E");
}
.badge-bronze {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='5.6' fill='%23b07a4a' opacity='0.10'/%3E%3Ccircle cx='6' cy='6' r='1.4' fill='%23b07a4a'/%3E%3C/svg%3E");
}
/* Footer */
footer {
    padding: 32px 0 48px;
    margin-top: 48px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

@media (min-width: 768px) {
    footer {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
    .footer-info {
        margin-bottom: 0;
    }
}

.footer-info {
    font-size: clamp(12px, 0.85vw, 13px);
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}
.footer-info a {
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.15s ease;
}
.footer-info a:hover {
    color: var(--color-gold);
}
.footer-info a:hover svg {
    fill: var(--color-gold);
}
.footer-info svg {
    vertical-align: -2px;
    margin-right: 4px;
    fill: var(--color-gold);
    transition: fill 0.15s ease;
}

.footer-shortcuts {
    font-size: clamp(12px, 0.85vw, 13px);
    color: var(--color-text-muted);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}
.listening-room-active footer {
    opacity: 0.6;
    transition: opacity 0.5s ease;
}
.listening-room-active footer:hover {
    opacity: 1;
}

.shortcuts-focus { display: none; }
.listening-room-active .shortcuts-standard { display: none; }
.listening-room-active .shortcuts-focus { display: inline; }

.footer-shortcuts kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    background: var(--color-kbd-bg);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: clamp(11px, 0.79vw, 12px);
    border: 1px solid var(--color-border);
}
.footer-tagline {
    font-family: "Financier Text", Georgia, "Times New Roman", Times, serif;
    font-weight: 380;
    font-style: italic;
    font-size: clamp(13px, 0.87vw, 14px);
    color: var(--color-text-muted);
    letter-spacing: 0.045em;
    opacity: 0.6;
}

/* Dark mode - icon switching (colors handled by tokens) */
[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}
[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

/* Today's Articles section */
.today-section {
    position: relative;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
    overflow: visible;
}
.today-section.today-has-overflow::after {
    content: "";
    position: absolute;
    bottom: 1px;
    left: 0;
    right: 0;
    height: 48px;
    background: linear-gradient(to bottom, transparent, var(--color-bg));
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}
.today-section.today-scrolled-end::after {
    opacity: 0;
}

.today-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px;
    cursor: pointer;
    user-select: none;
    background: none;
    border: 0;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: background 0.15s ease, margin-bottom 0.4s ease, padding-bottom 0.4s ease;
    margin: 0;
    border-radius: 4px;
}
.today-header:hover {
    background: var(--color-hover-overlay);
}
.today-header:hover .today-title,
.today-header:hover .today-toggle {
    color: var(--color-gold);
}
.today-header:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-focus-shadow);
}

.today-title {
    font-family: "Financier Display", Georgia, "Times New Roman", Times, serif;
    font-size: clamp(20px, 1.4vw, 23px);
    font-weight: 350;
    font-style: italic;
    letter-spacing: 0.045em;
    color: var(--color-text);
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    transition: color 0.15s ease;
}
.today-count {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: 0.85em;
}
.today-count::before {
    content: "·\00a0";
}

.today-toggle {
    color: var(--color-text-muted);
    transition:
        color 0.15s ease,
        transform 0.25s ease;
    padding: 8px;
    margin-right: -4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
}
.today-section.expanded .today-toggle {
    transform: rotate(180deg);
}
.today-toggle-icon {
    display: flex;
    transition: none; /* Handled by parent rotation */
}
.today-section.expanded .today-toggle-icon {
    transform: none;
}
@media (max-width: 767px) {
    .today-toggle {
        padding: 8px 12px;
    }
}

.today-list {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    padding-bottom: 0;
    transition:
        max-height 0.25s ease,
        padding-bottom 0.25s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
}
.today-section.expanded .today-list {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
}
.today-list::-webkit-scrollbar {
    width: 12px;
}
.today-list::-webkit-scrollbar-track {
    background: var(--color-scrollbar-track);
    border-radius: 999px;
}
.today-list::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 999px;
    border: 1px solid transparent;
    background-clip: content-box;
}
.today-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-scrollbar-thumb-hover);
    background-clip: content-box;
}

.today-list li {
    padding: 8px 12px;
    border-top: 1px solid var(--color-border);
    font-size: clamp(15px, 1.05vw, 17px);
    position: relative;
    z-index: 1;
    line-height: 1.4;
    transition: padding 0.4s ease;
}
.today-list li:first-child {
    border-top: none;
}

/* Shared hover architecture for Today items */
.today-list li::before,
.today-list li::after {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    opacity: 0;
    transition:
        opacity 0.15s cubic-bezier(0.2, 0, 0.2, 1),
        top 0.15s cubic-bezier(0.2, 0, 0.2, 1),
        bottom 0.15s cubic-bezier(0.2, 0, 0.2, 1);
    pointer-events: none;
}
.today-list li::after {
    right: 0;
    background: linear-gradient(
        90deg,
        var(--color-gradient-start) 0%,
        transparent 100%
    );
    border-radius: 4px;
    z-index: -2;
}
.today-list li::before {
    width: 2px;
    background: linear-gradient(
        180deg,
        var(--color-gold),
        var(--color-gold-end)
    );
    border-radius: 2px;
    z-index: -1;
}

.today-list li:hover::before,
.today-list li:hover::after {
    opacity: 1;
    top: 4px;
    bottom: 4px;
}

.today-list a {
    color: var(--color-text-body);
    text-decoration: none;
    display: block;
    font-weight: var(--font-weight-body);
    line-height: 1.3;
    transition: color 0.15s ease, font-size 0.4s ease, line-height 0.4s ease;
}
.today-list a:visited {
    color: var(--color-text-visited);
}
.today-list a:hover {
    color: var(--color-text);
}

.today-source {
    color: var(--color-text-muted);
    font-size: clamp(13px, 0.85vw, 14px);
    display: inline-block;
    margin-top: 1px;
    white-space: nowrap;
}

.today-time {
    color: var(--color-text-muted);
    font-size: clamp(12px, 0.8vw, 13px);
    margin-left: 6px;
    white-space: nowrap;
}
.today-time::before {
    content: "\00b7\00a0";
    opacity: 0.7;
}

.today-cat {
    font-size: clamp(12px, 0.8vw, 13px);
    color: var(--color-text-muted);
    font-style: italic;
    margin-left: 6px;
}
.today-cat::before {
    content: "\00b7\00a0";
    opacity: 0.7;
}

.today-list li.has-badge > a {
    display: inline;
}
.today-list .badge {
    margin-left: 6px;
}


.today-empty {
    color: var(--color-text-muted);
    font-style: italic;
    padding: 8px 12px;
}

/* Skeleton Loading */
@keyframes skeleton-loading {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-hover) 25%,
        var(--color-border) 50%,
        var(--color-bg-hover) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    display: block;
    height: 1.2em;
    margin: 8px 12px;
}
.skeleton-text {
    width: 80%;
}
.skeleton-meta {
    width: 40%;
    height: 0.8em;
}

/* Keyboard navigation focus state — mirrors hover pseudo-element approach */
.articles li.kb-focus::before,
.articles li.kb-focus::after,
.today-list li.kb-focus::before,
.today-list li.kb-focus::after {
    opacity: 1;
    top: 4px;
    bottom: 4px;
}
.articles li.kb-focus a,
.today-list li.kb-focus a {
    color: var(--color-text);
}

.listening-room-active .today-list li.kb-focus {
    background: var(--color-hover-overlay);
    border-radius: 8px;
}
.listening-room-active .today-list li.kb-focus::before,
.listening-room-active .today-list li.kb-focus::after {
    display: none; /* Cleaner look in immersive mode, background color is enough */
}

/* Scroll-to-top button */
.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.85);
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease,
        color 0.15s ease,
        border-color 0.15s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}
.scroll-top:hover {
    color: var(--color-gold);
    border-color: var(--color-gold);
}
.scroll-top:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

/* Empty search state */
.empty-state {
    display: none;
    text-align: center;
    padding: 80px 20px 60px;
    color: var(--color-text-secondary);
}
.empty-state.visible {
    display: block;
}
.empty-state::before {
    content: "—";
    display: block;
    font-family: "Financier Display", Georgia, serif;
    font-size: 1.6rem;
    color: var(--color-border);
    margin-bottom: 20px;
    letter-spacing: 0.2em;
}
.empty-state-title {
    font-family: "Financier Display", Georgia, serif;
    font-style: normal;
    font-weight: var(--font-weight-heading);
    font-size: clamp(20px, 1.5vw, 24px);
    letter-spacing: 0.02em;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}
.empty-state-title span {
    color: var(--color-gold);
}
.empty-state-hint {
    font-family: "Untitled Sans", sans-serif;
    font-size: clamp(13px, 0.9vw, 14px);
    color: var(--color-text-muted);
    line-height: 1.6;
}
.empty-state-clear {
    color: var(--color-gold);
    cursor: pointer;
    text-decoration: none;
    background: none;
    border: none;
    font: inherit;
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease;
}
.empty-state-clear:hover {
    border-bottom-color: var(--color-gold);
}
.empty-state-clear:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-focus-shadow);
    border-radius: 2px;
}

/* Reading Room / Immersive Mode Styling */
.listening-room-active {
    --color-bg: #fdfaf5; /* Warmer, paper-like background */
    transition: background 0.5s ease;
}
[data-theme="dark"].listening-room-active {
    --color-bg: #141414; /* Deep neutral dark for focus */
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]).listening-room-active {
        --color-bg: #141414;
    }
}

/* Hide distracting elements in Reading Room */
.listening-room-active .album-strip-section,
.listening-room-active .shelf-divider,
.listening-room-active .grid,
.listening-room-active .grid-toolbar,
.listening-room-active .cat-bar-container,
.listening-room-active .header-controls .search-box {
    display: none !important;
}

/* Elevate Today's Articles in Reading Room */
.today-section {
    transition: opacity 0.35s ease, max-width 0.35s ease, margin 0.4s ease;
}
.listening-room-active .today-section {
    max-width: 720px;
    margin: 60px auto 80px;
    border: none;
    animation: fadeIn 0.8s ease-out;
}

/* Warm background glow behind the content */
.listening-room-active .today-section::before {
    content: "";
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle at center, rgba(200, 155, 90, 0.04) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

.listening-room-active .today-header {
    cursor: default;
    pointer-events: none;
    justify-content: center;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 32px;
    padding-bottom: 24px;
}
.listening-room-active .today-header:hover {
    background: none;
}
.listening-room-active .today-toggle {
    display: none;
}

.listening-room-active .today-title {
    font-size: 2.2rem;
    text-align: center;
}
.listening-room-active .today-count {
    display: none;
}

.listening-room-active .today-list {
    max-height: none !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.listening-room-active .today-list li {
    padding: 24px 0;
    border: none;
    border-bottom: 1px solid rgba(160, 160, 168, 0.1);
}
.listening-room-active .today-list li:hover::before,
.listening-room-active .today-list li:hover::after {
    display: none; /* No hover signal needed in Focus Mode */
}

.listening-room-active .today-list a {
    font-size: 1.5rem;
    line-height: 1.35;
    font-weight: 400;
    color: var(--color-text);
    transition: color 0.2s ease;
    text-wrap: balance;
}
.listening-room-active .today-list a:hover {
    color: var(--color-gold);
}
.listening-room-active .today-meta {
    margin-top: 8px;
}

.listening-room-active .today-source {
    font-family: "Financier Text", serif;
    font-weight: 380;
    font-style: italic;
    font-size: 1.1rem;
    letter-spacing: 0.045em;
    color: var(--color-gold);
}
.listening-room-active .today-time,
.listening-room-active .today-cat {
    font-size: 1rem;
}

.listening-room-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.listening-room-toggle:hover {
    color: var(--color-gold);
    transform: scale(1.05);
}
.listening-room-active .listening-room-toggle {
    color: var(--color-gold);
}

/* System preference: icon switching (colors handled by tokens) */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: block;
    }
    html:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: none;
    }
}

/* Album recommendation strip */
.album-strip-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.album-strip-viewall {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: var(--cover-size);
    height: var(--cover-size);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    gap: 4px;
    transition: border-color 0.15s ease, color 0.15s ease;
    scroll-snap-align: start;
}
.album-strip-viewall:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}
.album-strip-viewall-arrow {
    font-size: 18px;
    line-height: 1;
}

.album-strip {
    --cover-size: 110px;
    --cover-gap: 14px;
    display: flex;
    gap: var(--cover-gap);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 4px 14px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.album-strip::-webkit-scrollbar {
    display: none;
}

.album-item {
    flex-shrink: 0;
    width: var(--cover-size);
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    scroll-snap-align: start;
}
.album-item.selected::after {
    content: "";
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--color-gold);
}
.album-item:focus-visible .album-cover {
    box-shadow: 0 0 0 2px var(--color-accent);
}
.album-item:focus-visible {
    outline: none;
}

.album-cover {
    width: var(--cover-size);
    height: var(--cover-size);
    border-radius: 4px;
    overflow: hidden;
    background: var(--color-bg-hover);
    position: relative;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.album-item:hover .album-cover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--color-cover-shadow);
}

.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    color: transparent;
    font-size: 0;
}

.album-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.04) 0%,
        transparent 50%
    );
    pointer-events: none;
}

.album-cover-placeholder {
    width: 100%;
    height: 100%;
    background: var(--color-bg-hover);
    position: relative;
}
.album-cover-placeholder::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44%;
    height: 44%;
    border-radius: 50%;
    border: 1.5px solid var(--color-border);
}
.album-cover-placeholder::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
}

/* Album detail card (inline expand below strip) */
.album-detail {
    max-height: 0;
    overflow: hidden;
    transition:
        max-height 0.25s ease,
        opacity 0.2s ease;
    opacity: 0;
}
.album-detail.open {
    opacity: 1;
}
.album-detail-inner {
    padding: 16px 0 8px;
    position: relative;
}
.album-detail-close {
    position: absolute;
    top: 16px;
    right: 0;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    transition: color 0.15s ease;
}
.album-detail-close:hover {
    color: var(--color-text);
}
.album-detail-close svg {
    transition: transform 0.2s ease;
}
.album-detail.open .album-detail-close svg {
    transform: rotate(180deg);
}
.album-detail-artist {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 3px;
}
.album-detail-title {
    display: block;
    font-weight: 460;
    font-size: 1.25rem;
    color: var(--color-text);
    line-height: 1.3;
    margin-bottom: 8px;
    text-decoration: none;
    transition: color 0.15s ease;
}
.album-detail-title:hover {
    color: var(--color-gold);
}
.album-detail-quote {
    font-family: "Untitled Sans", system-ui, sans-serif;
    font-style: normal;
    font-size: 1rem;
    color: var(--color-text-body);
    line-height: 1.55;
    margin-bottom: 8px;
    max-width: 40em;
    position: relative;
}
.album-detail-quote[data-quote-type="review"] {
    text-indent: 28px;
}
.album-detail-quote[data-quote-type="review"]::before {
    content: "\201C";
    font-family: "Financier Display", Georgia, serif;
    font-size: 4rem;
    line-height: 1;
    color: var(--color-gold);
    opacity: 0.65;
    position: absolute;
    left: 0;
    top: -10px;
    text-indent: 0;
}
.album-detail-source {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}
.album-detail-source a {
    color: var(--color-gold);
    text-decoration: none;
}

/* Responsive: adjust strip padding and cover sizes */
@media (max-width: 720px) {
    .album-strip {
        --cover-size: 100px;
        --cover-gap: 12px;
    }
}
@media (max-width: 580px) {
    .album-strip {
        --cover-size: 90px;
        --cover-gap: 10px;
    }
}
@media (max-width: 450px) {
    .album-strip {
        --cover-size: 85px;
        --cover-gap: 8px;
    }
}


