/* ===========================================
   concengine.com - Styles
   Retro-futuristic greenhouse x combustion engine
   =========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #1A0E08;
    color: #F2E8D9;
    font-family: 'Libre Baskerville', serif;
    font-size: 1.125rem;
    line-height: 1.65;
    overflow-x: hidden;
}

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

.hero-title {
    font-family: 'Righteous', cursive;
    font-size: 11vw;
    font-weight: 400;
    letter-spacing: 0.06em;
    line-height: 1.1;
    margin-bottom: 0.2em;
}

.hero-left {
    color: #D4600A;
}

.hero-right {
    color: #8FB37A;
}

.section-title {
    font-family: 'Righteous', cursive;
    font-size: 6vw;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: #D4600A;
    margin-bottom: 1rem;
}

.greenhouse-title {
    color: #1A0E08;
}

.convergence-title {
    font-size: 8vw;
    color: #E8A44A;
    text-align: center;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.5rem;
    color: #E8A44A;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
}

.greenhouse-sub {
    color: #3D5A2E;
}

.engine-label {
    font-family: 'Righteous', cursive;
    font-size: 16px;
    fill: #D4600A;
    letter-spacing: 0.06em;
}

.engine-annotation {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    fill: #E8A44A;
}

.dial-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    fill: #E8A44A;
}

.specimen-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    fill: #3D5A2E;
}

.specimen-name {
    font-family: 'Righteous', cursive;
    font-size: 2.4rem;
    color: #1A0E08;
    letter-spacing: 0.06em;
    text-align: center;
    margin-top: 1rem;
}

.specimen-latin {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.875rem;
    font-style: italic;
    color: #2B1810;
    text-align: center;
    line-height: 1.4;
}

.readout {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.5rem;
    color: #E8A44A;
    display: block;
    text-align: center;
    margin-top: 0.5rem;
}

.readout-line {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: #E8A44A;
    margin-bottom: 0.4rem;
}

.readout-label {
    color: #F2E8D9;
    opacity: 0.7;
}

.readout-value {
    color: #E8A44A;
}

.convergence-desc {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.125rem;
    color: #F2E8D9;
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem;
    line-height: 1.65;
}

.closing-text {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.125rem;
    color: #E8A44A;
    text-align: center;
    max-width: 500px;
    margin: 3rem auto 0;
    line-height: 1.65;
    font-style: italic;
}

.convergence-svg-title {
    font-family: 'Righteous', cursive;
    font-size: 20px;
    fill: #E8A44A;
    letter-spacing: 0.06em;
}

.convergence-svg-subtitle {
    font-family: 'Libre Baskerville', serif;
    font-size: 12px;
    fill: #F2E8D9;
    font-style: italic;
}

.thumb-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: #2B1810;
    display: block;
    text-align: center;
    margin-top: 0.3rem;
}

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

#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(26, 14, 8, 0.9);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.nav-brand {
    font-family: 'Righteous', cursive;
    font-size: 1.2rem;
    color: #D4600A;
    letter-spacing: 0.06em;
}

.nav-dots {
    display: flex;
    gap: 16px;
    align-items: center;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 200ms ease-out;
    position: relative;
}

.nav-dot:hover {
    transform: scale(1.4);
}

.nav-dot:not(:hover) {
    transform: scale(1);
    transition: transform 240ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.dot-engine {
    background: #D4600A;
}

.dot-greenhouse {
    background: #8FB37A;
}

.dot-merged {
    background: #F2E8D9;
}

.dot-tooltip {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: #E8A44A;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
}

.nav-dot:hover .dot-tooltip {
    opacity: 1;
}

/* ===========================================
   Opening Overlay
   =========================================== */

#opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1A0E08;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    transition: opacity 0.4s ease;
}

#opening-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#divider-draw {
    position: absolute;
    left: 55%;
    transform: translateX(-50%);
    height: 100%;
}

#divider-draw line {
    animation: drawDivider 0.6s ease-in-out 0.2s forwards;
}

@keyframes drawDivider {
    to {
        stroke-dashoffset: 0;
    }
}

/* ===========================================
   Split-Screen Layout
   =========================================== */

