/* ============================================
   kakuritsu.com — Glitch-Archaeology
   Horizontal-scroll probability narrative
   ============================================ */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1510;
    color: #ede5d5;
    font-family: 'Roboto Slab', serif;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.65;
}

/* --- Horizontal Scroll Container --- */
.scroll-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 500vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --- Panel Base --- */
.panel {
    position: relative;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
}

/* ============================================
   PANEL 0: THE VOID
   ============================================ */
.panel-void {
    background: #1a1510;
}

.voronoi-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1200ms ease-in;
}

.voronoi-canvas.visible {
    opacity: 0.12;
}

.glitch-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #d4b896;
    opacity: 0.4;
    z-index: 2;
    will-change: transform;
}

.hero-letters {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 5vw;
    z-index: 3;
}

.hero-letter {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    color: #ede5d5;
    letter-spacing: 0.25em;
    opacity: 0;
    transition: opacity 300ms ease-in;
    will-change: opacity;
}

.hero-letter.visible {
    opacity: 1;
}

/* Scroll hint arrow */
.scroll-hint {
    position: absolute;
    right: 3vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    border-right: 2px solid #c8a86e;
    border-bottom: 2px solid #c8a86e;
    transform: rotate(-45deg);
    animation: pulseArrow 2s ease-in-out infinite;
}

@keyframes pulseArrow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ============================================
   PANEL 1: THE LATTICE
   ============================================ */
.panel-lattice {
    background: #3a3025;
}

