/* ========================================
   lrx.wiki - Art-Deco Celestial Observatory
   Color Palette (from DESIGN.md):
   - Aged Parchment:      #f5ead0
   - Observatory Midnight: #1a1520
   - Sepia Wash:          #e8d5b0
   - Ink Dark:            #2c2418
   - Faded Ink:           #6b5d4f
   - Warm Ivory:          #f0e6d0
   - Antique Gold:        #c8a84e
   - Tarnished Brass:     #8a7340
   - Celestial Amber:     #e6b84d
   - Deep Umber:          #3d2e1a
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    --aged-parchment: #f5ead0;
    --observatory-midnight: #1a1520;
    --sepia-wash: #e8d5b0;
    --ink-dark: #2c2418;
    --faded-ink: #6b5d4f;
    --warm-ivory: #f0e6d0;
    --antique-gold: #c8a84e;
    --tarnished-brass: #8a7340;
    --celestial-amber: #e6b84d;
    --deep-umber: #3d2e1a;
    --dome-dark: #110e18;
    --dome-mid: #2a2035;
    --white: #ffffff;

    --font-display: 'Poiret One', sans-serif;
    --font-secondary: 'Cormorant Garamond', serif;
    --font-body: 'IBM Plex Mono', monospace;

    --scroll: 0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--ink-dark);
    background-color: var(--aged-parchment);
    overflow-x: hidden;
}

/* --- Typography --- */
.section-heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-dark);
    margin-bottom: 2rem;
}

.section-heading--centered {
    text-align: center;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--ink-dark);
    margin-bottom: 1.5rem;
    max-width: 680px;
}

.pull-quote {
    font-family: var(--font-secondary);
    font-weight: 500;
    font-style: italic;
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
    letter-spacing: 0.02em;
    color: var(--tarnished-brass);
    border-left: 3px solid var(--antique-gold);
    padding: 1.5rem 2rem;
    margin: 2.5rem 0;
    position: relative;
}

.pull-quote__mark {
    font-family: var(--font-secondary);
    color: var(--antique-gold);
    font-size: 1.4em;
    line-height: 0;
    vertical-align: -0.15em;
}

/* ========================================
   OBSERVATORY DOME (Hero)
   ======================================== */
.dome {
    position: relative;
    width: 100%;
    height: 100vh;
    background: radial-gradient(ellipse at 50% 0%, var(--dome-mid) 0%, var(--observatory-midnight) 60%, var(--dome-dark) 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Star field layer */
.dome__starfield {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.dome__starfield .star {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: starFadeIn 200ms ease-out forwards;
}

@keyframes starFadeIn {
    from { opacity: 0; }
    to { opacity: var(--star-opacity, 0.5); }
}

/* Sunburst */
.dome__sunburst {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 120vmax;
    height: 120vmax;
    transform: translate(-50%, 50%);
    background: repeating-conic-gradient(
        from 0deg at 50% 100%,
        rgba(200, 168, 78, 0.08) 0deg,
        transparent 2deg,
        transparent 10deg
    );
    clip-path: circle(0% at 50% 100%);
    z-index: 2;
    opacity: 0;
    transition: none;
}

.dome__sunburst.animate {
    animation: sunburstReveal 1200ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes sunburstReveal {
    from {
        clip-path: circle(0% at 50% 100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    to {
        clip-path: circle(60% at 50% 100%);
        opacity: 1;
    }
}

/* Dome ripple rings */
.dome__ripple-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;
}

.dome__ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 400px;
    height: 400px;
    border-radius: 50%;
    border: 1px solid rgba(200, 168, 78, 0.2);
    opacity: 0;
}

.dome__ripple.active {
    animation: domeRippleExpand 6s ease-out infinite;
}

.dome__ripple--1.active { animation-delay: 0s; }
.dome__ripple--2.active { animation-delay: 2s; }
.dome__ripple--3.active { animation-delay: 4s; }

@keyframes domeRippleExpand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Dome content */
.dome__content {
    position: relative;
    z-index: 5;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dome__title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.8rem, 7vw, 6rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--antique-gold);
    opacity: 0;
    transform: translateY(20px);
}

.dome__title.animate {
    animation: titleReveal 800ms ease-out forwards;
}

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

.dome__divider {
    margin: 1.5rem 0;
    opacity: 0;
    transform: scaleX(0);
}

.dome__divider.animate {
    animation: dividerDraw 600ms ease-out forwards;
}

.chevron-divider {
    width: 300px;
    height: 20px;
}

@keyframes dividerDraw {
    from {
        opacity: 1;
        transform: scaleX(0);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

.dome__tagline {
    font-family: var(--font-secondary);
    font-weight: 500;
    font-style: italic;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    letter-spacing: 0.04em;
    color: var(--warm-ivory);
    opacity: 0;
}

.dome__tagline.animate {
    animation: fadeIn 600ms ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 0.8; }
}

/* Constellation overlay */
.dome__constellations {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Scroll indicator */
.dome__scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    opacity: 0;
    cursor: pointer;
}

.dome__scroll-indicator.animate {
    animation: scrollBounce 2s ease-in-out infinite;
    opacity: 0.5;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(4px); }
}

/* ========================================
   SECTION DIVIDERS
   ======================================== */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
    max-width: 1200px;
    margin: 0 auto;
    gap: 1rem;
}

.section-divider__line {
    flex: 1;
    height: 1px;
    background: var(--antique-gold);
    opacity: 0.3;
    transform: scaleX(0);
    transition: transform 500ms ease-out;
}

.section-divider__line--left {
    transform-origin: right center;
}

.section-divider__line--right {
    transform-origin: left center;
}

.section-divider.visible .section-divider__line {
    transform: scaleX(1);
}

.section-divider__star {
    width: 24px;
    height: 24px;
    transform: scale(0) rotate(0deg);
    transition: transform 500ms ease-out;
    flex-shrink: 0;
    animation: starPulse 4s ease-in-out infinite;
}

.section-divider.visible .section-divider__star {
    transform: scale(1) rotate(180deg);
}

@keyframes starPulse {
    0%, 100% {
        transform: scale(1) rotate(180deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.08) rotate(180deg);
        opacity: 0.85;
    }
}

/* ========================================
   READING DESK (Primary Content)
   ======================================== */
.reading-desk {
    background: linear-gradient(180deg, var(--aged-parchment) 0%, var(--sepia-wash) 100%);
    padding: clamp(4rem, 8vh, 8rem) 2rem;
    position: relative;
}

.reading-desk::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(200, 168, 78, 0.08) 100%);
    pointer-events: none;
}

