/* rollup.quest — Derelict Submarine Sonar Station / Blockchain Data Compressor */
/* Colors: Abyss #080d18, Bulkhead #0f1a2e, Pressure Steel #1a2d4a, Sonar Cyan #4ac8e8 */
/* Proof Blue #7bb8d4, Grain Frost #c4dce9, Transmission White #e8f0f6, Bubble Glow #2aefd8, Warning Amber #e8a84c */

:root {
    --abyss: #080d18;
    --bulkhead: #0f1a2e;
    --pressure-steel: #1a2d4a;
    --sonar-cyan: #4ac8e8;
    --proof-blue: #7bb8d4;
    --grain-frost: #c4dce9;
    --transmission-white: #e8f0f6;
    --bubble-glow: #2aefd8;
    --warning-amber: #e8a84c;
    --deep-abyss: #050810;
    --compression-ratio: 0;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--abyss);
    color: var(--grain-frost);
    font-family: "IBM Plex Mono", monospace;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.65;
    overflow-x: hidden;
}

/* ============ GRAIN OVERLAY ============ */
#grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: var(--grain-opacity, 0.06);
}

#grain-overlay svg {
    width: 100%;
    height: 100%;
}

/* ============ ZONE COMMON ============ */
.zone {
    position: relative;
    width: 100%;
}

.zone-label {
    font-family: "Overpass Mono", monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sonar-cyan);
    opacity: 0.6;
    padding: 2rem 3rem;
}

.zone-label span {
    color: var(--bubble-glow);
}

/* ============ ZONE 1: TRANSACTION POOL ============ */
#zone-1 {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.zone-1-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

.hero-title {
    font-family: "Share Tech Mono", monospace;
    font-weight: 400;
    font-size: clamp(3rem, 10vw, 8rem);
    color: var(--transmission-white);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 1rem;
    position: relative;
}

.hero-title .dot {
    color: var(--sonar-cyan);
}

.hero-subtitle {
    font-family: "Overpass Mono", monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--proof-blue);
    margin-bottom: 2rem;
}

.warning-amber {
    font-family: "Overpass Mono", monospace;
    font-size: clamp(0.6rem, 0.7vw, 0.7rem);
    color: var(--warning-amber);
    letter-spacing: 0.04em;
    padding: 0.8rem 1.2rem;
    border: 1px solid rgba(232, 168, 76, 0.3);
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 2rem;
    background: rgba(232, 168, 76, 0.05);
}

.warning-icon {
    margin-right: 0.5rem;
}

/* Scattered Tiles in Zone 1 */
.scattered-tiles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.scatter-tile {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--w);
    height: var(--h);
    transform: rotate(var(--rot));
    background: var(--bulkhead);
    border: 1px solid rgba(120, 180, 220, 0.15);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: opacity 1s ease;
}

.tile-label {
    font-family: "Overpass Mono", monospace;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sonar-cyan);
}

.tile-hash {
    font-family: "Share Tech Mono", monospace;
    font-size: 0.6rem;
    color: var(--proof-blue);
    opacity: 0.6;
}

/* Sonar Pings */
.sonar-ping {
    position: absolute;
    left: var(--ping-x);
    top: var(--ping-y);
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 1px solid rgba(74, 200, 232, 0.15);
    animation: sonarPing 4s ease-out infinite;
    pointer-events: none;
    z-index: 0;
}

.sonar-ping:nth-child(2) {
    animation-delay: 2s;
}

@keyframes sonarPing {
    0% {
        width: 0px;
        height: 0px;
        opacity: 0.6;
        transform: translate(-50%, -50%);
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
        transform: translate(-50%, -50%);
    }
}

/* Bubble Container */
.bubble-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(74, 200, 232, 0.3);
    background: radial-gradient(circle at 30% 30%, rgba(42, 239, 216, 0.12), transparent 70%);
    box-shadow: inset 0 -8px 20px rgba(8, 13, 24, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bubbleDrift var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
    will-change: transform, opacity;
}

.bubble .bubble-text {
    font-family: "Overpass Mono", monospace;
    font-size: 0.6rem;
    color: var(--sonar-cyan);
    opacity: 0.7;
    letter-spacing: 0.04em;
}

@keyframes bubbleDrift {
    0% {
        transform: translateY(100vh) scale(0.3);
        opacity: 0;
    }
    20% {
        opacity: 0.8;
    }
    80% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-20vh) scale(1);
        opacity: 0;
    }
}

.bubble.frozen {
    animation-play-state: paused;
    opacity: 0.5;
    transition: all 1s ease;
}

/* ============ ZONE 2: COMPRESSION CHAMBER ============ */
#zone-2 {
    padding: 4rem 2rem;
    position: relative;
}

