/* layer-2.report -- Isometric Technical Cartography */

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

:root {
    --bg-abyssal: #0a0f1a;
    --bg-trench: #0f1a2e;
    --grid-line: #1a2a3a;
    --grid-hover: #2a3a4a;
    --text-primary: #8fa4b8;
    --accent-teal: #4ecdc4;
    --accent-green: #2a9d8f;
    --accent-orange: #e07a5f;
    --surface-light: #e8eff5;
    --font-display: 'Chakra Petch', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-mono: 'Azeret Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-abyssal);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    overflow-x: hidden;
}

#bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.annotation-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
}

/* ---- Sections ---- */
.section {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 4vw;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--surface-light);
    margin-bottom: 3rem;
    text-align: center;
}

/* ---- Hexagonal Cells ---- */
.hex-cell {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--bg-trench);
    border: none;
    width: 200px;
    height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.3s ease;
    --proximity: 0;
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: transparent;
    border: 1px solid var(--grid-line);
    border-color: rgba(78, 205, 196, var(--proximity));
    pointer-events: none;
    z-index: 1;
}

.hex-inner {
    padding: 1.5rem;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hex-data {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--accent-teal);
}

.hex-metric {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--accent-teal);
    margin-bottom: 0.5rem;
}

/* ---- Hero (Surface) ---- */
#surface {
    min-height: 100vh;
}

#surface .hex-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 900px;
}

.center-hex {
    width: 280px;
    height: 320px;
    background: var(--bg-trench);
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.5rem, 5vw, 3rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--surface-light);
    line-height: 1.2;
}

.hero-title .accent {
    color: var(--accent-teal);
}

.hero-sub {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Pulsing data hexagons */
.hex-cell[data-pulse] {
    animation: hexPulse 3s ease-in-out infinite alternate;
}

.hex-cell[data-pulse="2"] { animation-delay: 0.5s; }
.hex-cell[data-pulse="3"] { animation-delay: 1s; }
.hex-cell[data-pulse="4"] { animation-delay: 1.5s; }
.hex-cell[data-pulse="5"] { animation-delay: 2s; }
.hex-cell[data-pulse="6"] { animation-delay: 2.5s; }

@keyframes hexPulse {
    0% { background: var(--bg-trench); }
    100% { background: #132236; }
}

/* ---- Descent ---- */
#descent {
    min-height: 200vh;
    padding: 6rem 2rem;
}

.descent-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 3rem;
    max-width: 1200px;
    width: 100%;
    align-items: start;
}

.layer-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.layer-col .hex-cell {
    width: 240px;
    height: 276px;
}

.layer-col .hex-cell h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--surface-light);
    margin-bottom: 0.5rem;
}

.layer-col .hex-cell p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

/* Isometric Stack */
.isometric-stack {
    perspective: 800px;
    width: 200px;
    height: 400px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.iso-plane {
    position: absolute;
    width: 160px;
    height: 160px;
    transform: rotateX(55deg) rotateZ(45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent-teal);
    letter-spacing: 0.04em;
}

.iso-l1 {
    background: var(--bg-trench);
    border: 1px solid var(--grid-line);
    bottom: 80px;
    animation: isoFloat 4s ease-in-out infinite alternate;
}

.iso-l2 {
    background: rgba(15, 26, 46, 0.7);
    border: 1px solid var(--accent-teal);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.15);
    top: 80px;
    animation: isoFloat 4s ease-in-out infinite alternate;
    animation-delay: 0.5s;
}

@keyframes isoFloat {
    0% { transform: rotateX(55deg) rotateZ(45deg) translateY(0); }
    100% { transform: rotateX(55deg) rotateZ(45deg) translateY(-8px); }
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent-teal);
    border-radius: 50%;
    opacity: 0.6;
    animation: particleTravel 3s linear infinite;
}

.particle:nth-child(2) { animation-delay: 1s; animation-duration: 4s; }
.particle:nth-child(3) { animation-delay: 2s; animation-duration: 2.5s; }

@keyframes particleTravel {
    0% { top: -20px; left: 50%; opacity: 0.6; }
    50% { opacity: 1; }
    100% { top: 180px; left: 50%; opacity: 0; }
}

/* ---- Skeleton Loading ---- */
.skeleton-reveal .skeleton-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 80%;
    position: absolute;
    transition: opacity 0.3s ease;
}