.reading-desk__grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    position: relative;
}

.reading-desk__content {
    grid-column: 1 / 9;
}

.reading-desk__sidebar {
    grid-column: 9 / 12;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.reading-desk__sidebar.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Sidebar elements */
.sidebar__star-chart {
    padding: 0.5rem;
}

.star-chart-svg {
    width: 100%;
    height: auto;
}

.sidebar__ornament {
    padding: 1rem 0;
}

.art-deco-border {
    height: 60px;
    background:
        repeating-linear-gradient(135deg, var(--antique-gold) 0px, var(--antique-gold) 1px, transparent 1px, transparent 6px),
        repeating-linear-gradient(45deg, var(--antique-gold) 0px, var(--antique-gold) 1px, transparent 1px, transparent 6px);
    opacity: 0.25;
    border-top: 1px solid rgba(200, 168, 78, 0.4);
    border-bottom: 1px solid rgba(200, 168, 78, 0.4);
}

.sidebar__quote {
    text-align: center;
    padding: 1rem;
    border: 1px solid rgba(200, 168, 78, 0.3);
    position: relative;
}

.sidebar__quote::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 0.5px solid rgba(200, 168, 78, 0.15);
}

.sidebar__quote-text {
    font-family: var(--font-display);
    font-size: 0.95rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--tarnished-brass);
}

/* ========================================
   CARD CATALOG
   ======================================== */
.card-catalog {
    background: var(--sepia-wash);
    padding: clamp(4rem, 8vh, 8rem) 2rem;
}

.card-catalog__grid {
    max-width: 1200px;
    margin: 2rem auto 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* Catalog Card */
.catalog-card {
    position: relative;
    background: var(--aged-parchment);
    border: 1px solid rgba(200, 168, 78, 0.2);
    transition: transform 300ms ease-out, box-shadow 300ms ease-out;
    overflow: visible;
}

.catalog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(60, 46, 26, 0.15);
}

/* Corner flourishes */
.catalog-card__corner {
    position: absolute;
    width: 12px;
    height: 12px;
    transition: width 300ms ease-out, height 300ms ease-out;
    z-index: 2;
}

.catalog-card__corner--tl {
    top: -1px;
    left: -1px;
    border-left: 2px solid var(--antique-gold);
    border-top: 2px solid var(--antique-gold);
}

.catalog-card__corner--tr {
    top: -1px;
    right: -1px;
    border-right: 2px solid var(--antique-gold);
    border-top: 2px solid var(--antique-gold);
}

.catalog-card__corner--bl {
    bottom: -1px;
    left: -1px;
    border-left: 2px solid var(--antique-gold);
    border-bottom: 2px solid var(--antique-gold);
}

.catalog-card__corner--br {
    bottom: -1px;
    right: -1px;
    border-right: 2px solid var(--antique-gold);
    border-bottom: 2px solid var(--antique-gold);
}

.catalog-card:hover .catalog-card__corner {
    width: 20px;
    height: 20px;
}

.catalog-card__header {
    background: var(--sepia-wash);
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(200, 168, 78, 0.2);
}

.catalog-card__category {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--faded-ink);
}

.catalog-card__body {
    padding: 1.25rem;
}

.catalog-card__title {
    font-family: var(--font-secondary);
    font-weight: 500;
    font-style: italic;
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    letter-spacing: 0.02em;
    color: var(--ink-dark);
    margin-bottom: 0.75rem;
}

.catalog-card__text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    line-height: 1.7;
    color: var(--faded-ink);
}

.catalog-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(200, 168, 78, 0.15);
}

.catalog-card__meta {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.7rem, 0.8vw, 0.8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--faded-ink);
}

