/* ═══════════════════════════════════════════════════ */
/* RESET & VARIABLES                                   */
/* ═══════════════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #06090f;
    --bg2: #0a0e17;
    --card: #0d1117;
    --surface: #161b22;
    --border: #21262d;
    --border2: #30363d;
    --text: #e6edf3;
    --text2: #8b949e;
    --text3: #484f58;
    --planner: #f0883e;
    --critic: #f85149;
    --adjudicator: #8b5cf6;
    --gate: #58a6ff;
    --approved: #3fb950;
    --pending: #d29922;
    --gold: #e8b931;
    --serif: 'Instrument Serif', Georgia, serif;
    --sans: 'DM Sans', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --max-w: 1200px;
    --section-pad: 140px;
    --blog-max-w: 720px;
    --blog-text-size: 1.125rem;
    --blog-line-height: 1.7;
}

/* Light theme overrides based on browser/OS preference */
@media (prefers-color-scheme: light) {
    :root {
        --bg: #f8f9fa;
        --bg2: #ffffff;
        --card: #ffffff;
        --surface: #f0f1f3;
        --border: #d1d5db;
        --border2: #b0b8c4;
        --text: #1a1a2e;
        --text2: #4b5563;
        --text3: #9ca3af;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════ */
/* NAVIGATION                                          */
/* ═══════════════════════════════════════════════════ */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    background: rgba(6, 9, 15, .75);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid transparent;
    transition: border-color .3s, background .3s;
}

nav.scrolled {
    border-bottom-color: var(--border);
}

@media (prefers-color-scheme: dark) {
    nav.scrolled {
        background: rgba(6, 9, 15, .92);
    }
}

@media (prefers-color-scheme: light) {
    nav {
        background: rgba(248, 249, 250, .85);
    }

    nav.scrolled {
        background: rgba(248, 249, 250, .95);
    }
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--sans);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo em {
    color: var(--adjudicator);
    font-style: normal;
}

.nav-logo-img {
    height: 28px;
    width: auto;
}

.nav-logo .logo-light {
    display: none;
}

@media (prefers-color-scheme: light) {
    .nav-logo .logo-dark {
        display: none;
    }

    .nav-logo .logo-light {
        display: block;
    }
}

.nav-links {
    display: flex;
    gap: 36px;
    align-items: center;
    list-style: none;
}

.nav-links a {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text2);
    text-decoration: none;
    transition: color .2s;
    letter-spacing: 0.2px;
}

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

.nav-cta {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #fff !important;
    background: var(--adjudicator);
    padding: 8px 20px;
    border-radius: 8px;
    transition: opacity .2s, transform .2s !important;
}

.nav-cta:hover {
    opacity: .9;
    transform: translateY(-1px);
}

/* Mobile nav */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-links.show {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(6, 9, 15, .95);
        padding: 24px;
        border-bottom: 1px solid var(--border);
        gap: 24px;
        animation: slideDown 0.3s ease;
    }

    .nav-toggle {
        display: block;
        font-size: 24px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════════ */
/* FOOTER                                              */
/* ═══════════════════════════════════════════════════ */
footer {
    padding: 50px 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-logo {
    font-family: var(--sans);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.footer-logo em {
    color: var(--adjudicator);
    font-style: normal;
}

.footer-links {
    display: flex;
    gap: 28px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text3);
    text-decoration: none;
    transition: color .2s;
}

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

.footer-copy {
    font-size: 12px;
    color: var(--text3);
}

.footer-disclaimer {
    font-size: 11px;
    color: var(--text3);
    line-height: 1.6;
    margin-top: 16px;
    max-width: 720px;
    text-align: center;
    opacity: 0.7;
    width: 100%;
}

@media (max-width: 768px) {
    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* ═══════════════════════════════════════════════════ */
/* BLOG STYLES                                         */
/* ═══════════════════════════════════════════════════ */

body.blog-page {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: var(--blog-line-height);
}

.blog-main {
    padding-top: 140px;
    /* Space for fixed nav */
    padding-bottom: 120px;
}

.blog-header {
    text-align: center;
    max-width: 900px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

.blog-label {
    font-family: var(--mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--adjudicator);
    /* Purple */
    margin-bottom: 1.5rem;
    display: block;
    font-weight: 600;
}

.blog-title {
    font-family: var(--serif);
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.blog-subtitle {
    font-family: var(--sans);
    font-size: 1.35rem;
    color: var(--text2);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Content Container */
.blog-content {
    max-width: var(--blog-max-w);
    margin: 0 auto;
    padding: 0 24px;
    font-size: var(--blog-text-size);
}

/* Typography */
.blog-content h2 {
    font-family: var(--serif);
    font-size: 2.2rem;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.blog-content h3 {
    font-family: var(--sans);
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.blog-content p {
    margin-bottom: 1.8rem;
    color: var(--text);
    /* Slightly brighter for reading */
}

/* Lists */
.blog-content ul,
.blog-content ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.blog-content li {
    margin-bottom: 0.75rem;
    color: var(--text2);
    padding-left: 0.5rem;
}

.blog-content li::marker {
    color: var(--adjudicator);
}

/* Quotes */
.blog-content blockquote {
    border-left: 3px solid var(--adjudicator);
    padding: 0.5rem 0 0.5rem 2rem;
    margin: 2.5rem 0;
    font-family: var(--serif);
    font-size: 1.5rem;
    font-style: italic;
    color: var(--text2);
    line-height: 1.5;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    margin: 3rem 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}

.blog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 600px;
}

.blog-table th {
    text-align: left;
    padding: 1.2rem;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-family: var(--mono);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.blog-table td {
    padding: 1.2rem;
    border-bottom: 1px solid var(--border);
    color: var(--text2);
    vertical-align: top;
    line-height: 1.5;
}

.blog-table tr:last-child td {
    border-bottom: none;
}

/* Callouts / Warnings */
.callout {
    background: rgba(139, 92, 246, 0.05);
    /* Very subtle purple tint */
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 2rem;
    margin: 3rem 0;
}

.callout h4 {
    font-family: var(--mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--adjudicator);
    margin-bottom: 1rem;
    font-weight: 600;
}

.callout p:last-child {
    margin-bottom: 0;
}

.callout.warning {
    background: rgba(248, 81, 73, 0.05);
    border-color: rgba(248, 81, 73, 0.2);
}

.callout.warning h4 {
    color: var(--critic);
}

/* Diagrams */
.diagram-figure {
    margin: 4rem 0;
    text-align: center;
}

.diagram-container {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    overflow-x: auto;
    display: flex;
    justify-content: center;
}

.diagram-caption {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text3);
    margin-top: 1rem;
    display: block;
    letter-spacing: 0.05em;
}

/* Code */
code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--surface);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: var(--adjudicator);
    border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════ */
/* PAPER NAVIGATION (PREV / NEXT)                      */
/* ═══════════════════════════════════════════════════ */
.paper-nav {
    max-width: var(--blog-max-w);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 16px;
    margin-top: 60px;
    margin-bottom: 20px;
}

.paper-nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    transition: border-color .3s, transform .3s, box-shadow .3s;
}

.paper-nav-link:hover {
    border-color: var(--border2);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
}

.paper-nav-link.next {
    text-align: right;
    margin-left: auto;
}

.paper-nav-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--adjudicator);
    font-weight: 600;
}

.paper-nav-title {
    font-family: var(--serif);
    font-size: 1.1rem;
    color: var(--text);
    line-height: 1.3;
}

@media (max-width: 600px) {
    .paper-nav {
        flex-direction: column;
    }

    .paper-nav-link.next {
        text-align: left;
    }
}