.compression-line {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--sonar-cyan), transparent);
    margin: 2rem auto;
    width: calc(100% - (var(--compression-ratio) * 60%));
    opacity: calc(0.3 + var(--compression-ratio) * 0.4);
    transition: width 0.3s ease, opacity 0.3s ease;
}

/* Masonry Grid */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: calc(6px * (1 - var(--compression-ratio) * 0.6));
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
    transition: gap 0.3s ease;
}

.masonry-tile {
    background: var(--bulkhead);
    border: 1px solid rgba(120, 180, 220, 0.15);
    border-radius: 4px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transform: translateY(40px);
    opacity: 0;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out, background-color 0.3s ease;
}

.masonry-tile.visible {
    transform: translateY(0);
    opacity: 1;
}

.masonry-tile:hover {
    background: var(--pressure-steel);
}

.masonry-tile[data-height="tall"] {
    grid-row: span 2;
}

.masonry-tile[data-height="medium"] {
    grid-row: span 1;
}

.masonry-tile[data-height="short"] {
    grid-row: span 1;
}

.tile-corner-glyph {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tile-corner-glyph::before,
.tile-corner-glyph::after {
    content: "";
    display: block;
    height: 1px;
    background: var(--sonar-cyan);
    opacity: 0.3;
}

.tile-corner-glyph::before {
    width: 100%;
}

.tile-corner-glyph::after {
    width: 60%;
    align-self: flex-end;
}

.tile-meta {
    display: block;
    font-family: "Overpass Mono", monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sonar-cyan);
    margin-bottom: 0.75rem;
}

.masonry-tile p {
    font-family: "IBM Plex Mono", monospace;
    font-size: clamp(0.8rem, 0.95vw, 0.9rem);
    line-height: 1.65;
    color: var(--grain-frost);
    max-width: 52ch;
}

.masonry-tile code {
    color: var(--bubble-glow);
    font-family: "Share Tech Mono", monospace;
    font-size: 0.85em;
}

/* ============ ZONE 3: THE PROOF ============ */
#zone-3 {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem 2rem;
    position: relative;
}

.proof-block {
    position: relative;
    width: 100%;
    max-width: 700px;
    background: var(--bulkhead);
    border: 1px solid rgba(74, 200, 232, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.frozen-lattice {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.15;
}

.frozen-bubble {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(74, 200, 232, 0.25);
    background: radial-gradient(circle at 30% 30%, rgba(42, 239, 216, 0.08), transparent 70%);
}

.proof-content {
    position: relative;
    z-index: 2;
    padding: 3rem;
}

.proof-header {
    font-family: "Share Tech Mono", monospace;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--bubble-glow);
    text-transform: uppercase;
    letter-spacing: -0.01em;
    margin-bottom: 2rem;
    text-align: center;
}

.proof-transcript {
    font-family: "IBM Plex Mono", monospace;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    line-height: 1.8;
    color: var(--grain-frost);
    background: rgba(8, 13, 24, 0.5);
    padding: 2rem;
    border-radius: 4px;
    border: 1px solid rgba(74, 200, 232, 0.1);
    overflow-x: auto;
    white-space: pre;
}

.proof-footer {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.proof-stat {
    font-family: "Overpass Mono", monospace;
    font-size: clamp(0.6rem, 0.75vw, 0.7rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sonar-cyan);
    padding: 0.5rem 1rem;
    border: 1px solid rgba(74, 200, 232, 0.15);
    border-radius: 2px;
}

/* ============ ZONE 4: THE SETTLEMENT ============ */
#zone-4 {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem 2rem;
}

.settlement-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.compressed-block {
    width: 200px;
    height: 80px;
    background: var(--bulkhead);
    border: 1px solid rgba(74, 200, 232, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: settleDescent 2s ease-out forwards;
    opacity: 0;
    transform: translateY(-40px);
}

.compressed-block.settled {
    opacity: 1;
    transform: translateY(0);
}

.block-inner {
    text-align: center;
}

.block-inner span {
    display: block;
    font-family: "Overpass Mono", monospace;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--grain-frost);
}

.block-status {
    color: var(--bubble-glow) !important;
    margin-top: 0.3rem;
}

.settlement-line {
    width: 100%;
    max-width: 600px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--sonar-cyan), transparent);
}

.l1-label {
    font-family: "Overpass Mono", monospace;
    font-size: clamp(0.6rem, 0.75vw, 0.7rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--proof-blue);
    opacity: 0.5;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }

    .masonry-tile[data-height="tall"] {
        grid-row: span 1;
    }

    .hero-title {
        font-size: clamp(2rem, 12vw, 4rem);
    }

    .proof-footer {
        flex-direction: column;
        align-items: center;
    }

    .scattered-tiles {
        display: none;
    }

    .sonar-ping {
        display: none;
    }

    .zone-label {
        padding: 1.5rem 1.5rem;
    }

    .proof-content {
        padding: 1.5rem;
    }
}