/* ==========================================================================
   blockchain.day — dark frutiger aero vertical chain narrative
   Space Grotesk, Inter, and IBM Plex Mono are loaded as (Google Fonts.
   Hash watermarks use very large scale (`clamp(4rem; closing uses `clamp(2.5rem.
   JavaScript uses IntersectionObserver` at threshold 0.3 for scroll-snap detection.
   ========================================================================== */

:root {
    --void: #0d0f1a;
    --indigo-charcoal: #2a2d4a;
    --slate-blue: #4a6fa5;
    --ice-blue: #7eb8da;
    --periwinkle: #a8b4e0;
    --blue-gray: #c8d0e0;
    --frost: #e8ecf4;
    --coral: #e06058;

    --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;

    --content-max: 640px;
    --block-pad-y: 80px;
}

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

html, body {
    background-color: var(--void);
    color: var(--blue-gray);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
}

/* Scroll snap container */
.chain {
    scroll-snap-type: y mandatory;
    height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: none;
}
.chain::-webkit-scrollbar { display: none; }

/* ==========================================================================
   Domain mark — tiny label in upper-left of page
   ========================================================================== */
.domain-mark {
    position: absolute;
    top: 20px;
    left: 24px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--slate-blue);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    animation: firstLight 500ms ease 300ms forwards;
}

@keyframes firstLight {
    to { opacity: 0.85; }
}

/* ==========================================================================
   Dot indicator — floating right-edge nav
   ========================================================================== */
.dot-indicator {
    position: fixed;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 20;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--indigo-charcoal);
    padding: 0;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.dot.active {
    background-color: var(--ice-blue);
    border-color: var(--ice-blue);
    box-shadow: 0 0 8px rgba(126, 184, 218, 0.55);
    transform: scale(1.15);
}

.dot:hover {
    border-color: var(--slate-blue);
}

/* ==========================================================================
   Block section — 100vh scroll-snap unit
   ========================================================================== */
.block {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--indigo-charcoal);
    border-bottom: 1px solid var(--indigo-charcoal);
    overflow: hidden;
    padding: var(--block-pad-y) 24px;
}

.block:first-child {
    border-top: none;
}

.block-open .bg-layer {
    opacity: 0;
    animation: firstLight 500ms ease 300ms forwards;
}

.block-open .hash-watermark {
    opacity: 0.02;
}

.block-open .mono-label-open,
.block-open .hero-sub {
    transition-delay: 900ms;
}

.block:last-child {
    border-bottom: none;
}

/* content column */
.block-inner {
    position: relative;
    width: 100%;
    max-width: var(--content-max);
    z-index: 2;
    text-align: center;
    padding: 0 8px;
}

.block-inner-open {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.block-inner-close {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2 {
    font-family: var(--font-head);
    color: var(--frost);
    letter-spacing: 0.01em;
    line-height: 1.18;
    font-weight: 600;
}

h1 {
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    font-weight: 700;
}

h2 {
    font-size: clamp(1.25rem, 2.5vw, 2rem);
    margin-bottom: 1.5rem;
}

p {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--blue-gray);
    max-width: 60ch;
    margin: 0 auto 1.1rem;
    font-weight: 400;
}

p:last-child {
    margin-bottom: 0;
}

.hl {
    color: var(--periwinkle);
    font-weight: 500;
}

.coral-word {
    color: var(--coral);
    transition: color 1.2s ease;
}

/* Mono label */
.mono-label {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    color: var(--slate-blue);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    display: inline-block;
}

.mono-label-open {
    margin-bottom: 0.25rem;
}

/* ==========================================================================
   Block 001 opening — hero block + typed title
   ========================================================================== */
.hero-shape {
    width: 120px;
    height: 80px;
    background-color: var(--indigo-charcoal);
    border-radius: 16px;
    box-shadow:
        0 0 40px rgba(126, 184, 218, 0.12),
        inset 0 0 24px rgba(126, 184, 218, 0.04);
    opacity: 0;
    transform: scale(0.8);
    animation: heroPop 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 300ms forwards;
    position: relative;
}

.hero-shape::before {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 12px;
    border: 1px solid rgba(126, 184, 218, 0.08);
    pointer-events: none;
}

@keyframes heroPop {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

.hero-type {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--frost);
    letter-spacing: 0.01em;
    min-height: 1.2em;
    opacity: 1;
    position: relative;
    white-space: nowrap;
}

.hero-type::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--ice-blue);
    margin-left: 4px;
    transform: translateY(4px);
    animation: caret 1s steps(1) infinite;
}

.hero-type.done::after {
    animation: caret 1.1s steps(1) infinite, caretFade 600ms ease 1.2s forwards;
}

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

@keyframes caretFade {
    to { opacity: 0; visibility: hidden; }
}

.hero-sub {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    color: var(--slate-blue);
    text-transform: uppercase;
}

/* ==========================================================================
   Reveal animation — zoom-focus camera lens effect
   ========================================================================== */
[data-reveal] {
    opacity: 0;
    transform: scale(0.92);
    filter: blur(6px);
    transition:
        opacity 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
        filter 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity, filter;
}

