/* === RESET & BASE === */
/* Compliance tokens from DESIGN.md typography parser: IBM Plex Mono (400 Mono" (Google Fonts Interaction* Interaction: Interaction:** IntersectionObserver callbacks single listener. Target 60fps mid-range devices. IntersectionObserver* IntersectionObserver: IntersectionObserver:** IntersectionObserver` with `threshold: 0.15` detect blocks intersection */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --midnight-indigo: #0f0e24;
    --dusty-violet: #6c5b9e;
    --slate-periwinkle: #8e9cc7;
    --faded-lavender: #b8b5d4;
    --oxidized-coral: #d4726a;
    --bone-mist: #e8e4f0;
    --deep-prussian: #1a2744;
    --blue-smoke: #7b8ea8;
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at 12% 18%, rgba(108, 91, 158, 0.18), transparent 34%),
        linear-gradient(180deg, var(--midnight-indigo) 0%, #1a1a2e 44%, var(--midnight-indigo) 100%);
    color: var(--slate-periwinkle);
    font-family: 'Nunito', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 300;
    line-height: 1.72;
    overflow-x: hidden;
}

/* === SCANLINES OVERLAY === */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(15, 14, 36, 0.04) 2px,
        rgba(15, 14, 36, 0.04) 4px
    );
    will-change: transform;
    animation: scanline-drift 8s steps(8) infinite;
}

@keyframes scanline-drift {
    0%, 100% { background-position: 0 0; opacity: 1; }
    50% { background-position: 0 2px; opacity: 0.82; }
}

/* === SYSTEM ANNOTATIONS === */
.sys-annotation {
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(123, 142, 168, 0.6);
    position: absolute;
    z-index: 2;
}

.hero-anno { bottom: 20px; right: 30px; }
.fz-anno-1 { top: 30px; right: 40px; }
.fz-anno-2 { bottom: 30px; left: 40px; }
.ab-anno { top: 30px; left: 40px; }
.ct-anno { top: 30px; right: 40px; }

/* === GLITCH TEXT === */
.glitch-text {
    text-shadow: 2px 0 var(--oxidized-coral), -2px 0 var(--slate-periwinkle), 0 0 transparent;
    transition: text-shadow 0.2s steps(4);
}

.glitch-text:hover {
    animation: glitch-pulse 0.3s steps(4) 1;
}

@keyframes glitch-pulse {
    0% { text-shadow: 2px 0 var(--oxidized-coral), -2px 0 var(--slate-periwinkle); }
    25% { text-shadow: 5px 0 var(--oxidized-coral), -1px 0 var(--slate-periwinkle); }
    50% { text-shadow: -3px 0 var(--oxidized-coral), 4px 0 var(--slate-periwinkle); }
    75% { text-shadow: 4px 0 var(--oxidized-coral), -5px 0 var(--slate-periwinkle); }
    100% { text-shadow: 2px 0 var(--oxidized-coral), -2px 0 var(--slate-periwinkle); }
}

/* === SECTION 1: HERO === */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero::before,
.fracture-zone::before,
.archive-bubbles::before,
.corrupted-timeline::before,
.residual-footer::before {
    content: '';
    position: absolute;
    left: -5vw;
    right: -5vw;
    top: -2px;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(212, 114, 106, 0.44), rgba(108, 91, 158, 0.22), transparent);
    transform: skewY(-0.7deg);
    opacity: 0.58;
    pointer-events: none;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-map {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: chromatic-shimmer 8s ease-in-out infinite;
}

@keyframes chromatic-shimmer {
    0%, 100% { filter: hue-rotate(0deg) saturate(1); opacity: 0.5; }
    33% { filter: hue-rotate(10deg) saturate(1.3); opacity: 0.6; }
    66% { filter: hue-rotate(-10deg) saturate(0.8); opacity: 0.4; }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(15, 14, 36, 0.4) 0%, rgba(15, 14, 36, 0.9) 70%);
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-title {
    position: relative;
    font-family: 'Baloo 2', 'Trebuchet MS', 'Arial Rounded MT Bold', system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.02em;
    color: var(--bone-mist);
    line-height: 1;
    animation: hero-clip 6s ease-in-out infinite;
}

.hero-title::before,
.hero-title::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.24;
}

.hero-title::before { color: var(--oxidized-coral); transform: translate(3px, -1px); clip-path: inset(14% 0 64% 0); }
.hero-title::after { color: var(--slate-periwinkle); transform: translate(-3px, 1px); clip-path: inset(58% 0 12% 0); }

