/* ============================================
   dilemma.dev -- Desert Observatory
   ============================================ */

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

:root {
    /* Palette: Desert Observatory */
    --obsidian-soil: #1A120B;
    --deep-umber: #2B1F14;
    --sandstone: #6B4D30;
    --desert-gold: #D4A04A;
    --parchment: #F5EDE0;
    --warm-ash: #D9CCBA;
    --fossil: #8B7355;
    --dusk-indigo: #1E2A45;
    --twilight: #3A5A8C;
    --starfield: #7CA0D4;
    --ember: #C75B3A;
    --night-orchid: #2D1B4E;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--obsidian-soil);
    color: var(--warm-ash);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* --- Progress Bar --- */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: var(--desert-gold);
    z-index: 1000;
    transition: width 0.1s linear;
}

/* --- Bokeh Background Layer --- */
.bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.bokeh-circle.visible {
    opacity: 1;
}

/* --- Typography --- */
.display-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.light-on-dark {
    color: var(--parchment);
}

.dark-on-light {
    color: #2B1F14;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    color: var(--warm-ash);
}

.body-text--dark {
    color: var(--sandstone);
}

.accent-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--desert-gold);
    display: inline-block;
    margin-top: 12px;
}

.accent-label--muted {
    color: var(--fossil);
}

.marker-star {
    display: inline-block;
    font-size: 20px;
    color: var(--desert-gold);
    text-shadow: 0 0 8px rgba(212, 160, 74, 0.5);
    margin-bottom: 8px;
}

/* --- Hero Section (Stratum One) --- */
.stratum-one {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 80px 32px 60px;
}

.hero-content {
    text-align: center;
    margin-bottom: 60px;
}

.hero-star-wrap {
    margin-bottom: 32px;
    opacity: 0;
}

.hero-star {
    display: block;
    margin: 0 auto;
}

#hero-star-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke 3s ease;
}

.hero-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 96px;
    letter-spacing: -0.03em;
    color: var(--parchment);
    line-height: 1;
    margin-bottom: 16px;
    min-height: 1.1em;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
}

.hero-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 400;
    color: var(--desert-gold);
    letter-spacing: 0.04em;
    min-height: 1.5em;
    opacity: 0;
}

.hero-subtitle .char {
    display: inline;
    opacity: 0;
}

/* --- Bento Grid Base --- */
.bento-grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    gap: 12px;
    position: relative;
    z-index: 1;
}

/* --- Stratum One Grid --- */
.bento-grid--threshold {
    grid-template-columns: repeat(12, 1fr);
    margin-top: 40px;
}

.bento-grid--threshold .cell-panoramic {
    grid-column: span 8;
    min-height: 280px;
}

.bento-grid--threshold .cell-square {
    grid-column: span 3;
    min-height: 280px;
}

.bento-grid--threshold .cell-sliver {
    grid-column: span 1;
    min-height: 280px;
}

/* --- Stratum Two Grid --- */
.stratum-two {
    position: relative;
    z-index: 1;
    padding: 80px 0;
}

.bento-grid--branches {
    grid-template-columns: repeat(12, 1fr);
}

.bento-grid--branches .cell-wide {
    grid-column: span 8;
    min-height: 300px;
}

.bento-grid--branches .cell-square {
    grid-column: span 4;
    min-height: 300px;
}

.bento-grid--branches .cell-sliver {
    grid-column: span 1;
    min-height: 300px;
}

.bento-grid--branches .cell-panoramic {
    grid-column: span 7;
    min-height: 300px;
}

/* Row 3 of branches: sliver(1) + panoramic(7) + square(4) = 12 */
.bento-grid--branches .cell-square:nth-child(7) {
    grid-column: span 4;
}

/* --- Stratum Three Grid --- */
.stratum-three {
    position: relative;
    z-index: 1;
    padding: 80px 0 120px;
}

.bento-grid--convergence {
    grid-template-columns: repeat(12, 1fr);
}

.cell-choice {
    grid-column: span 6;
    min-height: 400px;
    cursor: pointer;
    transition: background-color 0.5s ease, filter 0.5s ease, box-shadow 0.5s ease;
}

.cell-full {
    grid-column: span 12;
    min-height: 350px;
}

