/* ===== badge.bar - Styles ===== */
/* Pastoral Neon Hexagonal Honeycomb */

/* --- Google Fonts are loaded in HTML --- */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0d0a1a;
    --bg-secondary: #1a1433;
    --neon-magenta: #ff2d7b;
    --neon-cyan: #00f0ff;
    --neon-amber: #ffb627;
    --neon-lime: #7aff3b;
    --text-primary: #e8e4f0;
    --text-muted: #8b82a8;
    --border-glow: #6c5ce7;

    --hex-clip: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    line-height: 1.65;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Honeycomb Background Pattern --- */
#honeycomb-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='138.56' height='160' viewBox='0 0 138.56 160'%3E%3Cpath d='M69.28 0 L138.56 40 L138.56 120 L69.28 160 L0 120 L0 40 Z' fill='none' stroke='%236c5ce7' stroke-width='1' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 80px 92.38px;
    pointer-events: none;
}

/* --- Neon Bloom Gradient --- */
#neon-bloom {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.6s ease;
    background: radial-gradient(
        ellipse at 50% 40%,
        rgba(255, 45, 123, 0.08) 0%,
        rgba(0, 240, 255, 0.05) 30%,
        transparent 70%
    );
    pointer-events: none;
}

/* --- Firefly Particle Layer --- */
#firefly-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.firefly {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--neon-amber);
    left: var(--x);
    bottom: -10px;
    opacity: 0;
    animation: firefly-rise var(--duration) ease-in-out var(--delay) infinite;
    box-shadow: 0 0 6px rgba(255, 182, 39, 0.6), 0 0 12px rgba(255, 182, 39, 0.3);
}

@keyframes firefly-rise {
    0% {
        transform: translateY(0) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: var(--max-opacity);
    }
    50% {
        transform: translateY(calc(-50vh)) scale(1);
    }
    90% {
        opacity: var(--max-opacity);
    }
    100% {
        transform: translateY(calc(-110vh)) scale(1.1);
        opacity: 0;
    }
}

/* --- Floating Decorative Badges --- */
#floating-badges {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

.floater {
    position: fixed;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    opacity: 0.25;
    pointer-events: none;
    animation:
        float var(--float-dur) ease-in-out infinite,
        spin var(--spin-dur) linear infinite;
}

.floater-inner {
    width: 100%;
    height: 100%;
    clip-path: var(--hex-clip);
    background: var(--bg-secondary);
    position: relative;
    animation: pulse-glow var(--pulse-dur) ease-in-out infinite;
    box-shadow:
        0 0 8px rgba(var(--glow-color-r), var(--glow-color-g), var(--glow-color-b), 0.3),
        0 0 16px rgba(var(--glow-color-r), var(--glow-color-g), var(--glow-color-b), 0.1);
}

.floater-inner::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    clip-path: var(--hex-clip);
    background: rgba(var(--glow-color-r), var(--glow-color-g), var(--glow-color-b), 0.4);
    z-index: -1;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

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

@keyframes pulse-glow {
    0%, 100% {
        box-shadow:
            0 0 8px rgba(var(--glow-color-r), var(--glow-color-g), var(--glow-color-b), 0.3),
            0 0 16px rgba(var(--glow-color-r), var(--glow-color-g), var(--glow-color-b), 0.1);
    }
    50% {
        box-shadow:
            0 0 16px rgba(var(--glow-color-r), var(--glow-color-g), var(--glow-color-b), 0.6),
            0 0 32px rgba(var(--glow-color-r), var(--glow-color-g), var(--glow-color-b), 0.2);
    }
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    overflow: hidden;
    perspective: 800px;
}

#hero-cluster {
    position: relative;
    width: 380px;
    height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hero-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(4rem, 12vw, 9rem);
    letter-spacing: 0.06em;
    text-transform: lowercase;
    color: var(--text-primary);
    text-align: center;
    z-index: 5;
    position: relative;
    opacity: 0;
    transform: scale(0.9);
    text-shadow:
        0 0 20px rgba(255, 45, 123, 0.3),
        0 0 40px rgba(0, 240, 255, 0.2),
        0 0 80px rgba(108, 92, 231, 0.15);
}

#hero-title.visible {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Hero Hex Cells (Ring of 6) --- */
.hero-hex {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0;
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease;
}

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

