/* Marrinn v2 · the layer-page shell (/architecture/<slug>/).
   Loads AFTER scrollcraft.css and v2.css, and reuses their tokens, header
   (.bar), rail (.rail), buttons, .win chrome, .demo-tag, .stack and footer.
   This file adds only what a layer page needs on top of the homepage:
     1. per-layer hue tokens, keyed off <body data-layer="N">
     2. the rail lit for the current page
     3. the layered-depth hero (.lh)
     4. generic section primitives (.ls, .lwrap, .split, .prose, .mock)
     5. the Demo scenario label (.demo-scn)
     6. "the other nine" strip (.o9) and the resolving close (.lclose)
   It deliberately ships NO middle-of-page template. Each page builds its own.
   Guide for page authors: /assets/v2/LAYER-SHELL.md */

/* ---------------------------------------------------------------- 1 · layer hues
   --lh      the hue on the ink ground (display type, lines, fills)
   --lh-ink  the same hue on the light ground. Tuned 2026-09-30 so small text
             in it clears 4.5:1 on #fcfbff (5.3 to 6.0) and on the #f3f0fb
             tint (4.9 to 5.5). Measured values are in LAYER-SHELL.md.
   --lc      "layer colour on this ground": resolves to --lh inside .t-dark
             and to --lh-ink inside .t-light. Page code should use --lc. */
