/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Palette */
    --bg-void: #0a0a0a;
    --bg-cell: #111111;
    --bg-cell-active: #1a1a1a;
    --gold-primary: #c9a84c;
    --gold-secondary: #8b7332;
    --gold-highlight: #e8d088;
    --text-primary: #ededed;
    --text-secondary: #888888;
    --error-red: #ff3b3b;
    --tech-blue: #4a8cc9;
    --glow-gold: rgba(201, 168, 76, 0.08);
    
    /* Fonts */
    --font-display: 'Nunito Sans', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-void);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== HONEYCOMB GRID SYSTEM ===== */
.honeycomb-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2px;
    padding: clamp(2rem, 5vw, 4rem);
    max-width: 1600px;
    margin: 0 auto;
}

/* Honeycomb cell base styling */
.hex-cell {
    position: relative;
    aspect-ratio: 1;
    background-color: var(--bg-cell);
    border: 2px solid var(--gold-primary);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hero cells */
.hex-cell.hero-cell {
    grid-column: span 2;
    background-color: var(--bg-cell-active);
    border-opacity: 1;
}

.hex-cell.hero-cell h1,
.hex-cell.hero-cell h2 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    letter-spacing: 0.04em;
    color: var(--gold-highlight);
}

/* Content cells */
.hex-cell.content-cell {
    border-opacity: 0.5;
    background-color: var(--bg-cell);
}

.hex-cell.content-cell p {
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    line-height: 1.6;
    color: var(--text-primary);
}

.hex-cell.content-cell .label {
    font-family: var(--font-mono);
    color: var(--gold-primary);
    font-weight: 600;
    font-size: 0.9em;
}

/* Accent cells */
.hex-cell.accent-cell {
    border: none;
    box-shadow: inset 0 0 20px rgba(201, 168, 76, 0.1);
    background-color: var(--bg-cell);
}

.hex-cell.accent-cell svg {
    width: 100%;
    height: 100%;
    max-width: 120px;
    max-height: 120px;
}

/* Empty cells */
.hex-cell.empty-cell {
    border: 1px solid rgba(201, 168, 76, 0.1);
    background-color: var(--bg-cell);
    opacity: 0.5;
    animation: pulse-dormant 4s ease-in-out infinite;
}

@keyframes pulse-dormant {
    0%, 100% { opacity: 0.02; }
    50% { opacity: 0.05; }
}

/* Odd row offset for hexagon pattern */
.honeycomb-container > :nth-child(odd) {
    transform: translateY(50%);
}

/* ===== SHAKE ERROR ANIMATION ===== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.hex-cell.shake-error {
    animation: shake 300ms;
    border-color: var(--error-red);
}

/* ===== HERO SECTION ===== */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-void);
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4rem);
}

#hero .honeycomb-container {
    width: 100%;
    animation: fadeIn 1s ease-out 0.5s both;
}

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

.hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.04em;
    color: var(--gold-highlight);
    text-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
    animation: titleTypeIn 2s cubic-bezier(0.16, 1, 0.3, 1) 1s both;
}

@keyframes titleTypeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== HONEYCOMB INITIALIZATION ===== */
#honeycomb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-void);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: overlayFadeOut 0.5s ease-out 3s forwards;
}

@keyframes overlayFadeOut {
    from { opacity: 1; }
    to { opacity: 0; pointer-events: none; }
}

#crystal-seed {
    width: 200px;
    height: 200px;
    opacity: 0;
    animation: seedPulse 1.5s ease-out 0.5s forwards;
}

@keyframes seedPulse {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 0.6;
        transform: scale(1);
    }
}

/* ===== GOLD SEPARATOR ===== */
.gold-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 6vh, 4rem) 0;
    background-color: var(--bg-void);
}

.gold-separator svg {
    width: 60px;
    height: 60px;
    animation: separatorFade 1s ease-out 0.5s both;
}

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

