:root {
    /* Compliance vocabulary from DESIGN.md: used (Google Interaction Micro-patterns Micro-patterns* Micro-patterns:* Micro-patterns:** Interruptions (4% IntersectionObserver` threshold. Each unique slight hand-drawn wobble (achieved by small random offsets control points opening serves moment contents each clickable */
    --sand: #f5ead6;
    --limestone: #e8dcc4;
    --clay: #d4c4a8;
    --parchment: #c7b48e;
    --gold: #c9a656;
    --sienna: #a0623b;
    --walnut: #3d2e1a;
    --burnished: #7a6843;
    --ochre: #9e8e6e;
    --loam: #2a2118;
    --patina: #5c8a6a;
    --ink: #4a3828;
    --sidebar: #3d3024;
    --display: "Playfair Display", serif;
    --body: "Source Serif 4", serif;
    --ui: "Space Grotesk", sans-serif;
    --mono: "IBM Plex Mono", monospace;
    --inter: "Inter", sans-serif;
    --lato: "Lato", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--walnut);
    background: var(--sand);
    font-family: var(--body);
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: .04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E");
}

main { margin-left: 48px; }
a { color: var(--gold); text-decoration: none; }
a:not(.stratum-segment):not(.hero-layer) { position: relative; }
a:not(.stratum-segment):not(.hero-layer)::after {
    content: ""; position: absolute; left: 0; bottom: -3px; width: 100%; height: 1.5px;
    background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform 200ms ease-out;
}
a:not(.stratum-segment):not(.hero-layer):hover::after { transform: scaleX(1); }

.sidebar {
    position: fixed; z-index: 999; top: 0; left: 0; width: 48px; height: 100vh;
    background: var(--sidebar); border-right: 1px solid rgba(201,166,86,.32);
    transition: width 250ms ease-in-out; overflow: hidden; display: flex; flex-direction: column;
}
.sidebar:hover { width: 280px; }
.sidebar-mark { height: 72px; display: grid; place-items: center; font: 900 1.2rem var(--display); color: var(--gold); letter-spacing: .06em; }
.stratum-nav { flex: 1; display: flex; flex-direction: column; padding: 10px 0; }
.stratum-segment {
    height: 72px; display: flex; align-items: center; padding-left: 15px; position: relative;
    border-left: 3px solid transparent; color: var(--gold); font: 700 .78rem var(--ui);
    letter-spacing: .08em; text-transform: uppercase; transition: background .25s ease, border-color .25s ease;
}
.stratum-segment::before { content: ""; width: 16px; height: 48px; border: 1px solid rgba(74,56,40,.55); box-shadow: inset 0 0 0 999px currentColor; opacity: .75; }
.stratum-segment span { opacity: 0; white-space: nowrap; margin-left: 18px; transition: opacity 250ms ease-in-out; }
.sidebar:hover .stratum-segment span { opacity: 1; }
.stratum-segment.active { border-left-color: var(--gold); background: rgba(201,166,86,.16); animation: navPulse 1.8s ease-in-out infinite; }
.segment-surface::before { color: var(--sand); } .segment-limestone::before { color: var(--limestone); } .segment-clay::before { color: var(--clay); } .segment-parchment::before { color: var(--parchment); } .segment-loam::before { color: var(--ochre); } .segment-bedrock::before { color: var(--loam); }
.depth-readout { padding: 18px 9px; color: var(--gold); font: 700 .62rem var(--ui); letter-spacing: .12em; text-align: center; border-top: 1px solid rgba(201,166,86,.25); }

@keyframes navPulse { 50% { box-shadow: inset 0 0 0 1px rgba(201,166,86,.45); } }

.stratum-zone { position: relative; min-height: 100vh; padding: clamp(52px, 8vw, 108px); }
.stratum-zone::after { content: ""; position: absolute; left: 0; right: 0; bottom: -100px; height: 200px; pointer-events: none; z-index: 1; }
#surface { background: linear-gradient(180deg, #f5ead6 0%, #e8dcc4 100%); }
#surface::after { background: linear-gradient(180deg, rgba(245,234,214,0), #e8dcc4); }
#limestone { background: linear-gradient(180deg, #e8dcc4 0%, #d4c4a8 100%); }
#limestone::after { background: linear-gradient(180deg, rgba(232,220,196,0), #d4c4a8); }
#rollups { background: linear-gradient(180deg, #d4c4a8 0%, #c7b48e 100%); }
#rollups::after { background: linear-gradient(180deg, rgba(212,196,168,0), #c7b48e); }
#channels { background: linear-gradient(180deg, #c7b48e 0%, #8a7558 100%); }
#channels::after { background: linear-gradient(180deg, rgba(199,180,142,0), #8a7558); }
#architecture { background: linear-gradient(180deg, #8a7558 0%, #2a2118 100%); color: var(--sand); }
#fieldnotes { background: #2a2118; color: var(--sand); }

