/* ============================================
   PPADDL.com - Victorian Astronomical Observatory
   Color Palette:
   - Deep Background (Midnight Walnut): #1B1520
   - Panel Background dark (Observatory Black): #0D0A11
   - Panel Background light (Aged Parchment): #E8DCC8
   - Primary Accent (Tarnished Brass): #C9A96E
   - Secondary Accent (Celestial Teal): #5B8A8A
   - Text on dark (Faded Ivory): #D4C5A9
   - Text on light (Deep Umber): #3A2E26
   - Highlight/Glow (Star White): #F0E6D0
   - Ornament Detail (Oxidized Copper): #6B7B6A
   - Alert/Energy (Comet Rose): #B5706A
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #D4C5A9;
    background: #0D0A11;
    overflow-x: hidden;
}

/* --- Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    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)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

#main-nav.scrolled {
    background: rgba(13, 10, 17, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-logo {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #C9A96E;
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B7D6B;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #F0E6D0;
}

.nav-bullet {
    color: #C9A96E;
    font-size: 0.5rem;
    opacity: 0.5;
}

.nav-ornament {
    height: 1px;
    background: linear-gradient(to right, transparent, #C9A96E 20%, #C9A96E 80%, transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

#main-nav.scrolled .nav-ornament {
    opacity: 0.3;
}

/* --- Scene Base --- */
.scene {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.scene-split {
    display: grid;
    background: radial-gradient(ellipse at center, #1B1520, #0D0A11);
}

.scene-split[data-ratio="60-40"] {
    grid-template-columns: 3fr 0 2fr;
}

.scene-split[data-ratio="40-60"] {
    grid-template-columns: 2fr 0 3fr;
}

.scene-split[data-ratio="55-45"] {
    grid-template-columns: 11fr 0 9fr;
}

/* --- Background Decorative Characters --- */
.scene-bg-char {
    position: absolute;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 25vw;
    color: #C9A96E;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}

/* --- Panels --- */
.panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 4rem 3rem;
    z-index: 1;
}

.panel-dark {
    background: transparent;
}

.panel-parchment {
    background: #E8DCC8;
    color: #3A2E26;
}

.panel-content {
    position: relative;
    z-index: 2;
    max-width: 500px;
}

/* --- Corner Brackets --- */
.corner-bracket {
    position: absolute;
    width: 80px;
    height: 80px;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.corner-bracket.visible {
    opacity: 1;
}

.corner-tl { top: 1rem; left: 1rem; }
.corner-tr { top: 1rem; right: 1rem; }
.corner-bl { bottom: 1rem; left: 1rem; }
.corner-br { bottom: 1rem; right: 1rem; }

/* --- SVG Ornament Path Animation --- */
.ornament-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ornament-path.drawn {
    stroke-dashoffset: 0;
}

.constellation-lines line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.constellation-lines.drawn line {
    stroke-dashoffset: 0;
}

/* Stagger constellation line animations */
.constellation-lines.drawn line:nth-child(1) { transition-delay: 0s; }
.constellation-lines.drawn line:nth-child(2) { transition-delay: 0.15s; }
.constellation-lines.drawn line:nth-child(3) { transition-delay: 0.3s; }
.constellation-lines.drawn line:nth-child(4) { transition-delay: 0.45s; }
.constellation-lines.drawn line:nth-child(5) { transition-delay: 0.6s; }
.constellation-lines.drawn line:nth-child(6) { transition-delay: 0.75s; }
.constellation-lines.drawn line:nth-child(7) { transition-delay: 0.9s; }
.constellation-lines.drawn line:nth-child(8) { transition-delay: 1.05s; }
.constellation-lines.drawn line:nth-child(9) { transition-delay: 1.2s; }
.constellation-lines.drawn line:nth-child(10) { transition-delay: 1.35s; }
.constellation-lines.drawn line:nth-child(11) { transition-delay: 1.5s; }
.constellation-lines.drawn line:nth-child(12) { transition-delay: 1.65s; }
.constellation-lines.drawn line:nth-child(13) { transition-delay: 1.8s; }
.constellation-lines.drawn line:nth-child(14) { transition-delay: 1.95s; }
.constellation-lines.drawn line:nth-child(15) { transition-delay: 2.1s; }
.constellation-lines.drawn line:nth-child(16) { transition-delay: 2.25s; }
.constellation-lines.drawn line:nth-child(17) { transition-delay: 2.4s; }

/* --- Ornamental Divider --- */
.ornamental-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 5;
    pointer-events: none;
    width: 40px;
}

.scene-split[data-ratio="60-40"] .ornamental-divider {
    left: calc(60% - 20px);
}

.scene-split[data-ratio="40-60"] .ornamental-divider {
    left: calc(40% - 20px);
}

.scene-split[data-ratio="55-45"] .ornamental-divider {
    left: calc(55% - 20px);
}

.divider-svg {
    width: 100%;
    height: 100%;
}

.divider-flourish {
    animation: dividerSway 8s ease-in-out infinite;
    transform-origin: center center;
}

@keyframes dividerSway {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(2px); }
    75% { transform: translateX(-2px); }
}

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

.star {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #F0E6D0, transparent);
    box-shadow: 0 0 4px rgba(240, 230, 208, 0.4);
    animation: twinkle var(--twinkle-duration, 3s) ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
}

@keyframes twinkle {
    0%, 100% { opacity: var(--star-max-opacity, 1); }
    50% { opacity: 0.4; }
}

/* --- Typography --- */
.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: 0.15em;
    color: #F0E6D0;
    text-align: center;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.title-line {
    display: block;
}

.hero-subtitle {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B7D6B;
    text-align: center;
    margin-bottom: 1rem;
}

.hero-tagline {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.125rem;
    color: #D4C5A9;
    text-align: center;
    opacity: 0.85;
}

.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: clamp(2rem, 3.5vw, 3rem);
    letter-spacing: -0.02em;
    color: #F0E6D0;
    margin-bottom: 1rem;
}