/* Position the 6 hexes in a ring around center */
.hero-hex[data-index="0"] {
    top: 10px;
    left: 50%;
    margin-left: -40px;
}
.hero-hex[data-index="1"] {
    top: 70px;
    right: 20px;
}
.hero-hex[data-index="2"] {
    bottom: 70px;
    right: 20px;
}
.hero-hex[data-index="3"] {
    bottom: 10px;
    left: 50%;
    margin-left: -40px;
}
.hero-hex[data-index="4"] {
    bottom: 70px;
    left: 20px;
}
.hero-hex[data-index="5"] {
    top: 70px;
    left: 20px;
}

.hero-hex-bg {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    clip-path: var(--hex-clip);
    background: var(--hex-color);
    opacity: 0.5;
}

.hero-hex-inner {
    position: relative;
    width: 100%;
    height: 100%;
    clip-path: var(--hex-clip);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 0 20px rgba(108, 92, 231, 0.15);
}

.hero-hex svg {
    filter: drop-shadow(0 0 4px var(--hex-color));
}

/* Hero hex chasing glow animation */
.hero-hex::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    clip-path: var(--hex-clip);
    background: var(--hex-color);
    opacity: 0;
    z-index: -1;
    animation: hero-hex-chase 2.4s ease-in-out infinite;
    animation-delay: calc(var(--chase-delay, 0) * 400ms);
}

.hero-hex[data-index="0"]::after { --chase-delay: 0; }
.hero-hex[data-index="1"]::after { --chase-delay: 1; }
.hero-hex[data-index="2"]::after { --chase-delay: 2; }
.hero-hex[data-index="3"]::after { --chase-delay: 3; }
.hero-hex[data-index="4"]::after { --chase-delay: 4; }
.hero-hex[data-index="5"]::after { --chase-delay: 5; }

@keyframes hero-hex-chase {
    0%, 100% { opacity: 0.1; }
    16.67% { opacity: 0.6; }
    33.33% { opacity: 0.1; }
}

/* --- Content Section --- */
#content {
    position: relative;
    z-index: 10;
    padding: 60px 20px 120px;
}

/* --- Honeycomb Grid --- */
#honeycomb-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Hex Cell --- */
.hex-cell {
    position: relative;
    width: 220px;
    height: 220px;
    margin: -12px 6px;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    transform: translateY(40px);
    color: var(--hex-color, var(--text-primary));
}

.hex-cell.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Offset every other row for honeycomb stagger */
.hex-cell:nth-child(4n+3),
.hex-cell:nth-child(4n+4) {
    /* Handled by JS for proper honeycomb layout */
}

.hex-bg {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    clip-path: var(--hex-clip);
    background: var(--hex-color, var(--border-glow));
    opacity: 0.35;
    transition: opacity 0.3s ease;
}

.hex-inner {
    position: relative;
    width: 100%;
    height: 100%;
    clip-path: var(--hex-clip);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    gap: 4px;
    transition: background 0.3s ease;
}