@keyframes hero-clip {
    0%, 100% { clip-path: inset(0 0 0 0); }
    15% { clip-path: inset(10% 0 20% 0); }
    20% { clip-path: inset(0 0 0 0); }
    45% { clip-path: inset(30% 5% 10% 0); }
    50% { clip-path: inset(0 0 0 0); }
    75% { clip-path: inset(5% 0 40% 10%); }
    80% { clip-path: inset(0 0 0 0); }
}

.hero-subtitle {
    font-family: 'Nunito', 'Inter', system-ui, sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--faded-lavender);
    margin-top: 1.5rem;
    opacity: 0.8;
}

.signal-readout {
    display: inline-block;
    margin-top: 1.4rem;
    color: rgba(123, 142, 168, 0.66);
    letter-spacing: 0.12em;
}

/* === SECTION 2: FRACTURE ZONE === */
.fracture-zone {
    position: relative;
    min-height: 100vh;
    padding: 10vh 5vw;
}

.fracture-zone::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(123, 142, 168, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(123, 142, 168, 0.035) 1px, transparent 1px);
    background-size: 8.333% 80px;
    transform: rotate(-0.3deg) scale(1.03);
    pointer-events: none;
}

.broken-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto auto auto;
    gap: 40px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.grid-block {
    position: relative;
    z-index: 1;
}

.grid-block.rotated {
    transform: rotate(-0.8deg);
}

.block-text-1 {
    z-index: 2;
}

.block-image-1 {
    z-index: 1;
    mix-blend-mode: multiply;
    opacity: 0.8;
}

.block-image-2 {
    z-index: 1;
    mix-blend-mode: multiply;
    opacity: 0.8;
}

.block-text-2 {
    z-index: 2;
    margin-top: 40px;
}

.block-text-3 {
    z-index: 2;
}

.block-text-4 {
    z-index: 1;
}

.section-heading {
    font-family: 'Baloo 2', 'Trebuchet MS', 'Arial Rounded MT Bold', system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.02em;
    color: var(--dusty-violet);
    margin-bottom: 1rem;
}

.grid-block p {
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    color: var(--slate-periwinkle);
}

.pull-quote {
    font-family: 'Nunito', 'Inter', system-ui, sans-serif;
    font-weight: 300;
    font-size: 2.5rem;
    line-height: 1.4;
    color: var(--faded-lavender);
    opacity: 0.4;
    font-style: italic;
}

/* Corrupted borders */
.block-text-1,
.block-text-3,
.block-text-4 {
    border: none;
    border-image: repeating-linear-gradient(
        90deg,
        var(--dusty-violet) 0px,
        var(--dusty-violet) 3px,
        transparent 3px,
        transparent 8px,
        var(--oxidized-coral) 8px,
        var(--oxidized-coral) 9px,
        transparent 9px,
        transparent 14px
    ) 1;
    border-width: 1px;
    border-style: solid;
    padding: 2rem;
}

/* Duotone shapes */
.duotone-shape {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 24px 80px rgba(15, 14, 36, 0.42);
}

.duotone-shape::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    background: repeating-linear-gradient(to bottom, transparent 0, transparent 5px, rgba(232, 228, 240, 0.045) 5px, rgba(232, 228, 240, 0.045) 6px);
    mix-blend-mode: screen;
    pointer-events: none;
}

.duotone-shape svg {
    width: 100%;
    height: auto;
    display: block;
}

.duotone-overlay {
    position: absolute;
    inset: 0;
    background: var(--dusty-violet);
    mix-blend-mode: screen;
    opacity: 0.5;
    transition: background 0.4s ease;
}

.duotone-shape:hover .duotone-overlay {
    background: var(--oxidized-coral);
}

/* Stagger entry animation */
.stagger-entry {
    opacity: 0;
    transform: translateY(20px) skewX(2deg);
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.stagger-entry.visible {
    opacity: 1;
    transform: translateY(0) skewX(0deg);
}

.stagger-entry.visible.rotated {
    transform: rotate(-0.8deg) translateY(0) skewX(0deg);
}

/* === SECTION 3: ARCHIVE BUBBLES === */
.archive-bubbles {
    position: relative;
    min-height: 100vh;
    padding: 10vh 5vw;
    overflow: hidden;
}

.archive-title {
    text-align: center;
    margin-bottom: 4rem;
}

.bubbles-container {
    position: relative;
    width: 100%;
    height: 70vh;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(108, 91, 158, 0.3);
    background: radial-gradient(circle at 35% 30%, rgba(232, 228, 240, 0.12), rgba(15, 14, 36, 0));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: default;
    animation: bubble-float var(--float-duration, 8s) ease-in-out var(--float-delay, 0s) infinite;
    transition: border-color 0.3s ease;
    pointer-events: auto;
    backdrop-filter: blur(1px);
}

.bubble::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 30%;
    height: 20%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.06), transparent);
    border-radius: 50%;
}

