/* ============================================================
   kaguya.dev — Corporate Naturalism Under Kinetic Tension
   Colors: #0F1117, #F0EDE8, #1C3D2E, #4CAF82, #E8C547, #8B7355, #2A4D3A, #1A1C1E, #2E3235
   Fonts: Syne (display), DM Sans (body), Space Mono (accent)
   ============================================================ */

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

:root {
    --color-bg-dark: #0F1117;
    --color-bg-warm: #F0EDE8;
    --color-bg-forest: #1C3D2E;
    --color-bg-near-black: #1A1C1E;
    --color-bg-studio: #2E3235;
    --color-accent-green: #4CAF82;
    --color-accent-amber: #E8C547;
    --color-umber: #8B7355;
    --color-dark-botanical: #2A4D3A;
    --color-studio-dark: #1A1D20;
    --color-text-warm: #C8C4BD;
    --color-text-dark: #1A1C1E;
    --font-display: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'Space Mono', monospace;
    --panel-left-width: 48vw;
    --panel-right-width: 52vw;
    --gutter: 40px;
    --seam-width: 3px;
}

html {
    cursor: none;
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg-dark);
    color: var(--color-text-warm);
    font-family: var(--font-body);
    font-weight: 300;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ── Custom Cursor ── */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 120ms ease;
    will-change: transform;
}

/* ── Left Panel ── */
.left-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--panel-left-width);
    height: 100vh;
    background-color: var(--color-bg-dark);
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Brand Mark */
.brand-mark {
    position: absolute;
    top: var(--gutter);
    left: var(--gutter);
    display: flex;
    align-items: baseline;
    gap: 0;
    z-index: 10;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    color: var(--color-bg-warm);
    letter-spacing: -0.02em;
}

.brand-dot {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 18px;
    color: var(--color-accent-green);
}

.brand-tld {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 11px;
    color: var(--color-accent-green);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    margin-left: 1px;
}

/* Kinetic Headline */
.kinetic-headline-wrapper {
    position: absolute;
    top: 50%;
    left: var(--gutter);
    transform: translateY(-50%);
    width: calc(100% - var(--gutter) * 2);
}

.kinetic-headline {
    position: relative;
    min-height: 200px;
}

.headline-phrase {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    opacity: 0;
    pointer-events: none;
}

.headline-phrase.active {
    opacity: 1;
    pointer-events: auto;
}

.h-char {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(48px, 5.5vw, 88px);
    line-height: 1.05;
    color: var(--color-bg-warm);
    display: inline-block;
    overflow: hidden;
    clip-path: inset(0 0 0 0);
    transition: clip-path 300ms ease, opacity 300ms ease;
}

.h-char.exit {
    animation: charExit 300ms ease forwards;
}

.h-char.enter {
    animation: charEnter 300ms ease forwards;
}

@keyframes charExit {
    from {
        clip-path: inset(0 0% 0 0);
        opacity: 1;
        transform: translateY(0);
    }
    to {
        clip-path: inset(0 100% 0 0);
        opacity: 0;
        transform: translateY(-20px);
    }
}

@keyframes charEnter {
    from {
        clip-path: inset(0 0 0 100%);
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        clip-path: inset(0 0% 0 0%);
        opacity: 1;
        transform: translateY(0);
    }
}

/* Left Navigation */
.left-nav {
    position: absolute;
    bottom: var(--gutter);
    left: var(--gutter);
}

.left-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-link {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 13px;
    color: var(--color-text-warm);
    text-decoration: none;
    letter-spacing: 0.04em;
    position: relative;
    display: inline-block;
    transition: color 200ms ease;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 1px;
    background: var(--color-accent-green);
    opacity: 0;
    transition: opacity 200ms ease, width 200ms ease;
}

.nav-link:hover {
    color: var(--color-accent-green);
}

.nav-link:hover::before {
    opacity: 1;
    width: 10px;
}

.nav-link.glitch-active {
    animation: navGlitch 120ms ease;
}

@keyframes navGlitch {
    0% { text-shadow: none; }
    20% { text-shadow: 3px 0 0 rgba(228, 47, 47, 0.7), -3px 0 0 rgba(47, 139, 228, 0.7); }
    40% { text-shadow: -2px 0 0 rgba(228, 47, 47, 0.7), 2px 0 0 rgba(47, 139, 228, 0.7); }
    60% { text-shadow: 2px 0 0 rgba(228, 47, 47, 0.7), -2px 0 0 rgba(47, 139, 228, 0.7); }
    80% { text-shadow: -1px 0 0 rgba(228, 47, 47, 0.7), 1px 0 0 rgba(47, 139, 228, 0.7); }
    100% { text-shadow: none; }
}

