/* ==========================================================================
   rational.monster - Styles
   Palette: Sepia-Nostalgic | Layout: Stacked Sections | Tone: Playful Sci-Fi
   ========================================================================== */

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

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

body {
    background: #2C241C;
    color: #F5ECD8;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.7;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: clamp(32px, 5vw, 68px);
}

/* --- Sections --- */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Star Field --- */
.star-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.star-field .star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #C8A855;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle var(--twinkle-duration, 3s) ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
}

.star-field .star--large {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 4px 1px rgba(200, 168, 85, 0.4);
}

.star-field .star--xlarge {
    width: 4px;
    height: 4px;
    box-shadow: 0 0 6px 2px rgba(200, 168, 85, 0.3);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

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

.constellation-line {
    stroke: #C8A855;
    stroke-width: 1;
    opacity: 0.6;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.5s ease;
}

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

.star-dot {
    fill: #C8A855;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.star-dot.visible {
    opacity: 1;
}

/* --- Lens Flare --- */
.lens-flare {
    position: absolute;
    pointer-events: none;
    z-index: 3;
}

.lens-flare--opening {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%) scale(0);
    background: radial-gradient(circle, rgba(232, 149, 90, 0.2) 0%, rgba(200, 168, 85, 0.1) 30%, transparent 60%);
    border-radius: 50%;
    transition: transform 1s ease-out;
}

.lens-flare--opening.active {
    transform: translate(-50%, -55%) scale(1);
}

.lens-flare--observatory {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(232, 149, 90, 0.15) 0%, rgba(200, 168, 85, 0.08) 40%, transparent 65%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.lens-flare--left {
    top: 20%;
    left: -50px;
    transform: scale(0.5);
}

.lens-flare--right {
    bottom: 20%;
    right: -50px;
    transform: scale(0.5);
}

.lens-flare--observatory.active {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   SECTION 1: Star Chart Opening
   ========================================================================== */
.section--opening {
    background: linear-gradient(170deg, #2C241C 0%, #3E342A 60%, #2C241C 100%);
    flex-direction: column;
    z-index: 1;
}

.opening-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 0 20px;
}

.wordmark {
    font-family: 'Fraunces', serif;
    font-size: clamp(40px, 8vw, 100px);
    font-variation-settings: 'wght' 200, 'SOFT' 100, 'WONK' 1;
    color: #F5ECD8;
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 0.6s ease, font-variation-settings 0.8s ease;
}

.wordmark.visible {
    opacity: 1;
    font-variation-settings: 'wght' 700, 'SOFT' 50, 'WONK' 1;
}

.tagline {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    color: #8B7355;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 16px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease 1.8s, transform 0.6s ease 1.8s;
}

.wordmark.visible ~ .tagline {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll Hint */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fadeInUp 0.6s ease 2.5s forwards;
}

.scroll-hint__text {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #8B7355;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.scroll-hint__arrow {
    animation: bobDown 2s ease-in-out infinite;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 0.7;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ==========================================================================
   SECTION 2-4: Monster Guidebook Sections
   ========================================================================== */
.section--guidebook {
    background: linear-gradient(170deg, #2C241C 0%, #3E342A 100%);
}

.section--guidebook-alt {
    background: linear-gradient(170deg, #3E342A 0%, #2C241C 50%, #3E342A 100%);
}

.section-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 720px;
    padding: 60px 20px;
}

/* --- Border-Animate Frames --- */
.framed-block {
    position: relative;
    padding: 50px 40px;
}

.border-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.border-rect {
    fill: none;
    stroke: #8B7355;
    stroke-width: 0.4;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.5s ease;
}

.framed-block.animated .border-rect {
    stroke-dashoffset: 0;
}

.framed-block__inner {
    position: relative;
    z-index: 3;
    text-align: center;
}

/* --- Star Labels --- */
.star-label {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    color: #8B7355;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 16px;
}

/* --- Section Titles --- */
.section-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(32px, 5vw, 68px);
    color: #F5ECD8;
    margin-bottom: 24px;
    font-variation-settings: 'wght' 200;
    transition: font-variation-settings 0.8s ease;
}

.section-title.weight-landed {
    font-variation-settings: 'wght' 700;
}

/* --- Monster Icons --- */
.monster-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 28px;
    opacity: 0;
    transform: scale(0.8) translateY(10px);
    transition: opacity 0.6s ease 0.3s, transform 0.6s ease 0.3s;
}

.framed-block.animated .monster-icon {
    opacity: 1;
    transform: scale(1) translateY(0);
}

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

.monster-icon--logician .monster-svg circle:first-child {
    fill: #7BAF6B;
}

.monster-icon--bayesian .monster-svg path:first-child {
    fill: #6B5B8B;
}

/* --- Section Text --- */
.section-text {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(16px, 1.5vw, 18px);
    font-weight: 400;
    line-height: 1.7;
    color: #F5ECD8;
    opacity: 0.85;
    max-width: 560px;
    margin: 0 auto;
}

/* ==========================================================================
   SECTION 5: Observatory
   ========================================================================== */
.section--observatory {
    background: linear-gradient(170deg, #1E180F 0%, #2C241C 50%, #1E180F 100%);
}

.observatory-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(20, 16, 10, 0.7) 70%, rgba(20, 16, 10, 0.95) 100%);
    z-index: 5;
    pointer-events: none;
}

.section-content--observatory {
    z-index: 10;
    max-width: 800px;
}

.telescopic-view {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
}

.telescopic-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(139, 115, 85, 0.3);
    pointer-events: none;
}

