/* ============================================
   simulai.org - Botanical Neural Herbarium
   Palette: Jewel Tones (no gradients)
   Layout: Editorial-flow with annotation gutter
   ============================================ */

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

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

body {
    background-color: #f4f0e8;
    color: #1a1a1a;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    line-height: 1.72;
    overflow-x: hidden;
}

/* ---------- Entry Screen ---------- */
.entry-screen {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: #0e1b2d;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.entry-illustration {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    max-width: 600px;
    height: auto;
    z-index: 1;
}

.branch-line {
    stroke: #1a6b4a;
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: var(--path-length, 300);
    stroke-dashoffset: var(--path-length, 300);
}

.leaf-node {
    fill: #1a6b4a;
    opacity: 0;
}

.entry-text {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
}

.entry-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 6rem);
    color: #e8e2d4;
    letter-spacing: 0.02em;
    font-variant: small-caps;
    margin-bottom: 0.3em;
}

.entry-subtitle {
    font-family: 'Barlow Condensed', Helvetica, sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c8962a;
    opacity: 0;
    transform: translateY(8px);
}

.entry-rule {
    border: none;
    height: 1px;
    background-color: #c8962a;
    opacity: 0;
    width: 0;
    margin: 1.2em auto 0;
    transition: width 0.6s ease-out, opacity 0.4s ease-out;
}

.entry-rule.visible {
    width: 200px;
    opacity: 0.4;
}

/* ---------- Navigation ---------- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3em;
    border-bottom: 1px solid rgba(200, 150, 42, 0.2);
    background-color: rgba(244, 240, 232, 0.95);
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.site-nav.visible {
    opacity: 1;
}

.nav-link {
    font-family: 'Barlow Condensed', Helvetica, sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1a1a1a;
    text-decoration: none;
    position: relative;
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #8b1a3a;
}

.nav-leaf {
    position: absolute;
    bottom: 4px;
    width: 12px;
    height: 12px;
    transition: left 0.4s ease-out;
    pointer-events: none;
}

.nav-leaf::before {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    background-color: #1a6b4a;
    clip-path: polygon(50% 0%, 100% 40%, 80% 100%, 20% 100%, 0% 40%);
}

/* ---------- Content Sections ---------- */
.content-section {
    padding: 6rem 2rem 4rem;
    background-color: #f4f0e8;
}

.section-layout {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    gap: 2rem;
}

/* ---------- Annotation Gutter ---------- */
.annotation-gutter {
    flex: 0 0 15%;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 1.5rem;
    padding-top: 0.5rem;
    border-right: 1px solid rgba(42, 74, 122, 0.15);
}

.gutter-label {
    font-family: 'Barlow Condensed', Helvetica, sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2a4a7a;
    opacity: 0.7;
    margin-bottom: 0.5em;
}

.gutter-number {
    font-family: 'Barlow Condensed', Helvetica, sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
    color: #c8962a;
    opacity: 0.6;
    margin-bottom: 1.5em;
}

.gutter-diagram {
    width: 30px;
    height: 90px;
    opacity: 0.6;
}

/* ---------- Specimen Field ---------- */
.specimen-field {
    flex: 1;
    max-width: 38em;
}

.plate-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: 0.04em;
    color: #1a1a1a;
    margin-bottom: 1em;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    max-width: 38em;
    margin-bottom: 1.5em;
    color: #1a1a1a;
}

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

/* ---------- Specimen Cards ---------- */
.specimen-card {
    position: relative;
    border: 1px solid rgba(42, 74, 122, 0.4);
    box-shadow: 0 1px 3px rgba(26, 26, 26, 0.08);
    padding: 1.5rem;
    margin: 2rem 0;
    background-color: #f4f0e8;
    opacity: 0;
    transform: translateY(6px);
    transition: transform 0.15s ease-out;
}

.specimen-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.specimen-card .card-border-top,
.specimen-card .card-border-right,
.specimen-card .card-border-bottom,
.specimen-card .card-border-left {
    position: absolute;
    background-color: rgba(42, 74, 122, 0.4);
}

