/* bada.day - A day at the sea
   Cinematic scroll-linked storytelling: dawn -> noon -> dusk -> night.
   The sky background is interpolated by JS through the day-arc palette.
*/

/* Design palette (interpolated via JS):
   Pre-Dawn:    #0a0e2a / #1a1040 (Indigo Night)
   Dawn:        #ff7b7b / #ffd4a0 (Coral Dawn / Peach Light)
   Morning:     #87ceeb / #f0f4f8 (Morning Blue / Misty White)
   Noon:        #e8f4f8 / #ffffff (Bright Noon / Pure White)
   Golden Hour: #ff8c42 / #ffd700 (Amber Gold / Sunset Gold)
   Dusk:        #6b2fa0 / #ff4757 (Twilight Purple / Dusk Red)
   Night:       #0a0e2a (Deep Night Blue)
   Horizon:     #c8c0b4 (Sand Line)
*/

:root {
    /* Sky gradient (updated by JS scroll handler) */
    --sky-top: #1a1040;
    --sky-bottom: #1a1040;
    --text-opacity: 1;
    --horizon-color: #c8c0b4;

    /* Day-arc palette references from DESIGN.md */
    --color-predawn: #0a0e2a;
    --color-indigo-night: #1a1040;
    --color-dawn-coral: #ff7b7b;
    --color-dawn-peach: #ffd4a0;
    --color-morning-blue: #87ceeb;
    --color-morning-mist: #f0f4f8;
    --color-noon: #e8f4f8;
    --color-pure-white: #ffffff;
    --color-golden-amber: #ff8c42;
    --color-golden-sun: #ffd700;
    --color-dusk-purple: #6b2fa0;
    --color-dusk-red: #ff4757;
    --color-night: #0a0e2a;
    --color-sand-line: #c8c0b4;

    /* Celestial body properties */
    --celestial-x: 50%;
    --celestial-y: -50px;
    --celestial-size: 20px;
    --celestial-color: #ffd700;
    --celestial-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    --celestial-opacity: 0;

    /* Stars */
    --stars-opacity: 1;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    color: #ffffff;
    background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.05s linear;
}

/* ─── Celestial body (sun/moon) ─── */
.celestial {
    position: fixed;
    width: var(--celestial-size);
    height: var(--celestial-size);
    border-radius: 50%;
    background: var(--celestial-color);
    box-shadow: var(--celestial-shadow);
    left: var(--celestial-x);
    top: var(--celestial-y);
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    opacity: var(--celestial-opacity);
    transition: opacity 0.4s ease, background 0.6s ease, box-shadow 0.6s ease;
    overflow: hidden;
}

/* Moon crescent overlay */
.celestial--moon::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: var(--sky-top);
    top: -10%;
    right: -20%;
}

/* ─── Persistent horizon line ─── */
.horizon {
    position: fixed;
    top: 65vh;
    left: 0;
    width: 100%;
    height: 6px;
    z-index: 5;
    pointer-events: none;
}

.horizon svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.horizon svg path {
    stroke: var(--horizon-color);
    transition: stroke 0.4s ease;
}

/* ─── Stars ─── */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65vh;
    z-index: 3;
    pointer-events: none;
    opacity: var(--stars-opacity);
    transition: opacity 0.4s ease;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ffffff;
    border-radius: 50%;
    opacity: 0.8;
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
    animation: twinkle 4s ease-in-out infinite;
}

.star--large {
    width: 3px;
    height: 3px;
    opacity: 1;
    box-shadow: 0 0 4px rgba(255, 255, 255, 1);
}

.star--dim {
    opacity: 0.4;
}

@keyframes twinkle {
    0%, 100% { opacity: var(--star-base, 0.8); }
    50%      { opacity: calc(var(--star-base, 0.8) * 0.4); }
}

/* ─── Hour indicator (scroll progress) ─── */
.hour-indicator {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 20;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, calc(var(--text-opacity, 1) * 0.6));
    pointer-events: none;
    transition: color 0.3s ease;
}

/* ─── Moment sections ─── */
.moment {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem;
}

.moment__content {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 2000ms ease, transform 2000ms ease;
    max-width: 80vw;
}

.moment__content.visible {
    opacity: var(--text-opacity, 1);
    transform: translateY(0);
}

/* Hero title (Cormorant Garamond) */
.moment__title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 8vw, 6rem);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, var(--text-opacity, 1));
}

.moment__subtitle {
    font-family: 'Spectral', serif;
    font-weight: 200;
    font-style: italic;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: rgba(255, 255, 255, calc(var(--text-opacity, 1) * 0.7));
    letter-spacing: 0.2em;
    margin-bottom: 2rem;
}

/* Memory phrases (Cormorant Garamond italic) */
.moment__phrase {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: normal;
    font-size: clamp(2rem, 6vw, 5rem);
    line-height: 1.3;
    color: rgba(255, 255, 255, var(--text-opacity, 1));
}

.moment__phrase em {
    font-style: italic;
    font-weight: 300;
}

/* Timestamps (Space Grotesk) */
.moment__time {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, calc(var(--text-opacity, 1) * 0.5));
    opacity: 0;
    transition: opacity 2000ms ease, color 0.4s ease;
}

.moment__content.visible ~ .moment__time {
    opacity: 1;
}

/* Accent text (Spectral italic) */
.moment__accent {
    font-family: 'Spectral', serif;
    font-weight: 200;
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    line-height: 1.8;
    color: rgba(255, 255, 255, calc(var(--text-opacity, 1) * 0.8));
    margin-top: 1rem;
}

/* Coda / ending */
.moment__coda {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.5rem, 4vw, 3rem);
    margin-top: 2rem;
    color: rgba(255, 255, 255, calc(var(--text-opacity, 1) * 0.6));
    letter-spacing: 0.1em;
}

/* ─── Bright sky text inversions (noon) ─── */
body.sky-bright .moment__phrase,
body.sky-bright .moment__title {
    color: rgba(10, 14, 42, var(--text-opacity, 1));
}

body.sky-bright .moment__subtitle,
body.sky-bright .moment__accent {
    color: rgba(10, 14, 42, calc(var(--text-opacity, 1) * 0.75));
}

body.sky-bright .moment__time,
body.sky-bright .hour-indicator {
    color: rgba(10, 14, 42, calc(var(--text-opacity, 1) * 0.5));
}

body.sky-bright .moment__coda {
    color: rgba(10, 14, 42, calc(var(--text-opacity, 1) * 0.6));
}

body.sky-bright .horizon svg path {
    stroke: #8b8378;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(200, 192, 180, 0.3);
    border-radius: 2px;
}

/* ─── Small screen adjustments ─── */
@media (max-width: 600px) {
    .moment__time {
        bottom: 1.5rem;
        right: 1.5rem;
        font-size: 0.8rem;
    }

    .moment {
        padding: 1.5rem;
    }

    .hour-indicator {
        top: 1rem;
        left: 1rem;
        font-size: 0.7rem;
    }
}
