/* ── Reset ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

:root {
    --bg: #ffffff;
    --bg-soft: #f8f9fc;
    --text: #1a1a2e;
    --text-soft: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #f59e0b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --bg-soft: #1e293b;
        --text: #f1f5f9;
        --text-soft: #94a3b8;
        --border: #334155;
        --primary: #60a5fa;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', system-ui, sans-serif;
    background: var(--bg-soft);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "ss01", "cv11";
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

a { color: var(--primary); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: .75; }

/* ── Header ──────────────────────────────────── */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}
.nav-row {
    display: flex; justify-content: space-between; align-items: center;
    height: 72px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.15em; letter-spacing: -0.01em; }
.logo-mark { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), #7c3aed); color: white;
             border-radius: 8px; display: inline-flex; align-items: center;
             justify-content: center; font-weight: 800; font-size: .82em;
             letter-spacing: -0.02em; box-shadow: 0 2px 8px -2px rgba(37,99,235,.4); }
.logo-word { font-weight: 700; }
nav { display: flex; gap: 24px; }
nav a { color: var(--text-soft); font-weight: 500; font-size: .95em; }
nav a:hover { color: var(--text); opacity: 1; }

/* ── Hero ────────────────────────────────────── */
.hero {
    padding: 80px 0 60px;
    text-align: center;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
    color: var(--text);
    font-feature-settings: "ss01";
}
.hero-subtitle {
    font-size: 1.15em;
    color: var(--text-soft);
    max-width: 600px;
    margin: 0 auto 40px;
}
.hero-stats {
    display: flex; gap: 48px; justify-content: center; padding: 24px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    max-width: 600px;
    margin: 0 auto;
}
.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 1.8em; font-weight: 700; color: var(--text); }
.stat-label { color: var(--text-soft); font-size: .85em; text-transform: uppercase; letter-spacing: .05em; }

/* ── Main Grid ───────────────────────────────── */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    padding: 60px 24px;
}
@media (max-width: 900px) {
    .main-grid { grid-template-columns: 1fr; }
}
.section-title {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}

