/* blockchain.day — Post-Neon Cyberpunk Aesthetic */
/* Colors: #f2ece3, #2d2a26, #5e8c83, #8a7e9b, #c4a95b, #33302c, #e5ddd1, #b5745a */
/* Fonts: Space Grotesk, Cormorant Garamond, IBM Plex Mono */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: #f2ece3;
    color: #2d2a26;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.7;
    overflow-x: hidden;
    opacity: 0;
    animation: bodyFadeIn 1.5s ease 0.3s forwards;
}

@keyframes bodyFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Noise Grain Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* Menu Glyph */
.menu-glyph {
    position: fixed;
    top: 20px;
    right: 24px;
    font-size: 14px;
    color: #5e8c83;
    z-index: 100;
    cursor: default;
    opacity: 0.6;
    font-family: 'Space Grotesk', sans-serif;
}

/* Bento Grid */
.bento-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto;
    gap: 0;
}

/* Base Tile Styles */
.tile {
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    animation: border-trace 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.tile-content {
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Border Trace Animation */
@keyframes border-trace {
    0% { border-color: transparent; }
    25% { border-top-color: #5e8c83; border-right-color: transparent; border-bottom-color: transparent; border-left-color: transparent; }
    50% { border-top-color: #5e8c83; border-right-color: #5e8c83; border-bottom-color: transparent; border-left-color: transparent; }
    75% { border-top-color: #5e8c83; border-right-color: #5e8c83; border-bottom-color: #5e8c83; border-left-color: transparent; }
    100% { border-color: rgba(94, 140, 131, 0.3); }
}

/* Tile hover border pulse */
.tile:hover {
    border-color: rgba(94, 140, 131, 0.8);
    transition: border-color 0.6s ease;
}

/* Staggered animation delays per tile */
.tile[data-tile="1"] { animation-delay: 0.5s; }
.tile[data-tile="2"] { animation-delay: 0.9s; }
.tile[data-tile="3"] { animation-delay: 1.3s; }
.tile[data-tile="4"] { animation-delay: 1.7s; }
.tile[data-tile="5"] { animation-delay: 2.1s; }

/* Tile 1: Genesis Block — 8 cols, 2 rows */
.tile-genesis {
    grid-column: 1 / 9;
    grid-row: 1 / 3;
    background-color: #f2ece3;
    min-height: 360px;
}

.tile-genesis .tile-content {
    justify-content: center;
    align-items: flex-start;
    padding: 3rem;
}

.domain-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: -0.03em;
    text-transform: lowercase;
    color: #2d2a26;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.genesis-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 14px;
    color: #8a7e9b;
    max-width: 480px;
    line-height: 1.6;
}

/* Tile 2: Hash Fragments — 4 cols, 1 row */
.tile-hash {
    grid-column: 9 / 13;
    grid-row: 1 / 2;
    background-color: #e5ddd1;
}

.tile-hash .tile-content {
    justify-content: space-between;
    padding: 1.5rem;
}

.aphorism-container {
    position: relative;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.aphorism {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.5;
    color: #b5745a;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.aphorism.active {
    opacity: 1;
}

.hash-ticker {
    overflow: hidden;
    width: 100%;
    margin-top: 1rem;
}

.hash-scroll {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: #8a7e9b;
    opacity: 0.4;
    white-space: nowrap;
    animation: marquee 20s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Tile 3: The Ledger — 4 cols, 3 rows */
.tile-ledger {
    grid-column: 9 / 13;
    grid-row: 2 / 5;
    background-color: #33302c;
    min-height: 400px;
}

.tile-ledger .tile-content {
    padding: 1.5rem 1rem;
    justify-content: flex-start;
    overflow: hidden;
}

.ledger-lines {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ledger-line {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #5e8c83;
    white-space: nowrap;
    opacity: 0;
    animation: fadeInLine 0.3s ease forwards;
}

@keyframes fadeInLine {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 0.85; transform: translateY(0); }
}

/* Tile 4: Consensus — 8 cols, 1 row */
.tile-consensus {
    grid-column: 1 / 9;
    grid-row: 3 / 5;
    background-color: #f2ece3;
    min-height: 260px;
}

.tile-consensus .tile-content {
    position: relative;
    padding: 2rem;
    justify-content: center;
    align-items: center;
}

.consensus-network {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 200px;
}

.consensus-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    text-transform: lowercase;
    color: #2d2a26;
    letter-spacing: -0.03em;
    opacity: 0.15;
    position: absolute;
    bottom: 1rem;
    left: 2rem;
}

/* Consensus Nodes */
.node {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #5e8c83;
    background: transparent;
}

.node::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #5e8c83;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.4;
}

/* Node positions — roughly circular */
#node-1 { top: 10%; left: 50%; transform: translateX(-50%); }
#node-2 { top: 25%; left: 78%; }
#node-3 { top: 60%; left: 85%; }
#node-4 { top: 80%; left: 60%; }
#node-5 { top: 80%; left: 30%; }
#node-6 { top: 60%; left: 8%; }
#node-7 { top: 25%; left: 15%; }

/* Node pulse animations */
@keyframes nodePulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 8px rgba(94, 140, 131, 0.6); }
}

#node-1 { animation: nodePulse 4s ease-in-out infinite; animation-delay: 0s; }
#node-2 { animation: nodePulse 4s ease-in-out infinite; animation-delay: 0.57s; }
#node-3 { animation: nodePulse 4s ease-in-out infinite; animation-delay: 1.14s; }
#node-4 { animation: nodePulse 4s ease-in-out infinite; animation-delay: 1.71s; }
#node-5 { animation: nodePulse 4s ease-in-out infinite; animation-delay: 2.28s; }
#node-6 { animation: nodePulse 4s ease-in-out infinite; animation-delay: 2.85s; }
#node-7 { animation: nodePulse 4s ease-in-out infinite; animation-delay: 3.42s; }

/* Connections between nodes — dashed lines */
.connection {
    position: absolute;
    border-bottom: 1px dashed rgba(94, 140, 131, 0.35);
    transform-origin: left center;
    height: 0;
}

/* Connection positions calculated for the node layout */
.conn-1-2 { top: 22%; left: 52%; width: 28%; transform: rotate(25deg); }
.conn-2-3 { top: 42%; left: 82%; width: 22%; transform: rotate(72deg); }
.conn-3-4 { top: 72%; left: 72%; width: 20%; transform: rotate(140deg); }
.conn-4-5 { top: 88%; left: 35%; width: 28%; transform: rotate(180deg); }
.conn-5-6 { top: 72%; left: 12%; width: 22%; transform: rotate(220deg); }
.conn-6-7 { top: 42%; left: 13%; width: 18%; transform: rotate(290deg); }
.conn-7-1 { top: 20%; left: 22%; width: 28%; transform: rotate(-15deg); }
.conn-1-4 { top: 50%; left: 50%; width: 32%; transform: rotate(110deg); }
.conn-2-5 { top: 55%; left: 38%; width: 42%; transform: rotate(200deg); }
.conn-3-6 { top: 60%; left: 15%; width: 72%; transform: rotate(0deg); }

/* Tile 5: Epoch — 12 cols, 1 row */
.tile-epoch {
    grid-column: 1 / 13;
    grid-row: 5 / 6;
    background-color: #e5ddd1;
    min-height: 180px;
}

.tile-epoch .tile-content {
    align-items: center;
    text-align: center;
    padding: 2rem;
}

.epoch-timestamp {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 7rem);
    color: #c4a95b;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.epoch-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 14px;
    color: #2d2a26;
    opacity: 0.6;
    max-width: 500px;
}

/* Responsive — Mobile (< 768px) */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .tile-genesis {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 280px;
    }

    .tile-hash {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tile-ledger {
        grid-column: 1 / -1;
        grid-row: auto;
        max-height: 60vh;
        min-height: auto;
    }

    .tile-consensus {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 220px;
    }

    .tile-epoch {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .domain-name {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .consensus-network {
        max-width: 100%;
        height: 160px;
    }

    /* Horizontal node arrangement for mobile */
    #node-1 { top: 50%; left: 2%; transform: translateY(-50%); }
    #node-2 { top: 50%; left: 16%; transform: translateY(-50%); }
    #node-3 { top: 50%; left: 30%; transform: translateY(-50%); }
    #node-4 { top: 50%; left: 44%; transform: translateY(-50%); }
    #node-5 { top: 50%; left: 58%; transform: translateY(-50%); }
    #node-6 { top: 50%; left: 72%; transform: translateY(-50%); }
    #node-7 { top: 50%; left: 86%; transform: translateY(-50%); }

    .connection {
        display: none;
    }

    .menu-glyph {
        top: 12px;
        right: 16px;
    }
}
