/* ═══ aura-distill research — dual mode theme ═══ */

/* ═══ LIGHT MODE (Ink on Cream) ═══ */
:root {
    --bg: #F5F1EB;
    --surface: #FFFDF8;
    --border: #D4CFC6;
    --text: #2D2A26;
    --dim: #7A756D;
    --bright: #1A1714;
    --accent: #8B5E3C;
    --accent-2: #4A6741;
    --accent-3: #9B4D3A;
    --accent-4: #5B6E8A;
    --positive: #4A6741;
    --negative: #9B4D3A;
    --without-bg: rgba(155, 77, 58, 0.05);
    --with-bg: rgba(74, 103, 65, 0.05);
    --code-bg: #EDE9E2;
    --ornament: #C4B9A8;
    --ornament-dim: #DDD7CC;
}

/* ═══ DARK MODE (Scandinavian Lab) ═══ */
[data-theme="dark"] {
    --bg: #111111;
    --surface: #1A1A1A;
    --border: #2A2A2A;
    --text: #D4D0CA;
    --dim: #808080;
    --bright: #F0EDE8;
    --accent: #C49A6C;
    --accent-2: #7DAF72;
    --accent-3: #D4796A;
    --accent-4: #8AACCC;
    --positive: #7DAF72;
    --negative: #D4796A;
    --without-bg: rgba(212, 121, 106, 0.06);
    --with-bg: rgba(125, 175, 114, 0.06);
    --code-bg: #1F1F1F;
    --ornament: #3A3A3A;
    --ornament-dim: #252525;
}

/* ═══ MODE TOGGLE ═══ */
.mode-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.4s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.mode-toggle:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}
.mode-toggle .icon-sun,
.mode-toggle .icon-moon { transition: opacity 0.3s ease; }
.mode-toggle .icon-moon { display: none; }
[data-theme="dark"] .mode-toggle .icon-sun { display: none; }
[data-theme="dark"] .mode-toggle .icon-moon { display: inline; color: #D4D0CA; }

/* ═══ BASE ═══ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Literata', serif;
    font-size: 16px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    transition: background 0.5s ease, color 0.4s ease;
}

.container { max-width: 820px; margin: 0 auto; padding: 0 2.5rem; }

/* ═══ ORNAMENTAL ELEMENTS ═══ */
.ornament {
    text-align: center;
    color: var(--ornament);
    font-size: 1.2rem;
    letter-spacing: 0.5em;
    margin: 2.5rem 0;
    user-select: none;
    transition: color 0.4s ease;
}

.ornament-line {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 3rem 0;
}
.ornament-line::before,
.ornament-line::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ornament-dim);
    transition: background 0.4s ease;
}
.ornament-line span {
    color: var(--ornament);
    font-size: 0.9rem;
    transition: color 0.4s ease;
}

.section-mark {
    display: inline-block;
    color: var(--ornament);
    font-size: 0.7rem;
    vertical-align: super;
    margin-right: 0.3rem;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.4s ease;
}

.drop-cap::first-letter {
    float: left;
    font-size: 3.2rem;
    line-height: 0.85;
    padding-right: 0.5rem;
    padding-top: 0.15rem;
    color: var(--accent);
    font-weight: 300;
    font-family: 'Literata', serif;
}

.flourish {
    display: block;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--ornament);
    font-size: 1.5rem;
    opacity: 0.6;
    transition: color 0.4s ease;
}

/* ═══ HEADER ═══ */
header {
    padding: 5rem 0 2.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 3rem;
    position: relative;
    transition: border-color 0.4s ease;
}

header::after {
    content: '◆';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg);
    padding: 0 1rem;
    color: var(--ornament);
    font-size: 0.7rem;
    transition: background 0.5s ease, color 0.4s ease;
}

.back {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: var(--dim);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
    transition: color 0.2s;
    position: sticky;
    top: 1.5rem;
    z-index: 100;
}
.back:hover { color: var(--accent); }

h1 {
    font-family: 'Literata', serif;
    font-size: 2.2rem;
    font-weight: 300;
    color: var(--bright);
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    transition: color 0.4s ease;
}

h2 {
    font-family: 'Literata', serif;
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--bright);
    margin-bottom: 1rem;
    padding-top: 0.5rem;
    transition: color 0.4s ease;
}

h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--bright);
    margin-bottom: 0.5rem;
}

.meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--dim);
    margin-bottom: 1.2rem;
    letter-spacing: 0.03em;
    transition: color 0.4s ease;
}

.abstract {
    font-size: 1.05rem;
    color: var(--dim);
    font-weight: 300;
    max-width: 620px;
    font-style: italic;
    line-height: 1.8;
    transition: color 0.4s ease;
}

/* ═══ CONTENT ═══ */
section { margin-bottom: 3rem; }
p { margin-bottom: 1.1rem; font-size: 0.93rem; }
p.note { font-size: 0.82rem; color: var(--dim); font-style: italic; }
ol, ul { margin: 0.5rem 0 1.5rem 1.5rem; font-size: 0.93rem; }
li { margin-bottom: 0.5rem; }
strong { color: var(--bright); font-weight: 600; }

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82em;
    color: var(--accent);
    background: var(--code-bg);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    transition: background 0.4s ease, color 0.4s ease;
}

blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 1.2rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--dim);
    font-size: 0.9rem;
    transition: border-color 0.4s ease, color 0.4s ease;
}