.specimen-label {
    display: inline-block;
    font-family: 'Barlow Condensed', Helvetica, sans-serif;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2a4a7a;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.specimen-card.revealed .specimen-label {
    opacity: 1;
    transform: translateX(0);
}

.specimen-content {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.specimen-illustration {
    flex: 0 0 160px;
    width: 160px;
    height: auto;
}

.specimen-path {
    stroke-dasharray: var(--path-length, 400);
    stroke-dashoffset: var(--path-length, 400);
    transition: stroke-dashoffset 1.2s ease-out;
}

.specimen-card.revealed .specimen-path {
    stroke-dashoffset: 0;
}

.specimen-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.65;
    color: #1a1a1a;
    flex: 1;
}

.annotation-line {
    position: absolute;
    bottom: -20px;
    right: 20px;
    width: 40px;
    height: 60px;
    opacity: 0.6;
}

.annotation-endpoint {
    cursor: pointer;
    transition: r 0.2s ease, fill 0.2s ease;
}

.annotation-endpoint:hover {
    r: 5;
}

.annotation-line:hover path {
    stroke: #8b1a3a;
    stroke-width: 1.5;
    opacity: 1;
    transition: all 0.2s ease;
}

.svg-label {
    font-family: 'Barlow Condensed', Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.08em;
}

/* ---------- Plate Breaks ---------- */
.plate-break {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    background-color: #0e1b2d;
    transition: background-color 0.3s ease;
}

.plate-break[data-bg="chrysoberyl"] {
    background-color: #0d2b1c;
}

.plate-break[data-bg="garnet"] {
    background-color: #1f0a12;
}

.plate-break[data-bg="lapis"] {
    background-color: #0f1a2e;
}

.plate-break-illustration {
    width: 50%;
    max-width: 500px;
    height: auto;
    margin-bottom: 2rem;
}

.plate-draw-path {
    stroke: #e8e2d4;
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: var(--path-length, 600);
    stroke-dashoffset: var(--path-length, 600);
    transition: stroke-dashoffset 2s ease-in-out;
}

.plate-draw-circle {
    stroke: #e8e2d4;
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: var(--circle-length, 1600);
    stroke-dashoffset: var(--circle-length, 1600);
    transition: stroke-dashoffset 2s ease-in-out;
}

.plate-break.animate .plate-draw-path,
.plate-break.animate .plate-draw-circle {
    stroke-dashoffset: 0;
}

.leaf-outline {
    stroke-width: 1;
    opacity: 0.5;
}

.plate-break-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: 0.04em;
    color: #e8e2d4;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.plate-break.animate .plate-break-title {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Fern Frond Dividers ---------- */
.fern-divider {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 40px;
    padding: 3rem 0;
    opacity: 0.25;
}

.fern-frond {
    width: 20px;
    height: 40px;
    transform: scaleY(0);
    transform-origin: bottom center;
    transition: transform 0.4s ease-out;
}

.fern-divider.visible .fern-frond {
    transform: scaleY(1);
    animation: fern-sway 3s ease-in-out infinite alternate;
}

.fern-divider.visible .fern-frond:nth-child(1) { transition-delay: 0ms; animation-delay: 0s; }
.fern-divider.visible .fern-frond:nth-child(2) { transition-delay: 80ms; animation-delay: 0.2s; }
.fern-divider.visible .fern-frond:nth-child(3) { transition-delay: 160ms; animation-delay: 0.4s; }
.fern-divider.visible .fern-frond:nth-child(4) { transition-delay: 240ms; animation-delay: 0.6s; }
.fern-divider.visible .fern-frond:nth-child(5) { transition-delay: 320ms; animation-delay: 0.8s; }
.fern-divider.visible .fern-frond:nth-child(6) { transition-delay: 400ms; animation-delay: 1.0s; }

@keyframes fern-sway {
    from { transform: scaleY(1) rotate(-2deg); }
    to { transform: scaleY(1) rotate(2deg); }
}

/* ---------- Closing Section ---------- */
.closing-section {
    position: relative;
    width: 100%;
    min-height: 60vh;
    background-color: #0e1b2d;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.closing-illustration {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    display: block;
}

.closing-illustration .branch-line {
    stroke: #e8e2d4;
}

.closing-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.72;
    color: #e8e2d4;
    margin-bottom: 1.5em;
}

.closing-mark {
    font-family: 'Barlow Condensed', Helvetica, sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #c8962a;
    opacity: 0.6;
}

/* ---------- Particle Container ---------- */
.particle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #1a6b4a 0%, transparent 70%);
    pointer-events: none;
}

/* ---------- Code/Technical ---------- */
code, .code-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.9em;
    /* Pressed Fern #1a3a2a at 15% opacity */
    background-color: rgba(26, 58, 42, 0.15);
    padding: 0.1em 0.3em;
    border-radius: 2px;
}

/* #1a3a2a - Pressed Fern used for code highlights */
.pressed-fern-bg {
    background-color: #1a3a2a;
}

/* ---------- Annotation Hover Effects ---------- */
.specimen-card.hover-highlight {
    border-left: 2px solid #8b1a3a;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .section-layout {
        flex-direction: column;
    }

    .annotation-gutter {
        flex: none;
        flex-direction: row;
        align-items: center;
        gap: 1em;
        border-right: none;
        border-bottom: 1px solid rgba(42, 74, 122, 0.15);
        padding-right: 0;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        min-width: auto;
    }

    .gutter-diagram {
        display: none;
    }

    .specimen-content {
        flex-direction: column;
    }

    .specimen-illustration {
        flex: none;
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }

    .site-nav {
        gap: 1.5em;
    }

    .nav-link {
        font-size: 0.7rem;
    }

    .plate-break-illustration {
        width: 80%;
    }

    .entry-illustration {
        width: 85%;
    }

    .content-section {
        padding: 4rem 1.2rem 3rem;
    }
}

@media (max-width: 480px) {
    .site-nav {
        gap: 1em;
    }

    .fern-divider {
        gap: 25px;
    }
}