.telescopic-ring--outer {
    width: min(600px, 90vw);
    height: min(600px, 90vw);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 1s ease;
}

.telescopic-ring--inner {
    width: min(420px, 70vw);
    height: min(420px, 70vw);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-color: rgba(139, 115, 85, 0.2);
    opacity: 0;
    transition: opacity 1s ease 0.3s;
}

.section--observatory.in-view .telescopic-ring {
    opacity: 1;
}

.telescopic-content {
    position: relative;
    text-align: center;
    z-index: 6;
    max-width: 480px;
}

.section-title--observatory {
    color: #C8A855;
}

.section-text--observatory {
    margin-bottom: 30px;
}

.observatory-coordinates {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.coord {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    color: #8B7355;
    letter-spacing: 0.08em;
}

.coord-divider {
    color: rgba(139, 115, 85, 0.4);
    font-size: 11px;
}

/* ==========================================================================
   SECTION 6: Constellation Footer
   ========================================================================== */
.section--footer {
    min-height: 60vh;
    background: linear-gradient(170deg, #2C241C 0%, #1E180F 100%);
    flex-direction: column;
    padding: 60px 20px;
}

.footer-constellation-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.4;
}

.footer-content {
    position: relative;
    z-index: 10;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}

.footer-link {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    color: #C8A855;
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
    transition: color 0.3s ease;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #C8A855;
    transition: width 0.3s ease;
}

.footer-link:hover {
    color: #E8955A;
}

.footer-link:hover::after {
    width: 100%;
    background: #E8955A;
}

.footer-inscription {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #8B7355;
}

.footer-coords {
    margin-bottom: 0;
    opacity: 0.6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .framed-block {
        padding: 36px 24px;
    }

    .section-content {
        padding: 40px 16px;
    }

    .telescopic-view {
        padding: 60px 20px;
    }

    .footer-nav {
        gap: 16px;
    }

    .observatory-coordinates {
        gap: 8px;
    }

    .coord-divider {
        display: none;
    }

    .observatory-coordinates {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .wordmark {
        font-size: clamp(32px, 10vw, 60px);
    }

    .framed-block {
        padding: 28px 18px;
    }

    .monster-icon {
        width: 90px;
        height: 90px;
    }
}
