
/* ==============================
   DESIGN TOKENS
   ============================== */
:root {
    --primary: #1F6FEB;
    --primary-hover: #1558c9;
    --bg-header: #0E1621;
    --bg-main: #F5F7FA;
    --bg-card: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --text-inverted: #FFFFFF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.14);
    --radius: 12px;
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --xs: 4px;
    --sm: 8px;
    --md: 16px;
    --lg: 24px;
    --xl: 32px;
    --xxl: 48px;
    --sidebar-width: 320px;
    --max-width: 1280px;
}

/* ==============================
   RESET
   ============================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
img { display: block; max-width: 100%; }
a { color: inherit; }

/* ==============================
   BASE
   ============================== */
body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==============================
   HEADER
   ============================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--lg);
    height: 56px;
    display: flex;
    align-items: center;
    gap: var(--lg);
}

.site-logo {
    color: var(--text-inverted);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-logo .logo-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.site-logo .logo-text { display: flex; align-items: baseline; gap: 0; }
.site-logo .logo-tech { color: var(--text-inverted); }
.site-logo .logo-story { color: var(--primary); }
.site-logo .logo-tld { color: rgba(255,255,255,0.5); font-size: 0.8em; font-weight: 600; }

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--xs);
    flex: 1;
}

.site-nav a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px var(--sm);
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--text-inverted);
    background: rgba(255,255,255,0.09);
}

.site-nav a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.nav-spacer { flex: 1; }

.nav-search {
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.15s;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.nav-search:hover { color: var(--text-inverted); }

.nav-search:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==============================
   PAGE LAYOUT
   ============================== */
.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--xl) var(--lg);
}

.page-grid {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--xl);
    align-items: start;
}

.content-area { min-width: 0; }

/* ==============================
   HERO CARD
   ============================== */
.hero-card {
    position: relative;
    height: 420px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: var(--xl);
    background: var(--bg-header);
    display: block;
    text-decoration: none;
    color: var(--text-inverted);
    transition: box-shadow 0.2s;
}

.hero-card:hover { box-shadow: var(--shadow-md); }

.hero-card:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

.hero-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.hero-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.48) 50%, rgba(0,0,0,0.1) 100%);
}

.hero-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 62%;
    padding: var(--xl);
}

.hero-card-meta {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: var(--sm);
    display: flex;
    align-items: center;
    gap: var(--sm);
}

.hero-source-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.hero-card h1 {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: var(--md);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-card-excerpt {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.78);
    line-height: 1.6;
    margin-bottom: var(--lg);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: var(--xs);
    background: var(--primary);
    color: var(--text-inverted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: var(--sm) var(--md);
    border-radius: 8px;
    transition: background 0.15s, transform 0.15s;
    border: none;
    cursor: pointer;
}

.hero-cta:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.hero-card.no-image {
    background: linear-gradient(135deg, #0E1621 0%, #162040 100%);
}

.hero-card.no-image .hero-card-content { width: 80%; }

/* ==============================
   CARDS GRID
   ============================== */
.cards-grid {
    columns: 2;
    column-gap: var(--lg);
}

/* ==============================
   STORY CARD
   ============================== */
.story-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    break-inside: avoid;
    margin-bottom: var(--lg);
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.story-card:focus-within { outline: 2px solid var(--primary); }

.story-card.hidden { display: none !important; }

.story-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: center;
    flex-shrink: 0;
}

.story-card-body {
    padding: var(--md);
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: var(--sm);
}

.story-card-meta {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--xs);
    flex-wrap: wrap;
}

.story-card-source { color: var(--primary); }

.story-card h2 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-card h2 a {
    color: inherit;
    text-decoration: none;
}

.story-card h2 a:hover { color: var(--primary); }

.story-card h2 a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.story-card-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: var(--sm);
    border-top: 1px solid var(--border);
    gap: var(--sm);
}

.story-card-tags {
    display: flex;
    gap: var(--xs);
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.story-card-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 500;
    background: rgba(31,111,235,0.08);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.story-card-readmore {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.story-card-readmore:hover { text-decoration: underline; }

/* Source badges on cards */
.source-badge {
    display: inline-block;
    font-size: 0.62rem;
    background: #F3F4F6;
    color: var(--text-secondary);
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

/* ==============================
   SIDEBAR
   ============================== */
.sidebar {
    position: sticky;
    top: 72px;
    display: flex;
    flex-direction: column;
    gap: var(--lg);
}

.sidebar-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.sidebar-section-header {
    padding: var(--sm) var(--md);
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-secondary);
    background: #FAFBFC;
}

/* Top Stories */
.top-stories-list { list-style: none; }

.top-stories-item {
    padding: var(--sm) var(--md);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: var(--sm);
    align-items: flex-start;
}

.top-stories-item:last-child { border-bottom: none; }

.top-stories-num {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--border);
    line-height: 1.3;
    flex-shrink: 0;
    width: 1.8rem;
    text-align: right;
}

.top-stories-item a {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.top-stories-item a:hover { color: var(--primary); }

/* Trending Topics */
.trending-topics {
    padding: var(--md);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm);
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--xs);
    font-size: 0.78rem;
    font-weight: 500;
    background: #F3F4F6;
    color: var(--text-secondary);
    padding: var(--xs) var(--sm);
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    user-select: none;
    font-family: var(--font);
}

.tag-pill:hover {
    background: rgba(31,111,235,0.08);
    color: var(--primary);
    border-color: rgba(31,111,235,0.2);
}

.tag-pill:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.tag-pill.active {
    background: var(--primary);
    color: var(--text-inverted);
    border-color: var(--primary);
}

