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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #1a0a10;
    color: #c9bfb0;
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Viewport Frame === */
.viewport-frame {
    position: fixed;
    inset: 8px;
    border: 2px solid #6b1d2e;
    pointer-events: none;
    z-index: 1000;
}

.viewport-frame .blinking-cursor {
    position: absolute;
    top: 12px;
    left: 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    color: #a33b50;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Corner Brackets */
.corner-bracket {
    position: absolute;
}
.corner-bracket.top-left { top: 4px; left: 4px; }
.corner-bracket.top-right { top: 4px; right: 4px; }
.corner-bracket.bottom-left { bottom: 4px; left: 4px; }
.corner-bracket.bottom-right { bottom: 4px; right: 4px; }

/* === HUD Overlay === */
.hud-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
}

.progress-rail {
    position: absolute;
    right: 24px;
    top: 80px;
    bottom: 80px;
    width: 2px;
}

.progress-track {
    position: absolute;
    inset: 0;
    background: #6b1d2e;
    width: 2px;
}

.progress-pip {
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    background: #a33b50;
    border-radius: 50%;
    transition: top 0.1s linear;
}

.coordinate-display {
    position: absolute;
    bottom: 20px;
    left: 28px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #d4a574;
}

/* === Content River === */
.content-river {
    padding: 100px 0 150px;
    max-width: 100vw;
}

.site-header {
    margin-left: 15vw;
    margin-bottom: 80px;
    max-width: 65ch;
}

.site-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5.5vw, 5rem);
    line-height: 1.08;
    letter-spacing: 0.03em;
    color: #f5ece0;
    text-shadow: 0 0 30px rgba(107, 29, 46, 0.3);
    margin-bottom: 24px;
}

.site-tagline {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    line-height: 1.45;
    color: #a33b50;
}

/* === Marble Bands === */
.marble-band {
    width: 100%;
    height: 120px;
    margin: 60px 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(163,59,80,0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(212,165,116,0.1) 0%, transparent 40%),
        repeating-linear-gradient(73deg, transparent, transparent 40px, rgba(138,125,111,0.08) 40px, rgba(138,125,111,0.08) 41px),
        repeating-linear-gradient(142deg, transparent, transparent 60px, rgba(201,191,176,0.06) 60px, rgba(201,191,176,0.06) 61px),
        linear-gradient(17deg, #2d1420, #1a0a10);
    animation: marble-drift 60s linear infinite;
}

.marble-band.marble-burgundy {
    background:
        radial-gradient(ellipse at 30% 70%, rgba(212,165,116,0.12) 0%, transparent 45%),
        radial-gradient(ellipse at 70% 30%, rgba(163,59,80,0.2) 0%, transparent 50%),
        repeating-linear-gradient(198deg, transparent, transparent 35px, rgba(163,59,80,0.1) 35px, rgba(163,59,80,0.1) 36px),
        repeating-linear-gradient(17deg, transparent, transparent 50px, rgba(212,165,116,0.07) 50px, rgba(212,165,116,0.07) 51px),
        linear-gradient(142deg, #2d1420, #1a0a10);
}

@keyframes marble-drift {
    0% { background-position: 0 0; }
    100% { background-position: 30px 30px; }
}

/* === Dossier Sections === */
.dossier-section {
    position: relative;
    margin-bottom: 40px;
}

.dossier-section[data-section="1"] { margin-left: 15vw; max-width: 60ch; }
.dossier-section[data-section="2"] { margin-left: 20vw; max-width: 55ch; }
.dossier-section[data-section="3"] { margin-left: 18vw; max-width: 58ch; }
.dossier-section[data-section="4"] { margin-left: 22vw; max-width: 62ch; }
.dossier-section[data-section="5"] { margin-left: 16vw; max-width: 56ch; }
.dossier-section[data-section="6"] { margin-left: 19vw; max-width: 50ch; }

/* Scanline effect */
.dossier-section::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(212, 165, 116, 0.15);
    animation: scanline 8s linear infinite;
    pointer-events: none;
}

@keyframes scanline {
    0% { top: 0; opacity: 0.15; }
    90% { opacity: 0.15; }
    100% { top: 100%; opacity: 0; }
}

/* Details / Summary */
details {
    border: none;
}

details summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 0;
    border-bottom: 1px solid #a33b50;
    position: relative;
}

details summary::before {
    content: '▸';
    font-family: 'IBM Plex Mono', monospace;
    color: #a33b50;
    margin-right: 12px;
    display: inline-block;
    transition: transform 0.2s ease;
}

details[open] summary::before {
    transform: rotate(90deg);
}

details summary::-webkit-details-marker {
    display: none;
}

.entry-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.8rem, 0.95vw, 0.95rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #d4a574;
}

/* Summary underline animation */
details summary .rule-line {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 1px;
    background: #a33b50;
    width: 100%;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.6s ease-out;
}

details summary.in-view .rule-line {
    clip-path: inset(0 0 0 0);
}

.entry-content {
    padding: 24px 0;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.entry-content p {
    margin-bottom: 1.4em;
    color: #c9bfb0;
}

.entry-content em {
    font-style: italic;
    color: #e8ddd0;
}

.entry-content strong {
    color: #f5ece0;
    font-weight: 700;
}

.entry-content code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.88em;
    color: #d4a574;
    background: rgba(45, 20, 32, 0.6);
    padding: 2px 6px;
    border-radius: 2px;
}

/* === Pull Quotes === */
.pull-quote {
    margin: 32px 0;
    padding: 28px 32px;
    border-left: 2px solid #a33b50;
    position: relative;
}

.pull-quote.cream-marble {
    background:
        radial-gradient(ellipse at 40% 60%, rgba(201,191,176,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(138,125,111,0.06) 0%, transparent 40%),
        repeating-linear-gradient(73deg, transparent, transparent 30px, rgba(201,191,176,0.04) 30px, rgba(201,191,176,0.04) 31px),
        repeating-linear-gradient(198deg, transparent, transparent 45px, #8a7d6f11 45px, #8a7d6f11 46px),
        linear-gradient(17deg, rgba(45,20,32,0.8), rgba(26,10,16,0.9));
}

.quote-text {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    line-height: 1.45;
    color: #a33b50;
    margin-bottom: 0;
}

/* === Dot Separator === */
.dot-separator {
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 1em;
    color: rgba(107, 29, 46, 0.4);
    text-align: center;
    margin: 24px 0 0;
    font-size: 0.9rem;
}

/* === Terminal Output === */
.terminal-output {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.8rem, 0.95vw, 0.95rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #d4a574;
    margin-top: 32px;
}

.blinking-cursor-inline {
    color: #a33b50;
    animation: blink 1s step-end infinite;
}

/* === Line draw animation === */
.line-animate {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.6s ease-out;
}

.line-animate.visible {
    clip-path: inset(0 0 0 0);
}

/* === Responsive === */
@media (max-width: 768px) {
    .dossier-section[data-section="1"],
    .dossier-section[data-section="2"],
    .dossier-section[data-section="3"],
    .dossier-section[data-section="4"],
    .dossier-section[data-section="5"],
    .dossier-section[data-section="6"] {
        margin-left: 24px;
        margin-right: 24px;
        max-width: calc(100vw - 48px);
    }

    .site-header {
        margin-left: 24px;
        margin-right: 24px;
    }

    .progress-rail {
        display: none;
    }
}
