:root {
    --bg-light: #f5ebe0;
    --bg-dark: #3d2518;
    --text-primary: #2b1810;
    --accent-terra: #c4653a;
    --accent-copper: #5a8a6e;
    --highlight-wheat: #e8c87a;
    --muted-lavender: #9b8b9e;
    --sidebar-bg: #ede3d5;
    --soft-terra: #c4956a;
    --sidebar-width: 260px;
    --font-mono: "IBM Plex Mono", monospace;
    --font-slab: "Bitter", Georgia, serif;
}

/* Compliance vocabulary from DESIGN.md: (Google — transforms same typeface something surprisingly readable `clamp(0.9rem Interaction Motif:** clickable hoverable element triggers concentric emanating interaction rings rendered expanding circles `border: #c4653a` 60% shifts `#5a8a6e` (oxidized IntersectionObserver`. Elements begin `opacity: speed should (2-3 seconds */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-light);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 300;
    letter-spacing: 0.02em;
    overflow-x: hidden;
}

#terrain-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    image-rendering: pixelated;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(245, 235, 224, 0.9) 0%, rgba(245, 235, 224, 0.76) 52%, rgba(245, 235, 224, 0.3) 100%),
        repeating-linear-gradient(0deg, rgba(196, 101, 58, 0.07) 0 1px, transparent 1px 15px);
}

.narrative::before { content: "Motif:** Motif:* Motif:"; display: none; }

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 38px 28px;
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
    z-index: 10;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(196, 101, 58, 0.42);
    overflow: hidden;
}

.stitch-layer,
.sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 1;
}

.stitch-layer {
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 5l6 6M11 5l-6 6' stroke='%23c4956a' stroke-width='1' opacity='.55'/%3E%3C/svg%3E");
    opacity: 0.16;
}

.sidebar::before {
    background: linear-gradient(180deg, rgba(232, 200, 122, 0.17), transparent 38%, rgba(90, 138, 110, 0.12));
}

.scroll-meter {
    position: absolute;
    right: 0;
    top: 0;
    width: 3px;
    height: 0;
    background: var(--accent-terra);
    box-shadow: 0 0 18px rgba(196, 101, 58, 0.55);
}

.strip-trigger { display: none; }

.shelf-mark {
    position: relative;
    z-index: 1;
    margin-bottom: 72px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.08em;
}

.shelf-mark::after {
    content: "";
    display: block;
    width: 92px;
    height: 1px;
    margin-top: 18px;
    background: var(--accent-terra);
}

.sidebar-nav {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 13px;
    width: max-content;
    max-width: 100%;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    overflow: hidden;
    padding: 9px 4px;
}

.nav-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent-terra);
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(196, 101, 58, 0.25);
}

.nav-item:hover .nav-dot,
.nav-item.active .nav-dot { animation: dotPulse 800ms ease-out; background: var(--accent-copper); }
.nav-item.active .nav-label { font-family: var(--font-slab); color: var(--accent-copper); }

.sidebar-note {
    position: relative;
    z-index: 1;
    margin-top: auto;
    font-family: var(--font-slab);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.7;
    color: rgba(43, 24, 16, 0.58);
}

.narrative {
    margin-left: var(--sidebar-width);
    padding-left: 48px;
    max-width: calc(780px + var(--sidebar-width) + 48px);
}

.zone {
    position: relative;
    min-height: 100vh;
    padding: 96px 0;
}

.zone-porch {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.zone-kicker {
    font-family: var(--font-slab);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-terra);
    margin-bottom: 26px;
}

.porch-statement {
    max-width: 760px;
    min-height: 4.8em;
    margin: 0;
    font-size: clamp(1.6rem, 3.5vw, 3.2rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.04em;
    color: var(--text-primary);
}

.char {
    position: relative;
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    animation: charIn 520ms ease-out forwards;
}

.char::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.85em;
    height: 0.85em;
    border: 1px solid var(--accent-terra);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    animation: charRing 700ms ease-out forwards;
    animation-delay: inherit;
}

.porch-copy {
    max-width: 620px;
    margin-top: 34px;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.75;
}

.zone-pantry { padding-top: 140px; }

.pantry-card {
    max-width: 740px;
    margin: 0 0 64px;
    padding: 0;
}

