/* ============================================================
   holos.dev — Candy-Bright Bioluminescent Honeycomb
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --hot-bubblegum: #ff69b4;
    --electric-lavender: #b388ff;
    --aqua-pop: #00e5ff;
    --lemon-fizz: #fff176;
    --deep-velvet: #1a0a2e;
    --plum-shadow: #2d1b4e;
    --cloud-cream: #fdf6ff;
    --lilac-haze: #c9b8d9;

    --hex-clip: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    --hex-width: 220px;
    --hex-height: calc(var(--hex-width) * 1.1547);
    --hex-gap: 8px;

    --font-display: 'Nunito', sans-serif;
    --font-body: 'Quicksand', sans-serif;
    --font-accent: 'Baloo 2', cursive;

    --glow-pink: rgba(255, 105, 180, 0.25);
    --glow-pink-strong: rgba(255, 105, 180, 0.45);
    --glow-lavender: rgba(179, 136, 255, 0.15);
    --glow-lavender-strong: rgba(179, 136, 255, 0.3);
    --glow-aqua: rgba(0, 229, 255, 0.4);
    --glow-aqua-soft: rgba(0, 229, 255, 0.2);
}

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

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

body {
    background-color: var(--deep-velvet);
    color: var(--cloud-cream);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-display);
    letter-spacing: 0.01em;
    text-transform: none;
}

h1 {
    font-weight: 900;
}

h2 {
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
}

h3 {
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.4rem);
    margin-bottom: 0.5em;
    color: var(--aqua-pop);
    text-shadow: 0 0 20px var(--glow-aqua), 0 0 40px var(--glow-aqua-soft);
}

p {
    max-width: 42ch;
    color: var(--cloud-cream);
}

/* --- Navigation Membrane --- */
#membrane {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    background: rgba(255, 105, 180, 0.08);
    border-bottom: 1px solid rgba(179, 136, 255, 0.2);
    box-shadow: 0 0 8px rgba(179, 136, 255, 0.5);
}

.nav-hex {
    width: 48px;
    height: 48px;
    clip-path: var(--hex-clip);
    background: var(--plum-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    color: var(--cloud-cream);
    transition: transform 400ms cubic-bezier(0.25, 1.5, 0.5, 1),
                background 300ms ease-out;
    box-shadow: 0 0 15px var(--glow-pink), 0 0 40px var(--glow-lavender);
    will-change: transform;
}

.nav-hex::before {
    content: '';
    position: absolute;
    inset: -3px;
    clip-path: var(--hex-clip);
    background: linear-gradient(135deg, var(--hot-bubblegum), var(--electric-lavender));
    z-index: -1;
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.nav-hex:hover {
    background: linear-gradient(135deg, var(--hot-bubblegum), var(--electric-lavender));
    box-shadow: 0 0 25px var(--glow-pink-strong), 0 0 60px var(--glow-lavender-strong);
}

.nav-hex:hover::before {
    opacity: 1;
}

.nav-hex[data-label]::after {
    content: attr(data-label);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    font-family: var(--font-accent);
    font-size: clamp(0.75rem, 1.4vw, 0.95rem);
    letter-spacing: 0.04em;
    color: var(--cloud-cream);
    background: var(--plum-shadow);
    padding: 4px 10px;
    clip-path: var(--hex-clip);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.nav-hex:hover[data-label]::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.nav-hex svg {
    width: 20px;
    height: 20px;
}

/* --- Particle Trail --- */
#particle-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 12px;
    height: 12px;
    clip-path: var(--hex-clip);
    pointer-events: none;
    animation: particle-fade 800ms ease-out forwards;
}

@keyframes particle-fade {
    0% {
        opacity: 0.9;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* --- Drift Zone: Floating Hexagons --- */
#drift-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.drift-hex {
    position: absolute;
    clip-path: var(--hex-clip);
    pointer-events: none;
    opacity: 0;
    will-change: transform, opacity;
}

/* Drift animations — 8 variants with different durations and paths */
@keyframes float-1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(15px, -25px) rotate(3deg); }
    50% { transform: translate(-10px, -45px) rotate(-2deg); }
    75% { transform: translate(20px, -20px) rotate(4deg); }
}

@keyframes float-2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-20px, -30px) rotate(-4deg); }
    50% { transform: translate(15px, -55px) rotate(3deg); }
    75% { transform: translate(-10px, -15px) rotate(-2deg); }
}

