/* ============================================================
   relativity.quest v2 - Styles
   Cinematic | Magazine-spread | Midnight-blue | Slide-reveal
   ============================================================ */

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

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

body {
    background: #0A1628;
    color: #C8D0D8;
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: #E8DFD0;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

h1 {
    font-size: clamp(40px, 7vw, 96px);
}

h2 {
    font-size: clamp(32px, 5vw, 72px);
    margin-bottom: 0.6em;
}

h3 {
    font-size: clamp(22px, 2.4vw, 32px);
    margin-bottom: 0.4em;
}

p {
    margin-bottom: 1.1em;
    max-width: 56ch;
}

em, .italic {
    font-style: italic;
    color: #E8DFD0;
}

.mono, .label, .timestamp {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #D4A855;
}

.equation {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: clamp(28px, 4vw, 44px);
    color: #D4A855;
    margin: 0.6em 0;
    letter-spacing: 0.02em;
}

a {
    color: #D4A855;
    text-decoration: none;
    border-bottom: 1px solid rgba(212, 168, 85, 0.3);
    transition: border-color 0.3s ease, color 0.3s ease;
}

a:hover, a:focus {
    color: #E8DFD0;
    border-bottom-color: #E8DFD0;
}

/* --- Starfield Background (re-usable) --- */
.starfield {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.starfield .star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #C8D0D8;
    border-radius: 50%;
}

/* --- Slide-reveal mechanic --- */
.slide-reveal {
    position: relative;
    overflow: hidden;
}

.slide-reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #0A1628;
    transform-origin: right center;
    transform: scaleX(1);
    transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 5;
    pointer-events: none;
}

.slide-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 2px;
    background: #D4A855;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.4s ease 0s;
    z-index: 6;
    box-shadow: 0 0 12px rgba(212, 168, 85, 0.6);
}

.slide-reveal.visible::after {
    transform: scaleX(0);
}

.slide-reveal.visible::before {
    transform: scaleY(0);
    transition: transform 0.4s ease 0.6s;
}

/* --- Marble columns (left/right viewport edges) --- */
.marble-column {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 60px;
    z-index: 2;
    opacity: 0;
    transition: opacity 1s ease 0.5s;
    pointer-events: none;
}

.marble-column.visible {
    opacity: 1;
}

.marble-column-left { left: 0; }
.marble-column-right { right: 0; transform: scaleX(-1); }

.marble-column svg {
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    .marble-column { display: none; }
}

/* --- Premiere Shot --- */
.premiere {
    position: relative;
    min-height: 100vh;
    background: #0A1628;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 60px;
}

.premiere-inner {
    position: relative;
    z-index: 3;
    max-width: 1100px;
    width: 100%;
    text-align: center;
}

.premiere-mark {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.4em;
    color: #6B7B8B;
    margin-bottom: 32px;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.3s forwards;
}

.premiere-wordmark {
    font-family: 'Playfair Display', serif;
    font-size: clamp(48px, 10vw, 132px);
    font-weight: 700;
    color: #E8DFD0;
    line-height: 0.95;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeIn 1s ease 1.2s forwards;
}

.premiere-wordmark .dot {
    color: #D4A855;
    font-style: italic;
    font-weight: 400;
}

.premiere-wordmark .quest {
    font-style: italic;
    font-weight: 400;
    color: #D4A855;
}

.premiere-tagline {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(18px, 2vw, 26px);
    color: #C8D0D8;
    max-width: 640px;
    margin: 0 auto 36px;
    opacity: 0;
    animation: fadeIn 1s ease 1.6s forwards;
}

.premiere-meta {
    display: flex;
    justify-content: center;
    gap: 36px;
    flex-wrap: wrap;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #6B7B8B;
    opacity: 0;
    animation: fadeIn 1s ease 1.9s forwards;
}

.premiere-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.premiere-meta span::before {
    content: '';
    width: 18px;
    height: 1px;
    background: #D4A855;
}

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

/* Hero astronomical photo (sepia-treated SVG illustration) */
.premiere-photo {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    opacity: 0.18;
    filter: sepia(0.3) contrast(0.85) brightness(0.95);
    animation: photoReveal 1.4s ease 0.8s forwards;
}

.premiere-photo svg {
    width: min(80vw, 900px);
    height: auto;
}

@keyframes photoReveal {
    from { opacity: 0; }
    to { opacity: 0.18; }
}

