/* ==========================================================================
   sim-ai.net — Generative Scholarly Codex
   Palette: Translucent Frost
   Colors: #F8FAFC #E8EDF5 #1A2332 #7A8FA8 #D4A855 #6A4E35
   Fonts: Literata (display), Alegreya Sans (body)
   ========================================================================== */

/* Interactive elements use `transition-timing-function: spring-physics */
/* --- Design Palette Variables --- */
:root {
    --frosted-white: #F8FAFC;
    --ice-glass: #E8EDF5;
    --deep-slate: #1A2332;
    --frost-blue: #7A8FA8;
    --warm-amber: #D4A855;
    --scholar-brown: #6A4E35;
}

/* --- Breathing Variable-Weight Typography --- */
@keyframes breathe-weight {
    0%   { font-weight: 400; }
    50%  { font-weight: 700; }
    100% { font-weight: 400; }
}

/* --- Candle Pulse Animation --- */
@keyframes candle-pulse {
    0%   { opacity: 0.04; }
    50%  { opacity: 0.08; }
    100% { opacity: 0.04; }
}

/* --- Spring Fade-In --- */
@keyframes spring-fade-in {
    0%   { opacity: 0; transform: translateY(40px) scale(0.97); }
    60%  { opacity: 1; transform: translateY(-8px) scale(1.01); }
    80%  { transform: translateY(3px) scale(0.998); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Reveal Animation (triggered by JS) --- */
@keyframes reveal-in {
    0%   { opacity: 0; transform: translateY(50px); }
    60%  { opacity: 1; transform: translateY(-6px); }
    80%  { transform: translateY(2px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

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

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

body {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.85;
    color: #7A8FA8;
    background-color: #F8FAFC;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Typography
   ========================================================================== */
.breathing-type {
    font-family: 'Literata', serif;
    animation: breathe-weight 8s ease-in-out infinite;
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    color: #1A2332;
    letter-spacing: -0.01em;
}

.section-heading {
    font-family: 'Literata', serif;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: #1A2332;
    margin-bottom: 1.5rem;
    animation: breathe-weight 8s ease-in-out infinite;
}

.section-body {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.85;
    color: #7A8FA8;
    margin-bottom: 1.2rem;
    max-width: 560px;
}

.annotation-title {
    font-family: 'Literata', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1A2332;
    margin-bottom: 0.6rem;
    letter-spacing: 0.02em;
}

.annotation-text {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #7A8FA8;
    font-style: italic;
}

/* ==========================================================================
   Section Base
   ========================================================================== */
.section {
    position: relative;
    min-height: 70vh;
    padding: 8vh 4vw;
    overflow: hidden;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.section--hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F8FAFC;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    animation: spring-fade-in 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.hero-title {
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: clamp(1rem, 2vw, 1.35rem);
    color: #7A8FA8;
    font-weight: 400;
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
}

/* --- Leather Accent Bar --- */
.leather-bar {
    width: 120px;
    height: 4px;
    margin: 0 auto;
    background-color: #6A4E35;
    border: 1px solid rgba(106, 78, 53, 0.2);
    border-radius: 2px;
    box-shadow: inset 0 1px 3px rgba(106, 78, 53, 0.1);
    filter: url(#leather-noise);
    opacity: 0.7;
}

.leather-bar--footer {
    margin-top: 2rem;
}

/* ==========================================================================
   Drift Left Section
   ========================================================================== */
.section--drift-left {
    background-color: #F8FAFC;
}

.section--drift-left > .section-content {
    display: flex;
    align-items: flex-start;
    gap: 4vw;
    margin-left: 6vw;
    max-width: 1100px;
}

.section--drift-left .content-main {
    max-width: 600px;
    flex: 1;
}

.section--drift-left .annotation-panel--right {
    flex: 0 0 280px;
    margin-top: 2rem;
}

/* ==========================================================================
   Drift Right Section
   ========================================================================== */
.section--drift-right {
    background-color: #F8FAFC;
}

.section--drift-right > .section-content {
    display: flex;
    align-items: flex-start;
    gap: 4vw;
    margin-left: auto;
    margin-right: 6vw;
    max-width: 1100px;
}

.section--drift-right .content-main {
    max-width: 600px;
    flex: 1;
}

.section--drift-right .annotation-panel--left {
    flex: 0 0 280px;
    margin-top: 2rem;
    order: -1;
}

/* ==========================================================================
   Closing Section
   ========================================================================== */
.section--closing {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F8FAFC;
}

.closing-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.closing-title {
    font-size: clamp(1.6rem, 3vw, 2rem);
    margin-bottom: 0.8rem;
}

.closing-text {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 1rem;
    color: #7A8FA8;
    letter-spacing: 0.03em;
}

/* ==========================================================================
   Frost Card (Glassmorphism)
   ========================================================================== */
.frost-card {
    background: rgba(232, 237, 245, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(106, 78, 53, 0.2);
    border-radius: 2px;
    box-shadow: inset 0 1px 3px rgba(106, 78, 53, 0.1);
    padding: 2rem 1.8rem;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.4s ease;
}

.frost-card:hover {
    transform: translateY(-3px);
    box-shadow: inset 0 1px 3px rgba(106, 78, 53, 0.1),
                0 8px 24px rgba(26, 35, 50, 0.06);
}

/* ==========================================================================
   Leather Divider
   ========================================================================== */
.leather-divider {
    width: 80%;
    max-width: 500px;
    height: 2px;
    margin: 0 auto 4vh;
    background-color: #6A4E35;
    border: 1px solid rgba(106, 78, 53, 0.2);
    border-radius: 2px;
    box-shadow: inset 0 1px 3px rgba(106, 78, 53, 0.1);
    filter: url(#leather-noise);
    opacity: 0.5;
}

/* ==========================================================================
   Candle-Atmospheric Light Pools
   ========================================================================== */
.candle-pool {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: candle-pulse 6s ease-in-out infinite;
}

.candle-pool--hero {
    width: 70vw;
    height: 70vw;
    max-width: 800px;
    max-height: 800px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at 50% 30%, rgba(212, 168, 85, 0.06) 0%, transparent 60%);
}

.candle-pool--left {
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    top: 10%;
    left: 10%;
    background: radial-gradient(ellipse at 50% 30%, rgba(212, 168, 85, 0.06) 0%, transparent 60%);
}

.candle-pool--right {
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    top: 10%;
    right: 10%;
    background: radial-gradient(ellipse at 50% 30%, rgba(212, 168, 85, 0.06) 0%, transparent 60%);
}

.candle-pool--center {
    width: 60vw;
    height: 60vw;
    max-width: 700px;
    max-height: 700px;
    top: 50%;
    left: 30%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at 50% 40%, rgba(212, 168, 85, 0.06) 0%, transparent 60%);
}

.candle-pool--center-secondary {
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    background: radial-gradient(ellipse at 50% 40%, rgba(212, 168, 85, 0.05) 0%, transparent 55%);
    animation-delay: 3s;
}

/* ==========================================================================
   Generative Procedural Patterns
   ========================================================================== */
.generative-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Spiral Pattern (Hero) */
.generative-pattern--spiral {
    background:
        repeating-conic-gradient(
            from 0deg at 50% 50%,
            rgba(122, 143, 168, 0.02) 0deg,
            transparent 10deg,
            rgba(122, 143, 168, 0.015) 20deg,
            transparent 30deg
        ),
        repeating-radial-gradient(
            circle at 50% 50%,
            transparent 0px,
            transparent 40px,
            rgba(122, 143, 168, 0.012) 42px,
            transparent 44px
        );
    opacity: 1;
}

/* Voronoi-like Pattern (Section 2) */
.generative-pattern--voronoi {
    background:
        radial-gradient(circle at 20% 30%, rgba(122, 143, 168, 0.03) 0%, transparent 30%),
        radial-gradient(circle at 70% 20%, rgba(122, 143, 168, 0.025) 0%, transparent 25%),
        radial-gradient(circle at 50% 70%, rgba(122, 143, 168, 0.03) 0%, transparent 35%),
        radial-gradient(circle at 85% 60%, rgba(122, 143, 168, 0.02) 0%, transparent 28%),
        radial-gradient(circle at 15% 80%, rgba(122, 143, 168, 0.025) 0%, transparent 22%),
        radial-gradient(circle at 40% 45%, rgba(122, 143, 168, 0.02) 0%, transparent 32%),
        radial-gradient(circle at 60% 90%, rgba(122, 143, 168, 0.015) 0%, transparent 27%),
        radial-gradient(circle at 90% 85%, rgba(122, 143, 168, 0.02) 0%, transparent 20%);
    opacity: 1;
}

/* Recursive Triangle Pattern (Section 3) */
.generative-pattern--triangles {
    background:
        conic-gradient(from 0deg at 25% 25%, transparent 0deg, rgba(122, 143, 168, 0.02) 60deg, transparent 120deg, rgba(122, 143, 168, 0.015) 180deg, transparent 240deg, rgba(122, 143, 168, 0.02) 300deg, transparent 360deg),
        conic-gradient(from 30deg at 75% 35%, transparent 0deg, rgba(122, 143, 168, 0.015) 60deg, transparent 120deg, rgba(122, 143, 168, 0.02) 180deg, transparent 240deg, rgba(122, 143, 168, 0.015) 300deg, transparent 360deg),
        conic-gradient(from 60deg at 50% 75%, transparent 0deg, rgba(122, 143, 168, 0.02) 60deg, transparent 120deg, rgba(122, 143, 168, 0.015) 180deg, transparent 240deg, rgba(122, 143, 168, 0.02) 300deg, transparent 360deg);
    opacity: 1;
}

/* Composite Pattern (Closing) */
.generative-pattern--composite {
    background:
        repeating-conic-gradient(
            from 0deg at 50% 50%,
            rgba(122, 143, 168, 0.025) 0deg,
            transparent 8deg,
            rgba(122, 143, 168, 0.02) 16deg,
            transparent 24deg
        ),
        radial-gradient(circle at 30% 40%, rgba(122, 143, 168, 0.03) 0%, transparent 30%),
        radial-gradient(circle at 70% 60%, rgba(122, 143, 168, 0.025) 0%, transparent 35%),
        conic-gradient(from 45deg at 50% 50%, transparent 0deg, rgba(122, 143, 168, 0.02) 90deg, transparent 180deg, rgba(122, 143, 168, 0.015) 270deg, transparent 360deg);
    opacity: 0.04;
}

/* Pattern visibility at 4% for closing */
.section--closing .generative-pattern--composite {
    opacity: 1;
}

/* ==========================================================================
   Scroll Reveal
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(50px);
}

.reveal.visible {
    animation: reveal-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Hero content uses its own spring-fade-in, so override reveal state */
.section--hero .hero-content.reveal {
    opacity: 0;
    animation: none;
}

.section--hero .hero-content.reveal.visible {
    animation: spring-fade-in 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .section--drift-left > .section-content,
    .section--drift-right > .section-content {
        flex-direction: column;
        margin-left: 5vw;
        margin-right: 5vw;
    }

    .section--drift-left .annotation-panel--right,
    .section--drift-right .annotation-panel--left {
        flex: 1;
        order: 0;
        margin-top: 2rem;
    }

    .section-body {
        max-width: 100%;
    }

    .frost-card {
        padding: 1.5rem 1.2rem;
    }
}
