/* ============================================
   blockchain.day - Styles
   Palette: #050505, #00FF41, #FF003C, #0A1A0F,
            #B0C4B0, #E0E0E0, #00FF4180, #003311
   Fonts: Share Tech Mono, Space Grotesk, Fira Code
   ============================================ */

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

html {
    scroll-snap-type: y mandatory;
    overflow-x: hidden;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    background: #050505;
    color: #B0C4B0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 16px;
    line-height: 1.7;
    letter-spacing: 0.02em;
    overflow-x: hidden;
}

/* --- Scanlines Overlay --- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
}

.scanlines.glitch-burst {
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.4) 2px,
        rgba(0, 0, 0, 0.4) 4px
    );
    transition: background 0.1s;
}

/* --- Glitch Layer --- */
.glitch-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    clip-path: inset(100% 0 0 0);
    background: #050505;
    mix-blend-mode: lighten;
}

.glitch-layer.active {
    background: linear-gradient(
        90deg,
        rgba(255, 0, 60, 0.4) 0%,
        rgba(0, 255, 65, 0.4) 50%,
        rgba(255, 0, 60, 0.4) 100%
    );
}

/* --- Top Bar --- */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 24px;
    background: rgba(5, 5, 5, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 24px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: rgba(0, 255, 65, 0.6);
}

.top-bar-item {
    white-space: nowrap;
}

.top-bar-cursor {
    margin-left: auto;
    width: 10px;
    height: 16px;
    background: #00FF41;
    animation: cursor-blink 530ms step-end infinite;
}

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

/* --- Main Chain Container --- */
.chain {
    width: 100%;
}

/* --- Block (Section) --- */
.block {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

/* --- Block Hash Watermark --- */
.block-hash-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-family: 'Fira Code', monospace;
    font-size: 3vw;
    color: #0A1A0F;
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.block-hash-watermark::before {
    content: attr(data-hash);
}

/* --- Block Seal (transition line between blocks) --- */
.block-seal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #00FF41;
    z-index: 5;
    animation: seal-glitch 0.3s ease-out;
    opacity: 0;
}

.block-seal.visible {
    opacity: 1;
    animation: seal-glitch 0.3s ease-out forwards;
}

@keyframes seal-glitch {
    0% { transform: translateX(0); opacity: 1; }
    20% { transform: translateX(20px); opacity: 1; }
    40% { transform: translateX(-10px); opacity: 1; }
    60% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(0); opacity: 1; }
}

/* --- Cursor Blink (reusable) --- */
.cursor-blink {
    display: inline-block;
    width: 10px;
    height: 20px;
    background: #00FF41;
    animation: cursor-blink 530ms step-end infinite;
    vertical-align: middle;
    margin-left: 4px;
}

/* ============================================
   BLOCK 0: GENESIS
   ============================================ */
.block-0 {
    background: radial-gradient(ellipse at center, #0A1A0F 0%, #050505 70%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.genesis-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.genesis-hash {
    font-family: 'Fira Code', monospace;
    font-size: clamp(10px, 1.8vw, 18px);
    color: #00FF41;
    white-space: nowrap;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
}

.hash-text {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    border-right: 2px solid #00FF41;
    animation: typing 3s steps(64) 1.5s forwards, blink-caret 530ms step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    0%, 100% { border-color: #00FF41; }
    50% { border-color: transparent; }
}

.genesis-title {
    margin-top: 32px;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(2rem, 6vw, 5rem);
    color: #00FF41;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.0;
    text-shadow: 0 0 8px #00FF4180, 0 0 20px #00FF4140;
    opacity: 1;
}

.genesis-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-20px);
}

.genesis-title.animate .char {
    animation: char-drop 0.4s cubic-bezier(0.23, 1, 0.32, 1) calc(var(--i) * 30ms) both;
}

@keyframes title-appear {
    to { opacity: 1; }
}

/* ============================================
   BLOCK 1: PROPAGATION
   ============================================ */