/* Monstera Crossover Element */
.monstera-crossover {
    position: absolute;
    left: calc(var(--panel-left-width) - 60%);
    top: 38vh;
    width: 28vw;
    z-index: 50;
    pointer-events: none;
    opacity: 0.85;
}

.monstera-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(44, 77, 58, 0.4));
}

/* ── Glitch Seam ── */
.glitch-seam {
    position: fixed;
    left: var(--panel-left-width);
    top: 0;
    width: var(--seam-width);
    height: 100vh;
    background: var(--color-dark-botanical);
    z-index: 200;
    pointer-events: none;
    transition: background 80ms ease;
}

.glitch-seam.glitch-burst {
    background: var(--color-accent-green);
    box-shadow: 0 0 8px var(--color-accent-amber), 0 0 2px var(--color-accent-green);
}

/* ── Right Panel ── */
.right-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--panel-right-width);
    height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.right-panel::-webkit-scrollbar {
    display: none;
}

/* ── Stations ── */
.station {
    width: 100%;
    min-height: 100vh;
    position: relative;
    padding: var(--gutter);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.station-inner {
    padding: 0 var(--gutter);
    max-width: 540px;
    position: relative;
    z-index: 5;
}

/* Station 1: Foundation */
.station-foundation {
    background-color: var(--color-bg-warm);
    color: var(--color-text-dark);
}

/* Station 2: Methodology */
.station-methodology {
    background-color: var(--color-bg-forest);
    color: var(--color-bg-warm);
    clip-path: polygon(8% 0, 100% 0, 100% 100%, 0% 100%);
}

/* Station 3: Ecosystem */
.station-ecosystem {
    background-color: var(--color-bg-dark);
    color: var(--color-text-warm);
}

/* Station 4: Contact */
.station-contact {
    background-color: var(--color-bg-warm);
    color: var(--color-text-dark);
}

/* ── Section Counter ── */
.section-counter {
    margin-bottom: 32px;
}

.counter-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-accent-green);
}

/* Scanline texture */
.scanline-texture {
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0, 0, 0, 0.08) 1px,
        rgba(0, 0, 0, 0.08) 2px
    );
    background-size: 100% 2px;
    -webkit-background-clip: text;
    background-clip: text;
}

/* ── Station Headings ── */
.station-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(26px, 2.8vw, 40px);
    line-height: 1.2;
    margin-bottom: 24px;
    color: inherit;
}

.station-methodology .station-heading,
.station-ecosystem .station-heading {
    color: var(--color-bg-warm);
}

/* ── Body Text ── */
.station-body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 15px;
    line-height: 24px;
    letter-spacing: 0.01em;
    margin-bottom: 16px;
    color: inherit;
    opacity: 0.85;
}

.station-methodology .station-body {
    color: var(--color-text-warm);
    opacity: 0.8;
}

.station-ecosystem .station-body {
    color: var(--color-text-warm);
}

/* ── Methodology Grid ── */
.methodology-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 32px;
}

.method-item {
    border-left: 1px solid var(--color-accent-green);
    padding-left: 16px;
    opacity: 0.85;
}

.method-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--color-accent-green);
    text-transform: uppercase;
    display: block;
    margin-bottom: 8px;
}

.method-desc {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 13px;
    line-height: 20px;
    color: var(--color-text-warm);
}

/* ── Aerial Roots Band ── */
.aerial-roots-band {
    position: absolute;
    top: 45%;
    left: 0;
    width: 100%;
    height: 60px;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

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

/* ── Ecosystem Grid ── */
.ecosystem-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 32px;
}

.eco-node {
    border: 1px solid rgba(74, 207, 130, 0.2);
    padding: 20px;
    position: relative;
    background: rgba(44, 77, 58, 0.08);
    transition: border-color 200ms ease, background 200ms ease;
}

.eco-node:hover {
    border-color: rgba(74, 207, 130, 0.5);
    background: rgba(44, 77, 58, 0.15);
}

.eco-node-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.node-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-accent-green);
    flex-shrink: 0;
    animation: nodePulse 3s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.eco-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--color-accent-green);
    text-transform: uppercase;
}

.eco-desc {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 13px;
    line-height: 20px;
    color: var(--color-text-warm);
    opacity: 0.8;
}

/* Fern background in ecosystem station */
.fern-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(ellipse at center, #1A1D20 0%, #2E3235 100%);
    border-radius: 50%;
}