.section-heading-dark {
    color: #3A2E26;
}

.body-text {
    font-family: 'Lora', serif;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #D4C5A9;
    margin-bottom: 1.5rem;
}

.drop-cap {
    float: left;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 4em;
    line-height: 0.8;
    margin-right: 0.1em;
    margin-top: 0.05em;
    color: #C9A96E;
    text-shadow: 0 0 20px rgba(201, 169, 110, 0.3);
}

.callout-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    line-height: 1.5;
    color: #F0E6D0;
    margin-bottom: 2rem;
}

/* --- Ornamental Rules --- */
.ornamental-rule {
    width: 100%;
    max-width: 300px;
    margin: 1rem 0 2rem;
}

.ornamental-rule svg {
    width: 100%;
    height: auto;
}

.ornamental-rule-dark svg line { stroke: #8B7D6B; }
.ornamental-rule-dark svg path { fill: #8B7D6B; }
.ornamental-rule-dark svg circle { fill: #3A2E26; }

.ornamental-rule-wide {
    max-width: 500px;
    margin: 1.5rem auto 2.5rem;
}

.ornamental-rule-wide svg {
    width: 100%;
    height: auto;
}

/* --- Animated Border Frame (Scene 1) --- */
.animated-border-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 2rem);
    max-width: 500px;
    height: calc(100% - 4rem);
    max-height: 400px;
    pointer-events: none;
    z-index: 0;
}

.border-frame-svg {
    width: 100%;
    height: 100%;
}

.observatory-text-panel .panel-content {
    position: relative;
    z-index: 2;
}

/* --- Observatory Door (Scene 1) --- */
.observatory-door-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.observatory-door-image {
    position: relative;
    z-index: 2;
}

.door-arch {
    width: 280px;
    height: 420px;
}

.door-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 30px rgba(201, 169, 110, 0.1));
}

/* --- Constellation Map (Scene 2) --- */
.constellation-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.constellation-svg {
    width: 80%;
    max-width: 600px;
    height: auto;
}

.mag-star {
    filter: drop-shadow(0 0 6px rgba(240, 230, 208, 0.6));
    transition: transform 0.1s linear;
}

.starchart-panel {
    padding: 2rem;
}

/* --- Instruments Grid (Scene 3) --- */
.instruments-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: 2rem;
    z-index: 2;
    position: relative;
}

.instrument-vignette {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: default;
}

.vignette-border {
    position: relative;
    width: 140px;
    height: 140px;
}

.vignette-border svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.vignette-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #C9A96E;
    box-shadow: 0 0 20px rgba(201, 169, 110, 0.15);
    overflow: hidden;
}

.instrument-icon {
    font-size: 2rem;
    color: #C9A96E;
    opacity: 0.8;
}

.instrument-label {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B7D6B;
    text-align: center;
}

.tilt-frame {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
    perspective: 800px;
}

/* --- Compass Rose Divider --- */
.compass-rose-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    background: radial-gradient(ellipse at center, #1B1520, #0D0A11);
}

.compass-rose-svg {
    width: 120px;
    height: 120px;
    opacity: 0.7;
}

/* --- Scene 4: Celestial Atlas (Full Bleed) --- */
.scene-fullbleed {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #1B1520, #0D0A11);
    min-height: 100vh;
}

.atlas-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.atlas-constellation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.atlas-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

.atlas-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(3rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    color: #F0E6D0;
    text-shadow: 0 0 40px rgba(240, 230, 208, 0.15);
    margin-bottom: 1rem;
}