body[data-layer="1"]   { --lh: #9a6bff; --lh-ink: #6d4bc0; }   /* the Core */
body[data-layer="2"]   { --lh: #3d7bff; --lh-ink: #2456d6; }   /* the Kernel */
body[data-layer="3"]   { --lh: #39d6f0; --lh-ink: #0b7187; }   /* the Context */
body[data-layer="4"]   { --lh: #2fe08a; --lh-ink: #137236; }   /* the Data */
body[data-layer="5"]   { --lh: #ff4fd8; --lh-ink: #b8199a; }   /* the Agents */
body[data-layer="6"]   { --lh: #ff9a3d; --lh-ink: #bb3e0b; }   /* the Workspace */
body[data-layer="7"]   { --lh: #b5f23a; --lh-ink: #44700d; }   /* the Lens */
body[data-layer="8"]   { --lh: #ffd23d; --lh-ink: #8f5706; }   /* the Ledger */
body[data-layer="9"]   { --lh: #ff5a4e; --lh-ink: #c2261b; }   /* the Admin */
body[data-layer] { --lc: var(--lh); }
body[data-layer] .t-dark { --lc: var(--lh); }
body[data-layer] .t-light { --lc: var(--lh-ink); }
body[data-layer] .hl { color: var(--lc); }
body[data-layer] ::selection { background: var(--lh); color: #08090d; }

/* ---------------------------------------------------------------- 2 · rail: on from the start, current page lit */
body[data-layer] .rail { opacity: 1; }
body[data-layer] .rail a[aria-current="page"] { opacity: 1; filter: none; transform: scale(1.18); outline: 1.5px solid var(--lh); outline-offset: 2px; }
body[data-layer] .rail a[aria-current="page"] span { opacity: 1; }
body[data-layer] .rail a[aria-current="page"]:not(:hover):not(:focus-visible) span { opacity: 0; }
@media (hover: hover) and (pointer: fine) { body[data-layer] .rail a:not([aria-current]):hover { opacity: .8; filter: none; } }

/* ---------------------------------------------------------------- 3 · the layered hero
   Back to front: plate (kie.ai hall) → rear haze in the layer hue → the
   layer's alpha tile, floating, with its floor reflection → front mist that
   crosses the tile's base → lead-corner scrim → copy → motes in front of the
   copy. layer.js moves each plane at its own rate on scroll and pointer. */
.lh { position: relative; height: 100svh; min-height: 640px; overflow: hidden; isolation: isolate; background: #08090d; color: #f4f3ef; }
.lh__plane { position: absolute; inset: 0; pointer-events: none; }
.lh__plate { inset: -6% -3%; z-index: 0; will-change: transform; }
.lh__plate img { width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 58%; }
.lh__haze { z-index: 1; mix-blend-mode: screen; will-change: transform, opacity;
  background:
    radial-gradient(26% 34% at 62% 46%, color-mix(in oklab, var(--lh) 34%, transparent), transparent 72%),
    radial-gradient(60% 40% at 60% 88%, color-mix(in oklab, var(--lh) 12%, transparent), transparent 70%); }
.lh__subject { z-index: 2; will-change: transform; }
.lh__tile { position: absolute; left: 62%; top: 42%; width: clamp(190px, 17.5vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); perspective: 900px; }
.lh__tile img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; filter: drop-shadow(0 18px 14px rgb(0 0 0 / .45)); will-change: transform; }
.lh__refl { position: absolute; left: 0; right: 0; top: 118%; height: 100%; transform: scaleY(-1); opacity: .22;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 46%); mask-image: linear-gradient(to top, #000 0%, transparent 46%); }
.lh__refl img { width: 100%; height: 100%; max-width: none; filter: blur(2px); }
.lh__mist { z-index: 3; will-change: transform;
  background:
    radial-gradient(38% 16% at 62% 74%, color-mix(in oklab, var(--lh) 16%, rgb(8 9 13 / .0)), transparent 72%),
    linear-gradient(to top, rgb(8 9 13 / .92) 0%, rgb(8 9 13 / .55) 14%, transparent 34%); }
.lh__scrim { z-index: 4; background: radial-gradient(64% 58% at 12% 86%, rgb(8 9 13 / .82), rgb(8 9 13 / .45) 45%, transparent 72%); }
.lh__copy { position: absolute; z-index: 5; left: clamp(20px, 7vw, 120px); bottom: clamp(56px, 13vh, 140px); max-width: min(680px, 47vw); }
.lh__motes { z-index: 6; width: 100%; height: 100%; }
/* 2026-10-08: the hero fades into the page ground at its foot. A fixed band that does not move with the
   parallax, so the plate's edge never shows as a line, and the next section (whose plate starts on the
   same #08090d) reads as the hero continuing down. Under the copy (z 5), over the planes. */
.lh::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 36%; z-index: 4; pointer-events: none;
  background: linear-gradient(180deg, rgb(8 9 13 / 0) 0%, rgb(8 9 13 / .35) 40%, rgb(8 9 13 / .8) 75%, #08090d 100%); }
.lh__h { font-family: var(--sc-font-display); font-weight: 600; letter-spacing: -.035em; line-height: 1.02; font-size: clamp(46px, min(6.2vw, 9svh), 92px); margin: 0; text-wrap: balance; }
/* the accent is the site-wide lavender at the headline's own weight (v2.css, Saife 2026-10-20); was weight 500 in a
   tint of the layer hue */
.lh__h em { font-weight: inherit; font-style: normal; }
.lh__sub { margin: 22px 0 0; max-width: 42ch; color: #c9ccd6; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.62; text-wrap: pretty; }
.lh__cta { display: flex; align-items: center; gap: 28px; margin-top: 32px; flex-wrap: wrap; }
.lh__copy .ltag { background: rgb(16 18 26 / .8); border-color: #2c303c; color: #f4f3ef; }
.lh__copy .ltag em { color: var(--lh); }
.lh__copy > * { opacity: 0; transform: translateY(14px); animation: rise .9s var(--ease) forwards; }
.lh__copy > :nth-child(2) { animation-delay: .1s; } .lh__copy > :nth-child(3) { animation-delay: .2s; } .lh__copy > :nth-child(4) { animation-delay: .3s; }
/* portrait composition: tile high in the aisle, copy on the floor */
@media (max-width: 700px) {
  .lh { min-height: 600px; }
  .lh__plate img { object-position: 50% 50%; }
  .lh__tile { left: 50%; top: 29%; width: min(46vw, 230px); }
  .lh__haze { background: radial-gradient(56% 26% at 50% 30%, color-mix(in oklab, var(--lh) 34%, transparent), transparent 72%); }
  .lh__mist { background:
    radial-gradient(60% 10% at 50% 50%, color-mix(in oklab, var(--lh) 14%, transparent), transparent 72%),
    linear-gradient(to top, rgb(8 9 13 / .96) 0%, rgb(8 9 13 / .82) 30%, rgb(8 9 13 / .2) 52%, transparent 62%); }
  .lh__scrim { display: none; }
  .lh__copy { left: 20px; right: 20px; bottom: 36px; max-width: none; }
  .lh__h { font-size: clamp(38px, 11vw, 52px); }
  .lh__sub { font-size: 16px; margin-top: 16px; }
  .lh__cta { gap: 20px; margin-top: 24px; }
}

/* ---------------------------------------------------------------- 4 · section primitives */
.ls { position: relative; padding-block: clamp(76px, 8vw, 124px); }
.ls--flush-top { padding-top: clamp(40px, 4vw, 64px); }
.lwrap { width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: clamp(20px, 7vw, 120px); }
.ld { font-family: var(--sc-font-display); font-weight: 600; letter-spacing: -.035em; line-height: 1.04; font-size: clamp(38px, 5.2vw, 76px); margin: 0; text-wrap: balance; }
.h4 { font-family: var(--sc-font-text); font-weight: 600; font-size: 17px; line-height: 1.35; letter-spacing: -0.005em; margin: 0; color: var(--sc-ink); }
.prose > p { max-width: 62ch; margin: 0; color: var(--sc-ink-soft); font-size: clamp(16px, 1.15vw, 17.5px); line-height: 1.66; text-wrap: pretty; }
.prose > p + p { margin-top: 14px; }
.prose > p b, .prose > p strong { color: var(--sc-ink); font-weight: 600; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 4.2vw, 64px); align-items: center; }
.split--lead { grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); }
.split--trail { grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); }
.split--top { align-items: start; }
@media (max-width: 900px) { .split, .split--lead, .split--trail { grid-template-columns: 1fr; } }
/* a plain note set off by a tint, never a side stripe */
.lnote { margin: 22px 0 0; max-width: 58ch; padding: 16px 18px; border-radius: 12px; background: var(--tint); border: 1px solid var(--line); color: var(--fg-body); font-size: 15px; line-height: 1.6; }
.lnote b { color: var(--sc-ink); }
.t-dark .lnote { background: color-mix(in oklab, var(--lh) 8%, #10121a); border-color: color-mix(in oklab, var(--lh) 22%, #1f222c); }
/* the layer haze: v2's violet .haze, recoloured to the page's hue */
.lhaze.sc-section, .lhaze > [data-sc-stage] { background-image:
  radial-gradient(48% 44% at 84% 20%, color-mix(in oklab, var(--lh) 18%, transparent), transparent 70%),
  radial-gradient(38% 38% at 6% 94%, color-mix(in oklab, var(--lh) 10%, transparent), transparent 70%); }
.t-light.lhaze.sc-section, .t-light.lhaze > [data-sc-stage] { background-image:
  radial-gradient(50% 42% at 88% 8%, color-mix(in oklab, var(--lh) 14%, transparent), transparent 70%),
  radial-gradient(40% 40% at 4% 96%, rgb(182 171 255 / .16), transparent 70%); }

/* ---------------------------------------------------------------- 5 · mockup frame + the Demo scenario label
   A mockup is a <figure class="mock"> holding a .win (v2 chrome). The label
   is on its face twice: in the window bar (.demo-tag, from v2.css) and as the
   caption (.demo-scn). Every mockup carries at least the window-bar tag. */
.mock { margin: 0; min-width: 0; }
.demo-scn { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; font-size: 13px; line-height: 1.4; color: var(--ink-4); }
.demo-scn .demo-tag { margin-left: 0; }
.mock > .demo-scn:last-child { margin: 12px 0 0; }

/* ---------------------------------------------------------------- 6a · the other nine */
.o9 { padding-block: clamp(72px, 7vw, 112px); }
.o9__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px 32px; flex-wrap: wrap; margin-bottom: 28px; }
.o9__head p { margin: 0; color: var(--sc-ink-soft); font-size: 15px; max-width: 52ch; }
.o9__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 10px; }
.o9__list a { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 12px 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--sc-ink); text-decoration: none; transition: transform .18s var(--ease), border-color .18s var(--ease); }
.o9__list img { width: 100%; aspect-ratio: 1; height: auto; border-radius: 10px; object-fit: cover; background: #05060a; }
.o9__n { display: block; font: 500 11px/1 var(--sc-font-mono); color: var(--c); }
.o9__list b { display: block; font-family: var(--sc-font-display); font-weight: 600; font-size: 18px; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.o9__d { display: block; font-size: 13px; line-height: 1.45; color: var(--ink-2); margin-top: 4px; }
@media (hover: hover) and (pointer: fine) { .o9__list a:hover { transform: translateY(-2px); border-color: var(--c); } }
.o9__list a:active { transform: translateY(0); }
body[data-layer="1"] .o9__list li[data-layer="1"], body[data-layer="2"] .o9__list li[data-layer="2"],
body[data-layer="3"] .o9__list li[data-layer="3"], body[data-layer="4"] .o9__list li[data-layer="4"],
body[data-layer="5"] .o9__list li[data-layer="5"], body[data-layer="6"] .o9__list li[data-layer="6"],
body[data-layer="7"] .o9__list li[data-layer="7"], body[data-layer="8"] .o9__list li[data-layer="8"],
body[data-layer="9"] .o9__list li[data-layer="9"] { display: none; }
@media (max-width: 1240px) { .o9__list { grid-template-columns: repeat(3, minmax(0, 1fr)); } .o9__list a { flex-direction: row; align-items: center; } .o9__list img { width: 56px; flex: none; } }
@media (max-width: 640px) { .o9__list { grid-template-columns: 1fr; gap: 8px; } .o9__list a { min-height: 72px; padding: 8px 12px 8px 8px; } .o9__list b { font-size: 17px; } }

/* ---------------------------------------------------------------- 6b · the close: the layer back in its stack */
.lclose { padding-block: clamp(96px, 11vw, 168px) 0; overflow: hidden; }
.lclose__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.lclose__cta { display: flex; align-items: center; gap: 28px; margin-top: 32px; flex-wrap: wrap; }
.lclose__art { position: relative; height: clamp(300px, 34vw, 460px); }
.lclose__st { inset: 20% 22% 14% 16%; --gap: 26px; }
.lclose__st .stack__tilt img { --o: .16; filter: saturate(.4) drop-shadow(0 8px 8px rgb(0 0 0 / .4)); }
body[data-layer="1"] .lclose__st img:nth-child(1), body[data-layer="2"] .lclose__st img:nth-child(2),
body[data-layer="3"] .lclose__st img:nth-child(3), body[data-layer="4"] .lclose__st img:nth-child(4),
body[data-layer="5"] .lclose__st img:nth-child(5), body[data-layer="6"] .lclose__st img:nth-child(6),
body[data-layer="7"] .lclose__st img:nth-child(7), body[data-layer="8"] .lclose__st img:nth-child(8),
body[data-layer="9"] .lclose__st img:nth-child(9) { --o: 1; --tx: 62%; --ty: -12%; filter: drop-shadow(0 10px 10px rgb(0 0 0 / .5)); }
.lclose__cap { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; text-align: center; font-size: 13px; color: var(--ink-4); }
.lclose__cap b { color: var(--lh); font-weight: 600; }
@media (max-width: 860px) { .lclose__grid { grid-template-columns: 1fr; } .lclose__art { height: 280px; order: -1; } }

/* ---------------------------------------------------------------- clearing the fixed rail
   --rail-clear is the rail's right edge (0 where the rail is hidden, under
   1100px). Anything that moves or overflows horizontally past the left edge
   (a pan track, a sideways scroller) takes .rail-clear so it fades out before
   it reaches the rail instead of sliding underneath the tiles. */
:root { --rail-clear: calc(clamp(10px, 1.4vw, 22px) + 38px); }
@media (max-width: 1100px) { :root { --rail-clear: 0px; } }
@media (min-width: 1101px) and (prefers-reduced-motion: no-preference) {
  .rail-clear {
    -webkit-mask-image: linear-gradient(to right, transparent 0, transparent var(--rail-clear), #000 calc(var(--rail-clear) + 24px));
            mask-image: linear-gradient(to right, transparent 0, transparent var(--rail-clear), #000 calc(var(--rail-clear) + 24px));
  }
}

/* ---------------------------------------------------------------- touch: every target at least 44px */
@media (max-width: 860px), (pointer: coarse) {
  body[data-layer] main .ulink { display: inline-flex; align-items: center; min-height: 44px; }
  body[data-layer] .ltag { min-height: 44px; }
  body[data-layer] .foot__nav a { padding: 12px 0; }
  body[data-layer] .dd__btn, body[data-layer] .bar__link, body[data-layer] .mark { min-height: 44px; }
}

/* ---------------------------------------------------------------- reduced motion: depth stays, travel goes */
@media (prefers-reduced-motion: reduce) {
  .lh__copy > * { animation: none; opacity: 1; transform: none; }
  .lh__plate, .lh__haze, .lh__subject, .lh__mist, .lh__tile img { transform: none !important; }
}