/* Apply data-color as CSS variable */
.hex-cell[data-color="#ff2d7b"] { --hex-color: #ff2d7b; }
.hex-cell[data-color="#00f0ff"] { --hex-color: #00f0ff; }
.hex-cell[data-color="#ffb627"] { --hex-color: #ffb627; }
.hex-cell[data-color="#7aff3b"] { --hex-color: #7aff3b; }
.hex-cell[data-color="#6c5ce7"] { --hex-color: #6c5ce7; }

/* Neon glow shadows on hex cells - applied via pseudo since clip-path clips box-shadow */
.hex-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    clip-path: var(--hex-clip);
    box-shadow:
        inset 0 0 20px rgba(var(--glow-r, 108), var(--glow-g, 92), var(--glow-b, 231), 0.15);
    pointer-events: none;
    z-index: 2;
}

/* Per-color glow variables */
.hex-cell[data-color="#ff2d7b"] { --glow-r: 255; --glow-g: 45; --glow-b: 123; }
.hex-cell[data-color="#00f0ff"] { --glow-r: 0; --glow-g: 240; --glow-b: 255; }
.hex-cell[data-color="#ffb627"] { --glow-r: 255; --glow-g: 182; --glow-b: 39; }
.hex-cell[data-color="#7aff3b"] { --glow-r: 122; --glow-g: 255; --glow-b: 59; }
.hex-cell[data-color="#6c5ce7"] { --glow-r: 108; --glow-g: 92; --glow-b: 231; }

/* Hex cell icon */
.hex-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    transition: filter 0.3s ease;
}

.hex-icon svg {
    filter: drop-shadow(0 0 3px currentColor);
}

/* Hex cell label */
.hex-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    letter-spacing: 0.03em;
    color: var(--text-primary);
    text-align: center;
}

/* Hex cell category tag */
.hex-tag {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Hex cell ID code */
.hex-id {
    font-family: 'Ubuntu Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 2px;
}

/* Checkmark for activated badges */
.hex-check {
    position: absolute;
    top: 28%;
    right: 18%;
    opacity: 0;
    color: var(--hex-color, var(--neon-lime));
    transition: opacity 0.3s ease;
    z-index: 5;
    filter: drop-shadow(0 0 4px currentColor);
}

.hex-cell.activated .hex-check {
    opacity: 1;
}

/* Pulse ring on hover */
.hex-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%) scale(1);
    clip-path: var(--hex-clip);
    background: transparent;
    border: 2px solid var(--hex-color, var(--border-glow));
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.hex-cell.pulsing .hex-pulse {
    animation: hex-pulse-ring 0.4s ease-out forwards;
}

@keyframes hex-pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* Hover state - intensified glow */
.hex-cell:hover .hex-bg {
    opacity: 0.6;
}

.hex-cell:hover .hex-icon svg {
    filter: drop-shadow(0 0 8px currentColor) brightness(1.3);
}

.hex-cell:hover .hex-inner {
    background: rgba(26, 20, 51, 0.95);
}

/* Activated state - brighter border */
.hex-cell.activated .hex-bg {
    opacity: 0.55;
}

.hex-cell.activated .hex-label {
    color: var(--hex-color, var(--text-primary));
}

/* --- Honeycomb Grid Layout --- */
/* Desktop: 4 columns */
@media (min-width: 1025px) {
    #honeycomb-grid {
        max-width: 1050px;
    }

    .hex-cell {
        width: 220px;
        height: 220px;
    }

    /* Row offset for honeycomb pattern - handled in JS via data attributes */
    .hex-cell.hex-offset {
        margin-top: -36px;
        transform: translateX(110px) translateY(40px);
    }
    .hex-cell.hex-offset.revealed {
        transform: translateX(110px) translateY(0);
    }
}

/* Tablet: 3 columns */
@media (min-width: 768px) and (max-width: 1024px) {
    .hex-cell {
        width: 190px;
        height: 190px;
    }
    #honeycomb-grid {
        max-width: 700px;
    }
    .hex-cell.hex-offset {
        margin-top: -30px;
        transform: translateX(95px) translateY(40px);
    }
    .hex-cell.hex-offset.revealed {
        transform: translateX(95px) translateY(0);
    }
}

/* Mobile: 2 columns */
@media (max-width: 767px) {
    .hex-cell {
        width: 150px;
        height: 150px;
    }

    #honeycomb-grid {
        max-width: 380px;
    }

    .hex-cell.hex-offset {
        margin-top: -24px;
        transform: translateX(75px) translateY(40px);
    }
    .hex-cell.hex-offset.revealed {
        transform: translateX(75px) translateY(0);
    }

    #hero-cluster {
        width: 280px;
        height: 280px;
    }

    .hero-hex {
        width: 60px;
        height: 60px;
    }

    .hero-hex[data-index="0"] { top: 10px; }
    .hero-hex[data-index="1"] { top: 55px; right: 10px; }
    .hero-hex[data-index="2"] { bottom: 55px; right: 10px; }
    .hero-hex[data-index="3"] { bottom: 10px; }
    .hero-hex[data-index="4"] { bottom: 55px; left: 10px; }
    .hero-hex[data-index="5"] { top: 55px; left: 10px; }

    .hex-icon svg {
        width: 24px;
        height: 24px;
    }

    .hex-label {
        font-size: 0.8rem;
    }

    .hex-tag {
        font-size: 0.65rem;
    }

    .hex-id {
        font-size: 0.6rem;
    }
}

/* --- Scroll-based Hero Parallax --- */
#hero.scrolled .hero-hex[data-index="0"] {
    transform: translate(0, -30px) scale(0.9);
}
#hero.scrolled .hero-hex[data-index="1"] {
    transform: translate(30px, -15px) scale(0.9);
}
#hero.scrolled .hero-hex[data-index="2"] {
    transform: translate(30px, 15px) scale(0.9);
}
#hero.scrolled .hero-hex[data-index="3"] {
    transform: translate(0, 30px) scale(0.9);
}
#hero.scrolled .hero-hex[data-index="4"] {
    transform: translate(-30px, 15px) scale(0.9);
}
#hero.scrolled .hero-hex[data-index="5"] {
    transform: translate(-30px, -15px) scale(0.9);
}

#hero-title.fixed {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- Selection --- */
::selection {
    background: rgba(108, 92, 231, 0.4);
    color: var(--text-primary);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-glow);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
}