/* Scroll cue */
.scroll-cue {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.3em;
    color: #6B7B8B;
    z-index: 4;
    opacity: 0;
    animation: fadeIn 1s ease 2.4s forwards;
    text-transform: uppercase;
}

.scroll-cue::after {
    content: '';
    display: block;
    width: 1px;
    height: 30px;
    background: linear-gradient(to bottom, #D4A855, transparent);
    margin: 12px auto 0;
}

/* --- Section base --- */
section {
    position: relative;
}

.section-padding {
    padding: clamp(80px, 12vh, 160px) clamp(40px, 8vw, 120px);
}

/* --- Frieze divider (between sections) --- */
.frieze-divider {
    width: 100%;
    height: 24px;
    margin: 0;
    overflow: hidden;
}

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

/* --- Magazine Spread --- */
.spread {
    background: #0A1628;
    position: relative;
    z-index: 1;
}

.spread:nth-child(even) {
    background: #14243A;
}

.spread-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    min-height: 80vh;
    align-items: center;
}

.spread.reversed .spread-grid {
    grid-template-areas: "img text";
}

.spread.reversed .spread-text { grid-area: text; }
.spread.reversed .spread-image { grid-area: img; }

@media (max-width: 900px) {
    .spread-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .spread.reversed .spread-grid {
        grid-template-areas: "text" "img";
    }
}

.spread-text {
    padding: 20px 0;
}

.spread-label {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #D4A855;
    margin-bottom: 22px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(212, 168, 85, 0.3);
    width: fit-content;
}

.spread-text h2 {
    margin-bottom: 24px;
    color: #E8DFD0;
}

.spread-text p {
    color: #C8D0D8;
    margin-bottom: 1.2em;
}

.pull-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(20px, 2vw, 26px);
    color: #E8DFD0;
    border-left: 2px solid #D4A855;
    padding: 4px 0 4px 24px;
    margin: 28px 0;
    line-height: 1.5;
}

.spread-image {
    position: relative;
    padding: 20px 0;
}

.image-frame {
    position: relative;
    background: #14243A;
    padding: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.spread:nth-child(even) .image-frame {
    background: #0A1628;
}

.image-frame::before, .image-frame::after {
    content: '';
    position: absolute;
    background: #6B7B8B;
    opacity: 0.4;
}

.image-frame::before {
    top: 0; left: 0; right: 0;
    height: 3px;
}

.image-frame::after {
    bottom: 0; left: 0; right: 0;
    height: 3px;
}

.frame-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #D4A855;
}

.frame-corner.tl { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.frame-corner.tr { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
.frame-corner.bl { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }
.frame-corner.br { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }

.spread-illustration {
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(0.3) contrast(0.85) brightness(0.95);
}

.image-caption {
    margin-top: 16px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #8B7B68;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* --- Time Dilation Gallery (horizontal scroll) --- */
.gallery {
    background: #0A1628;
    padding: clamp(80px, 12vh, 140px) 0 clamp(80px, 12vh, 140px);
    position: relative;
    overflow: hidden;
}

.gallery-header {
    max-width: 1280px;
    margin: 0 auto clamp(50px, 6vh, 80px);
    padding: 0 clamp(40px, 8vw, 120px);
}

.gallery-header h2 {
    margin-bottom: 16px;
}

.gallery-header p {
    color: #C8D0D8;
    max-width: 60ch;
}

.gallery-track {
    display: flex;
    gap: 32px;
    padding: 0 clamp(40px, 8vw, 120px) 28px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: #D4A855 #14243A;
}

.gallery-track::-webkit-scrollbar {
    height: 6px;
}

.gallery-track::-webkit-scrollbar-track {
    background: #14243A;
}

.gallery-track::-webkit-scrollbar-thumb {
    background: #D4A855;
    border-radius: 3px;
}

.gallery-card {
    flex: 0 0 320px;
    background: #14243A;
    scroll-snap-align: start;
    position: relative;
    border: 1px solid rgba(107, 123, 139, 0.2);
}

.gallery-card-photo {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #0A1628;
    overflow: hidden;
}

.gallery-card-photo svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: sepia(0.3) contrast(0.85) brightness(0.95);
}

.gallery-card-body {
    padding: 24px 24px 28px;
}

.gallery-card-num {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #D4A855;
    margin-bottom: 10px;
}

.gallery-card h3 {
    font-size: 22px;
    color: #E8DFD0;
    margin-bottom: 10px;
    line-height: 1.2;
}

.gallery-card p {
    font-size: 14px;
    color: #C8D0D8;
    line-height: 1.7;
    margin-bottom: 14px;
}

.gallery-card .equation {
    font-size: 18px;
    margin: 8px 0 0;
}

.gallery-cue {
    max-width: 1280px;
    margin: 24px auto 0;
    padding: 0 clamp(40px, 8vw, 120px);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #6B7B8B;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.gallery-cue::before {
    content: '\2192  ';
    color: #D4A855;
}

/* --- Equation Marquee --- */
.marquee {
    background: #14243A;
    padding: clamp(60px, 8vh, 110px) 0;
    overflow: hidden;
    border-top: 1px solid rgba(107, 123, 139, 0.2);
    border-bottom: 1px solid rgba(107, 123, 139, 0.2);
    position: relative;
}

.marquee-track {
    display: flex;
    gap: 80px;
    white-space: nowrap;
    animation: marquee 38s linear infinite;
    align-items: center;
}

.marquee-item {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(40px, 6vw, 88px);
    color: #E8DFD0;
    opacity: 0.92;
    flex-shrink: 0;
}

.marquee-item .glyph-sep {
    color: #D4A855;
    font-style: normal;
    margin: 0 36px;
    font-size: 0.6em;
    vertical-align: middle;
}

@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .marquee-track {
        animation: none;
    }
    .premiere-mark, .premiere-wordmark, .premiere-tagline, .premiere-meta, .scroll-cue {
        opacity: 1 !important;
        animation: none !important;
    }
    .slide-reveal::after {
        transition-duration: 0.01s;
    }
}

/* --- Footnotes / Bibliography --- */
.footnotes {
    background: #0A1628;
    padding: clamp(80px, 10vh, 120px) clamp(40px, 8vw, 120px);
    position: relative;
}

.footnotes-grid {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 60px;
}

@media (max-width: 800px) {
    .footnotes-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }
}