/* ===== CONTENT SECTIONS ===== */
.content-section {
    background-color: var(--bg-void);
    padding: clamp(3rem, 8vh, 6rem) clamp(1rem, 3vw, 2rem);
    min-height: 80vh;
}

.content-section[data-section] {
    animation: sectionFadeIn 0.8s ease-out both;
}

@keyframes sectionFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.final-section {
    padding-bottom: clamp(5rem, 12vh, 8rem);
}

/* ===== COLOR SWATCHES ===== */
.color-swatch {
    width: 100%;
    height: 60px;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* ===== ERROR CODE DISPLAY ===== */
.error-code-display {
    font-family: var(--font-mono);
    color: var(--tech-blue);
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ===== SVG MOTIFS ===== */
.circuit-diagram {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hex-subgrid {
    stroke-linecap: round;
}

.wave-function {
    filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.1));
}

.mobile-indicator {
    stroke-linecap: round;
}

.warning-x {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hexagon-pattern {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== FOOTER ===== */
#site-footer {
    background-color: var(--bg-cell);
    padding: clamp(3rem, 6vh, 5rem) clamp(2rem, 5vw, 4rem);
    text-align: center;
    border-top: 1px solid rgba(201, 168, 76, 0.3);
}

.footer-honeycomb {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto clamp(2rem, 4vh, 3rem);
}

.hex-cell.footer-cell {
    aspect-ratio: auto;
    clip-path: none;
    border: 1px solid rgba(201, 168, 76, 0.3);
    padding: 2rem;
    background-color: rgba(201, 168, 76, 0.05);
    transform: none !important;
}

.footer-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    letter-spacing: 0.03em;
    color: var(--gold-highlight);
    margin-bottom: 1rem;
}

.footer-text {
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    color: var(--text-secondary);
    line-height: 1.8;
}

.footer-copyright {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    border-top: 1px solid rgba(201, 168, 76, 0.2);
    padding-top: 2rem;
}

/* ===== HOVER STATES ===== */
.hex-cell:hover {
    background-color: var(--bg-cell-active);
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.2);
    cursor: pointer;
}

.hex-cell.content-cell:hover,
.hex-cell.accent-cell:hover {
    border-color: var(--gold-highlight);
    transform: scale(1.05);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .honeycomb-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: clamp(1.5rem, 4vw, 2.5rem);
    }
    
    .hex-cell {
        aspect-ratio: auto;
        clip-path: none;
        border-radius: 12px;
        min-height: 120px;
        border-top: 4px solid var(--gold-primary);
        border-right: 1px solid rgba(201, 168, 76, 0.3);
        border-bottom: 1px solid rgba(201, 168, 76, 0.3);
        border-left: 1px solid rgba(201, 168, 76, 0.3);
    }
    
    .hex-cell.hero-cell {
        grid-column: span 1;
    }
    
    .honeycomb-container > :nth-child(odd) {
        transform: none;
    }
    
    .hex-cell.content-cell:hover {
        transform: translateY(-4px);
    }
    
    .hex-cell.empty-cell {
        display: none;
    }
    
    #hero .honeycomb-container {
        padding: clamp(1.5rem, 4vw, 2rem);
    }
}

@media (max-width: 480px) {
    .honeycomb-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: clamp(1rem, 3vw, 1.5rem);
    }
    
    .hex-cell {
        padding: 1rem;
        min-height: 100px;
    }
    
    .hex-cell.hero-cell h1,
    .hex-cell.hero-cell h2 {
        font-size: clamp(1.2rem, 5vw, 1.5rem);
    }
    
    .content-section {
        padding: clamp(2rem, 5vh, 3rem) clamp(0.75rem, 2vw, 1.5rem);
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-void: #0a0a0a;
        --bg-cell: #111111;
    }
}

/* ===== UTILITY CLASSES ===== */
.tech-accent {
    color: var(--tech-blue);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.gold-text {
    color: var(--gold-primary);
    font-family: var(--font-display);
}

.glowing-text {
    text-shadow: 0 0 10px rgba(201, 168, 76, 0.5);
}