/* ═══ COMPARISONS ═══ */
.comparison {
    margin: 2rem 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.4s ease;
}

.comparison-header {
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.comparison-scenario {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--bright);
}

.comparison-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 0.25rem 0.65rem;
    border-radius: 3px;
    background: var(--with-bg);
    color: var(--positive);
    border: 1px solid var(--positive);
    opacity: 0.8;
}

.badge-loss {
    background: var(--without-bg) !important;
    color: var(--negative) !important;
    border-color: var(--negative) !important;
}

.side-warning { background: rgba(180, 140, 50, 0.06); }
.side-warning .side-label { color: #B08C32; }
.side-warning .side-content { color: var(--text); }
[data-theme="dark"] .side-warning { background: rgba(212, 170, 79, 0.06); }
[data-theme="dark"] .side-warning .side-label { color: #D4AA4F; }

.comparison-prompt {
    padding: 1rem 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    color: var(--dim);
    border-bottom: 1px solid var(--border);
    font-style: italic;
    line-height: 1.7;
    transition: border-color 0.4s ease;
}

.comparison-sides { display: grid; grid-template-columns: 1fr 1fr; }
.side { padding: 1.5rem; transition: background 0.4s ease; }
.side-without { background: var(--without-bg); border-right: 1px solid var(--border); }
.side-with { background: var(--with-bg); }

.side-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}
.side-without .side-label { color: var(--negative); }
.side-with .side-label { color: var(--positive); }
.side-content { font-size: 0.84rem; line-height: 1.75; color: var(--text); }
.side-without .side-content { color: var(--dim); }

/* ═══ INSIGHTS ═══ */
.insight {
    padding: 1.5rem 2rem;
    background: var(--surface);
    border-left: 3px solid var(--accent-2);
    border-radius: 0 4px 4px 0;
    margin: 2rem 0;
    position: relative;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.insight::before {
    content: '✦';
    position: absolute;
    top: -0.5rem;
    left: -0.65rem;
    background: var(--bg);
    color: var(--accent-2);
    font-size: 0.75rem;
    padding: 0.1rem;
    transition: background 0.5s ease, color 0.4s ease;
}

.insight-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-2);
    margin-bottom: 0.5rem;
}

.insight p { color: var(--bright); font-size: 0.93rem; margin: 0; }

/* ═══ SHIPPED FIX CALLOUT ═══ */
.shipped {
    padding: 1.2rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 2rem 0;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.shipped-icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.shipped-body {
    flex: 1;
}

.shipped-version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--positive);
    margin-bottom: 0.3rem;
}

.shipped-desc {
    font-size: 0.84rem;
    color: var(--text);
    line-height: 1.6;
}

.shipped-desc code {
    font-size: 0.78em;
}

/* ═══ TABLES ═══ */
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.85rem; }

th {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border);
    color: var(--dim);
    transition: border-color 0.4s ease;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.4s ease;
}
tr:last-child td { border-bottom: none; }
.score-positive { color: var(--positive); font-weight: 500; }
.score-neutral { color: var(--dim); }
.score-negative { color: var(--negative); font-weight: 500; }

/* ═══ DETAIL GRID ═══ */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 1.5rem 0; }
.detail-item { padding: 1rem; background: var(--surface); border-radius: 4px; transition: background 0.4s ease; }
.detail-label { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; color: var(--accent-4); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.3rem; }
.detail-value { font-size: 0.82rem; color: var(--text); }

/* ═══ CODE BLOCKS ═══ */
.code-block {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    position: relative;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.code-block::before {
    content: '—';
    position: absolute;
    top: 0.6rem;
    right: 1rem;
    color: var(--ornament);
    font-size: 0.7rem;
}

.code-block pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    line-height: 1.85;
    color: var(--text);
    margin: 0;
    white-space: pre-wrap;
}

/* ═══ FOOTER ═══ */
footer {
    padding: 2.5rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 0.76rem;
    color: var(--dim);
    position: relative;
    transition: border-color 0.4s ease;
}

footer::before {
    content: '◇';
    position: absolute;
    top: -0.45rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg);
    padding: 0 0.8rem;
    color: var(--ornament);
    font-size: 0.6rem;
    transition: background 0.5s ease, color 0.4s ease;
}

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

/* ═══ RESPONSIVE ═══ */
@media (max-width: 600px) {
    h1 { font-size: 1.7rem; }
    .comparison-sides { grid-template-columns: 1fr; }
    .side-without { border-right: none; border-bottom: 1px solid var(--border); }
    .detail-grid { grid-template-columns: 1fr; }
    .container { padding: 0 1.5rem; }
    .mode-toggle { top: 1rem; right: 1rem; width: 38px; height: 38px; }
}

/* ═══ WIDE VIEWPORT: SIDE NAV ═══ */
@media (min-width: 1100px) {
    .toc {
        position: fixed;
        left: 2rem;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        max-width: 160px;
    }

    .toc a {
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.65rem;
        color: var(--dim);
        text-decoration: none;
        padding: 0.3rem 0;
        border-left: 2px solid transparent;
        padding-left: 0.8rem;
        transition: all 0.3s ease;
        letter-spacing: 0.02em;
    }

    .toc a:hover,
    .toc a.active {
        color: var(--accent);
        border-left-color: var(--accent);
    }
}

@media (max-width: 1099px) {
    .toc { display: none; }
}