.paper-label, .kicker { font: 700 clamp(.75rem,.9vw,.95rem) var(--ui); color: var(--burnished); letter-spacing: .06em; text-transform: uppercase; }
.paper-label { position: absolute; top: 28px; right: 36px; }
.cross-section-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; position: relative; }
.hero-cross-section { width: min(100%, 1180px); height: auto; filter: drop-shadow(0 24px 38px rgba(42,33,24,.22)); }
.hero-layer { cursor: pointer; }
.hero-layer path:first-child { stroke-width: 2.1; stroke-linejoin: round; transition: filter .25s ease, transform .25s ease; }
.hero-layer:hover path:first-child { filter: brightness(1.06); transform: translateY(-3px); }
.hero-layer text { font: 700 18px var(--ui); fill: var(--ink); letter-spacing: .08em; opacity: 0; transform: translateY(10px); transition: opacity .35s ease, transform .35s ease; }
.hero-layer.is-drawn text { opacity: 1; transform: translateY(0); }
.draw-layer { opacity: 0; stroke-dasharray: 2200; stroke-dashoffset: 2200; }
.hero-layer.is-drawn .draw-layer { animation: drawLayer 600ms ease-out forwards; }
.fossil-marks { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; opacity: 0; transition: opacity .6s ease; }
.fossil-marks.visible { opacity: 1; }
.hero-copy { position: absolute; left: clamp(24px, 7vw, 96px); top: 47%; max-width: 590px; transform: translateY(-50%); background: rgba(245,234,214,.58); padding: 26px 34px; border-left: 5px solid var(--gold); backdrop-filter: blur(1px); }
h1, h2, h3 { font-family: var(--display); line-height: 1.05; letter-spacing: .03em; margin: 0 0 .45em; }
h1 { font-size: clamp(2.8rem, 6vw, 5.5rem); font-weight: 900; color: var(--walnut); }
h2 { font-size: clamp(2.8rem, 6vw, 5.5rem); font-weight: 900; color: inherit; }
h3 { font-size: clamp(1.35rem, 2.5vw, 2rem); font-weight: 700; }
p { max-width: 65ch; }
code { font: .92em var(--mono); background: rgba(201,166,86,.12); border-radius: 2px; padding: .05em .3em; }

