/* ============================================================
   chloengine.com — Scholarly Engine Exhibition
   ============================================================ */

:root {
    /* Color Palette */
    --bg-primary: #FBF6EF;
    --bg-secondary: #F5EDE0;
    --bg-tertiary: #EDE3D3;
    --text-primary: #4A3728;
    --text-heading: #5B3A29;
    --accent-primary: #C17F59;
    --accent-secondary: #A8B89C;
    --accent-tertiary: #D4A87C;
    --decorative-stroke: #C8B8A4;
    --deep-accent: #3D5A47;
    --text-muted: #8C7B6B;

    /* Spacing (golden ratio) */
    --space-1: 1rem;
    --space-2: 1.618rem;
    --space-3: 2.618rem;
    --space-4: 4.236rem;
    --space-5: 6.854rem;

    /* Animation */
    --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-gentle: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

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

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

/* ============================================================
   Typography
   ============================================================ */

h1, h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    font-variation-settings: 'opsz' 48, 'WONK' 1;
    color: var(--text-heading);
    letter-spacing: -0.01em;
    line-height: 1.12;
}

h1 {
    font-size: clamp(3rem, 7vw, 5.5rem);
}

h2 {
    font-size: clamp(2.2rem, 5vw, 4rem);
    margin-bottom: var(--space-3);
}

.section-heading {
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    margin-bottom: var(--space-3);
}

em {
    font-style: italic;
}

/* ============================================================
   Floating Navigation
   ============================================================ */

.floating-nav {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 1.5px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.5s var(--bounce);
    opacity: 0;
    animation: fadeInNav 0.6s ease 1.2s forwards;
    box-shadow: 0 4px 24px rgba(74, 55, 40, 0.08);
}

.floating-nav:hover,
.floating-nav.expanded {
    width: 220px;
    height: 220px;
    background: var(--deep-accent);
    border-color: var(--deep-accent);
}

.nav-trigger {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.floating-nav:hover .nav-trigger,
.floating-nav.expanded .nav-trigger {
    opacity: 0;
}

.nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease 0.15s;
}

.floating-nav:hover .nav-links,
.floating-nav.expanded .nav-links {
    opacity: 1;
    pointer-events: auto;
}

.nav-link {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bg-primary);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
    color: var(--accent-tertiary);
    background: rgba(251, 246, 239, 0.1);
}

@keyframes fadeInNav {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   Zones — General
   ============================================================ */

.zone {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.zone-content {
    position: relative;
    z-index: 2;
    padding: var(--space-4) var(--space-2);
}

/* ============================================================
   Zone 1: Opening Sequence
   ============================================================ */

.zone-1 {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    min-height: 100vh;
}

.zone-1-content {
    text-align: center;
    padding: var(--space-4);
}

.site-title {
    opacity: 0;
    transform: scale(0.92) translateY(30px);
    animation: bounceInTitle 0.8s var(--bounce) 0.2s forwards;
}

.site-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: var(--text-muted);
    margin-top: var(--space-2);
    opacity: 0;
    animation: fadeInSubtitle 0.8s ease 0.6s forwards;
}

@keyframes bounceInTitle {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

/* ============================================================
   Zone 2: Principles
   ============================================================ */

.zone-2 {
    background: var(--bg-secondary);
    clip-path: ellipse(85% 55% at 50% 50%);
    padding: var(--space-5) 0;
}

.zone-2-content {
    max-width: 900px;
    margin-left: 8vw;
    margin-right: auto;
    padding-right: 4vw;
}

/* ============================================================
   Zone 3: Mechanisms
   ============================================================ */

.zone-3 {
    background: var(--bg-primary);
    clip-path: ellipse(75% 52% at 50% 50%);
    padding: var(--space-5) 0;
}

.zone-3-content {
    max-width: 520px;
    margin: 0 auto;
}

/* ============================================================
   Zone 4: Futures
   ============================================================ */

.zone-4 {
    background: var(--bg-secondary);
    clip-path: ellipse(88% 54% at 50% 50%);
    padding: var(--space-5) 0;
}

.zone-4-content {
    max-width: 900px;
    margin-left: auto;
    margin-right: 8vw;
    padding-left: 4vw;
}

/* ============================================================
   Zone 5: Colophon
   ============================================================ */

.zone-5 {
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: var(--space-5) var(--space-2);
}

.zone-5-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.colophon-text {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    font-variation-settings: 'opsz' 48, 'WONK' 1;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--text-heading);
    margin-bottom: var(--space-1);
}

.colophon-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    color: var(--text-muted);
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    margin-bottom: var(--space-3);
}

