/* ===== CSS Variables & Reset ===== */
:root,
[data-theme="dark"] {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-card-hover: #1f2a40;
    --text-primary: #e8edf5;
    --text-secondary: #8b99b0;
    --text-muted: #5a6578;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --border-color: #2a3548;
    --radius: 12px;
    --radius-sm: 8px;
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fa;
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #94a3b8;
    --accent-blue: #2563eb;
    --accent-cyan: #0891b2;
    --accent-green: #059669;
    --accent-yellow: #d97706;
    --accent-red: #dc2626;
    --accent-purple: #7c3aed;
    --border-color: #e2e8f0;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

/* Focus indicators for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-cyan);
}

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

/* ===== Site Header ===== */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.site-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.site-logo span {
    color: var(--accent-cyan);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-nav a {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--text-primary);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-dropdown {
    position: relative;
}

.lang-dropdown-btn {
    width: auto;
    padding: 0 10px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    height: 36px;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.2s;
}

.lang-dropdown-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.lang-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 0;
    min-width: 140px;
    z-index: 1000;
    max-height: 320px;
    overflow-y: auto;
}

.lang-menu.open {
    display: block;
}

.lang-menu a {
    display: block;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.15s;
}

.lang-menu a:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.lang-menu a.active {
    color: var(--accent-blue);
    font-weight: 600;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    .site-nav {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 16px 20px;
        gap: 16px;
    }
    .site-nav.open {
        display: flex;
    }
}

/* ===== Site Footer ===== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 40px 20px;
    margin-top: 60px;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 8px;
    max-width: 320px;
}

.footer-links h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    max-width: 1100px;
    margin: 24px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 768px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ===== Page Container ===== */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-narrow {
    max-width: 760px;
}

/* ===== Hero Section ===== */
.hero {
    text-align: center;
    padding: 60px 20px;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 16px;
}

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

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .hero {
        padding: 40px 16px;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .hero p {
        font-size: 1rem;
    }
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background: #2563eb;
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1rem;
}

/* ===== Cards Grid ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 28px 24px;
    transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 16px;
}

.card-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.card-tag.coming-soon {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}

.card a {
    display: block;
    color: inherit;
    text-decoration: none;
}

/* ===== Section headings ===== */
.section-heading {
    text-align: center;
    margin-bottom: 12px;
}

.section-heading h2 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.section-heading p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 8px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Features list ===== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.feature {
    padding: 24px;
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.feature h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.feature p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== Guide / Article pages ===== */
.article {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px;
}

.article h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    line-height: 1.2;
}

.article-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.article h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 40px;
    margin-bottom: 12px;
}

.article h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 8px;
}

.article p {
    margin-bottom: 16px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.article ul, .article ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.article li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.article strong {
    color: var(--text-primary);
    font-weight: 600;
}

.article .cta-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin: 32px 0;
    text-align: center;
}

.article .cta-box p {
    margin-bottom: 16px;
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 12px 20px;
    max-width: 1100px;
    margin: 0 auto;
}

.breadcrumbs a {
    color: var(--text-muted);
}

.breadcrumbs a:hover {
    color: var(--accent-blue);
}

.breadcrumbs span {
    margin: 0 6px;
}

/* ===== Disclaimer banner ===== */
.disclaimer-banner {
    background: rgba(245, 158, 11, 0.08);
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
    padding: 10px 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--accent-yellow);
}

/* ===== About page ===== */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 32px;
}

.about-grid .card {
    padding: 24px;
}

.about-grid .card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.about-grid .card p {
    font-size: 0.88rem;
}

@media (max-width: 600px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
}

/* Utility: no hover transform on static cards */
.card-static {
    transform: none;
}
.card-static:hover {
    transform: none;
}

/* Inline list inside cards */
.card-features {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 12px 0 16px;
    padding-left: 20px;
}

/* Full-width utility */
.w-full { width: 100%; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-40 { margin-top: 40px; }
.text-left { text-align: left; }

/* ===== Theme toggle script helper ===== */
.theme-icon-dark,
.theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

[data-theme="light"] .theme-icon-light {
    display: inline;
}