#split-container {
    display: grid;
    grid-template-columns: 55fr 45fr;
    min-height: 300vh;
    position: relative;
    opacity: 0;
    transition: opacity 0.4s ease, grid-template-columns 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#split-container.visible {
    opacity: 1;
}

#split-container.state-2 {
    grid-template-columns: 30fr 70fr;
}

#split-container.state-3 {
    grid-template-columns: 70fr 30fr;
}

/* Divider */
#divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 55%;
    width: 4px;
    background: #2B1810;
    z-index: 10;
    transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

#split-container.state-2 #divider {
    left: 30%;
}

#split-container.state-3 #divider {
    left: 70%;
}

#split-container.state-merged #divider {
    opacity: 0;
}

/* Panels */
.panel {
    position: relative;
    overflow: hidden;
}

#engine-panel {
    background: #1A0E08;
}

#greenhouse-panel {
    background: #F2E8D9;
}

/* Sections */
.engine-section,
.greenhouse-section {
    min-height: 100vh;
    position: relative;
    padding: 80px 40px 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 600px;
}

/* ===========================================
   Grain Overlays
   =========================================== */

.grain-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.grain-overlay.active {
    opacity: 1;
}

.grain-dark::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    mix-blend-mode: overlay;
    opacity: 0.12;
}

.grain-light::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.12'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    mix-blend-mode: multiply;
    opacity: 0.12;
}

/* ===========================================
   Background Patterns
   =========================================== */

/* Blueprint dots - Engine Room */
.blueprint-dots {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(212, 96, 10, 0.08) 1px, transparent 1px);
    background-size: 8px 8px;
    pointer-events: none;
    z-index: 1;
}

/* Leaf veins - Greenhouse */
.leaf-veins {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M60 0 Q65 30 60 60 Q55 90 60 120' fill='none' stroke='%238FB37A' stroke-width='0.5' opacity='0.06'/%3E%3Cpath d='M60 60 Q40 50 20 55' fill='none' stroke='%238FB37A' stroke-width='0.4' opacity='0.06'/%3E%3Cpath d='M60 60 Q80 50 100 55' fill='none' stroke='%238FB37A' stroke-width='0.4' opacity='0.06'/%3E%3Cpath d='M60 60 Q45 75 30 80' fill='none' stroke='%238FB37A' stroke-width='0.3' opacity='0.06'/%3E%3Cpath d='M60 60 Q75 75 90 80' fill='none' stroke='%238FB37A' stroke-width='0.3' opacity='0.06'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 120px 120px;
}

/* ===========================================
   Engine Room Specific
   =========================================== */

.engine-diagram {
    max-width: 500px;
    margin: 0 auto;
}

.engine-svg {
    width: 100%;
    height: auto;
}

/* Gear rotation animations */
.gear-main {
    transform-origin: 250px 250px;
    animation: rotateGear 8s linear infinite;
}

.gear-secondary {
    transform-origin: 400px 150px;
    animation: rotateGearReverse 8s linear infinite;
}

.gear-tertiary {
    transform-origin: 120px 380px;
    animation: rotateGear 8s linear infinite;
}

