/* ============================================
   archetype.boo - Algorithmic Ceramics
   Color Palette:
   Burnt Sienna: #CC5A29
   Kiln Cream: #F2E6D4
   Deep Umber: #2A1810
   Fired Clay: #8B6F5C
   Oxidized Copper: #B87333
   Charcoal Ground: #1A120D
   Ember Glow: #E8772E
   Warm Ash: #C4B5A3
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #1A120D;
    color: #F2E6D4;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 300;
    line-height: 1.75;
    font-size: 1.05rem;
    overflow-x: hidden;
}

/* === Noise Overlay === */
.noise-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    filter: url(#noiseFilter);
    z-index: 1;
    opacity: 0.6;
    background: transparent;
}

.noise-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#noiseFilterDetail);
    background: transparent;
}

/* === Navigation Glyph === */
.nav-glyph {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1000;
}

.nav-trigger {
    width: 48px;
    height: 48px;
    background: rgba(26, 18, 13, 0.8);
    border: 1px solid rgba(184, 115, 51, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                border-color 0.4s ease;
    animation: glyph-pulse 4s ease-in-out infinite;
}

.nav-trigger:hover {
    transform: scale(1.15);
    border-color: #B87333;
}

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

.nav-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    margin-top: -100px;
    margin-left: -100px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nav-glyph.active .nav-menu {
    opacity: 1;
    pointer-events: all;
}

.nav-link {
    position: absolute;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    color: #F2E6D4;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 6px 12px;
    background: rgba(26, 18, 13, 0.9);
    border: 1px solid rgba(184, 115, 51, 0.4);
    border-radius: 4px;
    transition: color 0.3s ease, border-color 0.3s ease,
                transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    white-space: nowrap;
}

.nav-link:hover {
    color: #E8772E;
    border-color: #E8772E;
}

/* Radial positions */
.nav-link[data-index="0"] { top: -10px; left: 50%; transform: translateX(-50%); }
.nav-link[data-index="1"] { top: 30px; right: -40px; }
.nav-link[data-index="2"] { top: 75%; right: -50px; transform: translateY(-50%); }
.nav-link[data-index="3"] { bottom: 30px; right: -40px; }
.nav-link[data-index="4"] { bottom: -10px; left: 50%; transform: translateX(-50%); }

.nav-glyph:not(.active) .nav-link {
    transform: translate(0, 0) scale(0.5);
    opacity: 0;
}

/* === Typography === */
.hero-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 8vw, 7.5rem);
    letter-spacing: 0.12em;
    color: #F2E6D4;
    text-align: center;
    position: relative;
    z-index: 2;
}

.section-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: 0.12em;
    color: #F2E6D4;
    margin-bottom: 1.5rem;
}

.arch-module--light .section-heading,
.germ-module--text .section-heading {
    color: #2A1810;
}

.body-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #8B6F5C;
    margin-bottom: 1.25rem;
}