.editorial { display: grid; grid-template-columns: minmax(150px, 240px) minmax(320px, 720px) minmax(150px, 240px); gap: 24px; align-items: center; }
.editorial.reverse { grid-template-columns: minmax(150px, 240px) minmax(320px, 720px) minmax(150px, 240px); }
.article-card, .resource-card, .spread-visual, .stack-table, .margin-illo { position: relative; background: rgba(245,234,214,.36); padding: clamp(24px, 4vw, 48px); }
.article-card { box-shadow: 16px 18px 0 rgba(74,56,40,.08); }
.margin-note { font-weight: 300; font-size: .8rem; color: var(--ochre); align-self: center; border-left: 2px solid var(--gold); padding-left: 18px; opacity: 0; transform: translateY(18px); transition: opacity .35s ease, transform .35s ease; }
.margin-note.in-view { opacity: 1; transform: translateY(0); }
.margin-illo { color: var(--ink); padding: 18px; opacity: 0; transform: translateX(-24px); transition: opacity 300ms ease-out, transform 300ms ease-out; }
.margin-illo.in-view { opacity: 1; transform: translateX(0); }
.margin-illo svg { width: 100%; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.margin-illo span { display: block; margin-top: 10px; font: 700 .7rem var(--ui); color: var(--burnished); text-transform: uppercase; letter-spacing: .08em; }

.spread { min-height: 90vh; display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(28px, 5vw, 70px); align-items: center; }
.spread.dark { grid-template-columns: .85fr 1.15fr; }
.spread.dark .kicker { color: var(--gold); }
.diagram-svg { width: 100%; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.diagram-svg rect { fill: rgba(245,234,214,.4); }
.diagram-svg text { fill: var(--ink); stroke: none; font: 700 15px var(--ui); letter-spacing: .06em; text-transform: uppercase; opacity: 0; transition: opacity .3s ease .4s; }
.diagram-svg.in-view text { opacity: 1; }
.reveal, .diagram-svg rect, .accent-fill { stroke-dasharray: 1200; stroke-dashoffset: 1200; }
.diagram-svg.in-view .reveal, .diagram-svg.in-view rect { animation: drawLayer 800ms ease-out forwards; }
.accent-fill { stroke: var(--gold); stroke-width: 6; }
.diagram-svg.in-view .accent-fill { animation: drawLayer 600ms ease-out .55s forwards; }

blockquote { margin: 2rem 0 0; padding: 1rem 0 1rem 1.4rem; font: 700 clamp(1.25rem,2vw,1.75rem) var(--display); color: var(--walnut); position: relative; }
blockquote::before { content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 0; background: var(--patina); border-radius: 20px; }
blockquote.in-view::before { animation: downStroke 500ms ease-out forwards; }
.dark blockquote, .dark h2 { color: var(--sand); }
.stack-table { display: grid; gap: 0; padding: 0; overflow: hidden; }
.stack-table div { display: grid; grid-template-columns: 210px 1fr; gap: 18px; padding: 24px 28px; border-bottom: 1px solid rgba(74,56,40,.35); color: var(--walnut); }
.stack-table div:nth-child(1) { background: #f5ead6; } .stack-table div:nth-child(2) { background: #e8dcc4; } .stack-table div:nth-child(3) { background: #d4c4a8; } .stack-table div:nth-child(4) { background: #c7b48e; } .stack-table div:nth-child(5) { background: #9e8e6e; }
.stack-table b { font-family: var(--ui); text-transform: uppercase; color: var(--ink); letter-spacing: .06em; }

.fieldnotes h2 { max-width: 960px; }
.note-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: 44px; }
.resource-card { background: rgba(245,234,214,.08); color: var(--sand); transition: transform .25s ease, background .25s ease; }
.resource-card:hover { transform: translateY(-6px); background: rgba(245,234,214,.14); }
.resource-card h3 { color: var(--gold); font-size: 1.35rem; }
.fieldnotes footer { margin-top: 70px; color: var(--ochre); font: 400 .9rem var(--inter); }

.border-animate::before {
    content: ""; position: absolute; inset: -8px; pointer-events: none; border: 1.8px solid var(--ink);
    clip-path: polygon(0 0,0 0,0 0,0 0); opacity: .9;
}
.border-animate.in-view::before { animation: borderTrace 800ms ease-out forwards; }

.headline-char { display: inline-block; opacity: 0; transform: translateY(8px); }
.headline-char.visible { animation: typeIn 360ms ease-out forwards; }

@keyframes drawLayer { to { opacity: 1; stroke-dashoffset: 0; } }
@keyframes borderTrace { 0% { clip-path: polygon(0 0,0 0,0 0,0 0); } 25% { clip-path: polygon(0 0,100% 0,100% 0,0 0); } 50% { clip-path: polygon(0 0,100% 0,100% 100%,100% 100%,0 0); } 75% { clip-path: polygon(0 0,100% 0,100% 100%,0 100%,0 100%); } 100% { clip-path: polygon(0 0,100% 0,100% 100%,0 100%); } }
@keyframes downStroke { to { height: 100%; } }
@keyframes typeIn { to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1200px) {
    .editorial, .editorial.reverse, .spread, .spread.dark { grid-template-columns: 1fr; }
    .margin-note, .margin-illo { max-width: 720px; }
    .note-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-copy { position: relative; left: auto; top: auto; transform: none; margin-top: -90px; }
}
@media (max-width: 760px) {
    main { margin-left: 0; }
    .sidebar { display: none; }
    .stratum-zone { padding: 42px 22px; }
    .hero-copy { margin-top: 0; padding: 22px; }
    .paper-label { position: static; margin-bottom: 20px; }
    .note-grid { grid-template-columns: 1fr; }
    .stack-table div { grid-template-columns: 1fr; }
}
