/* ============================================
   continu.ax - Translucent Frost Design System
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #0B1120;
    color: #C8D8E8;
    font-family: 'Work Sans', sans-serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Scanline Overlay --- */
#scanlines {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(11, 17, 32, 0.4) 2px,
        rgba(11, 17, 32, 0.4) 3px
    );
    opacity: 0.06;
}

/* --- Moire Pattern Overlay --- */
#moire {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0.04;
    background:
        repeating-linear-gradient(
            43deg,
            transparent,
            transparent 4px,
            rgba(184, 212, 227, 0.15) 4px,
            rgba(184, 212, 227, 0.15) 5px
        ),
        repeating-linear-gradient(
            47deg,
            transparent,
            transparent 4px,
            rgba(184, 212, 227, 0.12) 4px,
            rgba(184, 212, 227, 0.12) 5px
        );
}

/* --- Generative Canvas --- */
.gen-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    image-rendering: auto;
}

/* --- Scene Base --- */
.scene {
    position: relative;
    overflow: hidden;
}

/* --- Opening Scene --- */
#opening {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.opening-title {
    position: relative;
    z-index: 2;
    text-align: center;
}

.title-main {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(56px, 10vw, 96px);
    letter-spacing: -0.02em;
    line-height: 0.92;
    color: #E8F0FE;
    text-shadow: 0 0 60px rgba(184, 212, 227, 0.3), 0 0 120px rgba(184, 212, 227, 0.1);
    -webkit-background-clip: text;
    position: relative;
}

.title-main::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(ellipse at center, rgba(232, 240, 254, 0.06) 0%, transparent 70%);
    z-index: -1;
    border-radius: 50%;
}

.title-annotation {
    display: block;
    margin-top: 24px;
    opacity: 0.6;
}

/* --- Typography --- */
.heading-display {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(40px, 6vw, 72px);
    letter-spacing: -0.02em;
    line-height: 0.92;
    color: #E8F0FE;
    text-shadow: 0 0 40px rgba(184, 212, 227, 0.3);
    margin-bottom: 24px;
}

.heading-accent {
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    font-size: clamp(22px, 3vw, 36px);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #B8D4E3;
    margin-bottom: 16px;
}

.body-text {
    font-family: 'Work Sans', sans-serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #C8D8E8;
}

.mono {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: #7BA7C2;
}

.label {
    display: block;
    margin-bottom: 12px;
}

/* --- Frost Glass Panels --- */
.frost-panel {
    background: rgba(11, 17, 32, 0.55);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(232, 240, 254, 0.08);
    border-radius: 2px;
    padding: 40px;
    position: relative;
    transition: backdrop-filter 0.6s ease, -webkit-backdrop-filter 0.6s ease;
}

.frost-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 2px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(123, 167, 194, 0.2), rgba(168, 180, 212, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: shimmer-border 8s linear infinite;
}

@keyframes shimmer-border {
    0% { background: linear-gradient(135deg, rgba(123, 167, 194, 0.2), rgba(168, 180, 212, 0.05)); }
    50% { background: linear-gradient(135deg, rgba(168, 180, 212, 0.05), rgba(123, 167, 194, 0.2)); }
    100% { background: linear-gradient(135deg, rgba(123, 167, 194, 0.2), rgba(168, 180, 212, 0.05)); }
}

.frost-panel:hover {
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

/* --- Drift Zones --- */
.drift-zone {
    min-height: 80vh;
    padding: 12vh 0;
}

/* --- Broken Grid System --- */
.broken-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    padding: 0 4vw;
    position: relative;
    z-index: 1;
}

/* Drift Zone 1 blocks */
.block-a {
    grid-column: 2 / 7;
    grid-row: 1 / 3;
    transform: rotate(-1.5deg);
    z-index: 2;
    opacity: 0.95;
}

.block-b {
    grid-column: 5 / 11;
    grid-row: 2 / 4;
    transform: rotate(2.5deg);
    z-index: 1;
    opacity: 0.85;
    margin-top: 60px;
}