/* ── Cards ───────────────────────────────────── */
.articles-section { display: flex; flex-direction: column; gap: 24px; }
.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    color: var(--text);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px -8px rgba(0,0,0,.12), 0 4px 12px -4px rgba(0,0,0,.08);
    border-color: var(--primary);
    opacity: 1;
}
.card-image {
    height: 200px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: var(--bg-soft);
}
.hero-svg { width: 100%; height: 100%; display: block; }
.card-content { padding: 24px 28px 28px; }
.card-meta {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 12px;
    font-size: .85em; color: var(--text-soft);
}
.cat-pill {
    background: var(--bg-soft);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 100px;
    font-weight: 600;
    font-size: .8em;
}
.featured-badge {
    background: linear-gradient(135deg, var(--accent), #ef4444);
    color: white;
    padding: 4px 10px;
    border-radius: 100px;
    font-weight: 700;
    font-size: .75em;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.card-title {
    font-size: 1.35em;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
    color: var(--text);
}
.card-excerpt { color: var(--text-soft); font-size: .95em; margin-bottom: 16px; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tag {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-soft);
    padding: 3px 10px;
    border-radius: 100px;
    font-size: .75em;
    font-weight: 500;
}
.card-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: .8em;
    color: var(--text-soft);
}

.card-featured { display: grid; grid-template-columns: 1fr 1.2fr; }
.card-featured .card-image { height: 100%; min-height: 280px; }
@media (max-width: 700px) {
    .card-featured { grid-template-columns: 1fr; }
    .card-featured .card-image { height: 200px; min-height: 200px; }
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.widget {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}
.widget h3 {
    font-size: .9em;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-soft);
    margin-bottom: 16px;
    font-weight: 700;
}
.widget ul { list-style: none; }
.widget li { margin-bottom: 10px; }
.widget li a { color: var(--text); font-weight: 500; }
.widget-text { color: var(--text-soft); font-size: .9em; margin-bottom: 12px; }
.affiliate-note { background: linear-gradient(135deg, #fef3c7, #fde68a); border: none; }
@media (prefers-color-scheme: dark) {
    .affiliate-note { background: linear-gradient(135deg, #422006, #581c0b); color: #fde68a; }
    .affiliate-note p { color: #fde68a !important; }
    .affiliate-note h3 { color: #fde68a !important; }
}

.author-widget { text-align: center; }
.author-avatar {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .95em;
    margin-bottom: 12px;
}
.author-widget h3 { color: var(--text); text-transform: none; font-size: 1em; letter-spacing: -.01em; }
.author-widget p { color: var(--text-soft); font-size: .88em; line-height: 1.55; margin-bottom: 12px; }
.author-link {
    display: inline-block;
    font-weight: 600;
    font-size: .88em;
    color: var(--primary);
    padding: 8px 16px;
    border: 1px solid var(--primary);
    border-radius: 100px;
    transition: background .15s, color .15s;
}
.author-link:hover { background: var(--primary); color: white; opacity: 1; }

.newsletter-form { display: flex; flex-direction: column; gap: 8px; }
.newsletter-form input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: .95em;
}
.newsletter-form input:focus {
    outline: none;
    border-color: var(--primary);
}
.newsletter-form button {
    padding: 10px;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.newsletter-form button:hover { opacity: .85; }
.newsletter-form .msg {
    font-size: .8em;
    color: var(--primary);
    min-height: 1.2em;
    font-weight: 600;
}

/* ── Trust Bar ───────────────────────────────── */
.trust-bar {
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 48px 0;
}
.trust-bar .container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    text-align: center;
}
@media (max-width: 700px) {
    .trust-bar .container { grid-template-columns: repeat(2, 1fr); }
}
.trust-item { display: flex; flex-direction: column; gap: 4px; padding: 12px; }
.trust-icon { font-size: 1.6em; margin-bottom: 8px; }
.trust-item strong { font-weight: 700; color: var(--text); font-size: 1.05em; }
.trust-item span:last-child { color: var(--text-soft); font-size: .85em; }

/* ── Footer ──────────────────────────────────── */
.site-footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 50px 0 30px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
}
@media (max-width: 700px) {
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}
.site-footer strong { color: var(--text); font-size: .95em; display: block; margin-bottom: 12px; }
.site-footer p { color: var(--text-soft); font-size: .88em; }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 6px; }
.site-footer li a { color: var(--text-soft); font-size: .9em; }
.site-footer li a:hover { color: var(--primary); opacity: 1; }
.footer-legal {
    text-align: center;
    color: var(--text-soft);
    font-size: .85em;
    padding-top: 24px;
}

/* ── Article Page ────────────────────────────── */
.article-page .article-header {
    padding: 60px 0 50px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.article-page .article-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 16px 0 16px;
}
.article-excerpt {
    font-size: 1.15em;
    color: var(--text-soft);
    max-width: 760px;
    margin: 16px 0 24px;
}
.article-meta { font-size: .85em; color: var(--text-soft); }
.back-link { color: var(--text-soft); font-weight: 500; }
.back-link:hover { color: var(--primary); opacity: 1; }
.article-footer-meta {
    display: flex; gap: 8px; align-items: center;
    color: var(--text-soft); font-size: .9em;
    padding-top: 16px; border-top: 1px solid var(--border);
}

.article-body { padding: 50px 0; }
.article-container {
    max-width: 760px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 50px 56px;
}
@media (max-width: 700px) {
    .article-container { padding: 30px 24px; border-radius: 0; border: none; }
}

.article-content {
    font-feature-settings: "kern", "liga";
    text-rendering: optimizeLegibility;
}
.article-content h1, .article-content h2, .article-content h3 {
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.article-content h2 { font-size: 1.6em; margin: 40px 0 16px; padding-top: 8px; position: relative; padding-left: 0; }
.article-content h2::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 28px;
    background: linear-gradient(180deg, var(--primary), #7c3aed);
    border-radius: 2px;
    opacity: 0;
    transition: opacity .3s ease;
}
.article-content h2:hover::before { opacity: 1; }
.article-content h3 { font-size: 1.25em; margin: 28px 0 12px; }
.article-content p { color: var(--text); margin: 18px 0; font-size: 1.05em; }
.article-content ul, .article-content ol { margin: 18px 0; padding-left: 24px; }
.article-content li { margin: 8px 0; color: var(--text); }
.article-content > p:first-of-type::first-letter {
    float: left;
    font-size: 3.6em;
    line-height: 0.85;
    font-weight: 800;
    color: var(--primary);
    margin: 0.08em 0.12em 0 -0.04em;
}
.article-content strong { color: var(--text); font-weight: 700; }
.article-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    opacity: 1;
}
.article-content a:hover { text-decoration-thickness: 2px; opacity: .8; }
.article-content table {
    width: 100%; border-collapse: collapse;
    margin: 28px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-size: .92em;
}
.article-content th, .article-content td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.article-content th {
    background: var(--bg-soft);
    color: var(--text);
    font-weight: 700;
    font-size: .78em;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.article-content th:first-child, .article-content td:first-child { font-weight: 600; }
.article-content tbody tr:hover { background: var(--bg-soft); }
.article-content tbody tr:nth-child(odd) { background: rgba(0,0,0,.015); }
.article-content tr:last-child td { border-bottom: none; }
@media (prefers-color-scheme: dark) {
    .article-content tbody tr:nth-child(odd) { background: rgba(255,255,255,.02); }
}
.article-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 16px 20px;
    margin: 24px 0;
    background: var(--bg-soft);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-soft);
}
.article-content code {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .9em;
    font-family: 'SF Mono', monospace;
}

.article-tags {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 40px; padding-top: 24px;
    border-top: 1px solid var(--border);
}
.article-tags .tag {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    border-radius: 100px;
    font-size: .85em; font-weight: 500;
}

.article-cta { padding: 60px 0; }
.cta-box {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    text-align: center;
    padding: 50px 30px;
    border-radius: 20px;
}
.cta-box h3 { font-size: 1.5em; margin-bottom: 8px; font-weight: 700; }
.cta-box p { opacity: .9; margin-bottom: 24px; }
.cta-button {
    display: inline-block;
    background: white;
    color: var(--primary);
    padding: 12px 28px;
    border-radius: 100px;
    font-weight: 700;
    transition: transform .15s;
}
.cta-button:hover { transform: translateY(-2px); opacity: 1; }

/* ── Static Pages ────────────────────────────── */
.static-page { max-width: 720px; margin: 60px auto; padding: 0 24px; }
.static-page h1 { font-size: 2.2em; font-weight: 800; margin-bottom: 24px; letter-spacing: -0.02em; }
.static-page h2 { font-size: 1.4em; font-weight: 700; margin: 32px 0 12px; }
.static-page p { margin: 16px 0; color: var(--text); }
.static-page ul { margin: 16px 0; padding-left: 24px; }
.static-page li { margin: 6px 0; color: var(--text); }

/* ── Reading Progress Bar ────────────────────── */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #7c3aed, #ec4899);
    z-index: 100;
    transition: width 0.1s ease-out;
    box-shadow: 0 1px 4px rgba(37, 99, 235, .3);
}

/* ── Breadcrumbs ────────────────────────────── */
.breadcrumb {
    font-size: .82em;
    color: var(--text-soft);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-soft); }
.breadcrumb a:hover { color: var(--primary); opacity: 1; }
.breadcrumb-sep { opacity: .4; }

/* ── Table of Contents ───────────────────────── */
.toc {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 32px 0;
    font-size: .92em;
}
.toc-title {
    font-weight: 700;
    font-size: .85em;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-soft);
    margin-bottom: 12px;
}
.toc ul { list-style: none; padding: 0; }
.toc li { margin: 6px 0; }
.toc a {
    color: var(--text);
    text-decoration: none;
    border-left: 2px solid transparent;
    padding-left: 12px;
    display: block;
    transition: all .15s ease;
}
.toc a:hover {
    color: var(--primary);
    border-left-color: var(--primary);
    padding-left: 16px;
    opacity: 1;
}

