:root {
    --bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --surface: #ffffff;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --text: #1a1a1a;
    --text-secondary: #555;
    --text-tertiary: #888;
    --accent: #1a73e8;
    --accent-dark: #1557b0;
    --accent-red: #d93025;
    --accent-green: #188038;
    --tag-bg: #e8f0fe;
    --tag-text: #1a73e8;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --card-radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Nav ── */
header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}
nav {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.03em;
}
.logo .ai {
    color: var(--accent);
    font-weight: 500;
}
.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-links a:hover { color: var(--accent); }

/* ── Search ── */
.search-form { flex: 1; max-width: 280px; margin: 0 2rem; }
.search-input {
    width: 100%;
    padding: 0.55rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input::placeholder { color: #aaa; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,115,232,0.15); }

/* ── Main ── */
main {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* ── Date Nav ── */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.date-nav h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}
.arrow {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.3rem 0.5rem;
    border-radius: 50%;
    transition: background 0.15s;
}
.arrow:hover { background: var(--border-light); color: var(--text); }
.today-badge {
    font-size: 0.7rem;
    background: var(--accent-red);
    color: #fff;
    padding: 0.2rem 0.65rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Top Story ── */
.headline-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 2rem 2.5rem;
    margin-bottom: 2.5rem;
    text-align: center;
    box-shadow: var(--card-shadow);
}
.headline-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-red);
    margin-bottom: 0.6rem;
}
.headline {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
    letter-spacing: -0.02em;
}

/* ── Hero + Sidebar ── */
.hero-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}
.hero-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s;
}
.hero-card:hover { box-shadow: var(--card-shadow-hover); }
.hero-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}
.hero-card a.hero-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    line-height: 1.3;
    letter-spacing: -0.02em;
    display: block;
    margin-bottom: 1rem;
}
.hero-card a.hero-title:hover { color: var(--accent); }
.hero-card .summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* ── Sidebar ── */
.sidebar { }
.sidebar-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--text);
}
.sidebar-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-item:last-child { border-bottom: none; }
.sidebar-cat {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.25rem;
}
a.sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    line-height: 1.4;
    display: block;
    margin-bottom: 0.3rem;
}
a.sidebar-title:hover { color: var(--accent); }
.sidebar-summary {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Category Sections ── */
.category-section { margin-bottom: 2.5rem; }
.category-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--text);
}
.cat-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.cat-count {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* ── Card Grid ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.article-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s, transform 0.15s;
}
.article-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}
.card-relevance {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.rel-high { background: #e6f4ea; color: var(--accent-green); }
.rel-mid { background: #fef7e0; color: #b06000; }
.rel-low { background: #f5f5f5; color: #999; }

a.article-title {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
}
a.article-title:hover { color: var(--accent); }

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

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
}
.tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}
.category-badge {
    background: var(--accent);
    color: #fff;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
}
.pub-date { color: var(--text-tertiary); font-size: 0.75rem; }
.relevance-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ── Search Page ── */
.search-info { color: var(--text-secondary); margin-bottom: 1.25rem; font-size: 0.92rem; }
.search-results { display: flex; flex-direction: column; gap: 0.75rem; }

/* ── Archive ── */
.archive-month { margin-bottom: 2rem; }
.month-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--text);
}
.archive-list { display: flex; flex-direction: column; gap: 0.5rem; }
.archive-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.15s;
}
.archive-item:hover { box-shadow: var(--card-shadow-hover); }
.archive-date { color: var(--accent); font-weight: 600; font-size: 0.85rem; min-width: 130px; }
.archive-headline { flex: 1; font-size: 0.9rem; font-weight: 500; }
.archive-count { color: var(--text-tertiary); font-size: 0.8rem; }

/* ── Empty / Footer ── */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-secondary); }
footer {
    background: #fff;
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1.5rem;
    color: var(--text-tertiary);
    font-size: 0.75rem;
}
footer a { color: var(--accent); text-decoration: none; }
.footer-stats { text-align: center; color: var(--text-tertiary); font-size: 0.8rem; margin-top: 2rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .top-news-grid { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    main { padding: 1.25rem 1rem; }
    .card-grid { grid-template-columns: 1fr; }
    .headline { font-size: 1.2rem; }
    .headline-box { padding: 1.5rem; }
    nav { padding: 0.6rem 1rem; }
    .search-form { max-width: 180px; margin: 0 0.75rem; }
    .archive-item { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}

/* ── Fix link visibility ── */
.headline { color: var(--text); }

/* ── Page Layout with Nav Sidebar ── */
.page-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 2rem;
    align-items: start;
}
.nav-sidebar {
    position: sticky;
    top: 70px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text);
}
.nav-link-pearls {
    color: var(--accent);
    font-weight: 600;
    background: var(--tag-bg);
}
.nav-link-pearls:hover { background: #d2e3fc; }
.page-content { min-width: 0; }

/* ── Clinical Pearls Section ── */
.pearls-section {
    background: #f0f7ff;
    border: 1px solid #d2e3fc;
    border-radius: var(--card-radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2.5rem;
}
.pearls-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}
.pearls-subtitle {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}
.pearls-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.pearl-item {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
    padding: 0.6rem 0.8rem;
    background: #fff;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}


/* ── Mobile: sidebar becomes horizontal tabs ── */
@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: 1fr;
    }
    .nav-sidebar {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 0.3rem;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid var(--border);
        -webkit-overflow-scrolling: touch;
    }
    .nav-link {
        white-space: nowrap;
        font-size: 0.78rem;
        padding: 0.4rem 0.7rem;
    }
}

/* ── Sticky mobile nav tabs ── */
@media (max-width: 900px) {
    .nav-sidebar {
        position: sticky;
        top: 52px;
        z-index: 90;
        background: #fff;
        padding: 0.5rem 0;
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }
}

/* ── Scroll padding so anchors don't hide behind sticky nav ── */
html { scroll-padding-top: 130px; }

/* ── Back to top button ── */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: opacity 0.2s;
}
.back-to-top.visible { display: flex; }

/* ── Clickable tags ── */
a.tag { text-decoration: none; cursor: pointer; transition: background 0.15s; }
a.tag:hover { background: #d2e3fc; }

/* ── Timestamps ── */
.pub-date {
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}
.pearls-date-range {
    color: var(--text-tertiary);
    font-style: italic;
}

/* ── Smoking Cessation Nav Link ── */
.nav-smoking {
    color: #188038 !important;
    font-weight: 600 !important;
}
.nav-smoking:hover { color: #34a853 !important; }