@keyframes float-3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(25px, -20px) rotate(5deg); }
    50% { transform: translate(-15px, -40px) rotate(-3deg); }
    75% { transform: translate(10px, -30px) rotate(2deg); }
}

@keyframes float-4 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-18px, -35px) rotate(-3deg); }
    66% { transform: translate(22px, -50px) rotate(4deg); }
}

@keyframes float-5 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(12px, -40px) rotate(2deg); }
    40% { transform: translate(-8px, -20px) rotate(-1deg); }
    60% { transform: translate(18px, -55px) rotate(3deg); }
    80% { transform: translate(-15px, -30px) rotate(-4deg); }
}

@keyframes float-6 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-20px, -60px) rotate(-5deg); }
}

@keyframes float-7 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    30% { transform: translate(10px, -20px) rotate(2deg); }
    60% { transform: translate(-12px, -45px) rotate(-3deg); }
}

@keyframes float-8 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-25px, -15px) rotate(-2deg); }
    75% { transform: translate(20px, -40px) rotate(3deg); }
}

/* Drift hex spawn animation */
@keyframes drift-spawn {
    0% {
        opacity: 0;
        transform: scale(0) translate(0, 0);
    }
    60% {
        opacity: 0.7;
        transform: scale(1.1);
    }
    100% {
        opacity: var(--target-opacity, 0.5);
        transform: scale(1);
    }
}

/* --- Glow Orbs --- */
#glow-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
}

@keyframes orb-drift-1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(40px, -30px); }
    50% { transform: translate(-20px, -60px); }
    75% { transform: translate(30px, -20px); }
}

@keyframes orb-drift-2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-35px, -45px); }
    66% { transform: translate(25px, -25px); }
}

@keyframes orb-drift-3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -50px); }
}

@keyframes orb-drift-4 {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-25px, -20px); }
    40% { transform: translate(15px, -50px); }
    60% { transform: translate(-30px, -35px); }
    80% { transform: translate(20px, -15px); }
}

/* --- Connection Lines --- */
#connection-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.connection-line {
    stroke: var(--electric-lavender);
    stroke-opacity: 0.15;
    stroke-width: 1px;
    fill: none;
}

@keyframes line-draw {
    0% { stroke-dashoffset: 500; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -500; }
}

/* --- Nucleus (Hero Section) --- */
#nucleus {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    overflow: hidden;
}

.nucleus-hex-wrapper {
    position: relative;
    width: min(60vh, 80vw);
    height: min(60vh, 80vw);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: gentle-spin 720s linear infinite;
}

@keyframes gentle-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.nucleus-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.nucleus-outline {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    animation: draw-hex-outline 1200ms ease-in-out 200ms forwards;
    filter: drop-shadow(0 0 8px rgba(179, 136, 255, 0.6));
}

@keyframes draw-hex-outline {
    0% { stroke-dashoffset: 1500; }
    100% { stroke-dashoffset: 0; }
}

.nucleus-fill-poly {
    opacity: 0;
    animation: fill-hex 400ms ease-out 1400ms forwards;
}

@keyframes fill-hex {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.nucleus-content {
    position: relative;
    z-index: 5;
    text-align: center;
    animation: gentle-spin 720s linear infinite reverse;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--cloud-cream);
    text-shadow: 0 0 20px var(--glow-aqua), 0 0 40px var(--glow-aqua-soft);
    opacity: 0;
    animation: hero-text-in 600ms ease-out 1400ms forwards;
}

@keyframes hero-text-in {
    0% {
        opacity: 0;
        text-shadow: 0 0 0px var(--glow-aqua), 0 0 0px var(--glow-aqua-soft);
    }
    100% {
        opacity: 1;
        text-shadow: 0 0 20px var(--glow-aqua), 0 0 40px var(--glow-aqua-soft);
    }
}

.hero-tagline {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: var(--lilac-haze);
    margin-top: 0.5em;
    opacity: 0;
    animation: hero-text-in 600ms ease-out 1800ms forwards;
}

