/* === Custom Properties === */
:root {
    --fern: #2d4a22;
    --lavender: #6b4c7a;
    --pollen: #c4952b;
    --linen: #f4f0e6;
    --soil: #1a1e16;
    --chlorophyll: #e8f0e0;
    --sage-wire: #b8d4a3;
    --bark: #6b6b5e;
    --mist: #d4dcc8;
    --hud-green: #7ba668;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.72;
    letter-spacing: 0.015em;
    color: var(--fern);
    background-color: var(--linen);
    overflow-x: hidden;
}

/* === Noise === */
.noise-svg {
    position: absolute;
    width: 0;
    height: 0;
}

.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0.04;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* === HUD Layer === */
.hud-layer {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    animation: hudPulse 4s ease-in-out infinite;
}

@keyframes hudPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.8; }
}

.hud-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    transform: translate(-50%, -50%);
    transition: opacity 0.6s ease;
}

.hud-cardinal {
    position: absolute;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--hud-green);
    opacity: 0.7;
}

.hud-cardinal-top {
    top: calc(50% - min(25vw, 300px) - 25px);
    left: 50%;
    transform: translateX(-50%);
}

.hud-cardinal-bottom {
    top: calc(50% + min(25vw, 300px) + 10px);
    left: 50%;
    transform: translateX(-50%);
}

.hud-cardinal-left {
    top: 50%;
    left: calc(50% - min(25vw, 300px) - 60px);
    transform: translateY(-50%);
}

.hud-cardinal-right {
    top: 50%;
    right: calc(50% - min(25vw, 300px) - 60px);
    transform: translateY(-50%);
}

/* HUD Brackets */
.hud-bracket {
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: var(--hud-green);
    border-style: solid;
    border-width: 0;
    opacity: 0;
    transition: all 0.5s ease;
}

.hud-bracket-tl { top: 20%; left: 10%; border-top-width: 1px; border-left-width: 1px; }
.hud-bracket-tr { top: 20%; right: 10%; border-top-width: 1px; border-right-width: 1px; }
.hud-bracket-bl { bottom: 20%; left: 10%; border-bottom-width: 1px; border-left-width: 1px; }
.hud-bracket-br { bottom: 20%; right: 10%; border-bottom-width: 1px; border-right-width: 1px; }

.hud-bracket.visible { opacity: 0.4; }

/* HUD Coordinates */
.hud-coord {
    position: absolute;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 300;
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--hud-green);
    opacity: 0.5;
}

.hud-coord-x { bottom: 15px; right: 20px; }
.hud-coord-y { bottom: 30px; right: 20px; }

/* === Branching Navigation === */
.branch-nav {
    position: fixed;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 150;
    width: 60px;
    height: 400px;
}

.branch-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 400px;
}

.branch-leaf {
    transition: opacity 0.3s ease;
}

.branch-link {
    position: absolute;
    left: 40px;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--fern);
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.branch-link:hover {
    opacity: 1;
    transform: translateX(4px);
}

.branch-link:hover ~ .branch-svg .branch-leaf,
.branch-nav:hover .branch-leaf {
    opacity: 0.6;
}

/* === Hero Section === */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--linen);
}

.botanical-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: var(--fern);
    letter-spacing: 0.02em;
    opacity: 0;
    animation: titleFadeIn 1.5s ease-out 0.3s forwards;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    animation: charFadeIn 0.4s ease-out forwards;
}

.hero-subtitle {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 300;
    font-size: 13px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--hud-green);
    opacity: 0;
    animation: subtitleFadeIn 1s ease-out 1.2s forwards;
    margin-top: 12px;
}

@keyframes titleFadeIn {
    to { opacity: 1; }
}

@keyframes charFadeIn {
    to { opacity: 1; }
}

@keyframes subtitleFadeIn {
    to { opacity: 0.7; }
}

/* === Grid Dividers === */
.grid-divider {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: hidden;
}

.grid-svg {
    width: 100%;
    height: 100%;
}

.grid-line-h, .grid-line-v {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 0.8s ease-out;
}

.grid-divider.revealed .grid-line-h,
.grid-divider.revealed .grid-line-v {
    stroke-dashoffset: 0;
}

