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

:root {
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-text-muted: #555;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-accent: #10b981;
    --color-border: #e5e7eb;
    --color-bg-alt: #f3f4f6;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "SF Mono", "Fira Code", monospace;
    --max-width: 1200px;
    --narrow-width: 760px;
    --radius: 8px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* === Layout === */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: var(--narrow-width); }

/* === Header === */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}
.logo span { color: var(--color-primary); }

.main-nav { display: flex; gap: 0.25rem; }
.nav-dropdown { position: relative; }
.nav-link {
    background: none;
    border: none;
    font: inherit;
    font-size: 0.9rem;
    color: var(--color-text);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: var(--radius);
}
.nav-link:hover { background: var(--color-bg-alt); }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.5rem 0;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 200;
}
.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    font-size: 0.9rem;
}
.dropdown-menu a:hover { background: var(--color-bg-alt); text-decoration: none; }
.nav-dropdown:hover .dropdown-menu { display: block; }

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 5px;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    transition: 0.2s;
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        padding: 1rem;
    }
    .main-nav.open { display: flex; }
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
    }
    .nav-dropdown:hover .dropdown-menu { display: block; }
    .nav-link { text-align: left; }
}

/* === Hero === */
.hero {
    padding: 5rem 0 4rem;
    text-align: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f5e9 100%);
}
.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}
.hero-sub {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

@media (max-width: 768px) {
    .hero { padding: 3rem 0 2.5rem; }
    .hero h1 { font-size: 2rem; }
    .hero-sub { font-size: 1rem; }
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: 0.15s;
}
.btn-primary {
    background: var(--color-primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    text-decoration: none;
}

/* === Sections === */
.section { padding: 4rem 0; }
.section-alt { background: var(--color-bg-alt); }
.section h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.section-sub {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

/* === Card Grid === */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.card {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: 0.15s;
    color: var(--color-text);
}
.card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(37,99,235,0.1);
    text-decoration: none;
}
.card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.card p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}
.card-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tag {
    font-size: 0.75rem;
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
}

/* === Trust Grid === */
.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}
.trust-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

/* === Article Pages === */
.article-page { padding: 3rem 0 4rem; }
.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.last-updated {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
.article-tags { display: flex; gap: 0.5rem; }

.article-page h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}
.article-subtitle {
    font-size: 1.15rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

/* Article content */
.article-content h2 {
    font-size: 1.5rem;
    margin: 2.5rem 0 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}
.article-content h3 {
    font-size: 1.2rem;
    margin: 2rem 0 0.5rem;
}
.article-content p {
    margin-bottom: 1rem;
}
.article-content ul, .article-content ol {
    margin: 0 0 1rem 1.5rem;
}
.article-content li {
    margin-bottom: 0.4rem;
}
.article-content blockquote {
    border-left: 3px solid var(--color-primary);
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--color-bg-alt);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}
.article-content th, .article-content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.article-content th {
    background: var(--color-bg-alt);
    font-weight: 600;
}
.article-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--color-bg-alt);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}
.article-content strong {
    font-weight: 600;
}

/* === Where to Buy Box === */
.where-to-buy {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f5e9 100%);
    border-radius: var(--radius);
    text-align: center;
}
.where-to-buy h2 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}
.where-to-buy p {
    margin-bottom: 1rem;
    color: var(--color-text-muted);
}

/* === Disclaimer Box === */
.disclaimer-box {
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    background: #fffbe6;
    border: 1px solid #f5e6a3;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* === Footer === */
.site-footer {
    background: var(--color-text);
    color: #ccc;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-col h4 {
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}
.footer-col p { font-size: 0.85rem; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.4rem; }
.footer-col a {
    color: #aaa;
    font-size: 0.85rem;
}
.footer-col a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid #333;
    padding-top: 1.5rem;
    font-size: 0.8rem;
    color: #888;
}
.disclaimer { margin-bottom: 0.75rem; }

/* === TL;DR highlight === */
.article-content > blockquote:first-of-type {
    background: #eef6ff;
    border-left-color: var(--color-primary);
    font-size: 1.02rem;
}

/* === Responsive table scroll === */
@media (max-width: 600px) {
    .article-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