.block-1 {
    background: #050505;
}

.propagation-content {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.propagation-text {
    width: 60%;
    padding: 80px 48px 48px 48px;
    overflow-y: auto;
    scrollbar-width: none;
}

.propagation-text::-webkit-scrollbar {
    display: none;
}

.propagation-text p {
    margin-bottom: 1.5em;
    opacity: 1;
}

.propagation-text p.visible {
    opacity: 1;
}

.network-visualization {
    width: 40%;
    position: relative;
    overflow: hidden;
}

.network-node {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid #00FF41;
    background: transparent;
    z-index: 3;
}

.network-node.pulse-active {
    background: #00FF41;
    transition: background 0.2s;
}

.network-line {
    position: absolute;
    height: 1px;
    background: rgba(0, 255, 65, 0.2);
    transform-origin: 0 0;
    z-index: 2;
}

.network-pulse {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #00FF41;
    z-index: 4;
    pointer-events: none;
}

/* ============================================
   BLOCK 2: CONSENSUS
   ============================================ */
.block-2 {
    background: #050505;
}

.data-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.rain-column {
    position: absolute;
    top: 0;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    color: rgba(0, 255, 65, 0.12);
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
    width: 33.33%;
    overflow: hidden;
}

.rain-col-1 {
    left: 0;
    animation: scroll-up 15s linear infinite;
}

.rain-col-2 {
    left: 33.33%;
    animation: scroll-up 22s linear infinite;
}

.rain-col-3 {
    left: 66.66%;
    animation: scroll-up 31s linear infinite;
}

@keyframes scroll-up {
    from { transform: translateY(0); }
    to { transform: translateY(-50%); }
}

.consensus-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 80px 24px 48px 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.consensus-cards {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 32px;
}

.consensus-card {
    background: #0A0A0A;
    opacity: 0.85;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid #003311;
    padding: 24px;
    position: relative;
    transition: border-color 4s linear;
}

.consensus-card[data-state="verified"] {
    border-color: #00FF41;
    animation: card-pulse-verified 4s infinite alternate;
}

.consensus-card[data-state="unverified"] {
    border-color: #FF003C;
    animation: card-pulse-unverified 4s infinite alternate;
}

@keyframes card-pulse-verified {
    0% { border-color: #00FF41; }
    100% { border-color: #FF003C; }
}

@keyframes card-pulse-unverified {
    0% { border-color: #FF003C; }
    100% { border-color: #00FF41; }
}

.consensus-card h2 {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.1rem;
    color: #00FF41;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
    text-shadow: 0 0 8px #00FF4180;
}

.consensus-card p {
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.card-hash {
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    color: rgba(0, 255, 65, 0.8);
    display: block;
}

/* ============================================
   BLOCK 3: IMMUTABLE
   ============================================ */
.block-3 {
    background: #050505;
}

.hex-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, 8px);
    grid-template-rows: repeat(auto-fill, 8px);
    overflow: hidden;
    z-index: 0;
}

.hex-cell {
    width: 8px;
    height: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 6px;
    color: rgba(0, 255, 65, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    line-height: 1;
}

.immutable-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 48px;
}

/* Knockout text effect: dark text that reveals grid behind */
.knockout-text {
    font-size: clamp(3rem, 15vw, 12rem) !important;
    color: #050505 !important;
    text-shadow: none !important;
    position: relative;
    z-index: 3;
}

.knockout-text .char {
    display: inline-block;
    color: #050505 !important;
    text-shadow: none !important;
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: translateY(-20px);
}

.knockout-text.animate .char {
    animation: char-drop 0.4s cubic-bezier(0.23, 1, 0.32, 1) calc(var(--i) * 30ms) both;
}

.immutable-statement {
    max-width: 700px;
    text-align: center;
    color: #B0C4B0;
    margin-top: 32px;
    position: relative;
    z-index: 3;
}

/* ============================================
   BLOCK 4: FORK
   ============================================ */
.block-4 {
    background: #050505;
}

.fork-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.fork-half {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.fork-green {
    clip-path: polygon(0 0, 100% 0, 0 100%);
    z-index: 2;
}

.fork-green .fork-content {
    padding: 80px 48px 48px 48px;
    max-width: 600px;
}

.fork-green .fork-content h1,
.fork-green .fork-content p {
    color: #00FF41;
}

.fork-green .fork-content p {
    color: #B0C4B0;
}

.fork-red {
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    z-index: 2;
}

.fork-red .fork-content {
    padding: 80px 48px 48px 48px;
    max-width: 600px;
    margin-left: auto;
    text-align: right;
    transform: translate(4px, 2px);
}

.fork-red .fork-content h1 {
    color: #FF003C !important;
    text-shadow: 0 0 8px rgba(255, 0, 60, 0.5), 0 0 20px rgba(255, 0, 60, 0.25) !important;
}

.fork-red .fork-content h1 .char {
    color: #FF003C !important;
    text-shadow: 0 0 8px rgba(255, 0, 60, 0.5), 0 0 20px rgba(255, 0, 60, 0.25) !important;
}

.fork-red .fork-content p {
    color: #B0C4B0;
}

.fork-red-heading .char {
    color: #FF003C !important;
    text-shadow: 0 0 8px rgba(255, 0, 60, 0.5), 0 0 20px rgba(255, 0, 60, 0.25) !important;
}

.fork-divider {
    position: absolute;
    top: 0;
    left: 0;
    width: 141.42%;
    height: 4px;
    background: #00FF41;
    transform-origin: 0 0;
    transform: rotate(45deg);
    z-index: 5;
    box-shadow: 0 0 8px #00FF4180;
    animation: divider-vibrate 66ms linear infinite;
}

@keyframes divider-vibrate {
    0% { transform: rotate(45deg) translateX(0); }
    50% { transform: rotate(45deg) translateX(2px); }
    100% { transform: rotate(45deg) translateX(0); }
}

/* Diagonal from top-left to bottom-right: use atan(h/w) but 45deg is specified */
.fork-divider {
    top: 0;
    left: 0;
    width: 150vw;
    height: 3px;
    transform: rotate(45deg);
    transform-origin: top left;
}

.fork-bridge {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    max-width: 600px;
    padding: 0 24px;
}

.bridge-text {
    color: #E0E0E0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.8;
}

/* ============================================
   HEADINGS (Kinetic Typography)
   ============================================ */
.kinetic-heading {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(2.5rem, 8vw, 7rem);
    font-weight: 400;
    line-height: 1.0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #00FF41;
    text-shadow: 0 0 8px #00FF4180, 0 0 20px #00FF4140;
    margin-bottom: 24px;
}

.kinetic-heading .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-20px);
}

.kinetic-heading.animate .char {
    animation: char-drop 0.4s cubic-bezier(0.23, 1, 0.32, 1) calc(var(--i) * 30ms) both;
}

@keyframes char-drop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE / MOBILE
   ============================================ */
@media (max-width: 768px) {
    .propagation-content {
        flex-direction: column;
    }

    .propagation-text {
        width: 100%;
        padding: 80px 24px 24px 24px;
        height: 60%;
    }

    .network-visualization {
        width: 100%;
        height: 40%;
    }

    .fork-green .fork-content,
    .fork-red .fork-content {
        padding: 80px 24px 24px 24px;
    }

    .fork-bridge {
        bottom: 8%;
    }

    .consensus-card {
        padding: 16px;
    }
}

/* ============================================
   CHROMATIC ABERRATION (for glitch bursts)
   ============================================ */
.chain.chromatic {
    animation: chromatic-burst 0.4s;
}

@keyframes chromatic-burst {
    0% { filter: hue-rotate(0deg); }
    25% { filter: hue-rotate(90deg); }
    50% { filter: hue-rotate(180deg); }
    75% { filter: hue-rotate(270deg); }
    100% { filter: hue-rotate(360deg); }
}