.arch-name {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.arch-module--dark .arch-name {
    color: #F2E6D4;
}

.arch-module--light .arch-name {
    color: #2A1810;
}

.arch-desc {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.arch-module--dark .arch-desc {
    color: #C4B5A3;
}

.arch-module--light .arch-desc {
    color: #8B6F5C;
}

.arch-params {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: rgba(184, 115, 51, 0.7);
    display: block;
}

/* === Scenes === */
.scene {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* --- SEED --- */
.scene--seed {
    height: 100vh;
    background-color: #1A120D;
    display: flex;
    align-items: center;
    justify-content: center;
}

.seed-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.seed-title {
    position: absolute;
    top: 38.2%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    text-align: center;
}

/* --- GERMINATION --- */
.scene--germination {
    min-height: 80vh;
    background-color: #2A1810;
    position: relative;
}

.germination-grid {
    display: flex;
    min-height: 80vh;
}

.germ-module {
    position: relative;
    padding: 4rem 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.germ-module--text {
    width: 40%;
    background-color: #F2E6D4;
}

.germ-module--visual {
    width: 60%;
    background-color: #2A1810;
}

.germ-content {
    position: relative;
    z-index: 2;
    max-width: 480px;
}

.germ-module--text .body-text {
    color: #8B6F5C;
}

.explore-link {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #B87333;
    text-decoration: none;
    position: relative;
    display: inline-block;
    margin-top: 1rem;
}

.explore-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #B87333;
    transition: width 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.explore-link:hover::after {
    width: 100%;
}

.lsystem-svg {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

/* Mortar line between germination modules */
.germination-grid::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 40%;
    width: 4px;
    background-color: #2A1810;
    z-index: 5;
    animation: mortar-pulse 8s ease-in-out infinite;
}

/* --- TAXONOMY --- */
.scene--taxonomy {
    background-color: #1A120D;
    padding: 4rem 0;
}

.taxonomy-header {
    text-align: center;
    padding: 2rem 2rem 3rem;
}

.taxonomy-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 4px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.arch-module {
    position: relative;
    min-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem 2.5rem;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.arch-module:hover {
    transform: scale(1.01);
    z-index: 10;
}

.arch-module--narrow {
    width: calc(30% - 2px);
    min-height: 400px;
}

.arch-module--wide {
    width: calc(70% - 2px);
    min-height: 400px;
}

.arch-module--dark {
    background-color: #1A120D;
    border: 1px solid rgba(42, 24, 16, 0.6);
}

.arch-module--light {
    background-color: #F2E6D4;
    border: 1px solid rgba(196, 181, 163, 0.4);
}

.arch-pattern {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.4;
    transition: opacity 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.arch-module:hover .arch-pattern {
    opacity: 0.7;
}

.arch-info {
    position: relative;
    z-index: 2;
}

/* Mortar rows */
.mortar-line {
    background: transparent;
}

.mortar-line--row {
    width: 100%;
    height: 4px;
    flex-basis: 100%;
    background-color: #2A1810;
    position: relative;
}

.mortar-line--row::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(204, 90, 41, 0.3) 20%,
        rgba(232, 119, 46, 0.5) 50%,
        rgba(204, 90, 41, 0.3) 80%,
        transparent 100%);
    animation: mortar-pulse 8s ease-in-out infinite;
}

.mortar-line--horizontal {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-color: #2A1810;
}

.mortar-line--horizontal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(204, 90, 41, 0.3) 20%,
        rgba(232, 119, 46, 0.5) 50%,
        rgba(204, 90, 41, 0.3) 80%,
        transparent 100%);
    animation: mortar-pulse 8s ease-in-out infinite;
}

/* Vertical mortar between modules */
.taxonomy-grid > .arch-module + .arch-module:not(.arch-module:first-child)::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: 4px;
    height: 100%;
    background-color: #2A1810;
    z-index: 5;
}

@keyframes mortar-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* --- CONVERGENCE --- */
.scene--convergence {
    height: 100vh;
    background-color: #1A120D;
    display: flex;
    align-items: center;
    justify-content: center;
}

.convergence-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.convergence-overlay {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 700px;
    padding: 3rem;
    background: rgba(26, 18, 13, 0.6);
    border: 1px solid rgba(184, 115, 51, 0.2);
}

.convergence-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: 0.1em;
    color: #F2E6D4;
    line-height: 1.4;
    margin-bottom: 1.5rem;
}

.convergence-subtext {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #C4B5A3;
}

/* --- SUBSTRATE (footer) --- */
.scene--substrate {
    height: 60vh;
    background-color: #1A120D;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2rem;
}

.substrate-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.substrate-info {
    position: relative;
    z-index: 3;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.substrate-domain,
.substrate-year {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: rgba(184, 115, 51, 0.5);
    letter-spacing: 0.1em;
}

/* === Module Reveal Animations === */
.module-reveal {
    opacity: 0;
    transform: translateY(30px) scale(0.92);
    transition: opacity 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.module-reveal.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* === Kiln Marks (decorative spots on light modules) === */
.arch-module--light::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 48% 52% 45% 55% / 50% 46% 54% 50%;
    background: radial-gradient(ellipse, rgba(204, 90, 41, 0.1) 0%, transparent 70%);
    top: 15%;
    right: 12%;
    z-index: 1;
    pointer-events: none;
}

.germ-module--text::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 44% 56% 50% 50% / 48% 52% 48% 52%;
    background: radial-gradient(ellipse, rgba(204, 90, 41, 0.08) 0%, transparent 70%);
    bottom: 10%;
    left: 8%;
    z-index: 1;
    pointer-events: none;
}

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

    .germ-module--text,
    .germ-module--visual {
        width: 100%;
    }

    .germ-module--text {
        min-height: 50vh;
    }

    .germ-module--visual {
        min-height: 40vh;
    }

    .germination-grid::after {
        left: 0;
        top: auto;
        bottom: 50%;
        width: 100%;
        height: 4px;
    }

    .arch-module--narrow,
    .arch-module--wide {
        width: 100%;
    }

    .arch-module {
        min-height: 350px;
    }

    .germ-module {
        padding: 2.5rem 1.5rem;
    }

    .arch-module {
        padding: 1.5rem;
    }

    .nav-link[data-index="1"],
    .nav-link[data-index="2"],
    .nav-link[data-index="3"] {
        right: -20px;
    }
}
