/* ============================================
   mystery.boo - Pop-Art Mystery Magazine
   ============================================ */
:root {
    --midnight-burgundy: #3A0E1A;
    --deep-burgundy: #6B1D2A;
    --bone-cream: #F5EDE0;
    --parchment: #EDE0CC;
    --spotlight-yellow: #F2C744;
    --charcoal-ink: #1A0A0F;
    --rosewood: #8B3040;
    --clue-blue: #2A5D8F;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    background: var(--midnight-burgundy);
    color: var(--parchment);
    font-family: 'Roboto Slab', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* --- Panel Navigation --- */
.panel-nav {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nav-icon {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--parchment);
    cursor: pointer;
    opacity: 0.4;
    transition: all 300ms ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-icon.active {
    opacity: 1;
    color: var(--rosewood);
}
.nav-icon svg {
    fill: none;
}

/* --- Panels --- */
.panel {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-top: 8px solid var(--charcoal-ink);
    border-bottom: 8px solid var(--charcoal-ink);
    padding: clamp(2rem, 4vw, 4rem);
    padding-left: clamp(3rem, 6vw, 6rem);
}
.panel--dark {
    background: var(--midnight-burgundy);
    color: var(--parchment);
}
.panel--light {
    background: var(--bone-cream);
    color: var(--charcoal-ink);
}

/* --- Ben-Day Dots --- */
.bendots {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.bendots--dark {
    background-image: radial-gradient(circle, var(--rosewood) 1.5px, transparent 1.5px);
    background-size: 12px 12px;
    opacity: 0.25;
}
.bendots--dark.bendots--large {
    background-size: 14px 14px;
}
.bendots--light {
    background-image: radial-gradient(circle, var(--midnight-burgundy) 1px, transparent 1px);
    background-size: 10px 10px;
    opacity: 0.08;
}
.bendots--light.bendots--fine {
    background-size: 8px 8px;
}

/* --- Bokeh --- */
.bokeh {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
    animation: bokehDrift 20s ease-in-out infinite;
}
.bokeh--yellow {
    background: radial-gradient(circle, rgba(242, 199, 68, 0.15) 0%, transparent 70%);
}
.bokeh--burgundy {
    background: radial-gradient(circle, rgba(107, 29, 42, 0.12) 0%, transparent 70%);
    animation-delay: -8s;
}
@keyframes bokehDrift {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(20px, -15px); }
    50% { transform: translate(-10px, 20px); }
    75% { transform: translate(15px, 10px); }
}

/* --- Panel Split --- */
.panel-split {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 6fr 4fr;
    gap: clamp(2rem, 4vw, 4rem);
    align-items: center;
    width: 100%;
    max-width: 1100px;
}
.panel-split--reverse {
    grid-template-columns: 4fr 6fr;
}
.panel-split--reverse .split-graphic { order: -1; }

.panel-center {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 800px;
}

/* --- Typography --- */
.hero-title {
    font-family: 'Alfa Slab One', cursive;
    font-weight: 400;
    font-size: clamp(3rem, 9vw, 8rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bone-cream);
    text-shadow: 4px 4px 0 var(--charcoal-ink);
    line-height: 1;
    margin-bottom: 2rem;
}
.section-heading {
    font-family: 'Alfa Slab One', cursive;
    font-weight: 400;
    font-size: clamp(1.6rem, 4.5vw, 3.5rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bone-cream);
    margin-bottom: 1.5rem;
}
.section-heading--dark {
    color: var(--deep-burgundy);
}
.body-text {
    font-family: 'Roboto Slab', serif;
    font-weight: 400;
    line-height: 1.72;
    color: rgba(237, 224, 204, 0.9);
    margin-bottom: 1rem;
    max-width: 50ch;
}
.body-text--dark {
    color: var(--charcoal-ink);
}
.highlight {
    background: rgba(107, 29, 42, 0.08);
    color: var(--deep-burgundy);
    padding: 0.1em 0.3em;
    font-weight: 700;
}

/* --- Speech Bubbles --- */
.speech-bubble {
    display: inline-block;
    background: var(--spotlight-yellow);
    border: 3px solid var(--charcoal-ink);
    border-radius: 12px;
    padding: 0.6rem 1.5rem;
    position: relative;
    transform: scale(0) rotate(-15deg);
    transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.speech-bubble.visible {
    transform: scale(1) rotate(0deg);
}
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 30px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid var(--charcoal-ink);
}
.speech-bubble--sm {
    padding: 0.4rem 1rem;
    margin-bottom: 1.5rem;
}
.bubble-text {
    font-family: 'Bangers', cursive;
    font-weight: 400;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--charcoal-ink);
    text-shadow: 2px 2px 0 var(--charcoal-ink);
    -webkit-text-stroke: 0;
    text-shadow: none;
    letter-spacing: 0.03em;
}

/* --- SVG Motifs --- */
.motif-svg {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}
.circuit-trace {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 3s ease-out;
}
.panel.in-view .circuit-trace {
    stroke-dashoffset: 0;
}
.fingerprint-ridge {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.5s ease-out;
}
.panel.in-view .fingerprint-ridge {
    stroke-dashoffset: 0;
}

/* --- Dossier --- */
.dossier {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.dossier-entry {
    border-left: 4px solid var(--spotlight-yellow);
    padding-left: 1.5rem;
}
.dossier-label {
    font-family: 'Alfa Slab One', cursive;
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bone-cream);
    margin-bottom: 0.25rem;
}

/* --- Binary Question --- */
.binary-question {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 200px;
    margin: 0 auto;
}
.binary-char {
    font-family: 'Roboto Slab', serif;
    font-weight: 300;
    font-size: 1.2rem;
    color: var(--bone-cream);
    text-align: center;
    opacity: 0;
    transition: opacity 300ms ease;
    transition-delay: calc(var(--i) * 80ms);
}
.binary-question.visible .binary-char {
    opacity: 0.7;
}
.big-q {
    grid-column: 1 / -1;
    font-family: 'Alfa Slab One', cursive;
    font-size: 5rem;
    color: var(--spotlight-yellow);
    text-shadow: 3px 3px 0 var(--charcoal-ink);
    line-height: 1;
    margin-top: 0.5rem;
}
.binary-question.visible .big-q {
    opacity: 1;
}

/* --- Lab Report --- */
.lab-report {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.lab-entry {
    position: relative;
}
.lab-label {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--clue-blue);
    display: block;
}
.lab-value {
    font-family: 'Roboto Slab', serif;
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--charcoal-ink);
    display: block;
    margin-top: 0.2rem;
}
.lab-rule {
    height: 1px;
    background: var(--deep-burgundy);
    margin-top: 0.75rem;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 800ms ease-out;
}
.panel.in-view .lab-rule {
    transform: scaleX(1);
}

