/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --bg:           #080808;
    --surface:      #0f0f0f;
    --border:       #1c1c1c;
    --border-hover: #2e2e2e;
    --accent:       #e8e0cc;
    --accent-dim:   rgba(232, 224, 204, 0.06);
    --text-primary: #efefef;
    --text-secondary: #555;
    --text-muted:   #333;
    --font-display: 'Barlow Condensed', sans-serif;
    --font-serif:   'Crimson Pro', Georgia, serif;
    --font-mono:    'JetBrains Mono', monospace;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ──────────────────────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-mono);
    min-height: 100vh;
    /* Subtle dot grid */
    background-image: radial-gradient(circle, #1a1a1a 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ── Scanline overlay ──────────────────────────────────────────────────────── */
.scanline {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0,0,0,0.07) 3px,
        rgba(0,0,0,0.07) 4px
    );
}

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 8, 8, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    text-align: center;
}

.header-inner {
    max-width: 860px;
    margin: 0 auto;
}

.header-top {
    display: flex;
    align-items: baseline;
    justify-content: center;
    padding: 28px 0 18px;
    gap: 16px;
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 800;
    letter-spacing: 0.14em;
    line-height: 1;
    color: var(--text-primary);
    text-transform: uppercase;
    word-spacing: 0.2em;
    /* Ensure the space between NEWS and 9UY is always visible */
    white-space: pre;
}

h1 .accent {
    color: var(--accent);
}

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

.header-rule {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-hover), transparent);
    margin-bottom: 12px;
}

/* ── Filter buttons ────────────────────────────────────────────────────────── */
#filter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding-bottom: 18px;
}

.filter-btn {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    padding: 4px 10px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    outline: none;
    /* Sharp corners — no border-radius */
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.filter-btn.active {
    color: var(--text-primary);
    border-color: #444;
    background: #1a1a1a;
}

/* ── Main ──────────────────────────────────────────────────────────────────── */
#app {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* ── State messages ────────────────────────────────────────────────────────── */
.state {
    padding: 60px 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

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

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

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

#error .error-msg {
    margin-bottom: 20px;
    color: #ff4444;
}

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

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

/* ── Feed ──────────────────────────────────────────────────────────────────── */
.feed {
    margin-top: 4px;
}

/* ── Article ───────────────────────────────────────────────────────────────── */
.article {
    border-bottom: 1px solid var(--border);
    padding: 20px 0 20px 16px;
    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-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 7px;
}

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

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

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

.article-snippet {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    font-style: italic;
}

/* ── Staggered fade-in for articles ────────────────────────────────────────── */
.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; }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    header         { padding: 0 20px; }
    .header-inner  { padding: 0; }
    #app           { padding: 0 20px 40px; }
    .article       { padding: 16px 0 16px 12px; }
    .article-snippet { display: none; }
}