/* --- Content Sections --- */
.content-section {
    position: relative;
    z-index: 10;
    padding: 80px 20px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section-heading {
    color: var(--cloud-cream);
    text-shadow: 0 0 20px var(--glow-aqua), 0 0 40px var(--glow-aqua-soft);
    margin-bottom: 40px;
    text-align: center;
}

/* Section Divider Hex */
.section-divider-hex {
    width: 60px;
    height: 60px;
    clip-path: var(--hex-clip);
    background: linear-gradient(135deg, var(--hot-bubblegum), var(--electric-lavender));
    margin: 0 auto 30px;
    opacity: 0;
    transform: scale(0);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
    box-shadow: 0 0 15px var(--glow-pink), 0 0 40px var(--glow-lavender);
}

.section-divider-hex.visible {
    opacity: 1;
    transform: scale(1);
}

/* --- Honeycomb Grid --- */
.honeycomb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--hex-gap);
    max-width: 1200px;
    width: 100%;
    justify-items: center;
    padding: 20px;
}

/* Hex Cell */
.hex-cell {
    width: var(--hex-width);
    height: var(--hex-height);
    clip-path: var(--hex-clip);
    background: var(--plum-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: default;
    transition: transform 400ms cubic-bezier(0.25, 1.5, 0.5, 1),
                box-shadow 300ms ease-out;
    box-shadow: 0 0 15px var(--glow-pink), 0 0 40px var(--glow-lavender);
    will-change: transform;
    opacity: 0;
    transform: scale(0);
}

.hex-cell.visible {
    animation: cell-appear 400ms ease-out forwards;
}

@keyframes cell-appear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    70% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: var(--hex-clip);
    background: radial-gradient(circle, rgba(255, 105, 180, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 300ms ease-out;
    z-index: 0;
}

.hex-cell:hover {
    box-shadow: 0 0 25px var(--glow-pink-strong), 0 0 60px var(--glow-lavender-strong);
}

.hex-cell:hover::before {
    opacity: 1;
}

/* Stagger odd rows */
.honeycomb-grid .hex-cell:nth-child(odd) {
    margin-top: calc(var(--hex-height) * -0.07);
}

.hex-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 30px 20px;
    max-width: 42ch;
}

.hex-content h3 {
    font-size: clamp(0.95rem, 1.8vw, 1.2rem);
}

.hex-content p {
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    color: var(--lilac-haze);
    line-height: 1.55;
}

/* --- Connective Tissue Glow (between hexagons) --- */
.honeycomb-grid::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(179, 136, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(255, 105, 180, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* --- Section Themes --- */
[data-theme="connect"] .section-heading {
    color: var(--hot-bubblegum);
    text-shadow: 0 0 20px rgba(255, 105, 180, 0.5), 0 0 40px rgba(255, 105, 180, 0.2);
}

[data-theme="grow"] .section-heading {
    color: var(--lemon-fizz);
    text-shadow: 0 0 20px rgba(255, 241, 118, 0.5), 0 0 40px rgba(255, 241, 118, 0.2);
}

[data-theme="explore"] .section-heading {
    color: var(--aqua-pop);
    text-shadow: 0 0 20px var(--glow-aqua), 0 0 40px var(--glow-aqua-soft);
}

[data-theme="about"] .section-heading {
    color: var(--electric-lavender);
    text-shadow: 0 0 20px rgba(179, 136, 255, 0.5), 0 0 40px rgba(179, 136, 255, 0.2);
}

/* Theme-specific hex cell border glows */
[data-theme="connect"] .hex-cell {
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.3), 0 0 40px rgba(179, 136, 255, 0.15);
}

[data-theme="connect"] .hex-cell:hover {
    box-shadow: 0 0 25px rgba(255, 105, 180, 0.5), 0 0 60px rgba(179, 136, 255, 0.3);
}

[data-theme="grow"] .hex-cell {
    box-shadow: 0 0 15px rgba(255, 241, 118, 0.2), 0 0 40px rgba(179, 136, 255, 0.15);
}

[data-theme="grow"] .hex-cell:hover {
    box-shadow: 0 0 25px rgba(255, 241, 118, 0.4), 0 0 60px rgba(179, 136, 255, 0.3);
}

[data-theme="explore"] .hex-cell {
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.25), 0 0 40px rgba(179, 136, 255, 0.15);
}

[data-theme="explore"] .hex-cell:hover {
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.45), 0 0 60px rgba(179, 136, 255, 0.3);
}

[data-theme="about"] .hex-cell {
    box-shadow: 0 0 15px rgba(179, 136, 255, 0.25), 0 0 40px rgba(255, 105, 180, 0.15);
}

