:root {
    --feed-nav-height: 64px;
    --feed-footer-height: 96px;
    --feed-filter-height: 56px;
}

.feed-filters {
    position: sticky;
    top: var(--feed-nav-height);
    z-index: 50;
    height: var(--feed-filter-height);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 0 20px;
    background: rgba(244, 246, 249, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.feed-filter-group {
    display: inline-flex;
    gap: 6px;
}

.feed-filter {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s;
}

.feed-filter:hover {
    background: var(--surface-raised);
    color: var(--navy-ink);
}

.feed-filter.active {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}

.feed-filter:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.feed-stage {
    position: relative;
    height: calc(100vh - var(--feed-nav-height) - var(--feed-footer-height) - var(--feed-filter-height));
    height: calc(100dvh - var(--feed-nav-height) - var(--feed-footer-height) - var(--feed-filter-height));
}

#termFeed {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    height: 100%;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    color: var(--text);
}

.feed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 1rem;
}

.feed-card {
    scroll-snap-align: start;
    scroll-snap-stop: always;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border-subtle);
    background: transparent;
}

.feed-card > * {
    width: 100%;
    max-width: 720px;
}

.feed-card .term-type {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: .75rem;
}

.feed-card .term-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 1rem 0;
    color: var(--navy-ink);
}

.feed-card .term-definition {
    font-size: clamp(1rem, 2.2vw, 1.25rem);
    line-height: 1.55;
    color: var(--text-dim);
    max-width: 60ch;
    white-space: pre-wrap;
}

.feed-card .article-publish-date {
    font-size: .85rem;
    color: var(--text-muted);
    letter-spacing: .04em;
    margin: -0.5rem 0 1rem;
}

.feed-card .article-excerpt {
    font-size: clamp(1rem, 2.2vw, 1.25rem);
    line-height: 1.55;
    color: var(--text-dim);
    max-width: 60ch;
    white-space: pre-wrap;
}

.feed-card .term-definition.empty {
    color: var(--text-muted);
    font-style: italic;
}

.feed-card .feed-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.feed-card .feed-btn {
    background: var(--gold);
    color: #fff;
    border: none;
    padding: .65rem 1.25rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.feed-card .feed-btn:hover {
    background: var(--gold-dim);
    transform: translateY(-1px);
}

.feed-card .feed-btn.secondary {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
}

.feed-card .feed-btn.secondary:hover {
    background: var(--gold-glow);
}

.feed-card.empty {
    align-items: center;
    text-align: center;
}

.overlay {
    position: absolute;
    inset: 0;
    background: var(--surface);
    color: var(--text);
    z-index: 40;
    display: none;
}

.overlay.active {
    display: block;
}

.overlay-track {
    display: flex;
    height: 100%;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    touch-action: pan-x;
}

.overlay-page {
    flex: 0 0 100%;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    padding: 4rem 1.5rem 4rem;
    overflow-y: auto;
    box-sizing: border-box;
}

.overlay-page h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    margin: 0 auto 1rem;
    color: var(--navy-ink);
    max-width: 60ch;
}

.overlay-page .body {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    line-height: 1.6;
    max-width: 60ch;
    margin: 0 auto;
    white-space: pre-wrap;
    color: var(--text);
}

.overlay-dots {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: .4rem;
    pointer-events: none;
    z-index: 41;
}

.overlay-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(11, 29, 58, 0.25);
    transition: background .2s, transform .2s;
}

.overlay-dots .dot.active {
    background: var(--navy-ink);
    transform: scale(1.2);
}

.overlay-dots .dot.last {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.overlay-back {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--gold);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: .55rem 1.1rem .55rem .9rem;
    font-family: 'DM Sans', sans-serif;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(11, 29, 58, 0.15);
    transition: background 0.2s, transform 0.15s;
    z-index: 42;
}

.overlay-back:hover,
.overlay-back:focus {
    background: var(--gold-dim);
    transform: translateY(-1px);
    color: #fff;
}

.overlay-back-arrow {
    font-size: 1.15rem;
    line-height: 1;
}

.end-chip {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--green);
    color: #fff;
    padding: .25rem .75rem;
    border-radius: 1rem;
    font-size: .75rem;
    font-weight: 600;
    display: none;
    z-index: 42;
}

.end-chip.visible {
    display: block;
}

.feed-page-counter {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-dim);
    font-size: .85rem;
    z-index: 41;
}