.catalog-card__star {
    color: var(--antique-gold);
    font-size: 1rem;
    animation: starPulseSmall 4s ease-in-out infinite;
}

@keyframes starPulseSmall {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
}

/* Card ripple effect */
.catalog-card .card-ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 168, 78, 0.2) 0%, transparent 70%);
    transform: scale(0);
    animation: cardRipple 600ms ease-out forwards;
    pointer-events: none;
    z-index: 1;
}

@keyframes cardRipple {
    from {
        transform: scale(0);
        opacity: 0.3;
    }
    to {
        transform: scale(1);
        opacity: 0;
    }
}

/* Card entry animation */
.catalog-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 500ms ease-out, transform 500ms ease-out, box-shadow 300ms ease-out;
}

.catalog-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.catalog-card:hover {
    transform: translateY(-4px);
}

/* ========================================
   METHODS SECTION
   ======================================== */
.methods-section {
    background: linear-gradient(180deg, var(--aged-parchment) 0%, var(--sepia-wash) 100%);
    padding: clamp(4rem, 8vh, 8rem) 2rem;
}

.methods-section__container {
    max-width: 1200px;
    margin: 0 auto;
}

.methods-section__columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-top: 2rem;
}

.methods-section__column {
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.methods-section__column.visible {
    opacity: 1;
    transform: translateY(0);
}

.method-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
}

.method-icon svg {
    width: 100%;
    height: 100%;
}

.method-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-dark);
    margin-bottom: 1rem;
}

.methods-section .body-text {
    max-width: none;
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    color: var(--faded-ink);
}

/* ========================================
   LOGBOOK FOOTER
   ======================================== */
.logbook-footer {
    background: var(--observatory-midnight);
    padding: clamp(4rem, 8vh, 6rem) 2rem clamp(2rem, 4vh, 3rem);
    position: relative;
    overflow: hidden;
}

/* Ruled lines background */
.logbook-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        180deg,
        transparent 0px,
        transparent calc(1.8rem - 1px),
        rgba(200, 168, 78, 0.08) calc(1.8rem - 1px),
        rgba(200, 168, 78, 0.08) 1.8rem
    );
    pointer-events: none;
}

.logbook-footer__content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.logbook-footer__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.4rem 0;
    line-height: 1.8rem;
}

.logbook-footer__row--credits {
    justify-content: center;
    padding: 0.25rem 0;
}

.logbook-footer__label {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--faded-ink);
}

.logbook-footer__value {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--warm-ivory);
    letter-spacing: 0.02em;
}

.logbook-footer__divider {
    width: 100%;
    height: 1px;
    background: rgba(200, 168, 78, 0.2);
    margin: 1rem 0;
}

.logbook-footer__credit {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.7rem, 0.8vw, 0.8rem);
    letter-spacing: 0.04em;
    color: var(--faded-ink);
}

.logbook-footer__constellation {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    z-index: 0;
    pointer-events: none;
}

/* ========================================
   RETURN TO DOME BUTTON
   ======================================== */
.return-to-dome {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(200, 168, 78, 0.4);
    background: rgba(26, 21, 32, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms ease-out, visibility 300ms ease-out, background 200ms ease;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.return-to-dome.visible {
    opacity: 1;
    visibility: visible;
}

.return-to-dome:hover {
    background: rgba(200, 168, 78, 0.2);
    border-color: var(--antique-gold);
}

/* ========================================
   CLICK RIPPLE
   ======================================== */
#ripple-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

.click-ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 168, 78, 0.3) 0%, transparent 70%);
    transform: scale(0);
    animation: clickRipple 600ms ease-out forwards;
    pointer-events: none;
}

@keyframes clickRipple {
    from {
        transform: scale(0);
        opacity: 0.3;
    }
    to {
        transform: scale(1);
        opacity: 0;
    }
}

/* ========================================
   ANIMATE-UP elements
   ======================================== */
[data-animate-up] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

[data-animate-up].visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   TEXT CHARACTER ANIMATION
   ======================================== */
.section-heading .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
}

.section-heading .char.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   SCROLL-LINKED PARALLAX (dome)
   ======================================== */
.dome__starfield {
    transform: translateY(calc(var(--scroll) * -0.3px));
    will-change: transform;
}

.dome__sunburst {
    transform: translate(-50%, 50%) rotate(calc(var(--scroll) * 0.02deg));
}

.dome__sunburst.animate {
    animation: sunburstReveal 1200ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .reading-desk__content {
        grid-column: 1 / -1;
    }

    .reading-desk__sidebar {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        transform: none;
    }

    .reading-desk__sidebar.visible {
        transform: none;
    }

    .sidebar__star-chart {
        max-width: 200px;
    }

    .card-catalog__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .methods-section__columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .card-catalog__grid {
        grid-template-columns: 1fr;
    }

    .methods-section__columns {
        grid-template-columns: 1fr;
    }

    .chevron-divider {
        width: 200px;
    }

    .dome__title {
        letter-spacing: 0.08em;
    }

    .reading-desk__sidebar {
        flex-direction: column;
        align-items: center;
    }
}