/* --- Cell Base Styles --- */
.bento-cell {
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cell backgrounds by temperature */
.cell-warm {
    background-color: var(--deep-umber);
}

.cell-cool {
    background-color: var(--dusk-indigo);
}

.cell-dark {
    background-color: var(--obsidian-soil);
    border: 1px solid rgba(139, 115, 85, 0.15);
}

.cell-light {
    background-color: var(--parchment);
}

.cell-night {
    background-color: var(--night-orchid);
}

.cell-choice-warm {
    background-color: var(--deep-umber);
}

.cell-choice-cool {
    background-color: var(--dusk-indigo);
}

/* Hover interactions for choice cells */
.cell-choice-warm.intensified {
    background-color: var(--sandstone);
    box-shadow: inset 0 0 60px rgba(212, 160, 74, 0.1);
}

.cell-choice-warm.dimmed {
    filter: saturate(0.5) brightness(0.7);
}

.cell-choice-cool.intensified {
    background-color: var(--twilight);
    box-shadow: inset 0 0 60px rgba(124, 160, 212, 0.1);
}

.cell-choice-cool.dimmed {
    filter: saturate(0.5) brightness(0.7);
}

/* --- Decorative Borders (select cells) --- */
.bento-grid--branches .cell-wide,
.bento-grid--branches .cell-panoramic,
.bento-grid--convergence .cell-choice,
.bento-grid--convergence .cell-full {
    border: 1px dashed rgba(139, 115, 85, 0.3);
}

/* --- Corner Accents --- */
.cell-corner {
    position: absolute;
    width: 6px;
    height: 6px;
    z-index: 2;
}

.cell-corner.tl {
    top: 4px;
    left: 4px;
    border-top: 1px solid var(--desert-gold);
    border-left: 1px solid var(--desert-gold);
}

.cell-corner.tr {
    top: 4px;
    right: 4px;
    border-top: 1px solid var(--desert-gold);
    border-right: 1px solid var(--desert-gold);
}

.cell-corner.bl {
    bottom: 4px;
    left: 4px;
    border-bottom: 1px solid var(--desert-gold);
    border-left: 1px solid var(--desert-gold);
}

.cell-corner.br {
    bottom: 4px;
    right: 4px;
    border-bottom: 1px solid var(--desert-gold);
    border-right: 1px solid var(--desert-gold);
}

/* --- Cell Content --- */
.cell-content {
    padding: 32px;
    position: relative;
    z-index: 1;
    width: 100%;
}

.cell-content.centered {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cell-content h2 {
    font-size: 56px;
    margin-bottom: 16px;
}

.cell-panoramic .cell-content h2,
.cell-full .cell-content h2 {
    font-size: 72px;
}

.cell-square .cell-content h2 {
    font-size: 48px;
}

.cell-content .body-text {
    max-width: 560px;
}

.cell-content.centered .body-text {
    max-width: 400px;
}

.closing-text {
    max-width: 640px;
    font-size: 20px;
    line-height: 1.7;
}

/* --- Canvas Elements --- */
.gen-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Micro Stars --- */
.micro-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.micro-star {
    position: absolute;
    width: 5px;
    height: 5px;
}

.micro-star svg {
    width: 100%;
    height: 100%;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

/* --- Reveal Animation (Stratum One cells) --- */
.cell-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* --- Slide Animation (Stratum Two & Three cells) --- */
.cell-slide {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.cell-slide[data-dir="left"] {
    transform: translateX(-30px);
}

.cell-slide[data-dir="right"] {
    transform: translateX(30px);
}

.cell-slide.visible {
    opacity: 1;
    transform: translateX(0);
}

/* --- Pulse Attention Animation --- */
@keyframes pulseAttention {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(212, 160, 74, 0); }
    50% { transform: scale(1.02); box-shadow: 0 0 12px rgba(212, 160, 74, 0.15); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(212, 160, 74, 0); }
}

.bento-cell.pulse {
    animation: pulseAttention 0.4s ease-out;
}

/* --- Star color cycle for hero star --- */
@keyframes starColorCycle {
    0%, 100% { stroke: #D4A04A; }
    50% { stroke: #7CA0D4; }
}

#hero-star-path.animate-color {
    animation: starColorCycle 8s ease-in-out infinite;
}

/* --- Warm glow on warm cells for depth --- */
.cell-warm::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 30% 50%, rgba(212, 160, 74, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

/* --- Cool glow on cool cells for depth --- */
.cell-cool::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 70% 50%, rgba(124, 160, 212, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .hero-title {
        font-size: 56px;
    }

    .bento-grid--threshold,
    .bento-grid--branches,
    .bento-grid--convergence {
        grid-template-columns: repeat(6, 1fr);
    }

    .bento-grid--threshold .cell-panoramic,
    .bento-grid--branches .cell-wide,
    .bento-grid--branches .cell-panoramic {
        grid-column: span 6;
    }

    .bento-grid--threshold .cell-square,
    .bento-grid--branches .cell-square {
        grid-column: span 3;
    }

    .bento-grid--threshold .cell-sliver,
    .bento-grid--branches .cell-sliver {
        grid-column: span 6;
        min-height: 120px;
    }

    .cell-choice {
        grid-column: span 6;
        min-height: 320px;
    }

    .cell-full {
        grid-column: span 6;
    }

    .cell-content h2 {
        font-size: 40px;
    }

    .cell-panoramic .cell-content h2,
    .cell-full .cell-content h2 {
        font-size: 48px;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 40px;
    }

    .bento-grid--threshold,
    .bento-grid--branches,
    .bento-grid--convergence {
        grid-template-columns: 1fr;
    }

    .bento-grid--threshold .cell-panoramic,
    .bento-grid--threshold .cell-square,
    .bento-grid--threshold .cell-sliver,
    .bento-grid--branches .cell-wide,
    .bento-grid--branches .cell-square,
    .bento-grid--branches .cell-sliver,
    .bento-grid--branches .cell-panoramic,
    .cell-choice,
    .cell-full {
        grid-column: span 1;
        min-height: 240px;
    }

    .bento-grid--threshold .cell-sliver,
    .bento-grid--branches .cell-sliver {
        min-height: 100px;
    }

    .cell-content h2 {
        font-size: 32px;
    }

    .cell-panoramic .cell-content h2,
    .cell-full .cell-content h2 {
        font-size: 36px;
    }

    .cell-content {
        padding: 24px;
    }

    .closing-text {
        font-size: 17px;
    }
}