/* --- Spotlight Beam --- */
.spotlight-beam {
    position: relative;
    width: 200px;
    height: 300px;
    margin: 0 auto;
}
.beam-shape {
    width: 0;
    height: 0;
    border-left: 100px solid transparent;
    border-right: 100px solid transparent;
    border-bottom: 300px solid rgba(242, 199, 68, 0.08);
    position: absolute;
    top: 0;
    left: 0;
}
.beam-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.beam-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--spotlight-yellow);
    opacity: 0.4;
    animation: particleDrift 6s ease-in-out infinite;
}
@keyframes particleDrift {
    0% { transform: translateY(100%) translateX(0); opacity: 0; }
    20% { opacity: 0.5; }
    80% { opacity: 0.3; }
    100% { transform: translateY(-100%) translateX(10px); opacity: 0; }
}

/* --- Keyhole Reveal --- */
.keyhole-reveal {
    position: relative;
    width: 200px;
    height: 300px;
    margin: 0 auto 3rem;
}
.keyhole-mask {
    width: 100%;
    height: 100%;
    clip-path: circle(20% at 50% 35%);
    transition: clip-path 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--charcoal-ink);
    overflow: hidden;
}
.keyhole-reveal.visible .keyhole-mask {
    clip-path: circle(60% at 50% 50%);
}
.server-rack {
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}
.server-unit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(139, 48, 64, 0.2);
    border: 1px solid rgba(139, 48, 64, 0.3);
}
.led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.led--green {
    background: #4CAF50;
    animation: ledBlink 2s steps(1) infinite;
}
.led--burgundy {
    background: var(--rosewood);
    animation: ledBlink 3s steps(1) infinite 1s;
}
@keyframes ledBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.server-bar {
    flex: 1;
    height: 4px;
    background: rgba(237, 224, 204, 0.15);
}

/* --- Finale --- */
.finale-heading {
    font-family: 'Alfa Slab One', cursive;
    font-weight: 400;
    font-size: clamp(1.6rem, 4.5vw, 3.5rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bone-cream);
}
.finale-underline {
    height: 4px;
    width: 0;
    background: var(--spotlight-yellow);
    margin-top: 1rem;
    transition: width 1.2s ease-out;
}
.finale-underline.visible {
    width: 200px;
}

/* --- Reveal Animation --- */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}
[data-reveal].visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 768px) {
    .panel { border-width: 4px; padding-left: 2rem; }
    .panel-nav { display: none; }
    .panel-split,
    .panel-split--reverse {
        grid-template-columns: 1fr;
    }
    .panel-split--reverse .split-graphic { order: 0; }
    .split-graphic {
        max-width: 200px;
        margin: 0 auto 2rem;
    }
}