/* ── Focus States ───────────────────────────── */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Selection & Scrollbar ───────────────────── */
::selection { background: rgba(37, 99, 235, .2); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

/* ── Related Articles ────────────────────────── */
.related-articles {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 60px 0;
}
.related-articles h3 {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.related-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform .2s, border-color .2s;
    color: var(--text);
}
.related-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    opacity: 1;
}
.related-card .card-image { height: 140px; }
.related-card .card-content { padding: 16px 20px; }
.related-card .card-title { font-size: 1.05em; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 700px) {
    .nav-row { height: 60px; }
    .logo-word { display: none; }
    .hero { padding: 40px 0; }
    .hero-stats { gap: 24px; }
    .stat-num { font-size: 1.4em; }
}

/* ── Animation ───────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.article-page .article-header > .container { animation: fadeIn .6s ease; }

/* ── Print ───────────────────────────────────── */
@media print {
    .site-header, .site-footer, .hero, .sidebar, .trust-bar,
    .reading-progress, .breadcrumb, .toc { display: none; }
    .card { break-inside: avoid; }
    .article-content a { text-decoration: underline; }
}

/* ── Logo Image ─────────────────────────────── */
/* ── Logo Mark + Wordmark ───────────────────── */
.logo-mark-wrap { display: inline-flex; align-items: center; width: 36px; height: 36px; }
.logo-mark-svg { width: 100%; height: 100%; display: block; }
.logo-text { font-weight: 800; font-size: 1.1em; letter-spacing: -0.01em; display: flex; align-items: baseline; }
.logo-pick { color: #1e3a8a; }
.logo-xpert { color: #0d9488; }
.logo-dot { color: #1e3a8a; margin: 0 1px 0 -1px; }
.author-avatar { padding: 0 !important; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.author-avatar .logo-mark-wrap { width: 100%; height: auto; aspect-ratio: 1; }

@media (prefers-color-scheme: dark) {
    .logo-pick { color: #60a5fa; }
    .logo-dot { color: #60a5fa; }
    .logo-xpert { color: #2dd4bf; }
}