.tag-count {
    font-size: 0.68rem;
    opacity: 0.7;
}

/* ==============================
   FOOTER
   ============================== */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: var(--xxl);
    padding: var(--xl) var(--lg);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==============================
   ARTICLE PAGE
   ============================== */
.article-container {
    max-width: 820px;
    margin: var(--xl) auto;
    padding: 0 var(--lg);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--xs);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: var(--lg);
}

.back-link:hover { text-decoration: underline; }

article.article-body {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--xl) var(--xxl);
}

article.article-body h1 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: var(--sm);
    color: var(--text-primary);
}

article.article-body .date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: var(--md);
}

article.article-body h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: var(--xl);
    margin-bottom: var(--sm);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--xs);
}

article.article-body h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: var(--lg);
    margin-bottom: var(--sm);
}

article.article-body p {
    margin-bottom: var(--md);
    line-height: 1.75;
    color: #374151;
}

article.article-body ul,
article.article-body ol {
    margin: var(--sm) 0 var(--md) var(--lg);
}

article.article-body li {
    margin-bottom: var(--xs);
    line-height: 1.65;
}

article.article-body a {
    color: var(--primary);
    text-decoration: none;
}

article.article-body a:hover { text-decoration: underline; }

article.article-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--xl) 0 var(--md);
}

article.article-body .article-sources {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: var(--sm);
}

article.article-body .article-sources a {
    color: var(--primary);
    font-weight: 500;
}

article.article-body .article-sources a:hover {
    text-decoration: underline;
}

article.article-body strong { font-weight: 600; }
article.article-body em { font-style: italic; }

article.article-body code {
    background: #F3F4F6;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

/* Article hero image */
.article-hero {
    margin: 0 calc(-1 * var(--xxl)) var(--xl);
    overflow: hidden;
}

.article-hero img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
}

.article-hero figcaption {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: right;
    padding: var(--xs) 0 0;
}

.article-hero figcaption a { color: var(--text-muted); }

/* Article tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--xs);
    margin-bottom: var(--lg);
}

.article-tags .tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(31,111,235,0.08);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 20px;
}

/* Comments section */
.comments-section {
    max-width: 740px;
    margin: var(--xl) auto 0;
    padding: var(--xl) 0 0;
    border-top: 1px solid var(--border);
}

.comments-heading {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--lg);
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 1023px) {
    .page-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--lg);
    }
}

@media (max-width: 767px) {
    .page-container { padding: var(--md); }
    .cards-grid { columns: 1; }
    .hero-card { height: 300px; }
    .hero-card-content { width: 90%; padding: var(--md); }
    .hero-card h1 { font-size: 1.3rem; }
    .hero-card-excerpt { display: none; }
    .sidebar { grid-template-columns: 1fr; }
    article.article-body { padding: var(--lg) var(--md); }
    .article-hero { margin: 0 calc(-1 * var(--md)) var(--lg); }
    .header-inner { padding: 0 var(--md); }
    .site-nav a:not(:first-child) { display: none; }
}

@media (max-width: 480px) {
    .hero-card { height: 240px; }
    .hero-card-content { width: 100%; }
}

/* ==============================
   SEARCH OVERLAY
   ============================== */
.search-box {
    position: absolute;
    inset: 0;
    background: var(--bg-header);
    z-index: 200;
    display: none;
    align-items: center;
    padding: 0 var(--lg);
    gap: var(--md);
}

.search-input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: var(--text-inverted);
    padding: 8px var(--md);
    font-size: 0.95rem;
    font-family: var(--font);
    outline: none;
}

.search-input::placeholder { color: rgba(255,255,255,0.4); }
.search-input:focus { border-color: var(--primary); }

.search-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 1.4rem;
    padding: var(--xs) var(--sm);
    line-height: 1;
    flex-shrink: 0;
}

.search-close:hover { color: var(--text-inverted); }

/* ==============================
   SCROLL SENTINEL / LOAD MORE
   ============================== */
.scroll-sentinel {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    margin-top: var(--lg);
}

/* ==============================
   COOKIE BANNER
   ============================== */
.cookie-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 999;
    background: #111827;
    color: rgba(255,255,255,0.85);
    padding: var(--md) var(--lg);
    display: none;
    align-items: center;
    gap: var(--lg);
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}

.cookie-banner p {
    flex: 1;
    font-size: 0.85rem;
    margin: 0;
    min-width: 200px;
    line-height: 1.55;
}

.cookie-banner a { color: var(--primary); text-decoration: underline; }

.cookie-actions { display: flex; gap: var(--sm); flex-shrink: 0; }

.cookie-btn {
    padding: 8px var(--md);
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font);
    white-space: nowrap;
    transition: opacity 0.15s;
}

.cookie-btn:hover { opacity: 0.85; }
.cookie-btn-accept { background: var(--primary); color: #fff; }
.cookie-btn-decline { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.85); }

/* ==============================
   LEGAL PAGES
   ============================== */
.legal-container {
    max-width: 820px;
    margin: var(--xl) auto var(--xxl);
    padding: 0 var(--lg);
}

.legal-container h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--xs);
}

.legal-container .legal-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--xl);
}

.legal-container h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: var(--xl);
    margin-bottom: var(--sm);
    color: var(--text-primary);
}

.legal-container p {
    line-height: 1.75;
    color: #374151;
    margin-bottom: var(--md);
}

.legal-container a { color: var(--primary); }
.legal-container ul { margin: var(--sm) 0 var(--md) var(--xl); }
.legal-container li { margin-bottom: var(--xs); line-height: 1.65; color: #374151; }
