/* ===== Custom Properties ===== */
:root {
    --bg-primary: #faf5ed;
    --bg-secondary: #f2e8dc;
    --fg-primary: #2e2a25;
    --fg-secondary: #5a4e42;
    --accent-warm: #d4a843;
    --accent-cool: #8fb5a3;
    --accent-rose: #d4928a;
    --neutral-mist: #e8dfd4;
    --shadow-tone: #c4b8a8;
    --accent-label: #a89580;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Mono', monospace;
    --font-serif: 'Cormorant Garamond', serif;

    --blob-small: 63% 37% 54% 46% / 55% 48% 52% 45%;
    --blob-medium: 42% 58% 48% 52% / 50% 44% 56% 50%;
    --blob-large: 30% 70% 62% 38% / 45% 55% 50% 50%;

    --ease-organic: cubic-bezier(0.23, 1, 0.32, 1);
    --shadow-soft: 0 8px 32px rgba(180, 160, 140, 0.12);
    --shadow-hover: 0 12px 32px rgba(180, 160, 140, 0.22);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.72;
    color: var(--fg-secondary);
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at 50% 30%, var(--bg-primary) 0%, var(--bg-secondary) 70%, var(--neutral-mist) 100%);
    overflow-x: hidden;
}

/* ===== Paper Grain Texture ===== */
.paper-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='1' cy='1' r='0.5' fill='%235a4e42'/%3E%3Ccircle cx='4' cy='3' r='0.4' fill='%235a4e42'/%3E%3Ccircle cx='2' cy='5' r='0.3' fill='%235a4e42'/%3E%3C/svg%3E");
}

/* ===== Navigation Pill ===== */
.nav-pill {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(250, 245, 237, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 50px;
    padding: 10px 28px;
    display: flex;
    gap: 24px;
    opacity: 0;
    transition: opacity 0.5s var(--ease-organic);
    box-shadow: 0 4px 16px rgba(180, 160, 140, 0.1);
}

.nav-pill.visible {
    opacity: 1;
}

.nav-pill a {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-label);
    text-decoration: none;
    transition: color 0.3s var(--ease-organic);
}

.nav-pill a:hover {
    color: var(--accent-warm);
}

/* ===== Section Labels ===== */
.section-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-label);
    text-align: center;
    margin-bottom: 48px;
}

/* ===== Chamber Base ===== */
.chamber {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ===== Scene 1: Atrium ===== */
.atrium {
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 40%, rgba(212, 168, 67, 0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 50% 30%, var(--bg-primary) 0%, var(--bg-secondary) 80%);
}

.atrium-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 168, 67, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.atrium-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.atrium-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 5.5rem);
    letter-spacing: -0.03em;
    color: var(--fg-primary);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-organic), transform 0.6s var(--ease-organic);
}

.atrium-title.revealed {
    opacity: 1;
    transform: translateY(0);
}

.atrium-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--fg-secondary);
    margin-top: 16px;
    min-height: 1.72em;
}

.atrium-subtitle .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent-warm);
    margin-left: 2px;
    animation: blink 0.8s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* SVG Organisms */
.organism {
    position: absolute;
    pointer-events: none;
    animation: float 6s ease-in-out infinite;
}

.organism-left {
    left: -60px;
    top: 20%;
    opacity: 0;
    transform: translateX(-80px);
    transition: opacity 1.2s var(--ease-organic), transform 1.2s var(--ease-organic);
}

.organism-right {
    right: -40px;
    bottom: 15%;
    opacity: 0;
    transform: translateX(80px);
    transition: opacity 1.2s var(--ease-organic), transform 1.2s var(--ease-organic);
}

.organism-left.revealed,
.organism-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.organism-between {
    position: relative;
    margin: 40px auto;
    display: block;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.organism-left.revealed {
    animation: float 6s ease-in-out infinite;
}
.organism-right.revealed {
    animation: float 6s ease-in-out infinite;
    animation-delay: -3s;
}

/* Circuit lines */
.circuit-line {
    animation: circuitFlow 4s linear infinite;
}

@keyframes circuitFlow {
    to { stroke-dashoffset: -40; }
}

.circuit-filigree {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ===== Scene 2: Docket Stream ===== */
.docket {
    min-height: 100vh;
    padding: 80px 5%;
    background: radial-gradient(ellipse at 50% 50%, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.docket-river {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
    z-index: 1;
}

.docket-card {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--blob-medium);
    padding: 28px 24px;
    width: 280px;
    box-shadow: none;
    opacity: 0;
    transform: translateY(24px);
    transition: transform 0.5s var(--ease-organic), opacity 0.5s var(--ease-organic), box-shadow 0.3s var(--ease-organic);
}

.docket-card.revealed {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(180, 160, 140, 0.15);
}

.docket-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--fg-primary);
    margin-bottom: 8px;
}

.card-court {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--accent-label);
    margin-bottom: 4px;
}

.card-time {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-secondary);
}

/* Live dot */
.live-dot {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 8px;
    height: 8px;
    background: var(--accent-rose);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

.live-dot-small {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--accent-rose);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    vertical-align: middle;
    margin-right: 4px;
}

/* ===== Scene 3: Deliberation Chamber ===== */
.deliberation {
    min-height: 120vh;
    padding: 80px 5%;
    background: radial-gradient(ellipse at 40% 50%, var(--bg-primary) 0%, var(--bg-secondary) 80%);
}

.deliberation-lobes {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.lobe {
    opacity: 0;
    transition: opacity 0.8s var(--ease-organic), transform 0.8s var(--ease-organic);
}

.lobe-left {
    flex: 0 0 62%;
    border-radius: var(--blob-large);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-soft);
    padding: 32px;
    transform: translateX(-60px);
}

