/* ============================================
   lunar.bar - Styles
   Swiss-precision meets celestial romance
   ============================================ */

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

:root {
    --deep-space: #0B1026;
    --crater-blue: #141B3D;
    --starlight-amber: #C4A265;
    --lunar-silver: #D8DEE9;
    --nebula-violet: #5B4A7A;
    --horizon-glow: #E8B87D;
    --void-black: #060914;
    --crater-dust: #7B8BA8;
    --elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background: var(--void-black);
    color: var(--lunar-silver);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.65;
    overflow-x: hidden;
}

/* --- Navigation: Moon Phase Dots --- */
#spread-nav {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#spread-nav.visible {
    opacity: 1;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid var(--crater-dust);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.nav-dot:hover {
    border-color: var(--starlight-amber);
}

.nav-dot .dot-fill {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--lunar-silver);
    transform: scale(0);
    transition: transform 0.4s var(--elastic);
}

.nav-dot.active .dot-fill {
    transform: scale(1);
}

/* --- Horizon Line --- */
#horizon-line {
    position: fixed;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--starlight-amber);
    opacity: 0.15;
    z-index: 50;
    pointer-events: none;
}

/* --- Spread Base --- */
.spread {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: var(--deep-space);
}

/* --- Binding Gap --- */
.binding-gap {
    width: 100%;
    height: 16px;
    background: var(--void-black);
}

/* --- Star Field --- */
.star-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.star {
    position: absolute;
    width: 1px;
    height: 1px;
    background: var(--lunar-silver);
    border-radius: 50%;
    animation: twinkle var(--twinkle-dur, 6s) ease-in-out var(--twinkle-delay, 0s) infinite alternate;
}

.star.large {
    width: 2px;
    height: 2px;
}

@keyframes twinkle {
    0% { opacity: var(--twinkle-min, 0.1); }
    100% { opacity: var(--twinkle-max, 0.6); }
}

/* ============================================
   SPREAD 1: Opening
   ============================================ */
.spread-opening {
    background: var(--deep-space);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 2;
}

.opening-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding-top: 18vh;
}

.opening-lunar {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: clamp(5rem, 15vw, 12rem);
    letter-spacing: 0.2em;
    color: var(--lunar-silver);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s var(--ease-out-expo) 0.3s forwards;
}

.opening-bar {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(5rem, 15vw, 12rem);
    letter-spacing: 0.2em;
    color: var(--starlight-amber);
    opacity: 0;
    transform: translateY(30px) scale(1.05);
    animation: elasticIn 1s var(--elastic) 0.8s forwards;
}

.opening-line {
    display: block;
    width: 60%;
    height: 2px;
    margin: 2rem auto;
    opacity: 0;
    animation: fadeIn 0.5s ease 1.5s forwards;
}

.opening-line line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 1.2s var(--ease-out-expo) 1.6s forwards;
}

.opening-tagline {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1rem;
    color: var(--crater-dust);
    max-width: 480px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 1s ease 2.2s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes elasticIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

/* ============================================
   SPREAD 2 & 3: Content Spreads
   ============================================ */
.spread-grid {
    position: relative;
    z-index: 10;
    display: grid;
    height: 100%;
    padding: 0 48px 0 72px;
    gap: 24px;
}

.spread-grid.left-text {
    grid-template-columns: 2fr 3fr;
}

.spread-grid.right-text {
    grid-template-columns: 3fr 2fr;
}

.spread-text-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 24px;
}

.spread-headline {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.4rem);
    letter-spacing: -0.02em;
    color: var(--lunar-silver);
    margin-bottom: 24px;
}

.spread-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.65;
    color: var(--crater-dust);
    margin-bottom: 16px;
}

.spread-image-col {
    position: relative;
    display: flex;
    align-items: stretch;
}