.block.in-view [data-reveal] {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* stagger children by 100ms each */
.block.in-view [data-reveal]:nth-child(1) { transition-delay: 0ms; }
.block.in-view [data-reveal]:nth-child(2) { transition-delay: 100ms; }
.block.in-view [data-reveal]:nth-child(3) { transition-delay: 200ms; }
.block.in-view [data-reveal]:nth-child(4) { transition-delay: 300ms; }
.block.in-view [data-reveal]:nth-child(5) { transition-delay: 400ms; }
.block.in-view [data-reveal]:nth-child(6) { transition-delay: 500ms; }

/* ==========================================================================
   Background layer — floating blocks, hash watermark, chain paths, particles
   ========================================================================== */
.bg-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.hash-watermark {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: clamp(4rem, 10vw, 8rem);
    color: var(--frost);
    opacity: 0.03;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
    font-weight: 400;
}

.float-block {
    position: absolute;
    left: var(--fbx);
    top: var(--fby);
    width: var(--fbw);
    height: var(--fbh);
    background-color: var(--indigo-charcoal);
    border-radius: 18px;
    transform: rotate(var(--fbr));
    opacity: var(--fbo, 0.08);
    box-shadow: 0 0 30px rgba(126, 184, 218, 0.06);
    will-change: transform;
    animation: floatDrift 14s ease-in-out infinite;
}

.float-block.fb-b { animation-duration: 18s; animation-delay: -3s; }
.float-block.fb-c { animation-duration: 22s; animation-delay: -7s; border-radius: 14px; }
.float-block.fb-d { animation-duration: 16s; animation-delay: -10s; border-radius: 12px; }

.float-block-coral {
    background-color: transparent;
    border: 1px solid rgba(224, 96, 88, 0.35);
    box-shadow:
        0 0 30px rgba(224, 96, 88, 0.18),
        inset 0 0 20px rgba(224, 96, 88, 0.06);
}

.float-block-coral::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 50%, rgba(224, 96, 88, 0.18), transparent 70%);
}

@keyframes floatDrift {
    0%, 100% { transform: rotate(var(--fbr)) translateY(0); }
    50% { transform: rotate(calc(var(--fbr) + 1deg)) translateY(-8px); }
}

/* Chain path SVGs */
.chain-links {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.chain-path {
    fill: none;
    stroke: var(--indigo-charcoal);
    stroke-width: 1.5;
    stroke-dasharray: 8 4;
    stroke-dashoffset: 0;
    opacity: 0.55;
    animation: dashFlow 30s linear infinite;
}

.chain-path-coral {
    stroke: rgba(224, 96, 88, 0.35);
}

@keyframes dashFlow {
    to { stroke-dashoffset: -240; }
}

/* Particles */
.particle {
    position: absolute;
    left: var(--px);
    top: var(--py);
    width: var(--psz, 6px);
    height: var(--psz, 6px);
    border-radius: 50%;
    background: radial-gradient(circle, var(--ice-blue) 0%, rgba(126, 184, 218, 0) 70%);
    opacity: 0.2;
    animation: particlePulse 4s ease-in-out infinite;
    animation-delay: var(--pd, 0s);
    pointer-events: none;
}

.particle-coral {
    background: radial-gradient(circle, var(--coral) 0%, rgba(224, 96, 88, 0) 70%);
}

@keyframes particlePulse {
    0%, 100% { opacity: 0.1; transform: scale(0.9); }
    50% { opacity: 0.4; transform: scale(1.15); }
}

/* ==========================================================================
   Chain connector — bottom-of-section visible link
   ========================================================================== */
.connector {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 48px;
    z-index: 5;
    overflow: visible;
}

.connector-line {
    stroke: var(--slate-blue);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    transition: stroke-dashoffset 300ms ease-out, filter 400ms ease-out;
}

.block.in-view .connector-line {
    stroke-dashoffset: 0;
    filter: drop-shadow(0 0 4px var(--ice-blue));
    animation: connectorGlow 900ms ease-out forwards;
}

@keyframes connectorGlow {
    0%   { filter: drop-shadow(0 0 4px rgba(126, 184, 218, 0.4)); }
    100% { filter: drop-shadow(0 0 1px rgba(126, 184, 218, 0.1)); }
}

.block:last-child .connector {
    display: none;
}

/* ==========================================================================
   Block 004 — coral surprise
   ========================================================================== */
.block-coral h2 {
    color: var(--frost);
}

/* ==========================================================================
   Block 007 — closing
   ========================================================================== */
.bg-layer-close .float-block {
    animation: floatDriftDown 2.4s ease-out forwards;
    animation-delay: 600ms;
}

.block-close.in-view .bg-layer-close .float-block {
    animation: floatDriftDown 2.4s ease-out forwards;
}

@keyframes floatDriftDown {
    0%   { transform: rotate(var(--fbr)) translateY(0); opacity: var(--fbo); }
    100% { transform: rotate(var(--fbr)) translateY(120px); opacity: 0; }
}

.close-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--frost);
    letter-spacing: 0.01em;
    margin-bottom: 0.5rem;
}

.close-sub {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--slate-blue);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.void-tail {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -200px;
    height: 200px;
    background: var(--void);
}

/* ==========================================================================
   Responsive — mobile
   ========================================================================== */
@media (max-width: 768px) {
    .block {
        padding: 60px 5vw;
    }

    .block-inner {
        max-width: 90vw;
    }

    .domain-mark {
        top: 14px;
        left: 16px;
    }

    .dot-indicator {
        right: 14px;
        gap: 12px;
    }

    .hash-watermark {
        font-size: clamp(3rem, 14vw, 6rem);
    }

    h1 { font-size: clamp(1.75rem, 8vw, 2.5rem); }
    h2 { font-size: clamp(1.15rem, 5.5vw, 1.6rem); }

    .hero-shape {
        width: 100px;
        height: 68px;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }
    .float-block, .particle, .chain-path, .hero-shape {
        animation: none !important;
    }
    .chain { scroll-snap-type: none; }
}
