/* News — app-local styles.
 *
 * Only the components this app owns: the source filter strip, the feed and
 * its articles, the quality-matrix dialog and the back-to-top button.
 * Everything shared (body, header, footer, panels, buttons, scanline,
 * scrollbars) comes from app.css; every colour here is one of its tokens,
 * so light and dark both follow the OS preference with no toggle. */

/* ── Header extras ─────────────────────────────────────────── */

.clock {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    white-space: nowrap;
}

/* ── Filters bar ───────────────────────────────────────────── */

/* Hidden by default; the header toggle reveals it on narrow screens and the
   desktop rules below keep it permanently open with the toggle hidden. */
.filters-toggle { display: none; }

.filters-toggle-label { line-height: 1; }

/* The shared .btn only highlights on hover; the toggle also carries an
   `.active` class while the panel is open. */
.filters-toggle.active {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.filters-panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease;
}

.filters-panel--open {
    max-height: 26rem;
    opacity: 1;
}

#filter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.75rem 0.875rem;
}

.filter-btn {
    font-family: inherit;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    outline: none;
}

.filter-btn:hover {
    color: var(--fg-bright);
    border-color: var(--border-hover);
}

.filter-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.filter-btn.active {
    color: var(--fg-bright);
    border-color: var(--accent);
    background: var(--hover-bg);
}

/* ── Quality matrix sliders ────────────────────────────────── */

.slider-container {
    padding: 0 0.875rem 0.875rem;
}

.sliders-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.slider-group {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 0.1875rem;
}

.slider-label {
    font-size: 0.625rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    user-select: none;
}

.slider-hint {
    font-size: 0.5625rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    user-select: none;
}

/* Dual-handle range track — both inputs sit on top of each other and only
   their thumbs take pointer events, so the track itself is not draggable. */
.dual-range {
    position: relative;
    height: 26px;
    display: flex;
    align-items: center;
}

.range-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    pointer-events: none;
}

.range-fill {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    pointer-events: none;
}

.dual-range input[type="range"] {
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 3;
}

.dual-range input[type="range"]:focus { outline: none; }

/* WebKit / Blink */
.dual-range input[type="range"]::-webkit-slider-runnable-track {
    height: 3px;
    background: transparent;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: all;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    cursor: grab;
    margin-top: -6px;
}

.dual-range input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }

/* Firefox */
.dual-range input[type="range"]::-moz-range-track {
    height: 3px;
    background: transparent;
    border: none;
}

.dual-range input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    cursor: grab;
    box-sizing: border-box;
}

/* ── State messages ────────────────────────────────────────── */

.state {
    padding: 3.75rem 0;
    text-align: center;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.loading-text { display: inline-block; }

.blink { animation: news-blink 1s step-end infinite; }

@keyframes news-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

#error .error-msg {
    margin-bottom: 1.25rem;
}

#retry-btn {
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 0.375rem;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

#retry-btn:hover {
    background: var(--accent);
    color: var(--bg);
}

/* ── Feed ──────────────────────────────────────────────────── */

.article {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 0 1.25rem 1rem;
    position: relative;
    transition: border-color 0.2s;
    animation: fadeIn 0.3s ease both;
}

.article::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: transparent;
    transition: background 0.2s;
}

.article:hover::before { background: var(--accent); }
.article:hover { border-color: var(--border-hover); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.article-meta {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4375rem;
}

.source-badge {
    display: inline-block;
    margin-left: 0.625rem;
    padding: 0.0625rem 0.3125rem;
    font-size: 0.58rem;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 0.25rem;
    vertical-align: middle;
}

.article-title {
    font-size: clamp(1.05rem, 2.5vw, 1.3rem);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.article-title a {
    color: var(--fg-bright);
    text-decoration: none;
    transition: color 0.15s;
}

.article-title a:hover { color: var(--accent); }

.article-snippet {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Staggered fade-in for the first screenful */
.article:nth-child(1)  { animation-delay: 0.02s; }
.article:nth-child(2)  { animation-delay: 0.05s; }
.article:nth-child(3)  { animation-delay: 0.08s; }
.article:nth-child(4)  { animation-delay: 0.11s; }
.article:nth-child(5)  { animation-delay: 0.14s; }
.article:nth-child(6)  { animation-delay: 0.17s; }
.article:nth-child(7)  { animation-delay: 0.20s; }
.article:nth-child(8)  { animation-delay: 0.23s; }
.article:nth-child(9)  { animation-delay: 0.26s; }
.article:nth-child(10) { animation-delay: 0.29s; }

/* ── Quality matrix dialog ─────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.2s;
}

.modal--is-hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-panel-solid);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-panel);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s;
    z-index: 10;
}

.modal-close:hover { color: var(--fg-bright); }

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-bright);
    text-align: center;
    padding: 1rem 2.5rem 0;
}

.modal-body { padding: 1rem; }

.modal-body img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ── Back to top ───────────────────────────────────────────── */

.back-to-top {
    position: fixed;
    bottom: 1.75rem;
    right: 1.5rem;
    z-index: 200;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1;
    color: var(--bg);
    background: var(--accent);
    border: none;
    border-radius: 0.375rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s, transform 0.2s, filter 0.2s;
    pointer-events: none;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover { filter: brightness(1.15); }

/* ── Responsive ────────────────────────────────────────────── */

@media (min-width: 601px) {
    .filters-panel {
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible;
    }
    .filters-toggle { display: none !important; }
}

@media (max-width: 600px) {
    .filters-toggle { display: inline-flex; }
    /* The header carries four controls plus the app name, so tighten it up
       and drop the toggle's word: the icon alone leaves the title readable
       at 375px. The button keeps its title and aria-label. */
    .header-right { gap: 0.625rem; }
    .filters-toggle-label { display: none; }
    .article { padding: 1rem 0 1rem 0.75rem; }
    .article-snippet { display: none; }
    .clock { display: none; }
    .back-to-top { bottom: 1.25rem; right: 1rem; }
}