.duotone-image {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Lunar surface image - CSS generated duotone gradient */
.lunar-surface-img {
    background:
        linear-gradient(135deg, var(--crater-blue) 0%, transparent 50%),
        linear-gradient(225deg, var(--starlight-amber) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 40%, #2a2f54 0%, var(--crater-blue) 40%, var(--deep-space) 70%),
        radial-gradient(circle at 70% 60%, #1e2448 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, #0d1230 0%, transparent 40%),
        radial-gradient(circle at 20% 70%, #161d3f 0%, transparent 30%),
        radial-gradient(circle at 80% 30%, #1a2245 0%, transparent 35%);
    background-color: var(--crater-blue);
}

/* Observatory interior image */
.observatory-img {
    background:
        linear-gradient(45deg, var(--crater-blue) 0%, transparent 60%),
        linear-gradient(180deg, transparent 20%, var(--deep-space) 90%),
        radial-gradient(ellipse at 50% 20%, #2d3460 0%, var(--crater-blue) 50%, var(--deep-space) 80%),
        radial-gradient(circle at 50% 40%, #1f264a 0%, transparent 40%),
        radial-gradient(circle at 30% 60%, #151c3a 0%, transparent 35%),
        radial-gradient(circle at 70% 50%, #1a2144 0%, transparent 30%);
    background-color: var(--crater-blue);
}

.image-grain {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.15'/%3E%3C/svg%3E");
    background-size: 128px 128px;
    mix-blend-mode: overlay;
    opacity: 0.5;
    pointer-events: none;
}

/* Constellation decoration */
.constellation-decoration {
    position: absolute;
    top: 10%;
    left: -40px;
    width: 80px;
    height: 200px;
    pointer-events: none;
    z-index: 5;
}

/* --- Pull Quote --- */
.pull-quote-gutter {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    z-index: 15;
    white-space: nowrap;
}

.pull-quote-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    letter-spacing: 0.04em;
    color: var(--starlight-amber);
    opacity: 0.7;
}

/* --- Moon Phase Divider --- */
.moon-phase-divider {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 12px;
    z-index: 20;
}

.moon-phase {
    width: 16px;
    height: 16px;
}

/* --- Spread Footer --- */
.spread-footer {
    position: absolute;
    bottom: 24px;
    right: 48px;
    z-index: 10;
}

.spread-number-watermark {
    position: absolute;
    right: 0;
    bottom: 0;
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: 8rem;
    color: var(--lunar-silver);
    opacity: 0.06;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.spread-attribution {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--crater-dust);
    position: relative;
    z-index: 1;
}

/* ============================================
   SPREAD 4: Menu Board
   ============================================ */
.spread-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 72px;
}

.crater-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    pointer-events: none;
    z-index: 1;
}

.crater-rings::before,
.crater-rings::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--nebula-violet);
    opacity: 0.2;
}

.crater-rings::before {
    inset: 0;
}

.crater-rings::after {
    inset: 60px;
}

.menu-header {
    position: relative;
    z-index: 10;
    text-align: center;
    margin-bottom: 48px;
}

.menu-grid {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px 48px;
    max-width: 1100px;
    width: 100%;
}

.menu-item {
    padding: 24px 0;
}

.menu-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.3rem);
    letter-spacing: -0.02em;
    color: var(--lunar-silver);
    margin-bottom: 12px;
}

.menu-separator {
    width: 100%;
    height: 1px;
    background: var(--starlight-amber);
    opacity: 0.5;
    margin-bottom: 12px;
}

.menu-desc {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    line-height: 1.6;
    color: var(--crater-dust);
}

/* ============================================
   SPREAD 5: Closing
   ============================================ */
.spread-closing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--void-black);
}

.star-field-dense .star {
    animation-duration: 3s;
}

.constellation-full {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.closing-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 680px;
    padding: 0 24px;
}

.closing-headline {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    letter-spacing: -0.02em;
    color: var(--lunar-silver);
    margin-bottom: 24px;
    line-height: 1.3;
}

.closing-line {
    display: block;
    width: 40%;
    height: 2px;
    margin: 0 auto 24px;
}

.closing-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 1rem;
    color: var(--crater-dust);
    font-style: italic;
}

/* --- Scroll to Top --- */
.scroll-to-top {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.scroll-to-top:hover {
    opacity: 0.7;
}

.scroll-label {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--starlight-amber);
    text-transform: lowercase;
}

/* ============================================
   Reveal Animations
   ============================================ */
.reveal-el {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.7s var(--ease-out-expo), transform 0.8s var(--elastic);
}

.right-text .reveal-el {
    transform: translateX(30px);
}

.reveal-el.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger children */
.reveal-group .reveal-el:nth-child(1) { transition-delay: 0s; }
.reveal-group .reveal-el:nth-child(2) { transition-delay: 0.2s; }
.reveal-group .reveal-el:nth-child(3) { transition-delay: 0.4s; }
.reveal-group .reveal-el:nth-child(4) { transition-delay: 0.6s; }

/* Menu item stagger */
.menu-grid .menu-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-out-expo), transform 0.7s var(--elastic);
}

.menu-grid .menu-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.menu-grid .menu-item:nth-child(1) { transition-delay: 0s; }
.menu-grid .menu-item:nth-child(2) { transition-delay: 0.1s; }
.menu-grid .menu-item:nth-child(3) { transition-delay: 0.2s; }
.menu-grid .menu-item:nth-child(4) { transition-delay: 0.3s; }
.menu-grid .menu-item:nth-child(5) { transition-delay: 0.4s; }
.menu-grid .menu-item:nth-child(6) { transition-delay: 0.5s; }

/* ============================================
   Constellation SVG Lines
   ============================================ */
.constellation-line {
    stroke: var(--starlight-amber);
    stroke-width: 0.5;
    opacity: 0.3;
}

.constellation-node {
    fill: var(--starlight-amber);
    r: 1.5;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .spread-grid.left-text,
    .spread-grid.right-text {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .spread-image-col {
        min-height: 30vh;
    }

    .spread-text-col {
        padding: 24px 0;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .spread-menu {
        padding: 48px 24px;
    }

    .pull-quote-gutter {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        text-align: center;
        padding: 24px;
        white-space: normal;
    }

    #spread-nav {
        left: 8px;
    }

    .opening-lunar,
    .opening-bar {
        letter-spacing: 0.1em;
    }

    .moon-phase-divider {
        display: none;
    }
}