@keyframes rotateGear {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotateGearReverse {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}

/* Piston animation */
.piston {
    animation: pistonMove 2s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

@keyframes pistonMove {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(20px); }
}

.piston-anim {
    animation: pistonMove 2s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

.piston-2 {
    animation-delay: -0.66s;
}

.piston-3 {
    animation-delay: -1.33s;
}

/* Dial needle animation */
.dial-needle {
    transform-origin: center;
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dashboard instruments */
.dashboard-instruments {
    display: flex;
    justify-content: space-around;
    margin: 2rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.instrument {
    text-align: center;
    flex: 0 0 auto;
}

.instrument-svg {
    width: 120px;
    height: 120px;
}

.technical-readout {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px solid rgba(228, 164, 74, 0.3);
    border-radius: 4px;
}

/* Schematic */
.schematic-display {
    margin-top: 2rem;
}

.schematic-svg {
    width: 100%;
    height: auto;
}

/* ===========================================
   Greenhouse Specific
   =========================================== */

.botanical-illustration {
    max-width: 400px;
    margin: 2rem auto;
}

.botanical-svg {
    width: 100%;
    height: auto;
}

.botanical-small {
    max-height: 350px;
}

/* Botanical drawing animations */
.draw-anim path,
.draw-anim line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 0.8s ease-in-out;
}

.draw-anim.drawn path,
.draw-anim.drawn line {
    stroke-dashoffset: 0;
}

.draw-delay-1 path,
.draw-delay-1 line {
    transition-delay: 0.4s;
}

.bloom-anim {
    transform: scale(0);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bloom-anim.bloomed {
    transform: scale(1);
}

/* Specimen grid */
.specimen-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

.specimen-thumb {
    cursor: pointer;
    transition: transform 180ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 1rem;
    border: 1px solid rgba(43, 24, 16, 0.2);
    border-radius: 4px;
    background: rgba(242, 232, 217, 0.5);
}

.specimen-thumb:hover {
    transform: scale(1.08);
}

.specimen-thumb:not(:hover) {
    transition: transform 240ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.thumb-svg {
    width: 100%;
    height: auto;
}

/* ===========================================
   Section 4: Convergence
   =========================================== */

#convergence {
    min-height: 100vh;
    background: #1A0E08;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
}

.convergence-content {
    max-width: 800px;
    width: 100%;
}

.final-illustration {
    margin: 2rem auto;
}

.machine-tree-svg {
    width: 100%;
    height: auto;
}

/* ===========================================
   Scale-Hover Pattern (Global)
   =========================================== */

.scale-hover {
    transition: transform 180ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scale-hover:hover {
    transform: scale(1.08);
}

.scale-hover:not(:hover) {
    transition: transform 240ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===========================================
   Cross-hatching pattern (decorative)
   =========================================== */

.engine-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(43, 24, 16, 0.04) 3px,
        rgba(43, 24, 16, 0.04) 4px
    );
    pointer-events: none;
    z-index: 0;
}

/* ===========================================
   Mobile (below 768px)
   =========================================== */

@media (max-width: 768px) {
    #split-container {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    #split-container.state-2,
    #split-container.state-3 {
        grid-template-columns: 1fr;
    }

    #divider {
        display: none;
    }

    .hero-title {
        font-size: 16vw;
    }

    .section-title {
        font-size: 10vw;
    }

    .convergence-title {
        font-size: 12vw;
    }

    .engine-section,
    .greenhouse-section {
        padding: 60px 20px 40px;
        min-height: auto;
    }

    /* Stack sections with horizontal rules */
    #greenhouse-panel {
        border-top: 2px solid #2B1810;
    }

    .greenhouse-section + .greenhouse-section {
        border-top: 2px solid #2B1810;
    }

    .engine-section + .engine-section {
        border-top: 2px solid #2B1810;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .specimen-name {
        font-size: 1.6rem;
    }

    .dashboard-instruments {
        flex-direction: column;
        align-items: center;
    }

    .instrument-svg {
        width: 100px;
        height: 100px;
    }

    .specimen-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    /* Tap-active instead of hover for mobile */
    .nav-dot:active {
        transform: scale(1.4);
        transition: transform 120ms ease;
    }

    .specimen-thumb:active {
        transform: scale(1.08);
        transition: transform 120ms ease;
    }

    #convergence {
        padding: 60px 20px;
    }

    .nav-brand {
        font-size: 1rem;
    }

    #navbar {
        padding: 0 16px;
    }
}

/* ===========================================
   Bloom animation origin for SVGs
   =========================================== */

#lily-bloom {
    transform-origin: 200px 150px;
}

#fern-tip {
    transform-origin: 200px 40px;
}

#thistle-head {
    transform-origin: 150px 100px;
}

#tree-canopy {
    transform-origin: 400px 250px;
}

/* Instrument needle animations triggered by class */
.instrument-needle.animated {
    transform: rotate(var(--target-angle, 0deg));
}

/* ===========================================
   Additional Color Usage
   =========================================== */

/* Oxidized Iron accent for mechanical warnings and hot elements */
.engine-section .gear-secondary circle {
    stroke: #A63D1E;
}

.engine-diagram .piston rect:first-child {
    stroke: #A63D1E;
}

.technical-readout {
    border-color: rgba(166, 61, 30, 0.3);
}

.engine-section.section-3 .schematic-svg .piston-anim rect {
    fill: #A63D1E;
}