.footnotes-grid h2 {
    font-size: clamp(28px, 3.5vw, 44px);
}

.footnote-list {
    list-style: none;
    counter-reset: footnote;
}

.footnote-list li {
    counter-increment: footnote;
    position: relative;
    padding: 18px 0 18px 56px;
    border-bottom: 1px solid rgba(107, 123, 139, 0.2);
}

.footnote-list li:last-child { border-bottom: 0; }

.footnote-list li::before {
    content: counter(footnote, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 22px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: #D4A855;
}

.footnote-year {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #8B7B68;
    margin-right: 14px;
    letter-spacing: 0.16em;
}

.footnote-title {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: #E8DFD0;
    font-size: 18px;
}

.footnote-author {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    color: #C8D0D8;
}

/* --- Observatory Footer --- */
.observatory {
    background: #050D1A;
    padding: clamp(80px, 10vh, 120px) clamp(40px, 8vw, 120px) 60px;
    position: relative;
    overflow: hidden;
    border-top: 1px solid rgba(107, 123, 139, 0.2);
}

.observatory-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 3;
}

.observatory-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(24px, 3vw, 38px);
    color: #E8DFD0;
    line-height: 1.4;
    margin-bottom: 16px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.observatory-attrib {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.24em;
    color: #D4A855;
    text-transform: uppercase;
    margin-bottom: 60px;
}

.observatory-attrib::before {
    content: '\2014  ';
}

.observatory-meta {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.16em;
    color: #6B7B8B;
    text-transform: uppercase;
}

.observatory-meta span strong {
    display: block;
    color: #C8D0D8;
    font-weight: 400;
    margin-top: 4px;
    letter-spacing: 0.1em;
}

.observatory-frieze {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    height: 14px;
    z-index: 1;
    opacity: 0.3;
}

.observatory-frieze svg {
    width: 100%;
    height: 100%;
}

.observatory-columns {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    opacity: 0.2;
}

.observatory-columns svg {
    height: 100%;
    width: 80px;
}

/* --- Equation list inline --- */
.inline-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin: 18px 0 28px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #6B7B8B;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.inline-meta span {
    padding: 4px 10px;
    border: 1px solid rgba(107, 123, 139, 0.3);
}

.inline-meta span strong {
    color: #D4A855;
    font-weight: 400;
    margin-left: 6px;
}

/* --- Reduced motion safety --- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .slide-reveal::after, .slide-reveal::before {
        transform: scaleX(0) scaleY(0);
        transition: none;
    }
}
