/* ============================================
   luminous.day — Victorian Astronomical Observatory
   ============================================ */

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

:root {
    /* Palette */
    --bg-primary: #0F1B2E;
    --bg-secondary: #162236;
    --text-primary: #E8DCC8;
    --text-secondary: #C4B8A6;
    --accent-teal: #7EC8C8;
    --accent-coral: #E87461;
    --accent-gold: #D4A847;
    --brass-trace: #8B7355;

    /* Typography sizes */
    --title-size: clamp(3rem, 7vw, 6rem);
    --body-size: clamp(1rem, 1.15vw, 1.2rem);
    --label-size: 0.75rem;

    /* Spacing (golden angle derived) */
    --space-a: 89px;
    --space-b: 144px;

    /* Cursor follow */
    --cx: 50%;
    --cy: 50%;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'opsz' 14, 'wght' 380;
    font-size: var(--body-size);
    line-height: 1.72;
    overflow-x: hidden;
}

/* --- Typography --- */
.title-display {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-weight: 400;
    font-size: var(--title-size);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-primary);
    text-shadow: 0 0 1px rgba(126, 200, 200, 0.4);
}

.section-title {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-primary);
    text-shadow: 0 0 1px rgba(126, 200, 200, 0.4);
    margin-bottom: 40px;
}

.body-text {
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'opsz' 14, 'wght' 380;
    font-size: var(--body-size);
    line-height: 1.72;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.data-label {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-weight: 400;
    font-size: var(--label-size);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-teal);
    opacity: 0.6;
}

/* --- Sections --- */
.section {
    position: relative;
    width: 100%;
}

.section--fullscreen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section--half {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section--column {
    padding: var(--space-b) 20px;
}

.section--fullbleed {
    padding: 0;
    overflow: hidden;
}

/* Alternating vertical rhythm */
.section:nth-child(odd) {
    padding-top: var(--space-a);
    padding-bottom: var(--space-b);
}

.section:nth-child(even) {
    padding-top: var(--space-b);
    padding-bottom: var(--space-a);
}

.section--fullscreen.section--fullbleed {
    padding-top: 0;
    padding-bottom: 0;
}

/* --- Observatory Column --- */
.observatory-column {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 2;
}

/* --- HUD Reticle Overlay --- */
#hud-reticle {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#hud-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hud-line {
    stroke: var(--accent-teal);
    stroke-width: 0.08;
    opacity: 0.3;
    transition: all 0.1s linear;
}

.hud-h {
    transform-origin: center;
    transform: translateY(calc(var(--cy) - 50%));
}

.hud-v {
    transform-origin: center;
    transform: translateX(calc(var(--cx) - 50%));
}

.hud-arc {
    fill: none;
    stroke: var(--accent-teal);
    stroke-width: 0.15;
    opacity: 0.3;
}

.hud-tick {
    stroke: var(--accent-teal);
    stroke-width: 0.1;
    opacity: 0.25;
}

#hud-coords {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.hud-label {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-teal);
    opacity: 0.6;
}

/* --- Twilight Section --- */
#twilight {
    background-color: var(--bg-primary);
    padding: 0;
}

.twilight-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

#site-title .letter {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.5s ease forwards;
}

#site-title .letter:nth-child(1) { animation-delay: 0ms; }
#site-title .letter:nth-child(2) { animation-delay: 150ms; }
#site-title .letter:nth-child(3) { animation-delay: 300ms; }
#site-title .letter:nth-child(4) { animation-delay: 450ms; }
#site-title .letter:nth-child(5) { animation-delay: 600ms; }
#site-title .letter:nth-child(6) { animation-delay: 750ms; }
#site-title .letter:nth-child(7) { animation-delay: 900ms; }
#site-title .letter:nth-child(8) { animation-delay: 1050ms; }
#site-title .letter:nth-child(9) { animation-delay: 1200ms; }
#site-title .letter:nth-child(10) { animation-delay: 1350ms; }
#site-title .letter:nth-child(11) { animation-delay: 1500ms; }
#site-title .letter:nth-child(12) { animation-delay: 1650ms; }

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

.twilight-tagline {
    max-width: 500px;
    text-align: center;
    opacity: 0;
    animation: fadeIn 1.5s ease forwards 2.2s;
}

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

/* Octagram */
.octagram {
    margin-top: 20px;
    opacity: 0;
    animation: fadeIn 2s ease forwards 2.5s;
}

.octagram-shape {
    fill: none;
    stroke: var(--accent-teal);
    stroke-width: 1.5;
    opacity: 0.7;
    animation: pulseOctagram 4s ease-in-out infinite;
}

@keyframes pulseOctagram {
    0%, 100% { opacity: 0.4; stroke-width: 1.5; }
    50% { opacity: 1; stroke-width: 2; }
}

/* --- Circuit Constellations --- */
.circuit-constellation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.circuit-line {
    stroke: var(--brass-trace);
    stroke-width: 1;
    opacity: 0.35;
}

.circuit-node {
    fill: var(--accent-teal);
    animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1.0; }
}

/* --- Blur-Focus Reveal --- */
.blur-focus {
    filter: blur(12px);
    opacity: 0.3;
    transition: filter 800ms ease, opacity 800ms ease;
}

.blur-focus.in-view {
    filter: blur(0px);
    opacity: 1;
}

/* --- Ornamental Frames --- */
.ornamental-frame {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 10px 0;
}

.ornamental-frame--top {
    margin-bottom: 30px;
}

.ornamental-frame--bottom {
    margin-top: 30px;
}

.ornament-path {
    fill: none;
    stroke: var(--brass-trace);
    stroke-width: 1;
    opacity: 0.5;
}