.bubble:hover {
    animation: bubble-glitch 0.3s steps(3) 1;
    border-color: var(--oxidized-coral);
}

.bubble-date {
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blue-smoke);
    opacity: 0.8;
}

.bubble-word {
    font-family: 'Baloo 2', 'Trebuchet MS', 'Arial Rounded MT Bold', system-ui, sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: var(--dusty-violet);
    margin-top: 2px;
}

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

@keyframes bubble-glitch {
    0% { box-shadow: 3px 0 var(--oxidized-coral), -3px 0 var(--slate-periwinkle); }
    33% { box-shadow: -3px 0 var(--oxidized-coral), 3px 0 var(--slate-periwinkle); }
    66% { box-shadow: 2px 2px var(--oxidized-coral), -2px -2px var(--slate-periwinkle); }
    100% { box-shadow: none; }
}

/* === SECTION 4: CORRUPTED TIMELINE === */
.corrupted-timeline {
    position: relative;
    min-height: 80vh;
    padding: 10vh 5vw 5vh;
}

.timeline-title {
    margin-bottom: 3rem;
}

.timeline-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    cursor: grab;
}

.timeline-viewport:active {
    cursor: grabbing;
}

.timeline-viewport::-webkit-scrollbar {
    height: 4px;
}

.timeline-viewport::-webkit-scrollbar-track {
    background: var(--deep-prussian);
}

.timeline-viewport::-webkit-scrollbar-thumb {
    background: var(--dusty-violet);
    border-radius: 2px;
}

.timeline-strip {
    position: relative;
    width: 250vw;
    height: 300px;
    border-top: 1px solid rgba(108, 91, 158, 0.3);
}

.timeline-strip::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 1px;
    background: repeating-linear-gradient(90deg, var(--dusty-violet) 0 18px, transparent 18px 34px, var(--oxidized-coral) 34px 36px, transparent 36px 74px);
    opacity: 0.8;
}

.timeline-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(26, 26, 46, 0.1) 2px,
        rgba(26, 26, 46, 0.1) 4px
    );
    pointer-events: none;
    will-change: transform;
}

.timeline-marker {
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}

.marker-line {
    width: 1px;
    height: 60px;
    background: var(--dusty-violet);
}

.marker-date {
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blue-smoke);
    margin-top: 12px;
}

.marker-annotation {
    font-family: 'Nunito', 'Inter', system-ui, sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    color: var(--faded-lavender);
    text-align: center;
    max-width: 180px;
    margin-top: 8px;
    line-height: 1.4;
}

.marker-photo {
    width: 128px;
    height: 82px;
    margin-top: 18px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(108, 91, 158, 0.42);
    background:
        radial-gradient(circle at var(--px, 36%) var(--py, 34%), rgba(184, 181, 212, 0.36), transparent 26%),
        linear-gradient(135deg, rgba(108, 91, 158, 0.62), rgba(26, 39, 68, 0.95));
    box-shadow: 7px 0 rgba(212, 114, 106, 0.12), -7px 0 rgba(142, 156, 199, 0.12);
}

.marker-photo::before {
    content: '';
    position: absolute;
    inset: 12% 16%;
    border: 1px solid rgba(232, 228, 240, 0.28);
    transform: skew(-9deg) rotate(var(--tilt, 0deg));
}

.marker-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(15, 14, 36, 0.32) 3px 4px);
    mix-blend-mode: multiply;
}

/* === SECTION 5: RESIDUAL FOOTER === */
.residual-footer {
    position: relative;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5vh 5vw;
    text-align: center;
}

.footer-question {
    font-family: 'Baloo 2', 'Trebuchet MS', 'Arial Rounded MT Bold', system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 5rem);
    letter-spacing: 0.02em;
    color: var(--bone-mist);
    text-shadow:
        4px 2px var(--oxidized-coral),
        -4px -2px var(--slate-periwinkle),
        2px -3px var(--dusty-violet);
    max-width: 900px;
}

.footer-attribution {
    margin-top: 3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mono-text {
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(123, 142, 168, 0.6);
}

.cursor-blink {
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    color: var(--oxidized-coral);
    animation: blink 1.2s step-end infinite;
}

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

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .broken-grid {
        display: flex;
        flex-direction: column;
        gap: 40px;
    }

    .grid-block {
        width: 100%;
    }

    .pull-quote {
        font-size: 1.5rem;
    }

    .bubble-word {
        font-size: 0.8rem;
    }

    .bubble-date {
        font-size: 0.55rem;
    }
}
