/* ============================================
   concepts.news — Botanical Darkroom Laboratory
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0B0E1A;
    --bg-overlay: #111627;
    --accent-sage: #C4D4A8;
    --accent-fern: #6B9E7A;
    --accent-teal: #2A5C4E;
    --text-body: #B8C4A2;
    --accent-copper: #D4A574;
    --highlight: #7ECBA1;
    --label-fern: #5C8A6E;
    --sage-dark: #8BA87C;
    --white-unused: #FFFFFF; /* palette deliberately avoids pure white */

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;
    --font-hand: 'Caveat', cursive;
}

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

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

body {
    background-color: var(--bg-primary);
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    font-weight: 400;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Wave-form Background Texture --- */
#wave-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.035;
}

#wave-background svg {
    width: 100%;
    height: 100%;
}

.standing-wave {
    animation: wave-drift 12s ease-in-out infinite;
}

.standing-wave-2 {
    animation: wave-drift 16s ease-in-out infinite reverse;
}

@keyframes wave-drift {
    0% { transform: translateX(0); }
    50% { transform: translateX(-40px); }
    100% { transform: translateX(0); }
}

/* --- Root System Navigation --- */
#root-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 40px;
    height: 100vh;
    z-index: 100;
    opacity: 0.4;
    transition: opacity 0.4s ease;
}

#root-nav:hover {
    opacity: 1;
}

#root-svg {
    width: 40px;
    height: 100%;
}

.root-main-stem {
    opacity: 0.5;
}

.root-branch {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.root-branch line {
    transition: stroke 0.3s ease;
}

.root-node {
    transition: fill 0.3s ease, r 0.3s ease;
}

.root-branch.active .root-node {
    fill: var(--highlight);
    animation: node-pulse 1s ease-out;
}

@keyframes node-pulse {
    0% { r: 3; opacity: 1; }
    50% { r: 6; opacity: 0.5; }
    100% { r: 3; opacity: 1; }
}

.root-label {
    font-family: var(--font-mono);
    font-size: 6px;
    fill: var(--label-fern);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.root-branch:hover .root-label {
    opacity: 1;
}

/* --- Mobile Dot Indicator --- */
#mobile-dots {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.mobile-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--label-fern);
    opacity: 0.4;
    transition: opacity 0.3s ease, background 0.3s ease, transform 0.3s ease;
    cursor: pointer;
}

.mobile-dot.active {
    background: var(--highlight);
    opacity: 1;
    transform: scale(1.4);
}

/* --- Plate (Section) Base --- */
.plate {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 60px 40px 60px 60px;
}

/* --- Opening Canopy --- */
.plate-canopy {
    flex-direction: column;
}

.canopy-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.canopy-wave {
    width: clamp(300px, 60vw, 800px);
    height: 60px;
    opacity: 0;
    transition: opacity 0.8s ease;
    margin-bottom: 30px;
}

.canopy-wave.visible {
    opacity: 0.15;
}

.canopy-wave-path {
    animation: wave-drift 12s ease-in-out infinite;
}

/* Site Title */
.site-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--accent-sage);
    letter-spacing: 0.02em;
    line-height: 1.05;
    text-align: center;
    margin-bottom: 20px;
}

.title-letter {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.title-letter.revealed {
    opacity: 1;
}

.title-dot {
    color: var(--accent-fern);
}

/* Tagline */
.tagline {
    font-family: var(--font-hand);
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--accent-copper);
    transform: rotate(-1.5deg);
    opacity: 0;
    transition: opacity 0.6s ease;
    margin-bottom: 40px;
}

.tagline.visible {
    opacity: 1;
}

/* Scroll Chevron */
.scroll-chevron {
    width: 40px;
    height: 50px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: chevron-pulse 2s ease-in-out infinite;
    animation-play-state: paused;
}

.scroll-chevron.visible {
    opacity: 0.7;
    animation-play-state: running;
}

.scroll-chevron:hover {
    opacity: 1;
}

@keyframes chevron-pulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* Diverging waves */
.canopy-diverge-waves {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    opacity: 0;
    transition: opacity 1s ease 1.5s;
}

.canopy-diverge-waves.visible {
    opacity: 0.2;
}

.diverge-wave-top {
    animation: wave-drift 10s ease-in-out infinite;
    transform-origin: center;
}

.diverge-wave-bottom {
    animation: wave-drift 14s ease-in-out infinite reverse;
    transform-origin: center;
}

/* --- Wave Dividers --- */
.wave-divider {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.wave-divider svg {
    width: 100%;
    height: 80px;
    opacity: 0.25;
}

.wave-divider-path {
    animation: wave-drift 12s ease-in-out infinite;
    will-change: transform;
    transition: transform 0.4s ease;
}

.wave-divider.amplified .wave-divider-path {
    transform: scaleY(2.5);
}

.wave-divider.amplified svg {
    opacity: 0.5;
}

.wave-divider-final {
    height: 20vh;
}

/* --- Specimen Plates --- */
.specimen-plate {
    padding: 80px 60px 80px 80px;
    background: radial-gradient(ellipse at center, var(--bg-overlay) 0%, var(--bg-primary) 70%);
}

.plate-content {
    display: flex;
    align-items: flex-start;
    max-width: 1200px;
    width: 100%;
    gap: 0;
}

.plate-main {
    flex: 0 0 55%;
    padding-right: 40px;
}

.plate-sidebar {
    flex: 0 0 30%;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.plate-sidebar.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Vertical Rule */
.vertical-rule {
    width: 1px;
    min-height: 200px;
    align-self: stretch;
    background: var(--accent-teal);
    opacity: 0.4;
    /* Slight irregularity via SVG-like background */
    background-image: repeating-linear-gradient(
        to bottom,
        var(--accent-teal) 0px,
        var(--accent-teal) 3px,
        transparent 3px,
        transparent 4px
    );
    background-size: 1px 7px;
}

.sidebar-content {
    padding-top: 10px;
}

.sidebar-heading {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--label-fern);
    opacity: 0.7;
    margin-bottom: 16px;
}

.sidebar-meta {
    display: grid;
    gap: 8px;
}

.sidebar-meta dt {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--label-fern);
    opacity: 0.6;
}

