:root {
  --stack-paper: #f4f1e9;
  --stack-white: #fcfbf8;
  --stack-ink: #111114;
  --stack-muted: #5f5d66;
  --stack-line: #d8d3c9;
  --stack-violet: #6842c2;
  --stack-violet-dark: #4e2f9c;
  --stack-violet-light: #b9a5e5;
  --stack-blue: #285f8f;
  --stack-green: #2f6f57;
  --stack-amber: #8a5a00;
  --stack-red: #963e49;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.operating-stack-page { margin: 0; background: var(--stack-paper); color: var(--stack-ink); font-family: Inter,system-ui,sans-serif; }
.stack-main { padding-top: 5rem; }
.stack-container { width: min(calc(100% - 3rem),68rem); margin-inline: auto; }
.stack-eyebrow { margin: 0 0 .85rem; color: var(--stack-violet-dark); font-size: .64rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.stack-hero { padding: clamp(4rem,8vw,7rem) 0 clamp(3rem,6vw,5rem); border-bottom: 1px solid var(--stack-line); }
.stack-hero__grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(18rem,.65fr); gap: clamp(2rem,6vw,5rem); align-items: end; }
.stack-hero h1 { max-width: 11ch; margin: 0; font: 500 clamp(3.4rem,7vw,6.5rem)/.88 Newsreader,Georgia,serif; letter-spacing: -.06em; }
.stack-hero h1 span { color: var(--stack-violet); font-size: .45em; vertical-align: top; }
.stack-hero__copy > p { margin: 0; color: var(--stack-muted); font-size: .92rem; line-height: 1.7; }
.stack-hero__legend { display: grid; margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--stack-line); grid-template-columns: 1fr 1fr; gap: 1rem; }
.stack-hero__legend dt { color: var(--stack-ink); font-size: .66rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.stack-hero__legend dd { margin: .35rem 0 0; color: var(--stack-muted); font-size: .68rem; line-height: 1.45; }
.stack-map-section { padding: clamp(3.5rem,7vw,6rem) 0; border-bottom: 1px solid var(--stack-line); background: var(--stack-white); }
.stack-map-layout { display: grid; grid-template-columns: minmax(15rem,.58fr) minmax(0,1.42fr); gap: clamp(2rem,6vw,5rem); align-items: start; }
.stack-section-intro { position: sticky; top: 7rem; }
.stack-section-intro h2, .stack-flow-heading h2, .stack-registry-heading h2, .stack-test-layout h2 { margin: 0; font: 500 clamp(2rem,4vw,3.5rem)/.98 Newsreader,Georgia,serif; letter-spacing: -.04em; }
.stack-section-intro > p:last-of-type { margin: 1.2rem 0 0; color: var(--stack-muted); font-size: .8rem; line-height: 1.65; }
.stack-direction { display: grid; grid-template-columns: 1fr auto; margin-top: 2rem; padding: 1rem 0; border-top: 1px solid var(--stack-line); border-bottom: 1px solid var(--stack-line); gap: .45rem 1rem; color: var(--stack-muted); font-size: .67rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.stack-direction span:nth-child(2) { color: var(--stack-violet); }
.stack-direction span:nth-child(4) { color: var(--stack-green); }
.stack-visual { display: grid; margin: 0; padding: 0; gap: .45rem; list-style: none; }
.stack-visual__layer { position: relative; transition: transform 160ms ease; }
.stack-visual__layer::before { content: ""; position: absolute; inset: 0 auto 0 0; width: .28rem; background: var(--layer); }
.stack-visual__layer a { display: grid; min-height: 5.55rem; padding: 1rem 1.25rem 1rem 1.4rem; border: 1px solid var(--stack-line); grid-template-columns: 8.5rem 1fr; align-content: center; gap: .25rem 1rem; background: var(--stack-paper); color: inherit; text-decoration: none; }
.stack-visual__layer small { grid-column: 1; grid-row: 1 / span 2; align-self: center; color: var(--layer); font-size: .61rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.stack-visual__layer strong { font: 500 1.28rem/1.05 Newsreader,Georgia,serif; }
.stack-visual__layer span { color: var(--stack-muted); font-size: .69rem; line-height: 1.45; }
.stack-visual__layer:hover { transform: translateX(.35rem); }
.stack-visual__layer--value { --layer: var(--stack-violet); }
.stack-visual__layer--ai { --layer: var(--stack-blue); }
.stack-visual__layer--integration { --layer: #6e5f82; }
.stack-visual__layer--core { --layer: var(--stack-amber); }
.stack-visual__layer--execution { --layer: var(--stack-green); }
.stack-visual__layer--edge { --layer: var(--stack-red); }
.stack-flow-section { padding: clamp(3.5rem,7vw,6rem) 0; border-bottom: 1px solid var(--stack-line); background: var(--stack-ink); color: #fff; }
.stack-flow-heading, .stack-registry-heading { display: grid; grid-template-columns: 1fr minmax(18rem,.72fr); margin-bottom: 2.2rem; gap: 3rem; align-items: end; }
.stack-flow-heading h2 { color: #fff; }
.stack-flow-heading > p, .stack-registry-heading > p { margin: 0; color: rgba(255,255,255,.58); font-size: .78rem; line-height: 1.65; }
.decision-flow { display: grid; margin: 0; padding: 0; border-top: 1px solid rgba(255,255,255,.28); grid-template-columns: repeat(5,1fr); list-style: none; counter-reset: flow; }
.decision-flow li { position: relative; min-height: 13rem; padding: 1.15rem 1.2rem; border-right: 1px solid rgba(255,255,255,.15); counter-increment: flow; }
.decision-flow li:last-child { border-right: 0; }
.decision-flow li:not(:last-child)::after { content: "→"; position: absolute; top: 50%; right: -.55rem; z-index: 1; display: grid; width: 1.1rem; height: 1.1rem; border-radius: 50%; place-items: center; background: var(--stack-violet); color: #fff; font-size: .58rem; }
.decision-flow span { color: var(--stack-violet-light); font-size: .61rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.decision-flow strong { display: block; margin: 2rem 0 .7rem; font: 500 1.18rem/1.05 Newsreader,Georgia,serif; }
.decision-flow p { margin: 0; color: rgba(255,255,255,.56); font-size: .68rem; line-height: 1.55; }
.stack-registry-section { padding: clamp(3.5rem,7vw,6rem) 0; border-bottom: 1px solid var(--stack-line); }
.stack-registry-heading > p { color: var(--stack-muted); }
.stack-registry { border-top: 1px solid var(--stack-ink); }
.stack-layer { border-bottom: 1px solid var(--stack-line); scroll-margin-top: 6rem; }
.stack-layer summary { display: grid; min-height: 6rem; padding: 1rem 0; grid-template-columns: minmax(14rem,.8fr) 1fr auto; align-items: center; gap: 2rem; cursor: pointer; list-style: none; }
.stack-layer summary::-webkit-details-marker { display: none; }
.stack-layer summary span { font: 500 clamp(1.35rem,2.3vw,2rem)/1.05 Newsreader,Georgia,serif; }
.stack-layer summary small { display: block; margin-bottom: .45rem; color: var(--stack-violet-dark); font: 600 .61rem/1.2 Inter,sans-serif; letter-spacing: .13em; text-transform: uppercase; }
.stack-layer summary > strong { color: var(--stack-muted); font-size: .7rem; font-weight: 500; }
.stack-layer summary i { display: grid; width: 2rem; height: 2rem; border: 1px solid var(--stack-line); border-radius: 50%; place-items: center; color: var(--stack-violet); font-style: normal; transition: transform 160ms ease; }
.stack-layer[open] summary i { background: var(--stack-violet); color: #fff; transform: rotate(45deg); }
.stack-layer[open] summary { background: linear-gradient(90deg,transparent,#eee8fa 48%,transparent); }
.stack-layer__body { display: grid; padding: .5rem 0 2rem; grid-template-columns: 1fr 1fr 1fr .78fr; gap: 1.5rem; }
.stack-layer__body > * { padding-top: 1rem; border-top: 1px solid var(--stack-line); }
.stack-layer__body h3, .stack-layer__body aside span { display: block; margin: 0 0 .7rem; color: var(--stack-violet-dark); font-size: .63rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.stack-layer__body p, .stack-layer__body li { color: var(--stack-muted); font-size: .7rem; line-height: 1.55; }
.stack-layer__body p { margin: 0; }
.stack-layer__body ul { display: grid; margin: 0; padding-left: 1rem; gap: .4rem; }
.stack-layer__body aside { padding: 1rem; border-top-color: var(--stack-violet); background: #eee8fa; }
.stack-test-section { padding: clamp(3.5rem,7vw,6rem) 0; background: #eee8fa; }
.stack-test-layout { display: grid; grid-template-columns: minmax(15rem,.65fr) 1.35fr; gap: clamp(2rem,6vw,5rem); }
.stack-test-layout ol { margin: 0; padding: 0; border-top: 1px solid rgba(104,66,194,.35); list-style: none; }
.stack-test-layout li { display: grid; padding: 1rem 0; border-bottom: 1px solid rgba(104,66,194,.22); grid-template-columns: minmax(11rem,.65fr) 1.35fr; gap: 1.5rem; }
.stack-test-layout strong { font: 500 1.02rem/1.1 Newsreader,Georgia,serif; }
.stack-test-layout span { color: var(--stack-muted); font-size: .72rem; line-height: 1.55; }
.operating-stack-page .smyrna-page-rail { display: none; }
.stack-main :focus-visible { outline: 3px solid var(--stack-violet-light); outline-offset: 4px; }
@media (max-width: 850px) {
  .stack-hero__grid, .stack-map-layout, .stack-flow-heading, .stack-registry-heading, .stack-test-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .stack-section-intro { position: static; }
  .decision-flow { grid-template-columns: 1fr; }
  .decision-flow li { min-height: 0; padding: 1rem 0; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.15); }
  .decision-flow li:not(:last-child)::after { content: "↓"; top: auto; right: 1rem; bottom: -.55rem; }
  .decision-flow strong { margin: .8rem 0 .45rem; }
  .stack-layer__body { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .stack-main { padding-top: 4rem; }
  .stack-container { width: min(calc(100% - 2rem),68rem); }
  .stack-hero h1 { font-size: clamp(3rem,16vw,4.5rem); }
  .stack-hero__legend { grid-template-columns: 1fr; }
  .stack-visual__layer a { min-height: 0; grid-template-columns: 1fr; gap: .35rem; }
  .stack-visual__layer small { grid-column: 1; grid-row: auto; }
  .stack-layer summary { min-height: 0; padding: 1.1rem 0; grid-template-columns: 1fr auto; gap: .8rem; }
  .stack-layer summary > strong { display: none; }
  .stack-layer__body { grid-template-columns: 1fr; }
  .stack-test-layout li { grid-template-columns: 1fr; gap: .45rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stack-visual__layer, .stack-layer summary i { transition: none; }
}
