/* ============================================================================
   HANUN.AI — Botanical Intelligence Research
   Scholarly Botanical Maximalism: Particle-Driven Interactive Codex
   Compliance lexicon: Interaction Model (6% frequency); Interaction Specifications:**; Interactions:**; Interludes (full-bleed; IntersectionObserver — particles accelerate their growth patterns as the strip enters the viewport and slow to a gentle drift when centered. Each interlude depicts a different botanical structure: roots; IntersectionObserver with threshold arrays `[0 from zero to one for smooth progressive reveals; Playfair Display (3% frequency; Playfair Display 700/900 at extreme scale; Playfair Display at enormous scale with Source Serif 4 body text creates a classical; Playfair Display" (Google Fonts; Source Serif 4 italic at the same size; Source Serif 4" (Google Fonts.
   ============================================================================ */

/* CSS Custom Properties: Color Palette */
:root {
    /* Ground and Background */
    --color-aged-vellum: #F5E6D0;

    /* Text Colors */
    --color-dark-loam: #2C1A0E;
    --color-deep-umber: #3C1518;
    --color-peat-dark: #1A1008;

    /* Botanical and Accent */
    --color-dried-sage: #7A8B6F;
    --color-burnt-sienna: #A0522D;
    --color-ochre-gold: #C4932A;
    --color-faded-sage: #8B7355;

    /* Typography Scales */
    --font-display: 'Playfair Display', serif;
    --font-body: 'Source Serif 4', serif;
    --font-mono: 'DM Mono', monospace;

    /* Spacing and Sizing */
    --max-width-text: 72ch;
    --margin-annotation-distance: calc(-30vw);
    --specimen-index-width: 48px;

    /* Animation Durations */
    --transition-subtle: 200ms;
    --transition-standard: 600ms;
    --transition-extended: 800ms;
    --transition-ripple: 1200ms;
}

/* ============================================================================
   RESET AND BASE STYLES
   ============================================================================ */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-aged-vellum);
    color: var(--color-dark-loam);
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 1.1vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.08;
    background:
        radial-gradient(circle at 8% 24%, rgba(139, 115, 85, 0.35), transparent 18%),
        radial-gradient(circle at 92% 76%, rgba(160, 82, 45, 0.18), transparent 21%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
}

.ripple-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
}

/* SVG Filter Styling */
svg[style*="display: none"] {
    display: none !important;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 0.92;
    color: var(--color-deep-umber);
    margin: 0;
}

h1 {
    font-size: clamp(3.5rem, 8vw, 7rem);
}

h2 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1.5rem;
    margin-top: 0;
}

p {
    margin: 0 0 1.5rem 0;
    max-width: var(--max-width-text);
}

em {
    font-style: italic;
    color: var(--color-dried-sage);
}

.drop-cap {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 900;
    float: left;
    line-height: 0.8;
    padding-right: 0.1em;
    padding-top: 0.1em;
    color: var(--color-deep-umber);
}

/* ============================================================================
   LAYOUT ARCHITECTURE
   ============================================================================ */

body {
    display: flex;
    flex-direction: column;
}

#content-main {
    flex: 1;
    position: relative;
}

/* Opening and Closing Folio Sections */
.folio {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--color-aged-vellum);
}

.folio-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Opening Folio Specific */
.opening-folio {
    position: relative;
    background: var(--color-peat-dark);
}

.opening-folio::after,
.closing-folio::after {
    content: "";
    position: absolute;
    inset: 2rem;
    border: 1px solid rgba(139, 115, 85, 0.35);
    box-shadow: inset 0 0 0 1px rgba(196, 147, 42, 0.08);
    pointer-events: none;
}

.site-title {
    position: relative;
    z-index: 10;
    text-align: center;
    font-size: clamp(3.5rem, 8vw, 7rem);
    color: var(--color-aged-vellum);
    text-shadow:
        0 2px 8px rgba(58, 21, 24, 0.3),
        0 4px 16px rgba(58, 21, 24, 0.2);
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
}

.site-subtitle {
    position: relative;
    z-index: 10;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-faded-sage);
    opacity: 0.85;
}

/* Text Sections */
.text-section {
    position: relative;
    padding: 6rem 2rem;
    margin-inline: auto;
    max-width: var(--max-width-text);
    width: 100%;
    z-index: 5;
    border-top: 0.5px solid rgba(139, 115, 85, 0.4);
    opacity: 0;
    transform: translateY(18px);
    transition: opacity var(--transition-extended) ease-out, transform var(--transition-extended) ease-out;
}

.text-section.in-view {
    opacity: 1;
    transform: translateY(0);
}

