/* ================================================
   blockchain.day — Styles
   Neubrutalist hexagonal honeycomb design
   ================================================ */

/* --- CSS Custom Properties --- */
:root {
    --burgundy: #5a0023;
    --charred-aubergine: #1a0a12;
    --charred-aubergine-alt: #200e18;
    --parchment: #f5efe6;
    --sienna: #c45a3c;
    --brass: #b8963e;
    --dried-ink: #2e1a1a;
    --warm-cream: #f0e8d8;
    --border-raw: #1a1a1a;
    --concrete: #3a3a3a;

    --hex-width: clamp(180px, 25vw, 360px);
    --hex-clip: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    --border-thick: 4px;
    --shadow-hard: 6px 6px 0px var(--border-raw);
    --shadow-hover: 8px 8px 0px var(--burgundy);

    --font-display: 'Libre Baskerville', 'Georgia', serif;
    --font-body: 'Work Sans', 'Helvetica Neue', sans-serif;
    --font-code: 'Fira Code', monospace;
}

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

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

body {
    background-color: var(--charred-aubergine);
    color: var(--warm-cream);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* --- Background Pulse --- */
.bg-pulse {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: var(--charred-aubergine);
    animation: bgPulse 60s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { background-color: var(--charred-aubergine); }
    50% { background-color: var(--charred-aubergine-alt); }
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--parchment);
}

h2 {
    font-size: clamp(1.2rem, 3vw, 2rem);
    margin-bottom: 0.5em;
}

p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--warm-cream);
}

code {
    font-family: var(--font-code);
    font-size: 0.85rem;
    background: rgba(90, 0, 35, 0.12);
    border-left: 2px solid var(--burgundy);
    padding: 2px 8px;
    display: inline-block;
}

.code-snippet {
    margin-top: 1em;
}

/* ================================================
   HERO SECTION
   ================================================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* --- Hero Central Hexagon --- */
.hero-hex-wrapper {
    position: relative;
    width: clamp(280px, 50vw, 520px);
    height: clamp(320px, 57vw, 600px);
    z-index: 2;
}

.hero-hex-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

.hex-outline {
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    animation: drawHex 1.2s ease-out 0.15s forwards;
}

@keyframes drawHex {
    to { stroke-dashoffset: 0; }
}

.hero-hex {
    position: absolute;
    top: 3%;
    left: 3%;
    width: 94%;
    height: 94%;
    clip-path: var(--hex-clip);
    background-color: var(--burgundy);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: heroFadeIn 600ms ease-out 150ms forwards;
}

@keyframes heroFadeIn {
    to { opacity: 1; }
}

.hero-hex-content {
    text-align: center;
    padding: 2rem;
}

.hero-title-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 5rem);
    color: var(--parchment);
    letter-spacing: 0.02em;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--parchment);
    width: 0;
    animation: typeIn 1.8s steps(15, end) 1.35s forwards, blinkCaret 0.7s step-end infinite 1.35s;
}

@keyframes typeIn {
    to { width: 100%; }
}

@keyframes blinkCaret {
    0%, 100% { border-color: var(--parchment); }
    50% { border-color: transparent; }
}

/* --- Satellite Hexagons --- */
.satellite-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(500px, 80vw, 900px);
    height: clamp(500px, 80vw, 900px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.satellite-hex {
    position: absolute;
    width: clamp(80px, 12vw, 140px);
    height: clamp(92px, 14vw, 162px);
    opacity: 0;
    pointer-events: auto;
}

.satellite-hex .hex-cell {
    width: 100%;
    height: 100%;
}

/* Position satellites in a ring */
.satellite-1 {
    top: 2%;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    animation: satIn 400ms ease-out 1.5s forwards;
}
.satellite-2 {
    top: 18%;
    right: 8%;
    transform: rotate(4deg);
    animation: satIn 400ms ease-out 1.65s forwards;
}
.satellite-3 {
    bottom: 18%;
    right: 8%;
    transform: rotate(-5deg);
    animation: satIn 400ms ease-out 1.8s forwards;
}
.satellite-4 {
    bottom: 2%;
    left: 50%;
    transform: translateX(-50%) rotate(3deg);
    animation: satIn 400ms ease-out 1.95s forwards;
}
.satellite-5 {
    bottom: 18%;
    left: 8%;
    transform: rotate(-4deg);
    animation: satIn 400ms ease-out 2.1s forwards;
}
.satellite-6 {
    top: 18%;
    left: 8%;
    transform: rotate(5deg);
    animation: satIn 400ms ease-out 2.25s forwards;
}

@keyframes satIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.85);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

