/* =========================================================================
   chloengine.com — diptych / anti-design / pastoral-romantic
   Compliance motifs: (Google Fonts) Interlocking gears whose teeth sprout tiny
   leaves through SVG animations; Intersection Observer. should use `will-change:
   transform` sparingly. The scroll-driven split ratio changes should use CSS
   custom properties updated via `requestAnimationFrame` for smooth 60fps transitions.
   ========================================================================= */

:root {
    --deep-ground: #0f1a12;
    --surface: #f2e8d5;
    --wild-rose: #c45c6a;
    --faded-sage: #7a9e7e;
    --warm-stone: #8b7d6b;
    --deep-moss: #1a2b1e;
    --pale-lichen: #b8c9a3;
    --terracotta: #a3735c;

    --font-display: "Dela Gothic One", "Inter", system-ui, serif;
    --font-body: "Crimson Pro", "Inter", Georgia, serif;
    --font-mono: "IBM Plex Mono", "Space Mono", ui-monospace, monospace;
    --font-ui: "DM Sans", "Inter", system-ui, sans-serif;

    /* Dynamic split ratio (pastoral% | engine%) — updated by JS */
    --split-ratio: 50%;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--surface);
    color: var(--deep-ground);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

em { font-style: italic; color: var(--wild-rose); }

@keyframes petal-drift {
    0% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-6px) rotate(1deg); }
    100% { transform: translateY(0) rotate(-1deg); }
}

/* ------------------------------------------------------------------ sigil */
.sigil {
    position: fixed;
    top: 1.4rem;
    left: 1.4rem;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(15, 26, 18, 0.08);
    z-index: 50;
    transform: rotate(-4deg);
    transition: transform 0.5s ease;
    animation: petal-drift 7s ease-in-out infinite;
}
.sigil:hover { transform: rotate(4deg) scale(1.06); }

/* -------------------------------------------------------------- nav dots */
.section-dots {
    position: fixed;
    left: var(--split-ratio);
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    z-index: 40;
    pointer-events: none;
}
.section-dots .dot {
    pointer-events: auto;
    width: 12px;
    height: 14px;
    background: var(--terracotta);
    clip-path: polygon(50% 0%, 100% 30%, 85% 100%, 15% 100%, 0% 30%);
    opacity: 0.45;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: relative;
}
.section-dots .dot.active {
    opacity: 1;
    transform: scale(1.3);
    background: var(--wild-rose);
}
.section-dots .dot::after {
    content: attr(data-label);
    position: absolute;
    left: 18px;
    top: 0;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-stone);
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}
.section-dots .dot:hover::after { opacity: 1; }

/* ----------------------------------------------------- boundary svg path */
.boundary {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}
.boundary path {
    stroke-dasharray: 6000;
    stroke-dashoffset: 6000;
    transition: stroke-dashoffset 0.2s linear;
}

.boundary-seeds {
    position: fixed;
    left: var(--split-ratio);
    top: 0;
    height: 100vh;
    width: 0;
    z-index: 3;
    pointer-events: none;
}
.boundary-seeds .seed-dot {
    position: absolute;
    left: -6px;
    width: 12px;
    height: 14px;
    transform: rotate(-12deg);
}

/* =========================================================== diptych */
.diptych {
    position: relative;
    z-index: 1;
}

.beat {
    position: relative;
    display: grid;
    grid-template-columns: var(--split-ratio) 1fr;
    transition: grid-template-columns 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

.panel {
    padding: 6rem 4vw 6rem 4vw;
    position: relative;
    overflow: hidden;
}
.panel .inner {
    max-width: 560px;
    margin: 0 auto;
}

.panel-pastoral {
    background:
        radial-gradient(ellipse at 20% 10%, rgba(196, 92, 106, 0.08), transparent 60%),
        radial-gradient(ellipse at 80% 90%, rgba(122, 158, 126, 0.10), transparent 60%),
        var(--surface);
    color: var(--deep-ground);
    border-right: 1px solid rgba(163, 115, 92, 0.12);
}

.panel-engine {
    background: var(--deep-moss);
    color: var(--pale-lichen);
    font-family: var(--font-mono);
    background-image:
        linear-gradient(transparent 95%, rgba(184, 201, 163, 0.04) 95%),
        linear-gradient(90deg, transparent 95%, rgba(184, 201, 163, 0.04) 95%);
    background-size: 24px 24px;
}

/* Color bleed overlay at the boundary (pastoral side receives moss tint) */
.panel-pastoral::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(26, 43, 30, 0.08));
    pointer-events: none;
}