[data-theme="about"] .hex-cell:hover {
    box-shadow: 0 0 25px rgba(179, 136, 255, 0.45), 0 0 60px rgba(255, 105, 180, 0.3);
}

/* Grow section: hex-cell h3 color override */
[data-theme="grow"] .hex-content h3 {
    color: var(--lemon-fizz);
    text-shadow: 0 0 20px rgba(255, 241, 118, 0.4), 0 0 40px rgba(255, 241, 118, 0.2);
}

[data-theme="connect"] .hex-content h3 {
    color: var(--hot-bubblegum);
    text-shadow: 0 0 20px rgba(255, 105, 180, 0.4), 0 0 40px rgba(255, 105, 180, 0.2);
}

[data-theme="about"] .hex-content h3 {
    color: var(--electric-lavender);
    text-shadow: 0 0 20px rgba(179, 136, 255, 0.4), 0 0 40px rgba(179, 136, 255, 0.2);
}

/* --- Footer --- */
#hive-footer {
    position: relative;
    z-index: 10;
    padding: 60px 20px 40px;
    display: flex;
    justify-content: center;
}

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

.footer-hex {
    width: 110px;
    height: 127px;
    clip-path: var(--hex-clip);
    background: var(--plum-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px var(--glow-pink), 0 0 25px var(--glow-lavender);
    transition: box-shadow 300ms ease-out, transform 400ms cubic-bezier(0.25, 1.5, 0.5, 1);
    will-change: transform;
}

.footer-hex:hover {
    box-shadow: 0 0 20px var(--glow-pink-strong), 0 0 50px var(--glow-lavender-strong);
}

.footer-label {
    font-family: var(--font-accent);
    font-size: clamp(0.75rem, 1.4vw, 0.95rem);
    letter-spacing: 0.04em;
    color: var(--lilac-haze);
    text-align: center;
}

/* --- Line Glow (borders/dividers) --- */
.line-glow {
    border: none;
    height: 1px;
    background: var(--electric-lavender);
    box-shadow: 0 0 8px rgba(179, 136, 255, 0.5);
    margin: 40px auto;
    width: 60%;
}

/* --- Responsive: Tablet --- */
@media (min-width: 768px) and (max-width: 1200px) {
    .honeycomb-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    :root {
        --hex-width: 200px;
    }
}

/* --- Responsive: Desktop --- */
@media (min-width: 1201px) {
    .honeycomb-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    :root {
        --hex-width: 220px;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 767px) {
    :root {
        --hex-width: 280px;
    }

    .honeycomb-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .hex-cell {
        clip-path: none;
        border-radius: 20px;
        width: 100%;
        max-width: 340px;
        height: auto;
        min-height: 160px;
        background: var(--plum-shadow);
        border: 1px solid rgba(179, 136, 255, 0.2);
    }

    .hex-cell::before {
        clip-path: none;
        border-radius: 20px;
    }

    .honeycomb-grid .hex-cell:nth-child(odd) {
        margin-top: 0;
    }

    .hex-content {
        padding: 24px 20px;
    }

    .nav-hex {
        width: 40px;
        height: 40px;
    }

    #membrane {
        gap: 8px;
        padding: 8px 12px;
    }

    .footer-hex {
        width: 80px;
        height: 92px;
    }

    .footer-label {
        font-size: 0.7rem;
    }

    .nucleus-hex-wrapper {
        width: min(75vh, 90vw);
        height: min(75vh, 90vw);
    }
}

/* --- Hex cell wide variant --- */
.hex-cell-wide {
    grid-column: span 2;
    width: calc(var(--hex-width) * 2 + var(--hex-gap));
}

@media (max-width: 767px) {
    .hex-cell-wide {
        grid-column: span 1;
        width: 100%;
    }
}

/* --- Pulse animation for decorative elements --- */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 15px var(--glow-pink), 0 0 40px var(--glow-lavender);
    }
    50% {
        box-shadow: 0 0 25px var(--glow-pink-strong), 0 0 60px var(--glow-lavender-strong);
    }
}

/* --- Selection styling --- */
::selection {
    background: rgba(179, 136, 255, 0.4);
    color: var(--cloud-cream);
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--deep-velvet);
}

::-webkit-scrollbar-thumb {
    background: var(--plum-shadow);
    border-radius: 4px;
    border: 1px solid rgba(179, 136, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--electric-lavender);
}