.lobe-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.lobe-gap {
    flex: 0 0 4%;
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { flex-basis: 3.8%; }
    50% { flex-basis: 4.2%; }
}

.lobe-right {
    flex: 0 0 34%;
    border-radius: 38% 62% 52% 48% / 46% 50% 50% 54%;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-soft);
    padding: 28px;
    transform: translateX(60px);
}

.lobe-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.stream-viewport {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-primary);
    border-radius: 24% 76% 60% 40% / 52% 40% 60% 48%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.gavel-icon {
    opacity: 0.6;
}

.stream-label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-label);
}

.meta-panel, .chat-panel {
    margin-bottom: 20px;
}

.meta-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--fg-primary);
    margin-bottom: 12px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--neutral-mist);
}

.meta-key {
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-label);
}

.meta-val {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--fg-secondary);
}

.status-live {
    color: var(--accent-rose);
    font-weight: 600;
}

.chat-line {
    font-size: 0.82rem;
    color: var(--fg-secondary);
    padding: 5px 0;
    border-bottom: 1px solid rgba(232, 223, 212, 0.5);
    font-weight: 300;
}

.chat-time {
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--accent-label);
    letter-spacing: 0.08em;
    margin-right: 8px;
}

/* ===== Scene 4: Archive Cortex ===== */
.archive {
    min-height: 100vh;
    padding: 80px 5%;
    background: radial-gradient(ellipse at 60% 40%, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.archive-constellation {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto;
    gap: 28px;
    max-width: 1100px;
    margin: 0 auto;
}

.archive-card {
    background: var(--bg-secondary);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    opacity: 0;
    transition: transform 0.8s var(--ease-organic), opacity 0.8s var(--ease-organic), box-shadow 0.3s var(--ease-organic);
    cursor: pointer;
}

.archive-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.archive-card.revealed {
    opacity: 1;
    transform: translate(0, 0);
}

.ac-1 { border-radius: 42% 58% 48% 52% / 50% 44% 56% 50%; transform: translate(8px, 12px); }
.ac-2 { border-radius: 55% 45% 52% 48% / 48% 55% 45% 52%; transform: translate(-5px, 8px); grid-column: span 2; }
.ac-3 { border-radius: 48% 52% 44% 56% / 52% 48% 52% 48%; transform: translate(12px, -6px); }
.ac-4 { border-radius: 38% 62% 56% 44% / 54% 46% 54% 46%; transform: translate(-10px, 15px); }
.ac-5 { border-radius: 52% 48% 58% 42% / 46% 54% 46% 54%; transform: translate(6px, -10px); }
.ac-6 { border-radius: 44% 56% 50% 50% / 50% 50% 50% 50%; transform: translate(-8px, 5px); grid-column: span 2; }
.ac-7 { border-radius: 60% 40% 46% 54% / 42% 58% 48% 52%; transform: translate(14px, -8px); grid-column: 1 / 3; }
.ac-8 { border-radius: 36% 64% 54% 46% / 56% 44% 52% 48%; transform: translate(-12px, 10px); grid-column: 3 / 5; }

.archive-thumb {
    width: 60px;
    height: 60px;
    background: var(--neutral-mist);
    border-radius: var(--blob-small);
    margin-bottom: 12px;
}

.card-meta {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-label);
}

/* ===== Scene 5: Verdict Threshold ===== */
.verdict {
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 50%, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--neutral-mist) 100%);
}

.verdict-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.verdict-quote {
    font-family: var(--font-serif);
    font-weight: 500;
    font-style: italic;
    font-size: clamp(1.3rem, 2.2vw, 2rem);
    line-height: 1.55;
    color: var(--fg-primary);
    margin-bottom: 48px;
    max-width: 600px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.8s var(--ease-organic), transform 0.8s var(--ease-organic);
}

.verdict-quote.revealed {
    opacity: 1;
    transform: translateY(0);
}

.verdict-cta {
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    background: var(--accent-warm);
    color: var(--fg-primary);
    border: none;
    border-radius: 50px;
    padding: 16px 40px;
    text-decoration: none;
    cursor: pointer;
    animation: ctaPulse 3s ease-in-out infinite;
    transition: transform 0.3s var(--ease-organic), box-shadow 0.3s var(--ease-organic);
    box-shadow: 0 4px 16px rgba(212, 168, 67, 0.25);
    opacity: 0;
    transition: opacity 0.6s var(--ease-organic), transform 0.3s var(--ease-organic), box-shadow 0.3s var(--ease-organic);
}

.verdict-cta.revealed {
    opacity: 1;
}

.verdict-cta:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(212, 168, 67, 0.35);
    animation-play-state: paused;
}

@keyframes ctaPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .atrium-title, .organism-left, .organism-right,
    .docket-card, .lobe, .archive-card, .verdict-quote, .verdict-cta {
        opacity: 1 !important;
        transform: none !important;
    }
    .nav-pill { opacity: 1 !important; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .deliberation-lobes {
        flex-direction: column;
        gap: 24px;
    }
    .lobe-left, .lobe-right {
        flex: 1 1 100%;
    }
    .lobe-gap {
        display: none;
    }
    .archive-constellation {
        grid-template-columns: 1fr 1fr;
    }
    .ac-2, .ac-6, .ac-7, .ac-8 {
        grid-column: auto;
    }
    .docket-river {
        flex-direction: column;
        align-items: center;
    }
    .nav-pill {
        padding: 8px 16px;
        gap: 12px;
    }
    .nav-pill a {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .archive-constellation {
        grid-template-columns: 1fr;
    }
}
