/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1vw + 0.5rem, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: #1a1220;
    background: #f5ead6;
    overflow-x: hidden;
}

/* === TYPOGRAPHY === */
.chamber-title, .panel-heading {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.08;
}
.accent {
    color: #ff2d6f;
    text-shadow: 0 0 30px rgba(255,45,111,0.4);
}
.index-label, .index-heading, .reticule {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 0.8vw + 0.3rem, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.sidebar-content, .note-entry p, .sidebar-tab {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.5;
}

/* === CHAMBER === */
#chamber {
    position: relative;
    width: 100%;
    height: 100svh;
    background: #1a1220;
    overflow: hidden;
    display: grid;
    align-items: end;
}
#topology-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    filter: blur(20px);
    transition: opacity 1200ms ease, filter 1200ms ease;
}
#topology-canvas.revealed {
    opacity: 1;
    filter: blur(0);
}
#chamber-text {
    position: relative;
    z-index: 2;
    padding: 4rem 3rem;
    grid-column: 1 / 3;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease 600ms, transform 800ms ease 600ms;
}
#chamber-text.revealed {
    opacity: 1;
    transform: translateY(0);
}
.chamber-title {
    font-size: clamp(2.4rem, 5vw + 0.5rem, 5rem);
    color: #ff2d6f;
    text-shadow: 0 0 30px rgba(255,45,111,0.4);
}
.chamber-subtitle {
    color: #e8dff0;
    margin-top: 0.5rem;
    font-size: 1.15rem;
    opacity: 0;
    transition: opacity 800ms ease 1000ms;
}
#chamber-text.revealed .chamber-subtitle {
    opacity: 1;
}
#scroll-chevron {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    color: #e8dff0;
    animation: pulse 2.5s ease-in-out infinite;
    z-index: 2;
}
@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* === DASHBOARD GRID === */
#dashboard {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    grid-template-areas: "sidebar main index";
    gap: 0;
    min-height: 100vh;
}

/* === FIELD NOTES SIDEBAR === */
#field-notes {
    grid-area: sidebar;
    background: linear-gradient(135deg, #f5ead6 0%, #ede0c8 40%, #f0e5cf 60%, #e8d9b8 100%);
    padding: 2rem 1.5rem;
    border-right: 1px solid rgba(160,82,45,0.2);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-tab {
    display: none;
}
.sidebar-heading {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 700;
    font-size: 1.4rem;
    color: #a0522d;
    margin-bottom: 1.5rem;
}
.note-entry {
    margin-bottom: 1.5rem;
    padding-left: 1.2rem;
    position: relative;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 500ms ease, transform 500ms ease;
}
.note-entry.visible {
    opacity: 1;
    transform: translateX(0);
}
.margin-glyph {
    position: absolute;
    left: 0;
    top: 0;
    color: #a0522d;
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
}
.note-entry p {
    color: #1a1220;
}

/* === OBSERVATION PANELS === */
#observation-area {
    grid-area: main;
    padding: 3rem 2rem;
}
.obs-panel {
    margin-bottom: 0;
    opacity: 0;
    filter: blur(8px);
    transform: translateY(30px);
    transition: opacity 600ms ease, filter 600ms ease, transform 600ms ease;
}
.obs-panel.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}
.obs-panel + .obs-panel {
    margin-top: -24px;
}
.panel-frame {
    position: relative;
    border: 1px solid rgba(26,18,32,0.2);
    padding: 6px;
    background: linear-gradient(135deg, #f5ead6 0%, #ede0c8 40%, #f0e5cf 60%, #e8d9b8 100%);
}
.panel-frame::after {
    content: '';
    position: absolute;
    inset: 6px;
    border: 2px solid rgba(26,18,32,0.3);
    pointer-events: none;
}
.contour-bg {
    position: absolute;
    inset: 6px;
    width: calc(100% - 12px);
    height: calc(100% - 12px);
    opacity: 0.15;
    pointer-events: none;
}
.panel-content {
    position: relative;
    padding: 2.5rem 2rem;
    z-index: 1;
}
.panel-heading {
    font-size: clamp(2.4rem, 5vw + 0.5rem, 5rem);
    margin-bottom: 1.5rem;
    color: #1a1220;
}
.panel-body {
    margin-bottom: 1rem;
    max-width: 65ch;
}
.panel-body:last-child { margin-bottom: 0; }

/* Reticules */
.reticule {
    position: absolute;
    font-size: 8px;
    color: #00e5c8;
    opacity: 0.3;
    z-index: 2;
}
.reticule.tl { top: 2px; left: 4px; }
.reticule.tr { top: 2px; right: 4px; }
.reticule.bl { bottom: 2px; left: 4px; }
.reticule.br { bottom: 2px; right: 4px; }

/* === NOISE STRIPS === */
.noise-strip {
    width: 100%;
    height: 60px;
    overflow: hidden;
    background: linear-gradient(90deg, #f5ead6, #d4a853 50%, #f5ead6);
}
.noise-strip svg {
    display: block;
}

/* === INDEX COLUMN === */
#index-column {
    grid-area: index;
    background: linear-gradient(180deg, #1a1220 0%, #2d1b4e 100%);
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.index-heading {
    color: #00e5c8;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.index-entry {
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease, transform 500ms ease;
}
.index-entry.visible {
    opacity: 1;
    transform: translateY(0);
}
.index-label {
    display: block;
    color: #00e5c8;
    margin-bottom: 0.5rem;
}
.thumb-canvas {
    display: block;
    width: 120px;
    height: 120px;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(0,229,200,0.2);
}
.metric {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 500;
    color: #00e5c8;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    #dashboard {
        grid-template-columns: 1fr;
        grid-template-areas: "main" "index";
    }
    #field-notes {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 300ms ease;
    }
    #field-notes.open {
        transform: translateX(0);
    }
    .sidebar-tab {
        display: block;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        background: #a0522d;
        color: #f5ead6;
        padding: 0.5rem 0.3rem;
        writing-mode: vertical-rl;
        cursor: pointer;
        z-index: 101;
        border-radius: 0 4px 4px 0;
    }
    #index-column {
        position: relative;
        height: auto;
    }
    .obs-panel + .obs-panel {
        margin-top: 0;
    }
}
