/* =============================================
   continu.ax - Botanical Glitch Honeycomb
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --burnt-sienna: #C1440E;
    --raw-amber: #D4820C;
    --pollen-gold: #E8A838;
    --charred-earth: #1C1410;
    --umber-shadow: #3A2A1E;
    --cream-vellum: #F5EBD8;
    --warm-parchment: #E8D5B5;
    --rust-flicker: #E85D26;

    --hex-size: clamp(180px, 18vw, 320px);
    --hex-gap: 3px;

    --font-display: 'Caveat', cursive;
    --font-section: 'Kalam', cursive;
    --font-body: 'Nunito', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--charred-earth);
    color: var(--cream-vellum);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw + 0.5rem, 1.2rem);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography Classes --- */
.caveat-bold {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.kalam {
    font-family: var(--font-section);
    font-weight: 400;
    line-height: 1.35;
}

.nunito {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.65;
}

h1.site-title {
    font-size: clamp(2.4rem, 7vw + 0.5rem, 5.5rem);
    color: var(--cream-vellum);
    text-shadow:
        -2px 0 var(--rust-flicker),
        2px 0 var(--charred-earth);
}

h2 {
    font-family: var(--font-section);
    font-size: clamp(1.4rem, 3.5vw + 0.3rem, 2.8rem);
    color: var(--cream-vellum);
    margin-bottom: 0.5em;
}

p.site-subtitle {
    font-size: clamp(1rem, 2vw + 0.3rem, 1.6rem);
    color: var(--pollen-gold);
    margin-top: 0.5em;
}

/* Accent labels */
.caveat-accent {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw + 0.3rem, 1.1rem);
    color: var(--pollen-gold);
}

/* --- Leaf Vein Background SVG --- */
.leaf-vein-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease;
}

.leaf-vein-bg.visible {
    opacity: 1;
}

.vein-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 4s ease;
}

.leaf-vein-bg.visible .vein-path {
    stroke-dashoffset: 0;
}

.vein-1 { transition-delay: 0s; }
.vein-2 { transition-delay: 0.3s; }
.vein-3 { transition-delay: 0.3s; }
.vein-4 { transition-delay: 0.6s; }
.vein-5 { transition-delay: 0.6s; }
.vein-6 { transition-delay: 0.9s; }
.vein-7 { transition-delay: 0.9s; }
.vein-8 { transition-delay: 1.2s; }
.vein-9 { transition-delay: 1.2s; }
.vein-10 { transition-delay: 1.5s; }
.vein-11 { transition-delay: 1.5s; }

/* --- Floating Hexagons (pollen motes) --- */
.floating-hexagons {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.floating-hex {
    position: absolute;
    border: 1px solid var(--warm-parchment);
    opacity: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.25;
    }
    90% {
        opacity: 0.25;
    }
    100% {
        transform: translateY(-110vh) rotate(30deg);
        opacity: 0;
    }
}