.sidebar-meta dd {
    font-family: var(--font-body);
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--text-body);
    opacity: 0.85;
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Specimen Icon */
.specimen-icon {
    width: clamp(120px, 15vw, 180px);
    height: clamp(120px, 15vw, 180px);
    margin-bottom: 24px;
}

.iso-icon {
    width: 100%;
    height: 100%;
}

.iso-draw path,
.iso-draw line,
.iso-draw circle,
.iso-draw ellipse {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease-out;
}

.iso-draw.drawn path,
.iso-draw.drawn line,
.iso-draw.drawn circle,
.iso-draw.drawn ellipse {
    stroke-dashoffset: 0;
}

/* Plate Heading */
.plate-heading {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: var(--accent-sage);
    letter-spacing: 0.02em;
    line-height: 1.05;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.plate-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Plate Subheading */
.plate-subheading {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--sage-dark);
    letter-spacing: 0.02em;
    line-height: 1.3;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.plate-subheading.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Plate Body */
.plate-body {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.plate-body.revealed {
    opacity: 1;
    transform: translateY(0);
}

.plate-body p {
    margin-bottom: 16px;
    font-weight: 300;
}

.plate-body p:last-child {
    margin-bottom: 0;
}

/* Annotation */
.annotation {
    font-family: var(--font-hand);
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--accent-copper);
    transform: rotate(-1.5deg);
    margin-top: 24px;
    opacity: 0;
    transition: opacity 0.4s ease 0.6s;
}

.annotation.revealed {
    opacity: 0.85;
}

/* Specimen Label */
.specimen-label {
    position: absolute;
    bottom: 40px;
    right: 60px;
    max-width: 200px;
    padding: 10px 14px;
    background: rgba(196, 212, 168, 0.08);
    border: 1px solid var(--label-fern);
    transform: rotate(0.5deg);
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.specimen-label.revealed {
    opacity: 1;
}

.specimen-label span {
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 0.75vw, 0.72rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--label-fern);
    opacity: 0.7;
}

.label-id {
    font-weight: 400;
    color: var(--accent-sage) !important;
    opacity: 0.9 !important;
}

/* --- Specimen Detail Overlay --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.2s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}

.overlay-close {
    position: fixed;
    top: 30px;
    right: 30px;
    background: none;
    border: none;
    color: var(--accent-sage);
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    z-index: 1001;
    font-family: var(--font-body);
}

.overlay-close:hover {
    opacity: 1;
}

.overlay-content {
    max-width: 640px;
    width: 100%;
    padding: 80px 40px;
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    color: var(--text-body);
}

.overlay-content h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--accent-sage);
    margin-bottom: 24px;
}

.overlay-content p {
    margin-bottom: 16px;
}

/* --- Colophon --- */
.plate-colophon {
    min-height: 50vh;
    flex-direction: column;
    gap: 16px;
}

.colophon-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.colophon-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--accent-sage);
    opacity: 0.4;
    letter-spacing: 0.02em;
}

.colophon-sub {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--label-fern);
    opacity: 0.5;
}

.colophon-leaf {
    width: 30px;
    height: 45px;
    opacity: 0.3;
    margin-top: 8px;
}

/* --- Hover Effects on Specimen Plates --- */
.specimen-plate:hover ~ .wave-divider .wave-divider-path,
.specimen-plate:hover + .wave-divider .wave-divider-path {
    transform: scaleY(1.5);
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .plate-content {
        flex-direction: column;
    }

    .plate-main {
        flex: 1 1 100%;
        padding-right: 0;
        margin-bottom: 40px;
    }

    .plate-sidebar {
        flex: 1 1 100%;
        transform: translateX(0);
    }

    .plate-sidebar.revealed {
        transform: translateX(0);
    }

    .specimen-icon {
        width: 100px;
        height: 100px;
    }

    .specimen-label {
        position: relative;
        bottom: auto;
        right: auto;
        margin-top: 30px;
    }

    .specimen-plate {
        padding: 60px 40px 60px 60px;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    #root-nav {
        display: none;
    }

    #mobile-dots {
        display: flex;
    }

    .plate {
        padding: 40px 20px;
    }

    .specimen-plate {
        padding: 40px 20px;
    }

    .specimen-icon {
        width: 80px;
        height: 80px;
    }

    .standing-wave-2 {
        display: none;
    }

    #wave-background {
        opacity: 0.02;
    }

    .specimen-label {
        position: relative;
        bottom: auto;
        right: auto;
        margin-top: 20px;
        max-width: 100%;
    }

    .wave-divider {
        height: 20vh;
    }

    .plate-heading {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .site-title {
        font-size: clamp(2.2rem, 10vw, 4rem);
    }
}

/* --- Selection Color --- */
::selection {
    background: var(--accent-teal);
    color: var(--accent-sage);
}

/* --- Scrollbar styling (Webkit) --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-teal);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-fern);
}

/* --- Will-change hints for animations --- */
.wave-divider-path,
.standing-wave,
.diverge-wave-top,
.diverge-wave-bottom,
.canopy-wave-path {
    will-change: transform;
}

.plate-heading,
.plate-subheading,
.plate-body,
.plate-sidebar,
.specimen-label,
.annotation {
    will-change: opacity, transform;
}