.colophon-meta {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 1.1vw, 0.8rem);
    color: var(--text-muted);
    letter-spacing: 0.05em;
    line-height: 1.8;
    margin-top: var(--space-2);
}

.colophon-gear {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.08;
    animation: rotateSlow 120s linear infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes rotateSlow {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================================
   Gradient Transitions
   ============================================================ */

.gradient-transition {
    height: 200px;
    position: relative;
    z-index: 1;
}

.gradient-1-2 {
    background: linear-gradient(to bottom, var(--bg-primary), var(--bg-secondary));
}

.gradient-2-3 {
    background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-primary));
}

.gradient-3-4 {
    background: linear-gradient(to bottom, var(--bg-primary), var(--bg-secondary));
}

.gradient-4-5 {
    background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-tertiary));
}

/* ============================================================
   Body Text & Content Elements
   ============================================================ */

.body-text {
    margin-bottom: var(--space-2);
    max-width: 70ch;
}

.body-text strong {
    font-weight: 600;
}

/* Pull Quotes */
.pull-quote {
    margin: var(--space-3) 0;
    padding: var(--space-2) var(--space-3);
    border-left: 3px solid var(--accent-primary);
    background: rgba(193, 127, 89, 0.04);
    border-radius: 0 8px 8px 0;
}

.pull-quote p {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    font-variation-settings: 'opsz' 48, 'WONK' 1;
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    color: var(--text-heading);
    line-height: 1.45;
    letter-spacing: -0.005em;
}

/* Margin Notes */
.margin-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: var(--space-2) 0;
    padding: var(--space-1) 0;
    max-width: 60ch;
}

.note-rule {
    display: block;
    flex-shrink: 0;
    width: 2px;
    min-height: 40px;
    height: 100%;
    background: rgba(193, 127, 89, 0.4);
    border-radius: 1px;
    align-self: stretch;
}

.margin-note p {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.65;
    letter-spacing: 0.01em;
}

/* Decorative HR */
.decorative-hr {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: var(--space-2) auto;
}

/* ============================================================
   Floating Elements
   ============================================================ */

.floating-element {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    will-change: transform;
}

/* Zone 1 floating gears */
.float-gear-1 {
    top: 15%;
    left: 8%;
    animation: floatGear 8s ease-in-out infinite;
}

.float-gear-2 {
    bottom: 20%;
    right: 10%;
    animation: floatGear 10s ease-in-out 1.5s infinite;
}

.float-gear-3 {
    bottom: 30%;
    left: 15%;
    animation: floatGear 7s ease-in-out 3s infinite;
}

/* Zone 2 floating cams */
.float-cam-1 {
    top: 15%;
    right: 5%;
    animation: floatRod 9s ease-in-out infinite;
}

.float-cam-2 {
    bottom: 10%;
    right: 8%;
    animation: floatRod 11s ease-in-out 2s infinite;
}

/* Zone 3 flywheel */
.float-flywheel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

/* Zone 4 bearings */
.float-bearing-1 {
    top: 10%;
    left: 5%;
    animation: floatBearing 7s ease-in-out infinite;
}

.float-bearing-2 {
    top: 35%;
    right: 6%;
    animation: floatBearing 9s ease-in-out 1s infinite;
}

.float-bearing-3 {
    bottom: 25%;
    left: 3%;
    animation: floatBearing 8s ease-in-out 2.5s infinite;
}