/* Drift Zone 2 blocks */
.block-c {
    grid-column: 1 / 6;
    grid-row: 1 / 3;
    transform: rotate(1.8deg);
    z-index: 3;
    opacity: 0.9;
}

.block-d {
    grid-column: 5 / 10;
    grid-row: 2 / 4;
    transform: rotate(-2.2deg);
    z-index: 2;
    opacity: 0.85;
    margin-top: 80px;
}

.block-e {
    grid-column: 8 / 13;
    grid-row: 1 / 3;
    transform: rotate(0.8deg);
    z-index: 1;
    opacity: 0.7;
    margin-top: 120px;
}

/* Drift Zone 3 blocks */
.block-f {
    grid-column: 4 / 11;
    grid-row: 1 / 2;
    transform: rotate(-1.2deg);
    z-index: 3;
    opacity: 0.9;
}

.block-g {
    grid-column: 1 / 7;
    grid-row: 2 / 4;
    transform: rotate(3deg);
    z-index: 2;
    opacity: 0.85;
    margin-top: -40px;
}

.block-h {
    grid-column: 6 / 12;
    grid-row: 3 / 5;
    transform: rotate(1.5deg);
    z-index: 1;
    opacity: 0.75;
    margin-top: 40px;
}

/* Drift Zone 4 blocks */
.block-i {
    grid-column: 2 / 8;
    grid-row: 1 / 2;
    transform: rotate(-0.8deg);
    z-index: 2;
    opacity: 0.7;
}

.block-j {
    grid-column: 6 / 12;
    grid-row: 1 / 3;
    transform: rotate(1.2deg);
    z-index: 1;
    opacity: 0.5;
    margin-top: 80px;
}

/* --- Sticky Block --- */
.sticky-block {
    position: sticky;
    top: 20vh;
}

/* --- Lens Flares --- */
.flare {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.flare-hex {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #F0F4FA 0%, transparent 70%);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: flare-pulse 4s ease-in-out infinite;
}

.flare-streak {
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #D4B8C8, transparent);
    transform: rotate(25deg);
    animation: streak-breathe 6s ease-in-out infinite;
}

.flare-prismatic {
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        #7BA7C2 20%,
        #B8D4E3 35%,
        #A8B4D4 50%,
        #D4B8C8 65%,
        #F0F4FA 80%,
        transparent 100%
    );
    mix-blend-mode: screen;
    animation: prismatic-shift 8s linear infinite;
}

/* Flare positions per zone */
#drift-1 .flare-hex {
    top: 45%;
    left: 38%;
}

#drift-2 .flare-streak {
    top: 30%;
    right: 20%;
}

#drift-2 .flare-hex {
    bottom: 25%;
    left: 50%;
}

#drift-3 .flare-prismatic {
    top: 50%;
    left: 0;
}

#drift-3 .flare-streak {
    bottom: 30%;
    right: 15%;
}

#drift-4 .flare-hex {
    top: 40%;
    left: 45%;
    opacity: 0.4;
}

@keyframes flare-pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.15); }
}

@keyframes streak-breathe {
    0%, 100% { opacity: 0.3; height: 1px; }
    50% { opacity: 0.6; height: 3px; }
}

@keyframes prismatic-shift {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* --- Dissolving Zone --- */
.dissolving .frost-panel {
    opacity: 0.6;
}

.dissolution .grid-block {
    transition: opacity 0.3s ease;
}

/* --- Terminal Fade --- */
#terminal {
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.terminal-pulse {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.pulse-point {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #F0F4FA;
    box-shadow: 0 0 20px rgba(240, 244, 250, 0.5), 0 0 60px rgba(184, 212, 227, 0.3);
    animation: pulse-breathe 4s ease-in-out infinite;
}

@keyframes pulse-breathe {
    0%, 100% { transform: scale(1); opacity: 0.4; box-shadow: 0 0 20px rgba(240, 244, 250, 0.3), 0 0 40px rgba(184, 212, 227, 0.15); }
    50% { transform: scale(1.5); opacity: 1; box-shadow: 0 0 30px rgba(240, 244, 250, 0.6), 0 0 80px rgba(184, 212, 227, 0.3); }
}

.terminal-label {
    opacity: 0.3;
    font-size: 12px;
}

/* --- Halftone Background Texture --- */
.drift-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle, rgba(184, 212, 227, 0.08) 1px, transparent 1px);
    background-size: 8px 8px;
    opacity: 0.5;
}