/* ================================================================ HERO */
.beat-hero {
    min-height: 100vh;
}

.eyebrow {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-stone);
    margin: 0 0 2rem 0;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 400;
    line-height: 0.9;
    letter-spacing: -0.06em;
    margin: 0 0 2.6rem 0;
    color: var(--deep-ground);
    display: inline-block;
}
.hero-title .letter {
    display: inline-block;
    margin-right: -0.12em;
    transform: translateY(0) rotate(0deg);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.hero-title .letter:nth-child(2) { transform: translateY(0.04em) rotate(-1deg); }
.hero-title .letter:nth-child(4) { transform: translateY(-0.03em) rotate(1deg); }
.hero-title .letter:last-child   { color: var(--wild-rose); }

.hero-sub {
    font-family: var(--font-body);
    font-size: 1.2rem;
    line-height: 1.7;
    margin: 0 0 2rem 0;
    color: var(--deep-ground);
    max-width: 44ch;
}

.hero-meta {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--warm-stone);
}
.hero-meta span { margin-right: 0.6rem; }

/* Hero engine side: Lottie substitute + code */
.lottie-scene {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 420px;
    margin: 0 auto 2rem auto;
    position: relative;
}
.gear-meadow {
    width: 100%;
    height: 100%;
    overflow: visible;
}
.gear-meadow .gear {
    transform-origin: center;
    transition: transform 0.1s linear, opacity 0.6s ease;
}
.gear-meadow .gear-a { transform-origin: 200px 200px; }
.gear-meadow .gear-b { transform-origin: 120px 300px; }
.gear-meadow .gear-c { transform-origin: 300px 110px; }
.gear-meadow .meadow .flower {
    opacity: 0;
    transform: scale(0) translateY(20px);
    transform-origin: center;
    transform-box: fill-box;
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.code-snippet {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--pale-lichen);
    background: rgba(15, 26, 18, 0.65);
    border-left: 2px solid var(--faded-sage);
    padding: 1.2rem 1.4rem;
    margin: 0;
    white-space: pre;
    overflow-x: auto;
}
.code-snippet .c-com { color: var(--warm-stone); font-style: italic; }
.code-snippet .c-kw  { color: var(--wild-rose); }
.code-snippet .c-fn  { color: #d3c28a; }
.code-snippet .c-str { color: var(--terracotta); }

/* ========================================================= PHILOSOPHY */
.section-label {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-stone);
    margin: 0 0 1.6rem 0;
}
.engine-label { color: var(--faded-sage); }

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 4.8vw, 3.8rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.04em;
    margin: 0 0 2rem 0;
    color: var(--deep-ground);
}
.section-title em { color: var(--wild-rose); font-style: italic; }
.tilt-slight { transform: rotate(-1.6deg); transform-origin: left center; }

.manifesto p {
    margin: 0 0 1.4rem 0;
    font-size: 1.12rem;
    line-height: 1.75;
}
.manifesto p.bleed-left {
    margin-left: -40px;
    padding: 0.6rem 1rem 0.6rem 1.4rem;
    border-left: 3px solid var(--wild-rose);
    background: rgba(196, 92, 106, 0.06);
    font-style: italic;
}

.signature {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-stone);
    margin-top: 3rem;
}

/* engine side */
.ascii-diagram {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--pale-lichen);
    margin: 0 0 2.4rem 0;
    white-space: pre;
    overflow-x: auto;
    background: rgba(15, 26, 18, 0.5);
    padding: 1.4rem;
    border: 1px dashed rgba(184, 201, 163, 0.18);
}

.spec-list {
    display: grid;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.88rem;
}
.spec {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px dotted rgba(184, 201, 163, 0.2);
}
.spec span { color: var(--warm-stone); }
.spec b    { color: var(--pale-lichen); font-weight: 500; }

/* ============================================================ FEATURES */
.beat-features {
    /* JS drives the split so the engine side can swell to nearly 70%. */
}

.vertical-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: 0 auto 2rem auto;
    display: block;
    width: max-content;
}

.vine {
    display: block;
    width: 100%;
    max-width: 60px;
    height: auto;
    margin: 0 auto;
}
.vine #vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.2s linear;
}
.vine .leaf, .vine .bud {
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel-wide { padding: 5rem 6vw; }
.panel-wide .inner { max-width: 100%; }

.section-title-dark {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--pale-lichen);
    margin: 0 0 3rem 0;
}
.section-title-dark em { color: var(--wild-rose); font-style: italic; }