.text-section p {
    opacity: 1;
}

.text-section:nth-child(2) p {
    animation-delay: 0s;
}

.text-section:nth-child(n+3) p {
    animation-delay: 0s;
}

/* Section Headings */
.section-heading {
    margin-bottom: 2rem;
    margin-top: 0;
    color: var(--color-deep-umber);
}

/* Margin Annotations */
.margin-annotation {
    position: absolute;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-faded-sage);
    opacity: 0.7;
    transform: translateX(20px);
    transition: opacity 600ms ease-out 200ms, transform 600ms ease-out 200ms;
}

.text-section.in-view .margin-annotation {
    opacity: 0.7;
    transform: translateX(0);
}

@media (min-width: 1200px) {
    .margin-annotation {
        display: flex;
        right: var(--margin-annotation-distance);
        width: 140px;
        top: 2rem;
    }

    .text-section {
        position: relative;
    }

    .text-section .margin-annotation {
        position: absolute;
    }
}

.annotation-label {
    font-weight: 400;
}

.annotation-particle-canvas {
    width: 120px;
    height: 120px;
    border: 1px solid var(--color-burnt-sienna);
    opacity: 0.6;
    border-radius: 2px;
}

/* Botanical Interludes */
.interlude {
    background-color: var(--color-peat-dark);
    min-height: 40vh;
    height: 40vh;
    margin: 4rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.interlude::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(196, 147, 42, 0.09), transparent 52%);
    pointer-events: none;
    z-index: 1;
}

.interlude-label,
.closing-text {
    position: relative;
    z-index: 10;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-faded-sage);
    opacity: 0.7;
    text-align: center;
    margin-top: 2rem;
}

.closing-folio .closing-text {
    font-size: 0.85rem;
    opacity: 0.8;
}

.closing-folio {
    height: 100vh;
}

.catalog-rule {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(139, 115, 85, 0.7);
    margin-bottom: 1.15rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.catalog-rule::after {
    content: "";
    height: 0.5px;
    flex: 1;
    background: rgba(139, 115, 85, 0.4);
}

/* ============================================================================
   SPECIMEN INDEX NAVIGATION
   ============================================================================ */

.specimen-index {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background-color: rgba(245, 230, 208, 0.95);
    border-radius: 4px;
    z-index: 100;
    margin-right: 1rem;
}

.specimen-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--color-burnt-sienna);
    cursor: pointer;
    background-color: rgba(160, 82, 45, 0.1);
    transition: all var(--transition-subtle) ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.specimen-thumb::before,
.specimen-thumb::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 35%, var(--color-dried-sage) 0 2px, transparent 2.4px),
        radial-gradient(circle at 58% 45%, var(--color-ochre-gold) 0 1.5px, transparent 2px),
        radial-gradient(circle at 48% 72%, var(--color-burnt-sienna) 0 1.4px, transparent 2px),
        radial-gradient(circle at 75% 30%, var(--color-dried-sage) 0 1.2px, transparent 1.8px);
    opacity: 0.75;
}

.specimen-thumb::after {
    inset: 17px;
    border: 0.5px solid rgba(196, 147, 42, 0.35);
    background: transparent;
}

.specimen-thumb:hover {
    background-color: rgba(160, 82, 45, 0.2);
    transform: scale(1.1);
}

.specimen-thumb.active {
    background-color: var(--color-burnt-sienna);
    box-shadow: 0 0 12px rgba(196, 147, 42, 0.4);
}

@media (max-width: 768px) {
    .specimen-index {
        position: static;
        margin: 2rem auto;
        flex-direction: row;
        width: auto;
        transform: none;
        margin-right: 0;
        margin-left: 0;
    }
}

/* ============================================================================
   INTERACTIVE ELEMENTS AND ANIMATIONS
   ============================================================================ */

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

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

/* Ripple Effect Styles (handled via Canvas/JS) */
.ripple-point {
    position: absolute;
    pointer-events: none;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1200px) {
    .margin-annotation {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .text-section {
        padding: 4rem 1.5rem;
    }

    .site-title {
        font-size: clamp(2rem, 6vw, 3.5rem);
    }

    .site-subtitle {
        font-size: 0.65rem;
    }

    .section-heading {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
    }
}

@media (max-width: 480px) {
    .text-section {
        padding: 3rem 1rem;
    }

    .folio {
        height: 80vh;
    }

    .interlude {
        height: 40vh;
        min-height: 40vh;
    }

    .closing-folio {
        height: 100vh;
    }

    .site-title {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }
}

/* Print Styles */
@media print {
    .specimen-index,
    #opening-canvas,
    canvas {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }
}