.pantry-card h2 {
    position: relative;
    display: inline-block;
    margin: 0 0 22px;
    padding-bottom: 12px;
    font-size: clamp(1.6rem, 3.5vw, 3.2rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pantry-card h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--accent-terra);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 900ms ease-out 160ms;
}

.pantry-card.is-visible h2::after { transform: scaleX(1); }

.pantry-card p,
.cellar-column p,
.compost-text p {
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.75;
    margin: 0;
}

.zone-cellar {
    min-height: 112vh;
    margin-left: -48px;
    padding-left: 48px;
    background: var(--bg-dark);
    color: var(--bg-light);
    box-shadow: 100vw 0 0 var(--bg-dark), -48px 0 0 var(--bg-dark);
}

.cellar-column { max-width: 520px; padding-top: 34px; }
.cellar-column h2 { font-size: clamp(1.4rem, 2.8vw, 2.45rem); line-height: 1.25; letter-spacing: 0.04em; margin: 0 0 30px; }
.cellar-column p { font-size: 14px; margin-bottom: 24px; }

.circuit-trace {
    width: min(780px, calc(100vw - var(--sidebar-width) - 72px));
    height: 210px;
    margin-top: 20px;
    overflow: visible;
}

.circuit-trace path {
    fill: none;
    stroke: rgba(196, 101, 58, 0.28);
    stroke-width: 1;
    stroke-linecap: square;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2600ms ease-in-out;
}

.circuit-trace.is-visible path { stroke-dashoffset: 0; }

.zone-compost {
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 62%, rgba(0,0,0,.34) 82%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 62%, rgba(0,0,0,.34) 82%, transparent 100%);
}

.compost-text { max-width: 720px; transition: filter 120ms linear, opacity 120ms linear; }
.compost-text p { margin-bottom: 32px; font-size: clamp(1rem, 2vw, 1.8rem); }
.fragment { display: inline-block; transition: opacity 120ms linear, transform 120ms linear; }

.domain-fade {
    margin-top: 120px;
    font-size: 0.9rem;
    opacity: 0.4;
    letter-spacing: 0.12em;
}

.particle {
    position: absolute;
    top: -20px;
    width: var(--size);
    height: var(--size);
    left: var(--left);
    background: var(--color);
    opacity: 0.55;
    animation: fall var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.reveal.is-visible { opacity: 1; transform: translateY(0); }

.ripple-target { position: relative; overflow: hidden; }
.ripple-span {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 1px solid var(--accent-terra);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.6;
    pointer-events: none;
    animation: ripple 800ms ease-out forwards;
}

@keyframes ripple { to { transform: translate(-50%, -50%) scale(4); opacity: 0; } }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 rgba(196,101,58,.6); } 100% { box-shadow: 0 0 0 18px rgba(196,101,58,0); } }
@keyframes charIn { to { opacity: 1; transform: translateY(0); } }
@keyframes charRing { 15% { opacity: .55; transform: translate(-50%, -50%) scale(0); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(2.6); } }
@keyframes fall { to { transform: translate3d(var(--drift), 125vh, 0) rotate(220deg); opacity: 0; } }

@media (max-width: 768px) {
    :root { --sidebar-width: 48px; }
    .sidebar { width: 48px; padding: 18px 0; transition: width 260ms ease; }
    .sidebar.open { width: 230px; padding-left: 22px; padding-right: 22px; }
    .strip-trigger { display: block; position: relative; z-index: 2; border: 0; background: transparent; color: var(--accent-terra); font: 600 1rem var(--font-mono); padding: 10px 0; cursor: pointer; }
    .shelf-mark, .nav-label, .sidebar-note { opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
    .sidebar.open .shelf-mark, .sidebar.open .nav-label, .sidebar.open .sidebar-note { opacity: 1; pointer-events: auto; }
    .shelf-mark { margin: 18px 0 38px; }
    .sidebar-nav { align-items: center; gap: 28px; }
    .sidebar.open .sidebar-nav { align-items: flex-start; }
    .nav-item { padding-left: 0; padding-right: 0; }
    .narrative { padding-left: 28px; margin-left: var(--sidebar-width); max-width: none; padding-right: 18px; }
    .zone-cellar { margin-left: -28px; padding-left: 28px; box-shadow: 100vw 0 0 var(--bg-dark), -28px 0 0 var(--bg-dark); }
    .circuit-trace { width: calc(100vw - 88px); }
}