/* Override transform for centered satellites */
.satellite-1 {
    animation: satInCenter 400ms ease-out 1.5s forwards;
}
.satellite-4 {
    animation: satInCenter 400ms ease-out 1.95s forwards;
}

@keyframes satInCenter {
    from {
        opacity: 0;
        transform: translateX(-50%) rotate(-10deg) scale(0.85);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) rotate(0deg) scale(1);
    }
}

/* ================================================
   HEXAGONAL CELLS (shared)
   ================================================ */
.hex-cell {
    clip-path: var(--hex-clip);
    position: relative;
    transition: box-shadow 200ms ease, transform 200ms ease;
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: var(--hex-clip);
    border: var(--border-thick) solid var(--border-raw);
    z-index: 2;
    pointer-events: none;
    transition: border-color 200ms ease;
}

.hex-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15%;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Cell Variants */
.hex-content {
    background-color: var(--parchment);
    cursor: pointer;
}

.hex-content .hex-inner h2 {
    color: var(--dried-ink);
}

.hex-content .hex-inner p {
    color: var(--dried-ink);
    font-size: 0.9rem;
}

.hex-content .hex-inner code {
    color: var(--dried-ink);
}

.hex-content:hover::before {
    border-color: var(--burgundy);
}

.hex-decorative {
    background-color: var(--parchment);
}

.hex-decorative svg {
    width: 70%;
    height: 70%;
}

.hex-type {
    background-color: var(--burgundy);
}

.hex-type .type-word {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 4.5rem);
    color: var(--warm-cream);
    letter-spacing: 0.05em;
    transition: color 300ms ease;
}

.hex-type:hover .type-word {
    color: var(--brass);
}

.hex-void {
    background-color: var(--burgundy);
}

.hex-void.hex-dark {
    background-color: var(--charred-aubergine);
}

.hex-void.hex-gold {
    background-color: var(--brass);
}

.hex-void.hex-sienna {
    background-color: var(--sienna);
}

.hex-dark {
    background-color: var(--charred-aubergine);
}

.hex-dark .hex-inner p {
    color: var(--warm-cream);
}

/* Expanded content hidden by default */
.hex-expand-content {
    display: none;
}

/* ================================================
   HEXAGONAL GRID LAYOUT
   ================================================ */