/* --- Growth Rings --- */
.growth-rings {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

.growth-ring {
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 2px solid var(--pollen-gold);
    animation: ringPulse 2s ease-out forwards;
}

@keyframes ringPulse {
    0% {
        transform: scale(0.3);
        opacity: 0.7;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* --- Scanline Sweep --- */
.scanline-sweep {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
}

.scanline-sweep.active {
    opacity: 1;
    background: repeating-linear-gradient(
        transparent,
        transparent 3px,
        rgba(232, 93, 38, 0.25) 3px,
        rgba(232, 93, 38, 0.25) 4px
    );
    animation: scanlineSweepAnim 1.5s linear forwards;
}

@keyframes scanlineSweepAnim {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 46px;
    z-index: 100;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-hex-svg {
    width: 100%;
    height: 100%;
}

.scroll-hex-fill {
    transition: y 0.15s ease;
}

/* --- Sections --- */
.section {
    position: relative;
    width: 100%;
    min-height: 200vh;
    overflow: hidden;
}

.section-emergence {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-growth {
    min-height: 200vh;
}

.section-flourishing {
    min-height: 200vh;
}

.section-glitchpeak {
    min-height: 200vh;
}

.section-resolution {
    min-height: 200vh;
}

/* --- Section Title --- */
.section-title-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.section-title-container.visible {
    opacity: 1;
}

/* --- Hex Grid (background tessellation) --- */
.hex-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.hex-cell {
    position: absolute;
    width: var(--hex-size);
    height: calc(var(--hex-size) * 1.1547);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background-color: var(--umber-shadow);
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.12s steps(3);
    will-change: opacity, transform;
}

.hex-cell.visible {
    opacity: 1;
}

.hex-cell.glitch-position {
    animation: glitchShift 0.12s steps(3) forwards;
}

@keyframes glitchShift {
    0% { transform: translate(0, 0); }
    33% { transform: translate(var(--gx, 5px), var(--gy, -3px)); }
    66% { transform: translate(calc(var(--gx, 5px) * -0.5), calc(var(--gy, -3px) * -0.5)); }
    100% { transform: translate(0, 0); }
}

.hex-cell.glitch-duplicate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transform: translate(6px, 2px);
    opacity: 0.35;
    mix-blend-mode: screen;
    animation: glitchDupe 0.36s ease forwards;
}

@keyframes glitchDupe {
    0% { opacity: 0; }
    22% { opacity: 0.35; }
    78% { opacity: 0.35; }
    100% { opacity: 0; }
}

/* Hex cell variant colors */
.hex-cell.warm {
    background-color: var(--burnt-sienna);
}

.hex-cell.amber {
    background-color: var(--raw-amber);
}

.hex-cell.golden {
    background-color: var(--pollen-gold);
}

.hex-cell.dark {
    background-color: var(--umber-shadow);
}

/* Breathing animation for flourishing section */
.hex-cell.breathing {
    animation: hexBreathe 6s ease-in-out infinite;
}

@keyframes hexBreathe {
    0%, 100% { transform: scale(0.98); }
    50% { transform: scale(1.02); }
}

/* Decompose animation for section transitions */
.hex-cell.decomposing {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

.hex-cell.assembling {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

/* --- Content Hex Cells --- */
.content-cluster {
    position: relative;
    z-index: 5;
}

.hex-content-cell {
    width: clamp(260px, 30vw, 420px);
    height: clamp(300px, 35vw, 485px);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background-color: var(--umber-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, opacity 0.8s ease;
    position: relative;
    opacity: 0;
    transform: scale(0.92);
}

.hex-content-cell.revealed {
    opacity: 1;
    transform: scale(1);
}

.hex-content-cell::after {
    content: '';
    position: absolute;
    inset: -3px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--pollen-gold);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.hex-content-cell:hover::after {
    opacity: 0.15;
}

.hex-content-cell.hex-warm {
    background-color: var(--burnt-sienna);
    background-image: linear-gradient(135deg, var(--burnt-sienna), var(--raw-amber));
}

.hex-content-cell.hex-golden {
    background-color: var(--raw-amber);
    background-image: linear-gradient(135deg, var(--raw-amber), var(--pollen-gold));
}

.hex-content-cell.hex-glitch-intense {
    background-color: var(--umber-shadow);
}

.hex-inner {
    padding: clamp(24px, 4vw, 48px);
    text-align: center;
    width: 80%;
}

.hex-inner h2 {
    margin-bottom: 0.75em;
}

.hex-inner p {
    font-size: clamp(0.85rem, 0.9vw + 0.4rem, 1.05rem);
    color: var(--cream-vellum);
    opacity: 0.9;
}

/* Glitch text effect */
.glitch-text {
    position: relative;
    text-shadow:
        -3px 0 var(--burnt-sienna),
        3px 0 var(--charred-earth);
}

.section-glitchpeak .glitch-text {
    text-shadow:
        -6px 0 var(--burnt-sienna),
        6px 0 var(--charred-earth);
}

/* Decorative leaf hex cells */
.hex-decorative-leaf {
    cursor: default;
    pointer-events: none;
}

.hex-decorative-leaf.revealed {
    opacity: 0.5;
}

.hex-decorative-leaf .hex-inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaf-silhouette {
    width: 60%;
    height: auto;
}

/* Leaf render SVGs in content cells */
.leaf-render {
    width: 70%;
    height: auto;
    max-height: 200px;
}

/* --- Content layout (zigzag honeycomb arrangement) --- */
.growth-content-clusters,
.flourishing-content-clusters,
.glitchpeak-content-clusters,
.resolution-content-clusters {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10vh 5vw;
    gap: 2vh;
}

.content-cluster {
    display: flex;
    justify-content: center;
}

.content-cluster:nth-child(even) {
    transform: translateX(calc(var(--hex-size) * 0.3));
}

.content-cluster:nth-child(odd) {
    transform: translateX(calc(var(--hex-size) * -0.3));
}

/* Closing statement style */
.closing-statement {
    font-size: clamp(2rem, 5vw + 0.5rem, 4rem);
    color: var(--pollen-gold);
}

/* --- Hex Zoom Overlay --- */
.hex-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(28, 20, 16, 0.85);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(4px);
}

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

/* --- Focused Cell Container --- */
.focused-cell-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    width: clamp(300px, 50vw, 600px);
    height: clamp(345px, 57.7vw, 693px);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--umber-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.focused-cell-container.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.focused-cell-content {
    padding: clamp(30px, 5vw, 60px);
    text-align: center;
    width: 80%;
}

.focused-cell-content h2 {
    font-family: var(--font-section);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--pollen-gold);
    margin-bottom: 0.8em;
}

.focused-cell-content p {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1vw + 0.4rem, 1.15rem);
    color: var(--cream-vellum);
    line-height: 1.7;
}

.focused-cell-content .caveat-accent {
    display: block;
    margin-top: 1.5em;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw + 0.3rem, 1.1rem);
    color: var(--pollen-gold);
    opacity: 0.7;
}

/* --- Section-specific overrides --- */

/* Emergence: dark, minimal */
.section-emergence {
    background-color: var(--charred-earth);
}

/* Growth: introduces warmth */
.section-growth {
    background: linear-gradient(180deg, var(--charred-earth) 0%, #221810 50%, var(--charred-earth) 100%);
}

/* Flourishing: warmer palette */
.section-flourishing {
    background: linear-gradient(180deg, var(--charred-earth) 0%, #2A1C12 30%, #2E1E14 70%, var(--charred-earth) 100%);
}

/* Glitch Peak: maximum intensity */
.section-glitchpeak {
    background: linear-gradient(180deg, var(--charred-earth) 0%, #1E1510 50%, var(--charred-earth) 100%);
}

/* Resolution: warm golden calm */
.section-resolution {
    background: linear-gradient(180deg, var(--charred-earth) 0%, #2C1E10 30%, #302216 60%, #241A10 100%);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --hex-size: clamp(140px, 40vw, 220px);
    }

    .hex-content-cell {
        width: clamp(220px, 70vw, 340px);
        height: clamp(254px, 80vw, 393px);
    }

    .content-cluster:nth-child(even),
    .content-cluster:nth-child(odd) {
        transform: none;
    }

    .hex-inner {
        padding: clamp(18px, 4vw, 32px);
        width: 85%;
    }

    .focused-cell-container {
        width: clamp(260px, 80vw, 400px);
        height: clamp(300px, 92vw, 462px);
    }

    .scroll-indicator {
        bottom: 12px;
        right: 12px;
        width: 32px;
        height: 37px;
    }
}

@media (max-width: 480px) {
    .hex-content-cell {
        width: clamp(200px, 85vw, 300px);
        height: clamp(231px, 98vw, 347px);
    }

    .section {
        min-height: 150vh;
    }

    .section-emergence {
        min-height: 100vh;
    }
}