/* --- Cross-hatch on Hover --- */
.frost-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 5px,
            rgba(184, 212, 227, 0.06) 5px,
            rgba(184, 212, 227, 0.06) 6px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 5px,
            rgba(184, 212, 227, 0.06) 5px,
            rgba(184, 212, 227, 0.06) 6px
        );
    border-radius: 2px;
}

.frost-panel:hover::after {
    opacity: 0.12;
}

/* --- Scroll-Driven Entry Animations --- */
.grid-block {
    opacity: 0;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.grid-block[data-enter="left"] {
    transform: translateX(-40px) rotate(var(--rot, 0deg));
}

.grid-block[data-enter="right"] {
    transform: translateX(40px) rotate(var(--rot, 0deg));
}

.grid-block[data-enter="bottom"] {
    transform: translateY(40px) rotate(var(--rot, 0deg));
}

.grid-block.visible {
    opacity: 1;
}

.block-a.visible { transform: rotate(-1.5deg); opacity: 0.95; }
.block-b.visible { transform: rotate(2.5deg); opacity: 0.85; }
.block-c.visible { transform: rotate(1.8deg); opacity: 0.9; }
.block-d.visible { transform: rotate(-2.2deg); opacity: 0.85; }
.block-e.visible { transform: rotate(0.8deg); opacity: 0.7; }
.block-f.visible { transform: rotate(-1.2deg); opacity: 0.9; }
.block-g.visible { transform: rotate(3deg); opacity: 0.85; }
.block-h.visible { transform: rotate(1.5deg); opacity: 0.75; }
.block-i.visible { transform: rotate(-0.8deg); opacity: 0.7; }
.block-j.visible { transform: rotate(1.2deg); opacity: 0.5; }

/* --- Ripple Effect on Interaction --- */
.ripple-effect {
    position: absolute;
    border: 1px solid #D4B8C8;
    border-radius: 50%;
    pointer-events: none;
    animation: ripple-expand 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    z-index: 100;
}

@keyframes ripple-expand {
    0% { width: 0; height: 0; opacity: 0.6; }
    100% { width: 400px; height: 400px; opacity: 0; margin-left: -200px; margin-top: -200px; }
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .broken-grid {
        grid-template-columns: repeat(6, 1fr);
        padding: 0 3vw;
    }

    .block-a, .block-c, .block-f, .block-i { grid-column: 1 / 5; }
    .block-b, .block-d, .block-j { grid-column: 3 / 7; }
    .block-e { grid-column: 2 / 7; margin-top: 40px; }
    .block-g { grid-column: 1 / 5; }
    .block-h { grid-column: 2 / 7; }

    .heading-display {
        font-size: clamp(32px, 8vw, 56px);
    }

    .frost-panel {
        padding: 28px;
    }
}

@media (max-width: 600px) {
    .broken-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .grid-block {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        margin-top: 0 !important;
    }

    .block-a, .block-b, .block-c, .block-d, .block-e,
    .block-f, .block-g, .block-h, .block-i, .block-j {
        transform: rotate(0deg) !important;
    }

    .block-a.visible, .block-b.visible, .block-c.visible,
    .block-d.visible, .block-e.visible, .block-f.visible,
    .block-g.visible, .block-h.visible, .block-i.visible,
    .block-j.visible {
        transform: rotate(0deg) !important;
        opacity: 1 !important;
    }

    .frost-panel {
        padding: 24px;
    }

    .drift-zone {
        padding: 8vh 0;
    }
}