.float-bearing-4 {
    bottom: 10%;
    right: 10%;
    animation: floatBearing 10s ease-in-out 4s infinite;
}

.float-curve-1 {
    top: 20%;
    left: 2%;
    animation: floatGear 12s ease-in-out 1s infinite;
}

.float-curve-2 {
    bottom: 35%;
    right: 3%;
    animation: floatGear 11s ease-in-out 3s infinite;
}

/* ============================================================
   Float Keyframes
   ============================================================ */

@keyframes floatGear {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-12px) rotate(2deg);
    }
}

@keyframes floatRod {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-16px) rotate(-1.5deg);
    }
}

@keyframes floatBearing {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(3deg);
    }
}

/* ============================================================
   Background Abstract Shapes
   ============================================================ */

.bg-shape {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.bg-shape-1 {
    width: 500px;
    height: 400px;
    background: rgba(193, 127, 89, 0.04);
    top: 20%;
    right: -100px;
    border-radius: 50% 40% 60% 50%;
}

.bg-shape-2 {
    width: 350px;
    height: 350px;
    background: rgba(168, 184, 156, 0.03);
    bottom: 10%;
    left: -80px;
    border-radius: 45% 55% 50% 50%;
}

.bg-shape-3 {
    width: 450px;
    height: 380px;
    background: rgba(193, 127, 89, 0.04);
    top: 30%;
    left: -120px;
    border-radius: 50% 45% 55% 50%;
}

.bg-shape-4 {
    width: 400px;
    height: 400px;
    background: rgba(168, 184, 156, 0.03);
    bottom: 15%;
    right: -60px;
    border-radius: 50%;
}

.bg-shape-5 {
    width: 500px;
    height: 420px;
    background: rgba(193, 127, 89, 0.04);
    top: 10%;
    left: -150px;
    border-radius: 55% 45% 50% 50%;
}

.bg-shape-6 {
    width: 320px;
    height: 320px;
    background: rgba(168, 184, 156, 0.03);
    bottom: 20%;
    right: -80px;
    border-radius: 50% 50% 45% 55%;
}

/* ============================================================
   Reveal Animations (Bounce-Enter)
   ============================================================ */

.reveal-item {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--bounce), transform 0.6s var(--bounce);
}

.reveal-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Scroll Rotation on Floating Elements
   ============================================================ */

.floating-element {
    transition: transform 0.1s linear;
}

/* ============================================================
   Mobile Responsive (768px breakpoint)
   ============================================================ */

@media (max-width: 768px) {
    .zone-2 {
        clip-path: none;
    }

    .zone-3 {
        clip-path: none;
    }

    .zone-4 {
        clip-path: none;
    }

    .zone-2-content {
        margin-left: auto;
        margin-right: auto;
        padding: var(--space-3) var(--space-2);
        max-width: 90%;
    }

    .zone-3-content {
        max-width: 90%;
        padding: var(--space-3) var(--space-2);
    }

    .zone-4-content {
        margin-left: auto;
        margin-right: auto;
        padding: var(--space-3) var(--space-2);
        max-width: 90%;
    }

    /* Hide alternating floating elements */
    .float-gear-2,
    .float-cam-2,
    .float-bearing-2,
    .float-bearing-4,
    .float-curve-2 {
        display: none;
    }

    /* Reduce floating element sizes */
    .float-gear-1 svg,
    .float-gear-3 svg {
        width: 100px;
        height: 100px;
    }

    .floating-nav {
        width: 52px;
        height: 52px;
        top: 16px;
        right: 16px;
    }

    .floating-nav:hover,
    .floating-nav.expanded {
        width: 180px;
        height: 200px;
        border-radius: 16px;
    }

    .margin-note {
        margin-left: 0;
    }

    h1 {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .colophon-gear svg {
        width: 250px;
        height: 250px;
    }
}

/* ============================================================
   Selection
   ============================================================ */

::selection {
    background: rgba(193, 127, 89, 0.2);
    color: var(--text-heading);
}
