/* ============================================
   gabs.wiki — Styles
   Cyberpunk-botanical greenhouse wiki
   ============================================ */

/* Custom Properties */
:root {
    --bg-deep: #0d0b08;
    --bg-parchment: #f5efe6;
    --bg-greenhouse: #1a1612;
    --accent-terracotta: #c4956a;
    --accent-patina: #5e8a6e;
    --text-charcoal: #2c2519;
    --text-sage: #8a7a62;
    --text-cream: #e8dfd2;
    --highlight-amber: #d4a853;
    --base-unit: 8px;
    --card-clip: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 0 100%);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-cream);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Circuit overlay */
.circuit-overlay {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M0 60h30l10-10h20l10 10h50' stroke='%23c4956a' stroke-width='0.8' fill='none'/%3E%3Cpath d='M60 0v30l-10 10v20l10 10v50' stroke='%23c4956a' stroke-width='0.8' fill='none'/%3E%3Ccircle cx='30' cy='60' r='2.5' fill='none' stroke='%23c4956a' stroke-width='0.8'/%3E%3Ccircle cx='60' cy='30' r='2.5' fill='none' stroke='%23c4956a' stroke-width='0.8'/%3E%3Cpath d='M90 0v20l10 10h20' stroke='%23c4956a' stroke-width='0.8' fill='none'/%3E%3Ccircle cx='90' cy='20' r='2' fill='none' stroke='%23c4956a' stroke-width='0.8'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
}

.circuit-overlay--light {
    opacity: 0.03;
}

/* ============================================
   HERO — The Entry
   ============================================ */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    background-color: var(--bg-greenhouse);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    width: 90%;
    max-width: 1200px;
}

.hero-title-gabs {
    grid-column: 2 / 6;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 9vw, 8rem);
    letter-spacing: 0.04em;
    line-height: 1.0;
    text-transform: uppercase;
    color: var(--text-cream);
    transform: translateY(-12px);
}

.hero-fern {
    grid-column: 5 / 8;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.fern-svg {
    width: 160px;
    height: auto;
}

.hero-title-wiki {
    grid-column: 5 / 9;
    grid-row: 2;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 9vw, 8rem);
    letter-spacing: 0.04em;
    line-height: 1.0;
    text-transform: uppercase;
    color: var(--text-cream);
    transform: translateY(24px);
}

.hero-subtitle {
    grid-column: 3 / 10;
    grid-row: 3;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-sage);
    margin-top: 48px;
    text-align: center;
}

/* Fern stroke animation */
.fern-stem,
.fern-leaf {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: draw-stroke 2.4s ease-out forwards;
}

.fern-leaf-1, .fern-leaf-2 { animation-delay: 0.3s; }
.fern-leaf-3, .fern-leaf-4 { animation-delay: 0.5s; }
.fern-leaf-5, .fern-leaf-6 { animation-delay: 0.7s; }
.fern-leaf-7, .fern-leaf-8 { animation-delay: 0.9s; }
.fern-leaf-9, .fern-leaf-10 { animation-delay: 1.1s; }
.fern-leaf-11, .fern-leaf-12 { animation-delay: 1.3s; }
.fern-leaf-13, .fern-leaf-14 { animation-delay: 1.5s; }

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

/* ============================================
   COLLECTION — Specimen Cards
   ============================================ */
.collection {
    position: relative;
    padding: 120px 0 160px;
    background-color: var(--bg-greenhouse);
}

.collection-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    row-gap: 40px;
}

/* Specimen Card base */
.specimen-card {
    background: var(--bg-parchment);
    border: 2px solid var(--accent-terracotta);
    clip-path: var(--card-clip);
    padding: 40px 36px 32px;
    position: relative;
    transform: rotate(var(--card-rotation, 0deg));
    transition: transform 0.3s ease-out, border-color 0.3s ease-out;
    opacity: 0;
    z-index: 1;
}

.specimen-card.is-visible {
    opacity: 1;
}

.specimen-card:hover {
    transform: rotate(var(--card-rotation, 0deg)) translateY(-2px);
    border-color: var(--highlight-amber);
}

.card-heading {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.02em;
    color: var(--text-charcoal);
    margin-bottom: 16px;
    line-height: 1.2;
}

