:root {
    /* Color Palette - Modern Dark Theme */
    --bg-color: #09090f;
    --surface-color: rgba(18, 18, 30, 0.7);
    --surface-border: rgba(255, 255, 255, 0.08);

    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --text-muted: #64748b;
    /* Slate 500 */

    --accent-blue: #3b82f6;
    /* Blue 500 */
    --accent-purple: #8b5cf6;
    /* Violet 500 */
    --accent-teal: #14b8a6;
    /* Teal 500 */

    /* Typography */
    --font-sans: 'Pretendard', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: 'Outfit', 'Pretendard', sans-serif;

    /* Spacing & Layout */
    --max-width: 1200px;
    --sidebar-width: 300px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    /* Animations */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.7;
    font-size: 16px;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* --- Decorative Background Blobs --- */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.4;
    animation: float 10s infinite alternate ease-in-out;
}

.blob-1 {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    top: -10vw;
    left: -10vw;
}

.blob-2 {
    width: 35vw;
    height: 35vw;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    bottom: -10vw;
    right: -10vw;
    animation-delay: -5s;
}

.blob-3 {
    width: 25vw;
    height: 25vw;
    background: radial-gradient(circle, var(--accent-teal) 0%, transparent 70%);
    top: 40%;
    left: 40%;
    animation-duration: 15s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 40px) scale(1.1);
    }
}

/* --- Progress Bar --- */
#progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    z-index: 1000;
}

#progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple), var(--accent-teal));
    width: 0%;
    transition: width 0.1s ease-out;
}

/* --- Layout --- */
.page-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 2rem;
    min-height: 100vh;
}

/* --- Glassmorphism Utilities --- */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* --- Sidebar (Table of Contents) --- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.toc-container {
    position: sticky;
    top: 2rem;
    padding: 1.5rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

/* Scrollbar wrapper for WebKit */
.toc-container::-webkit-scrollbar {
    width: 6px;
}

.toc-container::-webkit-scrollbar-track {
    background: transparent;
}

.toc-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.toc-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--surface-border);
}

.toc-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.toc-icon {
    font-size: 1.25rem;
}

.toc-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.insight-link {
    display: inline-block;
    margin-bottom: 1rem;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(90deg, rgba(20, 184, 166, 0.25), rgba(59, 130, 246, 0.2));
    border: 1px solid rgba(20, 184, 166, 0.35);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-base);
}

.insight-link:hover {
    transform: translateY(-1px);
    background: linear-gradient(90deg, rgba(20, 184, 166, 0.35), rgba(59, 130, 246, 0.3));
}

.toc-nav li a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
    line-height: 1.4;
}

.toc-nav li a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.toc-nav li a.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.1));
    border-left: 3px solid var(--accent-purple);
    font-weight: 500;
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    min-width: 0;
    /* Prevents overflow */
}

.transcript-container {
    padding: 3rem;
}

/* --- Landing Page --- */
.landing-page {
    align-items: center;
}

.landing-hero {
    padding: 2.5rem 3rem;
    margin-bottom: 1.5rem;
}

.landing-kicker {
    color: var(--accent-teal);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.landing-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.landing-description {
    color: var(--text-secondary);
    max-width: 700px;
}

.landing-grid {
    display: grid;
    gap: 1rem;
}

.post-card {
    padding: 2rem;
}

.post-tag {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-blue);
    font-weight: 700;
}

.post-card h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin-top: 0.35rem;
    margin-bottom: 0.25rem;
}

.post-subtitle {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.post-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}

.post-description {
    color: var(--text-primary);
    margin-bottom: 1.2rem;
}

.landing-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.ghost-link {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Typography elements */
h1.main-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent !important;
}

h2.sub-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--accent-blue);
    margin-bottom: 3rem;
}

h3.section-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    scroll-margin-top: 2rem;
    letter-spacing: -0.01em;
}

.section-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--surface-border), transparent);
    margin: 4rem 0;
}

p.standard-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

blockquote.source-note {
    margin: 0 0 2rem 0;
    border-left: 3px solid var(--accent-teal);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    background: rgba(20, 184, 166, 0.08);
    border-radius: var(--radius-sm);
}

blockquote.source-note p {
    margin: 0;
}

/* --- Dialogue Boxes --- */
.dialogue-box {
    margin-bottom: 2rem;
    padding: 1.5rem 2rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border-left: 4px solid transparent;
    transition: transform var(--transition-fast), background var(--transition-base);
}

.dialogue-box:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.04);
}

.speaker-label {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
}

.dialogue-text p {
    color: var(--text-primary);
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

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

/* Naval Specific Styles */
.dialogue-box.naval {
    border-left-color: var(--accent-purple);
}

.dialogue-box.naval .speaker-label {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

/* Nivi Specific Styles */
.dialogue-box.nivi {
    border-left-color: var(--accent-teal);
}

.dialogue-box.nivi .speaker-label {
    background: rgba(20, 184, 166, 0.15);
    color: var(--accent-teal);
}

.dialogue-box.speaker-generic {
    border-left-color: var(--accent-blue);
}

.dialogue-box.speaker-generic .speaker-label {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

/* --- End Marker --- */
.end-marker {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 5rem;
    margin-bottom: 2rem;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

/* --- Insight Page --- */
.insight-page {
    justify-content: center;
}

.insight-article h1,
.insight-article h2,
.insight-article h3 {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.insight-article p {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.insight-article ul {
    margin: 0.75rem 0 1.25rem 1.25rem;
}

.insight-article li {
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.insight-article blockquote {
    margin: 1rem 0;
    border-left: 3px solid var(--accent-teal);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    background: rgba(20, 184, 166, 0.08);
    border-radius: var(--radius-sm);
}

.insight-article hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--surface-border), transparent);
    margin: 1.8rem 0;
}

.insight-article code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .page-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: -1;
        /* Move TOC to top on mobile */
    }

    .toc-container {
        position: relative;
        top: 0;
        max-height: 300px;
    }

    .transcript-container {
        padding: 2rem;
    }

    h1.main-title {
        font-size: 2.5rem;
    }

    .landing-hero {
        padding: 2rem;
    }
}

@media (max-width: 640px) {
    .page-wrapper {
        padding: 1rem;
    }

    .transcript-container {
        padding: 1.5rem 1rem;
    }

    h1.main-title {
        font-size: 2rem;
    }

    .dialogue-box {
        padding: 1.25rem;
    }

    .dialogue-text p {
        font-size: 1.05rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* ── Highlight Quotes ── */
.highlight-quote {
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.08), rgba(91, 141, 222, 0.05));
    border-left: 3px solid var(--accent-gold);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 2rem 2.5rem;
    margin: 3.5rem 0;
    position: relative;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.highlight-quote::before {
    content: '"';
    font-family: var(--font-display);
    position: absolute;
    top: -1.5rem;
    left: 1rem;
    font-size: 8rem;
    color: rgba(201, 169, 110, 0.15);
    line-height: 1;
    z-index: 0;
}

.highlight-quote p {
    position: relative;
    z-index: 1;
    font-size: 1.25rem;
    line-height: 1.8;
    font-weight: 600;

    /* Safe, bright, high-visibility color for all browsers */
    color: #eedd88;
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.4);

    margin-bottom: 1.5rem;
}

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