.fern-svg {
    width: 100%;
    height: 100%;
    animation: fernRotate 60s linear infinite;
}

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

/* ── Contact Form ── */
.contact-form {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-accent-green);
}

.form-input,
.form-textarea {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-accent-green);
    padding: 8px 0;
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 15px;
    color: var(--color-text-dark);
    outline: none;
    resize: none;
    width: 100%;
    transition: border-color 200ms ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: rgba(26, 28, 30, 0.35);
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--color-text-dark);
}

.form-textarea {
    min-height: 100px;
    line-height: 24px;
}

.form-submit {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 1px solid var(--color-accent-green);
    padding: 12px 24px;
    cursor: none;
    width: fit-content;
    transition: background 200ms ease, color 200ms ease;
}

.form-submit:hover {
    background: var(--color-accent-green);
}

.submit-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-dark);
}

.submit-arrow {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-accent-green);
    transition: transform 200ms ease;
}

.form-submit:hover .submit-arrow {
    transform: translateX(4px);
    color: var(--color-text-dark);
}

/* ── Root System Footer ── */
.root-system-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    pointer-events: none;
    z-index: 2;
}

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

/* ── Glitch Artifact Strip ── */
.glitch-artifact-strip {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 3px,
        rgba(74, 207, 130, 0.15) 3px,
        rgba(74, 207, 130, 0.15) 6px,
        transparent 6px,
        transparent 9px,
        rgba(232, 197, 71, 0.1) 9px,
        rgba(232, 197, 71, 0.1) 12px
    );
    z-index: 3;
    pointer-events: none;
}

/* ── Botanical Watermark Textures ── */
.station-foundation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(ellipse 60% 80% at 80% 50%, rgba(44, 77, 58, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.station-methodology::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(ellipse 50% 70% at 20% 60%, rgba(74, 207, 130, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── Active Navigation State ── */
.nav-link.is-active {
    color: var(--color-accent-green);
}

.nav-link.is-active::before {
    opacity: 1;
    width: 10px;
}

/* ── Glitch Seam Animation ── */
@keyframes seamDisplace {
    0% { transform: translateX(0); }
    10% { transform: translateX(3px); }
    20% { transform: translateX(-2px); }
    30% { transform: translateX(4px); }
    50% { transform: translateX(-1px); }
    70% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

.right-panel.glitching {
    animation: seamDisplace 80ms steps(3) 1;
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .cursor {
        display: none;
    }

    html {
        cursor: auto;
    }

    .left-panel {
        position: sticky;
        top: 0;
        width: 100%;
        height: 64px;
        flex-direction: row;
        align-items: center;
        padding: 0 20px;
        z-index: 100;
        background-color: var(--color-bg-dark);
    }

    .brand-mark {
        position: static;
        margin-right: auto;
    }

    .kinetic-headline-wrapper {
        display: none;
    }

    .kinetic-headline-wrapper.mobile-hero {
        display: block;
        position: static;
        transform: none;
        width: 100%;
        padding: 60px 20px 40px;
        background: var(--color-bg-dark);
    }

    .headline-phrase.active {
        position: static;
        display: flex;
    }

    .h-char {
        font-size: clamp(36px, 10vw, 60px);
    }

    .left-nav {
        position: static;
    }

    .left-nav ul {
        flex-direction: row;
        gap: 20px;
    }

    .monstera-crossover {
        display: none;
    }

    .glitch-seam {
        display: none;
    }

    .right-panel {
        position: static;
        width: 100%;
        height: auto;
        overflow: visible;
    }

    .station {
        min-height: auto;
        padding: 60px 20px;
    }

    .station-methodology {
        clip-path: none;
    }

    .station-inner {
        padding: 0;
    }

    .methodology-grid,
    .ecosystem-grid {
        grid-template-columns: 1fr;
    }

    :root {
        --gutter: 20px;
    }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    .h-char,
    .h-char.exit,
    .h-char.enter {
        animation: none;
        clip-path: none;
        transform: none;
        opacity: 1;
    }

    .headline-phrase {
        opacity: 0;
        transition: none;
    }

    .headline-phrase.active {
        opacity: 1;
    }

    .right-panel.glitching {
        animation: none;
    }

    .glitch-seam.glitch-burst {
        background: var(--color-dark-botanical);
    }

    .nav-link.glitch-active {
        animation: none;
    }

    .fern-svg {
        animation: none;
    }

    .node-indicator {
        animation: none;
    }

    .cursor {
        display: none;
    }

    html {
        cursor: auto;
    }
}