.gradient-mesh-1 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 30%, #d4b896 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, #c8a86e 0%, transparent 45%),
        radial-gradient(ellipse at 50% 80%, #8a7560 0%, transparent 55%),
        radial-gradient(ellipse at 85% 20%, #f0e6d0 0%, transparent 40%),
        radial-gradient(ellipse at 10% 70%, #c8a86e 0%, transparent 35%),
        radial-gradient(ellipse at 60% 15%, #d4b896 0%, transparent 42%),
        linear-gradient(135deg, #1a1510 0%, #3a3025 100%);
}

.voronoi-lattice-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* ============================================
   PANEL 2: THE DISRUPTION
   ============================================ */
.panel-disruption {
    background: #d4b896;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.glitch-strips {
    position: relative;
    width: 80%;
    z-index: 2;
}

.glitch-strip {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #1a1510;
    line-height: 1.3;
    white-space: nowrap;
    will-change: transform;
}

.glitch-strip.chromatic .strip-text {
    text-shadow:
        2px 0 #c8503c,
        -2px 0 #5c8a8e;
}

/* Block corruption artifacts */
.corruption-block {
    position: absolute;
    background: #d4b896;
    z-index: 3;
    opacity: 0;
    animation: corruptionPulse 10s steps(3) infinite;
}

.cb-1 {
    width: 180px;
    height: 12px;
    top: 18%;
    left: 35%;
    opacity: 0.7;
    background: #c8a86e;
    animation-delay: 0s;
    animation-duration: 8s;
}

.cb-2 {
    width: 120px;
    height: 8px;
    top: 55%;
    right: 20%;
    opacity: 0.6;
    background: #8a7560;
    animation-delay: 3s;
    animation-duration: 11s;
}

.cb-3 {
    width: 200px;
    height: 16px;
    bottom: 25%;
    left: 10%;
    opacity: 0.65;
    background: #f0e6d0;
    animation-delay: 5s;
    animation-duration: 9s;
}

@keyframes corruptionPulse {
    0%, 15%, 85%, 100% { opacity: 0; }
    20%, 80% { opacity: 0.7; }
}

/* ============================================
   PANEL 3: THE CONVERGENCE
   ============================================ */
.panel-convergence {
    background: #1a1510;
}

.shards-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.shard {
    position: absolute;
    will-change: transform;
    transition: transform 0.05s linear;
}

.shard-mesh {
    width: 100%;
    height: 100%;
}

.shard-1 {
    width: 220px;
    height: 180px;
    top: 12%;
    left: 15%;
    transform: rotate(-8deg);
    clip-path: polygon(10% 0%, 95% 5%, 100% 85%, 15% 100%, 0% 40%);
}

.shard-1 .shard-mesh {
    background:
        radial-gradient(ellipse at 30% 40%, #d4b896 0%, transparent 60%),
        radial-gradient(ellipse at 70% 70%, #c8a86e 0%, transparent 50%),
        linear-gradient(160deg, #3a3025, #8a7560);
}

.shard-2 {
    width: 260px;
    height: 200px;
    top: 8%;
    left: 55%;
    transform: rotate(5deg);
    clip-path: polygon(5% 10%, 90% 0%, 100% 75%, 60% 100%, 0% 80%);
}

.shard-2 .shard-mesh {
    background:
        radial-gradient(ellipse at 50% 30%, #f0e6d0 0%, transparent 55%),
        radial-gradient(ellipse at 20% 80%, #c8a86e 0%, transparent 45%),
        linear-gradient(200deg, #8a7560, #3a3025);
}

.shard-3 {
    width: 190px;
    height: 240px;
    top: 35%;
    left: 38%;
    transform: rotate(-12deg);
    clip-path: polygon(15% 5%, 85% 0%, 100% 60%, 70% 100%, 0% 90%, 5% 30%);
}

.shard-3 .shard-mesh {
    background:
        radial-gradient(ellipse at 60% 25%, #d4b896 0%, transparent 50%),
        radial-gradient(ellipse at 30% 75%, #8a7560 0%, transparent 55%),
        linear-gradient(140deg, #1a1510, #c8a86e);
}

.shard-4 {
    width: 180px;
    height: 160px;
    top: 55%;
    left: 10%;
    transform: rotate(15deg);
    clip-path: polygon(0% 15%, 80% 0%, 100% 70%, 50% 100%, 10% 85%);
}

.shard-4 .shard-mesh {
    background:
        radial-gradient(ellipse at 40% 50%, #f0e6d0 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, #d4b896 0%, transparent 45%),
        linear-gradient(180deg, #3a3025, #1a1510);
}

.shard-5 {
    width: 240px;
    height: 170px;
    top: 60%;
    left: 50%;
    transform: rotate(-3deg);
    clip-path: polygon(5% 5%, 95% 15%, 85% 95%, 20% 100%, 0% 50%);
}

.shard-5 .shard-mesh {
    background:
        radial-gradient(ellipse at 25% 60%, #c8a86e 0%, transparent 55%),
        radial-gradient(ellipse at 75% 30%, #d4b896 0%, transparent 45%),
        linear-gradient(120deg, #8a7560, #3a3025);
}

.shard-6 {
    width: 200px;
    height: 190px;
    top: 20%;
    left: 75%;
    transform: rotate(9deg);
    clip-path: polygon(10% 0%, 100% 10%, 90% 90%, 0% 100%, 5% 45%);
}

.shard-6 .shard-mesh {
    background:
        radial-gradient(ellipse at 55% 45%, #f0e6d0 0%, transparent 50%),
        radial-gradient(ellipse at 15% 80%, #8a7560 0%, transparent 50%),
        linear-gradient(170deg, #c8a86e, #1a1510);
}

.shard-caption {
    display: block;
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: #7a9486;
    white-space: nowrap;
}

/* ============================================
   PANEL 4: THE RESOLUTION
   ============================================ */
.panel-resolution {
    background: #f0e6d0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.voronoi-resolved-svg {
    width: 60vmin;
    height: 60vmin;
    z-index: 2;
}

.voronoi-resolved-svg polygon {
    stroke: #c8a86e;
    stroke-width: 1.5;
    opacity: 0;
    transition: opacity 400ms ease-in, fill 400ms ease-in;
}

.voronoi-resolved-svg polygon.crystallized {
    opacity: 1;
}

.resolution-title {
    margin-top: 3vh;
    z-index: 2;
}

.resolution-link {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: #1a1510;
    text-decoration: none;
    letter-spacing: 0.08em;
}

/* ============================================
   GLITCH TRANSITION OVERLAY
   ============================================ */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100;
}

.glitch-flash {
    position: absolute;
    left: 0;
    width: 100%;
    background: #d4b896;
    animation: glitchFlash 120ms steps(3) forwards;
}

@keyframes glitchFlash {
    0% { opacity: 0.6; }
    100% { opacity: 0; }
}

/* ============================================
   PANEL INDICATORS
   ============================================ */
.panel-indicators {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    z-index: 50;
}

.indicator {
    width: 10px;
    height: 10px;
    border: 1.5px solid #c8a86e;
    transform: rotate(45deg);
    background: transparent;
    transition: background 400ms ease, border-color 400ms ease;
    cursor: pointer;
}

.indicator.active {
    background: #c8a86e;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .shard {
        transform: scale(0.7) !important;
    }

    .shard-caption {
        font-size: 0.65rem;
    }

    .glitch-strip {
        font-size: clamp(1.2rem, 4vw, 2.5rem);
    }

    .scroll-hint {
        right: 5vw;
    }
}