.honeycomb-section {
    padding: 4rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.hex-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.hex-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.hex-row-offset {
    margin-top: -3%;
    transform: translateX(calc(var(--hex-width) * 0.28));
}

.hex-row .hex-cell {
    width: var(--hex-width);
    height: calc(var(--hex-width) * 1.155);
    flex-shrink: 0;
}

/* --- Hex Reveal Animation --- */
.hex-reveal {
    opacity: 0;
    transform: translateY(20px) scale(0.85);
    transition: opacity 350ms cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hex-reveal.hex-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Neubrutalist shadow on content hexes */
.hex-content {
    filter: drop-shadow(6px 6px 0px var(--border-raw));
    transition: filter 200ms ease, transform 200ms ease;
}

.hex-content:hover {
    filter: drop-shadow(8px 8px 0px var(--burgundy));
    transform: translate(-1px, -1px);
}

/* ================================================
   SECTION DIVIDERS
   ================================================ */
.hex-divider {
    width: 100%;
    height: 48px;
    border-top: 2px solid var(--border-raw);
    border-bottom: 2px solid var(--border-raw);
    background-color: var(--concrete);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='28' viewBox='0 0 32 28'%3E%3Cpolygon points='16,0 32,8 32,20 16,28 0,20 0,8' fill='%235a0023' stroke='%231a1a1a' stroke-width='1'/%3E%3C/svg%3E");
    background-size: 32px 28px;
    position: relative;
    overflow: hidden;
}

.hex-divider::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='28' viewBox='0 0 32 28'%3E%3Cpolygon points='16,0 32,8 32,20 16,28 0,20 0,8' fill='%23f5efe6' stroke='%231a1a1a' stroke-width='1'/%3E%3C/svg%3E");
    background-size: 32px 28px;
    background-position: 16px 14px;
}

/* ================================================
   SVG GLYPH ANIMATIONS
   ================================================ */
/* Consensus rings rotation */
.glyph-consensus .ring-1 {
    transform-origin: center;
    animation: rotateRing 30s linear infinite;
}
.glyph-consensus .ring-2 {
    transform-origin: center;
    animation: rotateRing 22s linear infinite reverse;
}
.glyph-consensus .ring-3 {
    transform-origin: center;
    animation: rotateRing 40s linear infinite;
}

@keyframes rotateRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Triangles rotation */
.glyph-triangles .tri-1 {
    transform-origin: center;
    animation: rotateRing 25s linear infinite;
}
.glyph-triangles .tri-2 {
    transform-origin: center;
    animation: rotateRing 35s linear infinite reverse;
}

/* Block stack sway */
.glyph-blocks .block-stack {
    transform-origin: center bottom;
    animation: blockSway 6s ease-in-out infinite;
}

@keyframes blockSway {
    0%, 100% { transform: translate(60px, 85px) rotate(-2deg); }
    50% { transform: translate(60px, 85px) rotate(2deg); }
}

/* Correct transform for hero satellite block stack */
.satellite-hex .glyph-blocks .block-stack {
    animation: blockSway2 6s ease-in-out infinite;
}

@keyframes blockSway2 {
    0%, 100% { transform: translate(60px, 80px) rotate(-2deg); }
    50% { transform: translate(60px, 80px) rotate(2deg); }
}

/* Chain link pulse */
.glyph-chain circle {
    animation: chainPulse 4s ease-in-out infinite;
}

@keyframes chainPulse {
    0%, 100% { stroke-width: 2.5; }
    50% { stroke-width: 4; }
}

/* Hash grid shimmer */
.glyph-hash .hash-grid rect {
    animation: hashShimmer 8s ease-in-out infinite;
}

.glyph-hash .hash-grid rect:nth-child(odd) {
    animation-delay: -4s;
}

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

/* Diamonds pulse */
.glyph-diamonds rect:first-child {
    animation: rotateRing 40s linear infinite;
}
.glyph-diamonds rect:nth-child(2) {
    animation: rotateRing 28s linear infinite reverse;
}

/* ================================================
   EXPANDED HEX STATE
   ================================================ */
.hex-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 10, 18, 0.7);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.hex-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.hex-cell.hex-expanded {
    position: fixed;
    top: 10vh;
    left: 10vw;
    width: 80vw;
    height: 80vh;
    z-index: 100;
    clip-path: var(--hex-clip);
    background-color: var(--parchment);
    transition: all 500ms ease-out;
    filter: none;
    overflow-y: auto;
}

.hex-cell.hex-expanded .hex-inner {
    padding: 8% 12%;
    align-items: flex-start;
    text-align: left;
    justify-content: flex-start;
    overflow-y: auto;
}

.hex-cell.hex-expanded .hex-expand-content {
    display: block;
    margin-top: 1em;
}

.hex-cell.hex-expanded .hex-expand-content p {
    margin-bottom: 0.8em;
    color: var(--dried-ink);
    font-size: 1rem;
    line-height: 1.7;
}

/* Blur neighboring hexes when one is expanded */
body.hex-is-expanded .hex-cell:not(.hex-expanded) {
    filter: blur(4px);
    opacity: 0.3;
    transition: filter 300ms ease, opacity 300ms ease;
}

body.hex-is-expanded .hex-compass {
    filter: blur(4px);
    opacity: 0.3;
}

/* ================================================
   NAVIGATION COMPASS
   ================================================ */
.hex-compass {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 74px;
    z-index: 100;
    cursor: pointer;
    transition: filter 300ms ease, opacity 300ms ease;
}

.compass-svg {
    width: 100%;
    height: 100%;
}

