/* ── Blog Common Styles ── */

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

:root {
    /* Light Theme */
    --bg-main: #F9FAFB;
    --bg-secondary: #FFFFFF;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --primary: #5E6AD2;
    --primary-glow: rgba(94, 106, 210, 0.1);
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --radius: 12px;

    /* Component specific */
    --box-bg: #F3F4F6;
    --box-text: #0f172a;
    --white: #ffffff;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-main: #08090A;
    --bg-secondary: #141516;
    --text-primary: #F7F8F8;
    --text-secondary: #8A8F98;
    --primary: #7c3aed;
    --primary-glow: rgba(124, 58, 237, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);

    /* Component specific */
    --box-bg: #1C1D1F;
    --box-text: #F7F8F8;
    --white: #08090A;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    background: var(--bg-main);
    transition: background 0.3s ease, color 0.3s ease;
}

.spotlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    opacity: 0.7;
}

.spotlight:nth-child(2) {
    bottom: 0;
    top: auto;
    right: 0;
    left: auto;
    transform: translate(50%, 50%);
}

.theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 15px;
}

[data-theme="dark"] .theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.theme-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1) rotate(15deg);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Theme Icon Visibility */
.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

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

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

/* ── Glass Nav Integration ── */
.glass-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 0;
}

:not([data-theme="dark"]) .glass-nav {
    background: rgba(255, 255, 255, 0.8);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.logo-img {
    height: 32px;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-links a.active {
    color: var(--primary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ── Layout ── */
.page-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 48px;
    align-items: start;
}

/* ── TOC Sidebar ── */
.toc-sidebar {
    position: sticky;
    top: 88px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
}

.toc-sidebar h4 {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.toc-sidebar ol {
    list-style: none;
    counter-reset: toc;
    padding: 0;
}

.toc-sidebar ol li {
    counter-increment: toc;
    margin-bottom: 2px;
}

.toc-sidebar ol li a {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: .85rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 5px 8px;
    border-radius: 6px;
    line-height: 1.4;
    transition: all .2s;
}

.toc-sidebar ol li a::before {
    content: counter(toc);
    font-size: .7rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 16px;
}

.toc-sidebar ol li a:hover,
.toc-sidebar ol li a.active {
    background: var(--primary-glow);
    color: var(--primary);
}

.toc-quantlease {
    margin-top: 20px;
    padding: 16px;
    background: var(--box-bg);
    border-radius: var(--radius);
    text-align: center;
}

.toc-quantlease p {
    font-size: .78rem;
    color: var(--box-text);
    margin-bottom: 10px;
    line-height: 1.4;
}

.toc-quantlease a {
    display: block;
    background: var(--primary);
    color: #ffffff;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    transition: opacity .2s;
}

/* ── Article Body ── */
.article-body {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 52px 56px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.article-hero {
    margin-bottom: 40px;
    padding-bottom: 36px;
    border-bottom: 2px solid var(--border);
}

.article-tag {
    display: inline-block;
    background: var(--primary-glow);
    color: var(--primary);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
}

h1,
h2,
h3,
h4 {
    color: var(--text-primary);
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 16px;
}

h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 48px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    scroll-margin-top: 90px;
}

h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 28px 0 8px;
    color: var(--primary);
    scroll-margin-top: 90px;
}

.article-intro {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
}

/* ── Components ── */

/* Graphic / Process / Comparison */
.graphic-container {
    margin: 40px 0;
    background: var(--box-bg);
    border-radius: var(--radius);
    padding: 40px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.process-step {
    flex: 1;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.process-step:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.step-num {
    display: inline-flex;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 12px;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    background: var(--bg-main);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.comparison-table th,
.comparison-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: var(--primary-glow);
    color: var(--primary);
    font-weight: 700;
}

/* Impact Grid / Ratio Grid */
.impact-grid,
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 32px 0;
}

.impact-card,
.ratio-card {
    padding: 24px;
    background: var(--box-bg);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.impact-card h4,
.ratio-card .ratio-name {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 700;
}

/* Formula Box */
.formula-box {
    background: var(--box-bg);
    color: var(--box-text);
    border-radius: var(--radius);
    padding: 22px 28px;
    font-family: 'Courier New', monospace;
    font-size: .92rem;
    line-height: 1.9;
    margin: 20px 0 24px;
    border-left: 4px solid var(--primary);
}

/* Callouts */
.callout {
    border-radius: var(--radius);
    padding: 18px 22px;
    margin: 24px 0;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.callout-info {
    background: var(--primary-glow);
    border-left: 4px solid var(--primary);
}

/* Checklist */
.checklist {
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

.checklist li {
    position: relative;
    padding-left: 32px;
    margin-bottom: 12px;
}

.checklist li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 800;
}

/* CTA Section */
.cta-section {
    background: var(--box-bg);
    border-radius: var(--radius);
    padding: 40px;
    margin-top: 60px;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    text-decoration: none;
    padding: 14px 26px;
    border-radius: 8px;
    font-weight: 700;
    font-size: .9rem;
    display: inline-block;
    transition: background .2s, box-shadow .2s;
}

.btn-primary:hover {
    background: #4c56b0;
    box-shadow: 0 6px 20px rgba(94, 106, 210, 0.25);
}

/* Simple Diagram SVG Utility */
.simple-diagram {
    margin: 40px 0;
    text-align: center;
}

/* ── Footer ── */
.site-footer {
    padding: 64px 0 32px;
    border-top: 1px solid var(--border);
    background: var(--bg-main);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}

.footer-links h4 {
    margin-bottom: 20px;
    font-size: .9rem;
    font-weight: 700;
}

.footer-links a {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: .9rem;
    text-decoration: none;
}

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

@media (max-width: 900px) {
    .page-wrap {
        grid-template-columns: 1fr;
    }

    .toc-sidebar {
        display: none;
    }

    .graphic-container,
    .impact-grid,
    .ratio-grid {
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}