/* ==========================================================================
   sora.day  --  one day's sky, observed dawn to dusk
   wabi-sabi, immersive-scroll, ma-negative-space
   ==========================================================================
   Palette (keyframes traversed by scroll):
     #0F0E2A  pre-dawn indigo
     #2D1B3D  dawn transition (derived)
     #6B3A5C  dawn accent / muted mauve
     #C77B6B  sunrise terracotta-rose
     #E8B89D  morning peach
     #D4E4F0  noon pale blue
     #F0F4F8  noon white-blue
     #F0DFC0  afternoon pale gold
     #E8C88A  afternoon golden-straw
     #C85A3A  sunset burnt orange
     #5C2840  dusk wine-purple
     #2A1530  late dusk plum
     #0A0A1A  night near-black blue
   Accents: #F5D6C3 morning scatter, #C8D0E0 stars, #8BA4B8 noon text,
            #E88A5C dusk arc, #8A4A3A horizon, #4A5568 shadow rect / dark text,
            #D8C8B8 cream text on dark bg.
   Fonts: Cormorant Garamond (display), EB Garamond (body),
          IBM Plex Mono (labels). The seed-listed names "sora", "space",
          "inter" are referenced conceptually; the elegant-serif stack
          above is the implementation per the design's typography section.
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    /* Total scroll height: 600vh of phases, body sized by sections. */
    min-height: 600vh;
    background-color: #0F0E2A;
    color: #D8C8B8;
    font-family: "EB Garamond", "Cormorant Garamond", Georgia, serif;
    font-size: 18px;
    line-height: 1.9;
    font-weight: 400;
    overflow-x: hidden;
    transition: color 1200ms ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.text-dark {
    color: #4A5568;
}

#diurnal-arc {
    position: relative;
    width: 100%;
}

/* ----- Phase sections -------------------------------------------------- */

.phase {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Each phase has a generous, asymmetric layout grid: ma negative space. */
.phase-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(720px, 80vw);
    text-align: center;
}

.phase-center-final {
    top: 70%;
}

.phase-content {
    position: absolute;
    max-width: 420px;
}

.phase-content-left {
    top: 50%;
    left: 15%;
    transform: translateY(-50%);
}

.phase-content-right {
    right: 15%;
    transform: translateY(-50%);
    text-align: right;
}

.phase-content-upper {
    top: 22%;
    transform: none;
}

.phase-content-lower {
    top: 70%;
    transform: none;
}

/* ----- Typography ------------------------------------------------------ */

.domain {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 300;
    font-size: clamp(56px, 8vw, 72px);
    letter-spacing: 0.01em;
    line-height: 1.1;
    color: inherit;
    margin-bottom: 2.4rem;
}

.meditation {
    font-family: "EB Garamond", Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.9;
    color: inherit;
    font-style: italic;
}

.meditation-center {
    text-align: center;
}

.meditation-right {
    text-align: right;
}

.meditation-noon {
    /* Deliberate near-illegibility against pale noon background. */
    color: #8BA4B8;
    font-size: 22px;
    letter-spacing: 0.02em;
    opacity: 0.85;
}

.meditation-final {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 300;
    font-style: normal;
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: 0.16em;
    color: #C8D0E0;
    opacity: 0.78;
}

.phase-label {
    position: absolute;
    top: 24px;
    left: 32px;
    font-family: "IBM Plex Mono", "Menlo", monospace;
    font-weight: 300;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: inherit;
    opacity: 0.45;
}

/* ----- SVG layers (cloud lines, scatter, shadows, stars) -------------- */

.cloud-layer,
.scatter-layer,
.shadow-layer,
.horizon-layer,
.star-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Cloud trace lines drift leftward at varying speeds. */
.cloud-line {
    transform-origin: center;
    will-change: transform;
}

@keyframes drift {
    from { transform: translateX(0); }
    to   { transform: translateX(-220px); }
}

.drift-slow {
    animation: drift 110s linear infinite;
}

.drift-medium {
    animation: drift 70s linear infinite;
    animation-delay: -20s;
}

.drift-fast {
    animation: drift 42s linear infinite;
    animation-delay: -8s;
}

/* Star pulses -- gentle scintillation. */
.star {
    transform-origin: center;
    will-change: opacity;
}

@keyframes pulse-a {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 0.55; }
}
@keyframes pulse-b {
    0%, 100% { opacity: 0.20; }
    50%      { opacity: 0.50; }
}
@keyframes pulse-c {
    0%, 100% { opacity: 0.30; }
    50%      { opacity: 0.45; }
}
@keyframes pulse-d {
    0%, 100% { opacity: 0.18; }
    50%      { opacity: 0.42; }
}

.pulse-a { animation: pulse-a 4.2s ease-in-out infinite; }
.pulse-b { animation: pulse-b 5.6s ease-in-out infinite; animation-delay: -1.4s; }
.pulse-c { animation: pulse-c 7.1s ease-in-out infinite; animation-delay: -2.8s; }
.pulse-d { animation: pulse-d 6.3s ease-in-out infinite; animation-delay: -3.6s; }

/* ----- Phase visibility (fade in/out as scroll enters phase) --------- */

.phase {
    opacity: 0;
    transition: opacity 800ms ease;
}

.phase.is-visible {
    opacity: 1;
}

/* The phase-label sits subtle; brightens slightly when active. */
.phase.is-active .phase-label {
    opacity: 0.7;
}

/* ----- Progress rail (right edge orientation marker) ----------------- */

.progress-rail {
    position: fixed;
    top: 10vh;
    right: 18px;
    width: 14px;
    height: 80vh;
    z-index: 50;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: rgba(200, 208, 224, 0.18);
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0%;
    background: #C8D0E0;
    transition: background-color 600ms ease, height 80ms linear;
}

.progress-readout {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: "IBM Plex Mono", "Menlo", monospace;
    font-weight: 300;
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #C8D0E0;
    opacity: 0.55;
    white-space: nowrap;
    transition: color 600ms ease, opacity 600ms ease;
}

/* ----- Per-phase tints for cloud lines, accents (purely cosmetic) ---- */

.phase-noon .cloud-line { stroke-opacity: 0.25; }

/* Hide native scrollbar look while keeping scroll functional. */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* ----- Responsive tightening on narrow viewports --------------------- */

@media (max-width: 720px) {
    body {
        font-size: 16px;
    }
    .phase-content,
    .phase-content-left,
    .phase-content-right {
        left: 8%;
        right: 8%;
        max-width: none;
        text-align: left;
        transform: translateY(-50%);
    }
    .phase-content-right {
        text-align: left;
    }
    .meditation-right {
        text-align: left;
    }
    .domain {
        font-size: clamp(44px, 14vw, 64px);
    }
    .progress-rail {
        right: 8px;
    }
}