.atlas-subtitle {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B7D6B;
}

/* --- Scene 5: Correspondence --- */
.correspondence-text-panel .panel-content {
    max-width: 520px;
}

.parchment-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.7' numOctaves='3' type='fractalNoise'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 100px 100px;
    pointer-events: none;
}

.testimonial {
    position: relative;
    margin-bottom: 2.5rem;
    padding-left: 2rem;
    border-left: 2px solid #8B7D6B;
}

.testimonial p {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #3A2E26;
    margin-bottom: 0.75rem;
}

.testimonial cite {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8B7D6B;
    font-style: normal;
}

.crescent-marker {
    position: absolute;
    left: -1.5rem;
    top: 0;
    font-size: 1rem;
    color: #C9A96E;
    transform: translateX(-50%);
}

/* --- Portrait Frame (Scene 5) --- */
.correspondence-portrait-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.portrait-frame {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.portrait-oval-frame {
    width: 300px;
    height: 375px;
    filter: drop-shadow(0 0 20px rgba(201, 169, 110, 0.1));
}

.portrait-caption {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B7D6B;
    margin-top: 1.5rem;
    text-align: center;
}

/* --- Scene 6: Grand Finale --- */
.scene-fullwidth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, #1B1520, #0D0A11);
    position: relative;
}

.finale-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.finale-border-svg {
    width: 100%;
    height: 100%;
}

.finale-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 700px;
    padding: 4rem 2rem;
}

.finale-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 5vw, 4rem);
    letter-spacing: -0.02em;
    color: #F0E6D0;
    text-shadow: 0 0 30px rgba(240, 230, 208, 0.1);
    margin-bottom: 0.5rem;
}

.finale-statement {
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    line-height: 1.9;
    color: #D4C5A9;
    margin-bottom: 3rem;
}

.finale-cta {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    padding: 1rem 2rem;
    border: 1px solid #C9A96E;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.finale-cta:hover {
    background: rgba(201, 169, 110, 0.08);
    box-shadow: 0 0 20px rgba(201, 169, 110, 0.15);
}

.cta-text {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #C9A96E;
}

.cta-arrow {
    width: 40px;
    height: 20px;
}

/* --- Finale Particles --- */
#finale-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.finale-particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #F0E6D0, transparent);
    box-shadow: 0 0 6px rgba(240, 230, 208, 0.4);
    pointer-events: none;
    transition: transform 0.3s ease-out;
}

/* --- Fade Up Animation --- */
.fade-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger fade-ups */
.fade-up:nth-child(2) { transition-delay: 0.1s; }
.fade-up:nth-child(3) { transition-delay: 0.2s; }
.fade-up:nth-child(4) { transition-delay: 0.3s; }
.fade-up:nth-child(5) { transition-delay: 0.4s; }

/* --- Scale In Animation for images --- */
.scale-in {
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.scale-in.visible {
    transform: scale(1);
    opacity: 1;
}

/* --- Wallpaper Pattern on Select Dark Panels --- */
.starchart-panel::before,
.instruments-grid-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23C9A96E' stroke-width='0.5'%3E%3Cpath d='M30 5 L35 15 L30 12 L25 15 Z'/%3E%3Ccircle cx='30' cy='30' r='8'/%3E%3Cpath d='M15 30 C20 25 25 22 30 22 C35 22 40 25 45 30 C40 35 35 38 30 38 C25 38 20 35 15 30'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* --- Photography Treatment --- */
.photo-treated {
    filter: sepia(15%) saturate(80%) brightness(95%);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .scene-split {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto;
    }

    .ornamental-divider {
        position: relative;
        left: 0 !important;
        width: 100%;
        height: 60px;
        transform: rotate(90deg);
    }

    .divider-svg {
        width: 100%;
        height: 100%;
    }

    .panel {
        min-height: 60vh;
        padding: 3rem 1.5rem;
    }

    .nav-links {
        display: none;
    }

    .instruments-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .corner-bracket {
        width: 50px;
        height: 50px;
    }

    .portrait-oval-frame {
        width: 220px;
        height: 275px;
    }

    .scene-bg-char {
        font-size: 40vw;
    }
}

@media (max-width: 480px) {
    .scene-bg-char {
        display: none;
    }

    .instruments-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .vignette-border {
        width: 100px;
        height: 100px;
    }

    .vignette-inner {
        width: 78px;
        height: 78px;
    }

    .hero-title {
        font-size: 2rem;
        letter-spacing: 0.08em;
    }

    .panel {
        padding: 2rem 1rem;
    }

    .atlas-title {
        font-size: 2.5rem;
    }

    .finale-heading {
        font-size: 2rem;
    }

    .starchart-panel::before,
    .instruments-grid-panel::before {
        display: none;
    }
}