.chevron {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: var(--accent-terracotta);
    margin-right: 8px;
    letter-spacing: -0.02em;
}

.card-body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.72;
    color: var(--text-charcoal);
}

.card-label {
    display: block;
    margin-top: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-sage);
}

.card-botanical {
    position: absolute;
    top: 12px;
    right: 36px;
    width: 80px;
    height: 80px;
    opacity: 0.35;
}

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

/* Card positions — broken grid */
.card-1 {
    grid-column: 1 / 7;
    transform: rotate(0.3deg) translate(16px, 0);
}
.card-1.is-visible { transform: rotate(0.3deg) translate(16px, 0); }

.card-2 {
    grid-column: 6 / 13;
    transform: rotate(-0.5deg) translate(-20px, 32px);
    z-index: 2;
}
.card-2.is-visible { transform: rotate(-0.5deg) translate(-20px, 32px); }

.card-3 {
    grid-column: 2 / 8;
    transform: rotate(0.7deg) translate(0, -20px);
}
.card-3.is-visible { transform: rotate(0.7deg) translate(0, -20px); }

.card-4 {
    grid-column: 7 / 13;
    transform: rotate(-0.3deg) translate(-32px, 16px);
    z-index: 2;
}
.card-4.is-visible { transform: rotate(-0.3deg) translate(-32px, 16px); }

.card-5 {
    grid-column: 3 / 10;
    transform: rotate(0.6deg) translate(24px, -24px);
}
.card-5.is-visible { transform: rotate(0.6deg) translate(24px, -24px); }

/* ============================================
   ARCHIVE INDEX
   ============================================ */
.archive-index {
    position: relative;
    min-height: 80vh;
    background-color: var(--bg-deep);
    padding: 120px 0 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.archive-index-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-sage);
    margin-bottom: 64px;
    position: relative;
    z-index: 1;
}

.archive-index-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px 80px;
    width: 90%;
    max-width: 700px;
}

.index-entry {
    display: flex;
    align-items: baseline;
    gap: 12px;
    position: relative;
    padding-bottom: 8px;
}

.index-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-sage);
    flex-shrink: 0;
}

.index-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--text-cream);
}

.index-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 1px;
    background-color: var(--accent-terracotta);
    transition: width 0.8s ease-out;
}

.index-entry.is-visible .index-line {
    width: 100%;
}

/* ============================================
   ROOTS — The Root System
   ============================================ */
.roots {
    position: relative;
    min-height: 60vh;
    background-color: var(--bg-deep);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-bottom: 200px;
    overflow: hidden;
}

.roots-svg-container {
    width: 100%;
    max-width: 800px;
    position: relative;
}

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

.root-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 3s ease-out;
}

.roots.is-visible .root-path {
    stroke-dashoffset: 0;
}

.root-path-2 { transition-delay: 0.2s; }
.root-path-3 { transition-delay: 0.4s; }
.root-path-4 { transition-delay: 0.6s; }
.root-path-5 { transition-delay: 0.8s; }
.root-path-6 { transition-delay: 1.0s; }
.root-path-7 { transition-delay: 1.2s; }
.root-path-8 { transition-delay: 1.4s; }

.roots-label {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: var(--text-sage);
    margin-top: 40px;
    letter-spacing: 0.04em;
}

/* ============================================
   RESPONSIVE — Collapse to single column < 768
   ============================================ */
@media (max-width: 768px) {
    .hero-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .hero-title-gabs,
    .hero-title-wiki {
        transform: none;
    }

    .hero-fern {
        order: -1;
        margin-bottom: 16px;
    }

    .hero-subtitle {
        margin-top: 32px;
    }

    .collection-grid {
        display: flex;
        flex-direction: column;
        gap: 32px;
    }

    .specimen-card {
        transform: rotate(0deg) !important;
    }
    .specimen-card.is-visible {
        transform: rotate(0deg) !important;
    }

    .archive-index-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .fern-stem,
    .fern-leaf {
        animation: none;
        stroke-dashoffset: 0;
    }

    .specimen-card {
        opacity: 1;
    }

    .root-path {
        stroke-dashoffset: 0;
        transition: none;
    }

    .index-line {
        width: 100%;
        transition: none;
    }
}
