/* ============================================================
   concengine.net v2 -- Naturalist Specimen Catalog
   A concurrency engine observed as natural phenomenon
   ============================================================ */

/* --- Palette --- */
:root {
    --substrate: #FAF6F0;
    --ink: #1B2A4A;
    --teal: #2EC4B6;
    --coral: #E07A5F;
    --amber: #D4A373;
    --sage: #D8E2DC;
    --warm-gray: #9B8E82;
    --stone: #EDE8E2;
}

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

html {
    background-color: var(--substrate);
}

body {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.72;
    color: var(--ink);
    background-color: var(--substrate);
    overflow-x: hidden;
}

/* --- Typography --- */
.domain-title {
    font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
    font-weight: 700;
    font-size: clamp(36px, 6vw, 72px);
    letter-spacing: 0.02em;
    color: var(--ink);
    line-height: 1.1;
}

.section-heading {
    font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
    font-weight: 600;
    font-size: clamp(28px, 4vw, 56px);
    letter-spacing: 0.02em;
    color: var(--ink);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.subtitle {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.8vw, 20px);
    color: var(--warm-gray);
    margin-top: 0.75rem;
    line-height: 1.72;
}

.fig-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(11px, 1vw, 14px);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--warm-gray);
}

.fig-sublabel {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(10px, 0.9vw, 12px);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--warm-gray);
    display: block;
    margin-top: 0.5rem;
    text-align: center;
}

/* --- Progress Bar (left edge, vertical thermometer) --- */
#progress-bar {
    position: fixed;
    left: 0;
    top: 0;
    width: 24px;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    pointer-events: none;
}

#progress-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background-color: var(--teal);
    transition: height 0.15s ease-out;
}

#progress-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 10px;
    letter-spacing: 0.04em;
    color: var(--teal);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    position: absolute;
    bottom: 12px;
    left: 6px;
    opacity: 0.7;
}

/* --- Opening Viewport --- */
#opening {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 4vw 5vw;
    overflow: hidden;
}

#opening-svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#branching-tree {
    width: 80%;
    height: 80%;
    opacity: 0.9;
}

.plate-title {
    position: relative;
    z-index: 10;
    max-width: 600px;
}

/* --- Content Sections (editorial spine) --- */
.content-section {
    padding: 8vh 5vw;
    position: relative;
}

.section-layout {
    display: grid;
    grid-template-columns: 60px 1fr 1fr;
    gap: 0 8vw;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
}

.sync-layout {
    grid-template-columns: 60px auto 1fr;
}

.margin-annotation {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    align-self: start;
    padding-top: 0.5rem;
}

.text-column {
    max-width: 55ch;
}

.text-column p {
    margin-bottom: 1.5rem;
}

.text-column p strong {
    font-weight: 600;
    color: var(--ink);
}

.illustration-column {
    display: flex;
    align-items: center;
    justify-content: center;
}

#cell-division-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

/* --- Full-bleed Sections --- */
.fullbleed-section {
    position: relative;
    width: 100%;
    height: 150vh;
    overflow: hidden;
}

#section-emergence {
    height: 100vh;
}

.fullbleed-section canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.overlay-text {
    position: sticky;
    top: 15vh;
    z-index: 10;
    padding: 4vw 5vw;
    max-width: 60ch;
}

.overlay-text p {
    margin-bottom: 1.5rem;
    text-shadow:
        0 0 8px rgba(250, 246, 240, 0.95),
        0 0 16px rgba(250, 246, 240, 0.85),
        0 0 32px rgba(250, 246, 240, 0.6);
    color: var(--ink);
}

.overlay-heading {
    text-shadow:
        0 0 12px rgba(250, 246, 240, 0.98),
        0 0 24px rgba(250, 246, 240, 0.9),
        0 0 48px rgba(250, 246, 240, 0.6);
}

.overlay-annotation {
    position: absolute;
    top: 4vw;
    left: 5vw;
    z-index: 10;
    writing-mode: vertical-rl;
}

.centered-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 100%;
    height: 100vh;
    top: 0;
    position: sticky;
}

.emergence-heading {
    font-size: clamp(32px, 5vw, 64px);
    text-shadow:
        0 0 20px rgba(250, 246, 240, 1),
        0 0 40px rgba(250, 246, 240, 0.9),
        0 0 60px rgba(250, 246, 240, 0.7);
}

/* --- Synchronization Diagrams --- */
.sync-diagrams {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding: 1rem 0;
}

.sync-item {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.sync-item.revealed {
    opacity: 1;
    transform: scale(1.0);
}

.sync-svg {
    width: 200px;
    height: 200px;
    display: block;
    margin: 0 auto;
}

/* --- Specimen Plate (Section 5) --- */
#section-plate {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vw;
}

.specimen-plate-border {
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#specimen-plate-svg {
    width: 100%;
    height: 100%;
}

.plate-annotation {
    position: absolute;
    bottom: 4vw;
    left: 5vw;
    writing-mode: horizontal-tb;
}

/* --- Footer --- */
#site-footer {
    padding: 4vh 5vw;
    border-top: 1px solid var(--warm-gray);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    max-width: 300px;
}

.footer-domain {
    font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
    font-weight: 600;
    font-size: clamp(14px, 1.5vw, 18px);
    color: var(--ink);
}

.footer-year {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(11px, 1vw, 14px);
    letter-spacing: 0.04em;
    color: var(--warm-gray);
}

/* --- Generative Element Styling --- */
.branch-line {
    stroke: var(--ink);
    stroke-linecap: round;
    fill: none;
}

.branch-tip {
    fill: var(--teal);
    opacity: 0;
}

.branch-tip.active {
    animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; r: 4; }
    50% { opacity: 1; r: 6; }
}

/* Cell division circles */
.cell-circle {
    opacity: 0;
    transform-origin: center;
}

.cell-circle.visible {
    animation: cell-appear 0.3s ease-out forwards, cell-pulse 4s ease-in-out 0.3s infinite;
}

@keyframes cell-appear {
    from { opacity: 0; }
    to { opacity: 0.85; }
}

@keyframes cell-pulse {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(1.05); }
}

.cell-line {
    stroke: var(--ink);
    stroke-width: 0.5;
    opacity: 0.4;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .section-layout {
        grid-template-columns: 40px 1fr;
        gap: 0 4vw;
    }

    .illustration-column {
        grid-column: 2;
        margin-top: 3rem;
    }

    .sync-layout {
        grid-template-columns: 40px 1fr;
    }

    .sync-diagrams {
        grid-column: 2;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        margin-bottom: 2rem;
    }

    .text-column {
        grid-column: 2;
    }

    .overlay-text {
        padding: 6vw;
    }
}

@media (max-width: 600px) {
    .section-layout {
        grid-template-columns: 1fr;
        gap: 2rem 0;
    }

    .sync-layout {
        grid-template-columns: 1fr;
    }

    .margin-annotation {
        writing-mode: horizontal-tb;
    }

    .illustration-column {
        grid-column: 1;
    }

    .sync-diagrams {
        grid-column: 1;
    }

    .text-column {
        grid-column: 1;
    }
}