.skeleton-reveal .skeleton-bars span {
    display: block;
    height: 8px;
    background: var(--grid-line);
    border-radius: 4px;
    animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-reveal .skeleton-bars span:nth-child(2) { width: 70%; animation-delay: 0.1s; }
.skeleton-reveal .skeleton-bars span:nth-child(3) { width: 50%; animation-delay: 0.2s; }

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

.skeleton-reveal .skeleton-bars span {
    background: linear-gradient(90deg, var(--grid-line) 25%, var(--grid-hover) 50%, var(--grid-line) 75%);
    background-size: 400px 100%;
}

.skeleton-reveal .content-block {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skeleton-reveal.revealed .skeleton-bars {
    opacity: 0;
    pointer-events: none;
}

.skeleton-reveal.revealed .content-block {
    opacity: 1;
}

/* ---- Topology ---- */
#topology {
    min-height: 200vh;
    padding: 6rem 2rem;
}

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

.honeycomb-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 900px;
}

.protocol-hex {
    width: 260px;
    height: 300px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.protocol-hex:hover {
    background: #152a3e;
}

.protocol-hex h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--surface-light);
    margin-bottom: 0.3rem;
}

.protocol-hex p {
    font-size: 13px;
    line-height: 1.5;
}

/* ---- Proof Path ---- */
#proof {
    min-height: 100vh;
}

.proof-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
}

#proofPath {
    width: 100%;
    height: auto;
}

#mainPath {
    stroke-dasharray: 0;
    stroke-dashoffset: 0;
}

#mainPath.animate {
    animation: drawPath 8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawPath {
    from { stroke-dashoffset: var(--path-length); }
    to { stroke-dashoffset: 0; }
}

.proof-node {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.proof-node.visible {
    opacity: 1;
    animation: nodePulse 2s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { r: 6; }
    50% { r: 8; }
}

.proof-label {
    font-family: var(--font-mono);
    font-size: 12px;
    fill: var(--accent-teal);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.proof-label.visible {
    opacity: 1;
}

.finalize-label {
    fill: var(--accent-orange);
}

/* ---- Report / Typewriter ---- */
#report {
    min-height: 100vh;
    background: linear-gradient(to bottom, var(--bg-abyssal), #050810);
}

.report-container {
    max-width: 700px;
    width: 100%;
    padding: 2rem;
}

.typewriter-block {
    font-family: var(--font-mono);
    font-size: 16px;
    color: var(--accent-teal);
    line-height: 1.8;
    letter-spacing: 0.02em;
    min-height: 300px;
}

.typewriter-text {
    white-space: pre-wrap;
}

.cursor {
    animation: blink 530ms step-end infinite;
    color: var(--accent-teal);
    font-weight: 400;
}

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

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .section-heading {
        font-size: 7vw;
    }

    .descent-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .isometric-stack {
        order: -1;
        height: 200px;
    }

    .iso-plane {
        transform: rotateX(0) rotateZ(0);
        width: 120px;
        height: 60px;
    }

    @keyframes isoFloat {
        0% { transform: rotateX(0) rotateZ(0) translateY(0); }
        100% { transform: rotateX(0) rotateZ(0) translateY(-8px); }
    }

    .hex-cell {
        width: 100%;
        max-width: 340px;
        height: auto;
        min-height: 180px;
        clip-path: none;
        border-radius: 12px;
        border: 1px solid var(--grid-line);
    }

    .hex-cell::before {
        clip-path: none;
        border-radius: 12px;
    }

    .center-hex {
        width: 100%;
        max-width: 340px;
        height: auto;
        min-height: 200px;
    }

    .protocol-hex {
        width: 100%;
        max-width: 340px;
        height: auto;
        min-height: 200px;
    }

    .honeycomb-grid {
        flex-direction: column;
        align-items: center;
    }

    .particle {
        display: none;
    }

    .hero-title {
        font-size: 1.8rem;
    }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .hex-cell[data-pulse] {
        animation: none;
    }

    .iso-l1,
    .iso-l2 {
        animation: none;
    }

    .particle {
        display: none;
    }

    .skeleton-reveal .skeleton-bars span {
        animation: none;
    }

    .cursor {
        animation: none;
        opacity: 1;
    }

    #mainPath.animate {
        animation: none;
        stroke-dashoffset: 0;
    }
}