.ornament-diamond {
    fill: var(--brass-trace);
    opacity: 0.5;
}

.ornamental-divider {
    width: 100%;
    max-width: 400px;
    margin: 20px auto 30px;
    padding: 5px 0;
}

.ornament-diamond-shape {
    fill: var(--brass-trace);
    opacity: 0.5;
}

/* --- The Prism Section --- */
#the-prism {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.prism-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.prism-crystal {
    animation: crystallineRotate 30s linear infinite;
}

.crystal-wireframe {
    transform-origin: center;
}

.crystal-face {
    fill: none;
    stroke: var(--accent-teal);
    stroke-width: 0.8;
    opacity: 0.4;
}

.crystal-edge {
    stroke: var(--accent-teal);
    stroke-width: 0.5;
    opacity: 0.3;
}

.crystal-vertex {
    fill: var(--accent-coral);
    opacity: 0.9;
}

@keyframes crystallineRotate {
    to {
        transform: rotateY(360deg) rotateX(12deg);
    }
}

.prism-rays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.prism-ray {
    position: absolute;
    left: 55%;
    top: 50%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 20px;
    transform-origin: left center;
    transform: rotate(var(--ray-angle)) translateX(180px);
    white-space: nowrap;
}

.prism-ray .data-label {
    color: var(--ray-color);
    opacity: 0.8;
    font-size: 0.65rem;
}

.ray-text {
    font-family: 'Literata', Georgia, serif;
    font-size: 0.85rem;
    color: var(--ray-color);
    opacity: 0.7;
}

/* --- Scale Hover --- */
.scale-hover {
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scale-hover:hover {
    transform: rotate(var(--ray-angle, 0deg)) translateX(180px) scale(1.15);
}

/* --- Spectrum Band Section --- */
#spectrum-band {
    background: var(--bg-primary);
}

.spectrum-bands {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 2;
}

.spectrum-strip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    text-align: center;
    gap: 16px;
    background-color: color-mix(in srgb, var(--strip-color) 5%, var(--bg-primary));
    border-right: 1px solid rgba(139, 115, 85, 0.15);
    transition: background-color 0.3s ease;
}

.spectrum-strip:last-child {
    border-right: none;
}

.spectrum-strip .data-label {
    color: var(--strip-color);
    opacity: 0.8;
    font-size: 0.65rem;
}

.strip-text {
    font-family: 'Literata', Georgia, serif;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    opacity: 0.7;
    max-width: 140px;
}

#scanning-beam {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: var(--accent-teal);
    opacity: 0.4;
    z-index: 3;
    pointer-events: none;
    transition: left 0.05s linear;
}

/* --- Deep Field Section --- */
#deep-field {
    background: var(--bg-primary);
}

/* --- Zenith Section --- */
#zenith {
    background: var(--bg-primary);
    overflow: hidden;
}

.zenith-crystal {
    position: absolute;
    z-index: 1;
    opacity: 0.3;
}

.zenith-crystal--1 {
    top: 10%;
    right: 5%;
    animation: crystallineRotate 30s linear infinite;
}

.zenith-crystal--2 {
    bottom: 15%;
    left: 3%;
    animation: crystallineRotate 30s linear infinite reverse;
}

/* --- Convergence Section --- */
#convergence {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.convergence-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.convergence-crystal {
    animation: crystallineRotate 30s linear infinite reverse;
}

.convergence-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    z-index: 3;
}

.convergence-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    opacity: 0;
    transform: translateX(var(--conv-offset, 0px));
    transition: opacity 1s ease, transform 1s ease;
}

.convergence-item.converged {
    opacity: 1;
    transform: translateX(0);
}

.convergence-item--1 { --conv-offset: -200px; }
.convergence-item--2 { --conv-offset: 150px; }
.convergence-item--3 { --conv-offset: -120px; }
.convergence-item--4 { --conv-offset: 180px; }
.convergence-item--5 { --conv-offset: -160px; }

.convergence-item .data-label {
    color: var(--conv-color);
    opacity: 0.8;
}

.convergence-item .ray-text {
    color: var(--conv-color);
    opacity: 0.6;
    font-size: 0.9rem;
}

/* --- Dawn Section --- */
#dawn {
    background: linear-gradient(to bottom, var(--bg-primary), var(--bg-secondary));
    padding: var(--space-b) 20px;
}

.dawn-title {
    text-align: center;
    margin-bottom: 30px;
    opacity: 0.8;
}

.dawn-text {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .observatory-column {
        max-width: 100%;
        padding: 0 20px;
    }

    .prism-ray {
        left: 50%;
        transform: rotate(0deg) translateX(0);
        position: relative;
        white-space: normal;
        text-align: center;
        padding: 8px 16px;
    }

    .prism-rays {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 80px 20px;
    }

    .scale-hover:hover {
        transform: scale(1.05);
    }

    .spectrum-bands {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .spectrum-strip {
        border-right: none;
        border-bottom: 1px solid rgba(139, 115, 85, 0.15);
        padding: 30px 20px;
    }

    .strip-text {
        max-width: none;
    }

    .convergence-elements {
        position: relative;
        padding: 40px 20px;
    }

    .convergence-item {
        --conv-offset: 0px;
    }

    #hud-coords {
        bottom: 10px;
        right: 10px;
    }

    .hud-label {
        font-size: 0.6rem;
    }

    .zenith-crystal {
        display: none;
    }
}

@media (max-width: 480px) {
    :root {
        --title-size: clamp(2rem, 10vw, 3.5rem);
    }

    .section-title {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }

    .prism-center svg {
        width: 180px;
        height: 180px;
    }

    .convergence-center svg {
        width: 180px;
        height: 180px;
    }
}