.feature-stack {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.6rem 1.2rem;
    margin-top: 1rem;
}

.feature-card {
    background: rgba(242, 232, 213, 0.04);
    border: 1px solid rgba(184, 201, 163, 0.22);
    padding: var(--pad, 1.4rem);
    transform: rotate(var(--rot, 0deg));
    transition: transform 0.4s ease, background 0.4s ease, border-color 0.4s ease;
    position: relative;
}
.feature-card:hover {
    transform: rotate(0deg) translateY(-4px);
    background: rgba(242, 232, 213, 0.08);
    border-color: var(--wild-rose);
}
.feature-card.bleed-right {
    margin-right: -20px;
    padding-right: 40px;
}
.feature-card .icon {
    width: 36px;
    height: 36px;
    margin-bottom: 1rem;
}
.feature-card .icon svg { width: 100%; height: 100%; }
.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin: 0 0 0.8rem 0;
    color: var(--surface);
    line-height: 1.1;
}
.feature-card h3 .mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--faded-sage);
    letter-spacing: 0;
    font-weight: 400;
    display: inline-block;
    margin-left: 0.2rem;
}
.feature-card p {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--pale-lichen);
    margin: 0;
}

/* ============================================================ CLOSING */
.beat-closing {
    grid-template-columns: 1fr;
    min-height: 120vh;
}
.monolith {
    position: relative;
    grid-column: 1 / -1;
    min-height: 120vh;
    overflow: hidden;
    background: var(--deep-ground);
    color: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer {
    position: absolute;
    inset: 0;
    will-change: transform;
    pointer-events: none;
}
.layer-bg {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(196, 92, 106, 0.22), transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(122, 158, 126, 0.18), transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(163, 115, 92, 0.25), transparent 70%),
        var(--deep-ground);
    filter: blur(2px);
}
.layer-mid {
    filter: blur(0.5px);
    opacity: 0.7;
}
.layer-mid svg { width: 100%; height: 100%; }
.layer-fg {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: none;
}
.seed-core {
    width: 280px;
    height: 280px;
    max-width: 40vw;
    max-height: 40vw;
    transform-origin: center;
}
.seed-core .core-glow { opacity: 0; transform-origin: 150px 150px; transition: opacity 1s ease; }
.seed-core .roots path {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    transition: stroke-dashoffset 1s ease;
}

.monolith-text {
    position: relative;
    z-index: 5;
    max-width: 720px;
    padding: 4rem 2rem;
    text-align: center;
}
.closing-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 9vw, 7rem);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.06em;
    margin: 0 0 1.4rem 0;
    color: var(--surface);
}
.closing-sub {
    font-family: var(--font-body);
    font-size: 1.25rem;
    line-height: 1.6;
    margin: 0 0 2.4rem 0;
    color: var(--pale-lichen);
    max-width: 36ch;
    margin-left: auto;
    margin-right: auto;
}
.closing-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem 1.4rem;
    margin-bottom: 4rem;
}
.link-primary {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--surface);
    background: var(--wild-rose);
    padding: 0.9rem 1.6rem;
    text-decoration: none;
    border: 1px solid var(--wild-rose);
    transition: background 0.3s ease, transform 0.3s ease;
}
.link-primary:hover {
    background: transparent;
    color: var(--wild-rose);
    transform: translateY(-2px);
}
.link-secondary {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pale-lichen);
    text-decoration: none;
    border-bottom: 1px dotted var(--faded-sage);
    padding-bottom: 2px;
    transition: color 0.3s ease;
}
.link-secondary:hover { color: var(--wild-rose); border-bottom-color: var(--wild-rose); }

.colophon {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    line-height: 1.7;
    color: var(--warm-stone);
    max-width: 48ch;
    margin: 0 auto;
}

/* =========================================================== responsive */
@media (max-width: 820px) {
    .beat {
        grid-template-columns: 1fr !important;
    }
    .panel {
        padding: 4rem 1.4rem;
    }
    .boundary, .boundary-seeds { display: none; }
    .section-dots {
        left: auto;
        right: 1rem;
        top: 50%;
    }
    .hero-title { font-size: clamp(3.4rem, 18vw, 7rem); }
    .feature-stack { grid-template-columns: 1fr; }
    .feature-card.bleed-right { margin-right: 0; padding-right: var(--pad); }
}