.compass-edges {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.compass-edge {
    position: absolute;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compass-edge span {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0;
    color: var(--parchment);
    white-space: nowrap;
    transition: font-size 200ms ease, opacity 200ms ease;
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.compass-edge:hover span {
    font-size: 0.7rem;
    opacity: 1;
}

/* Edge positions */
.edge-top {
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
}
.edge-top span {
    bottom: 100%;
    margin-bottom: 4px;
}

.edge-top-right {
    top: 18%;
    right: -8px;
}
.edge-top-right span {
    left: 110%;
}

.edge-bottom-right {
    bottom: 18%;
    right: -8px;
}
.edge-bottom-right span {
    left: 110%;
}

.edge-bottom {
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
}
.edge-bottom span {
    top: 100%;
    margin-top: 4px;
}

.edge-bottom-left {
    bottom: 18%;
    left: -8px;
}
.edge-bottom-left span {
    right: 110%;
}

.edge-top-left {
    top: 18%;
    left: -8px;
}
.edge-top-left span {
    right: 110%;
}

.compass-edge::before {
    content: '';
    display: block;
    width: 24px;
    height: 3px;
    background-color: var(--brass);
    transition: width 200ms ease, background-color 200ms ease;
}

.compass-edge:hover::before {
    width: 40px;
    background-color: var(--sienna);
}

/* ================================================
   FOOTER SECTION
   ================================================ */
.footer-section {
    padding: 6rem 1rem 4rem;
    display: flex;
    justify-content: center;
    position: relative;
    min-height: 70vh;
}

.footer-hex-field {
    position: relative;
    width: clamp(400px, 60vw, 700px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-footer-main {
    width: clamp(300px, 45vw, 520px);
    height: clamp(346px, 52vw, 600px);
    background-color: var(--burgundy);
    z-index: 2;
    position: relative;
}

.hex-footer-main .hex-inner {
    padding: 18%;
}

.hex-footer-main h2 {
    font-size: clamp(1.5rem, 4vw, 3rem);
    margin-bottom: 0.8em;
    color: var(--warm-cream);
}

.hex-footer-main p {
    color: var(--warm-cream);
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    margin-bottom: 1.5em;
}

.footer-domain {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--brass);
    letter-spacing: 0.05em;
}

/* Scattered hexagons */
.footer-scatter {
    position: absolute;
    inset: -30%;
    pointer-events: none;
}

.hex-scatter {
    position: absolute;
    background-color: var(--burgundy);
    clip-path: var(--hex-clip);
    opacity: 0.3;
}

.hex-scatter-1 {
    width: 60px; height: 69px;
    top: 5%; left: -5%;
    opacity: 0.5;
}
.hex-scatter-2 {
    width: 45px; height: 52px;
    top: -5%; right: 10%;
    opacity: 0.35;
}
.hex-scatter-3 {
    width: 35px; height: 40px;
    bottom: 15%; left: -12%;
    opacity: 0.2;
    background-color: var(--brass);
}
.hex-scatter-4 {
    width: 50px; height: 58px;
    bottom: 5%; right: -5%;
    opacity: 0.4;
}
.hex-scatter-5 {
    width: 28px; height: 32px;
    top: 30%; left: -18%;
    opacity: 0.15;
}
.hex-scatter-6 {
    width: 40px; height: 46px;
    top: 20%; right: -10%;
    opacity: 0.25;
    background-color: var(--sienna);
}
.hex-scatter-7 {
    width: 22px; height: 25px;
    bottom: 25%; right: -15%;
    opacity: 0.12;
}
.hex-scatter-8 {
    width: 32px; height: 37px;
    bottom: 0%; left: 10%;
    opacity: 0.18;
    background-color: var(--brass);
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 900px) {
    .hex-row {
        flex-wrap: wrap;
    }

    .hex-row-offset {
        transform: translateX(calc(var(--hex-width) * 0.14));
        margin-top: -2%;
    }

    .satellite-ring {
        display: none;
    }

    .hex-cell.hex-expanded {
        top: 5vh;
        left: 5vw;
        width: 90vw;
        height: 90vh;
    }
}

@media (max-width: 600px) {
    .hex-row {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .hex-row-offset {
        transform: none;
        margin-top: 0;
    }

    .hex-row .hex-cell {
        width: clamp(250px, 80vw, 360px);
        height: calc(clamp(250px, 80vw, 360px) * 1.155);
    }

    .hex-compass {
        width: 48px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }

    .hero-hex-wrapper {
        width: 85vw;
        height: 98vw;
    }
}