/* === Content Sections === */
.content-section {
    position: relative;
    padding: 80px 5%;
    min-height: 60vh;
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
}

.section-dark {
    background-color: var(--soil);
    color: var(--chlorophyll);
}

.section-dark .specimen-card {
    background: rgba(232, 240, 224, 0.05);
    border-color: rgba(184, 212, 163, 0.2);
    backdrop-filter: blur(2px);
}

.section-dark .specimen-card h2 {
    color: var(--chlorophyll);
}

.section-dark .specimen-card p {
    color: var(--mist);
}

.section-dark .card-label {
    color: var(--pollen);
}

.botanical-section-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* === Specimen Cards === */
.specimen-card {
    position: relative;
    background: var(--chlorophyll);
    border: 1px solid rgba(184, 212, 163, 0.5);
    border-radius: 16px;
    padding: 36px 32px;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.specimen-card[data-entrance="right"] {
    transform: translateX(40px);
}

.specimen-card.visible {
    opacity: 1;
    transform: translateX(0);
}

.card-label {
    display: block;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bark);
    margin-bottom: 16px;
}

.specimen-card h2 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--fern);
    margin-bottom: 16px;
    line-height: 1.3;
}

.specimen-card p {
    color: #3d3d3d;
    margin-bottom: 12px;
}

.specimen-card p:last-child {
    margin-bottom: 0;
}

/* Card positioning - asymmetric golden ratio grid */
.card-left {
    width: min(540px, 55%);
    margin-left: 5%;
}

.card-right {
    width: min(440px, 42%);
    margin-left: auto;
    margin-right: 8%;
    margin-top: 40px;
}

.card-center-offset {
    width: min(520px, 50%);
    margin-left: 12%;
}

.card-right-offset {
    width: min(440px, 42%);
    margin-left: auto;
    margin-right: 5%;
}

.card-wide {
    width: min(700px, 70%);
    margin-left: 8%;
}

.card-left-small {
    width: min(280px, 30%);
    margin-left: 5%;
}

.card-right-small {
    width: min(340px, 35%);
    margin-left: auto;
    margin-right: 10%;
}

.card-center {
    width: min(580px, 60%);
    margin-left: 15%;
}

.card-left-offset {
    width: min(480px, 48%);
    margin-left: 8%;
    margin-top: 20px;
}

/* Phi display */
.phi-display {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.phi-symbol {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 3rem;
    color: var(--lavender);
    line-height: 1;
}

.phi-value {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 300;
    font-size: 1.2rem;
    color: var(--bark);
    letter-spacing: 0.08em;
}

/* === Footer === */
.root-footer {
    position: relative;
    background: var(--soil);
    padding: 120px 5% 40px;
    overflow: hidden;
}

.root-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 400px;
}

.footer-content {
    position: relative;
    z-index: 10;
    display: flex;
    gap: 60px;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

.footer-col {
    flex: 1;
    min-width: 200px;
}

.footer-label {
    display: block;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--pollen);
    margin-bottom: 12px;
}

.footer-col p {
    color: var(--sage-wire);
    font-size: 15px;
    line-height: 1.8;
}

.footer-link {
    color: var(--chlorophyll);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.3s ease;
    display: inline-block;
}

.footer-link:hover {
    color: var(--pollen);
}

.footer-base {
    position: relative;
    z-index: 10;
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(184, 212, 163, 0.15);
}

.footer-mark {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--bark);
}

/* === Magnetic element hover === */
.magnetic-element {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* === Responsive === */
@media (max-width: 768px) {
    .branch-nav {
        display: none;
    }

    .hud-cardinal-left,
    .hud-cardinal-right {
        display: none;
    }

    .content-section {
        padding: 50px 4%;
        flex-direction: column;
    }

    .specimen-card,
    .card-left, .card-right, .card-center-offset,
    .card-right-offset, .card-wide, .card-left-small,
    .card-right-small, .card-center, .card-left-offset {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .footer-content {
        flex-direction: column;
        gap: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .hud-layer {
        animation: none;
        opacity: 0.7;
    }
}
