/* The existing scroll-assembled stack, with silver and graphite materials. */
:root {
  --sl-shadow: #000000; --sl-dot: #929292;
  --sl-edge-base: #292929; --sl-edge-stroke: #b0b0b0;
  --sl-inner: #f4f4f4; --sl-inner-base: #969696;
  --sl-icon: #333333; --sl-icon-base: #cdcdcd; --sl-node: #ebebeb;
  --sl-label: #242424; --sl-label-base: #e3e3e3; --sl-num: #555555; --sl-num-base: #bcbcbc;
  --g-glass-1: #f3f3f3; --g-glass-2: #b5b5b5; --g-glass-3: #ededed; --g-glass-4: #7f7f7f; --g-glass-5: #d8d8d8;
  --g-sel-1: #e5efdb; --g-sel-2: #b2c798; --g-sel-3: #e1ead5;
  --g-edge-1: #5e5e5e; --g-edge-2: #e5e5e5; --g-edge-3: #7b7b7b; --g-edge-4: #dfdfdf; --g-edge-5: #ababab;
  --g-rim-1: #f4f4f4; --g-rim-2: #dedede; --g-rim-3: #8c8c8c; --g-rim-4: #f4f4f4;
  --g-base-1: #464646; --g-base-2: #191919; --g-base-3: #373737; --g-base-4: #252525;
  --g-ground: #3f423b; --g-ref: #f5f5f5;
}
.stack-svg .g-glass-1 { stop-color: var(--g-glass-1); stop-opacity: .93; }
.stack-svg .g-glass-2 { stop-color: var(--g-glass-2); stop-opacity: .42; }
.stack-svg .g-glass-3 { stop-color: var(--g-glass-3); stop-opacity: .64; }
.stack-svg .g-glass-4 { stop-color: var(--g-glass-4); stop-opacity: .35; }
.stack-svg .g-glass-5 { stop-color: var(--g-glass-5); stop-opacity: .78; }
.stack-svg .g-sel-1 { stop-color: var(--g-sel-1); stop-opacity: .6; }
.stack-svg .g-sel-2 { stop-color: var(--g-sel-2); stop-opacity: .5; }
.stack-svg .g-sel-3 { stop-color: var(--g-sel-3); stop-opacity: .6; }
.stack-svg .g-edge-1 { stop-color: var(--g-edge-1); stop-opacity: .5; }
.stack-svg .g-edge-2 { stop-color: var(--g-edge-2); stop-opacity: .95; }
.stack-svg .g-edge-3 { stop-color: var(--g-edge-3); stop-opacity: .8; }
.stack-svg .g-edge-4 { stop-color: var(--g-edge-4); }
.stack-svg .g-edge-5 { stop-color: var(--g-edge-5); stop-opacity: .8; }
.stack-svg .g-rim-1 { stop-color: var(--g-rim-1); }
.stack-svg .g-rim-2 { stop-color: var(--g-rim-2); stop-opacity: .6; }
.stack-svg .g-rim-3 { stop-color: var(--g-rim-3); stop-opacity: .7; }
.stack-svg .g-rim-4 { stop-color: var(--g-rim-4); }
.stack-svg .g-base-1 { stop-color: var(--g-base-1); }
.stack-svg .g-base-2 { stop-color: var(--g-base-2); }
.stack-svg .g-base-3 { stop-color: var(--g-base-3); }
.stack-svg .g-base-4 { stop-color: var(--g-base-4); }
.stack-svg .g-ground-1 { stop-color: var(--g-ground); stop-opacity: .2; }
.stack-svg .g-ground-2 { stop-color: var(--g-ground); stop-opacity: 0; }
.stack-svg .g-ref-0 { stop-color: var(--g-ref); stop-opacity: 0; }
.stack-svg .g-ref-1 { stop-color: var(--g-ref); stop-opacity: .6; }
.stack-svg .sl-dot { fill: var(--sl-dot); opacity: .25; }
.stack-svg .sl-shadow { fill: var(--sl-shadow); opacity: .14; }
.stack-svg .sl-edge, .stack-svg .sl-edge-base { stroke: var(--sl-edge-stroke); stroke-width: .45; }
.stack-svg .sl-edge-base { fill: var(--sl-edge-base); }
.stack-svg .sl-inner { stroke: var(--sl-inner); stroke-opacity: .55; }
.stack-svg .sl-inner-base { stroke: var(--sl-inner-base); stroke-opacity: .55; }
.stack-svg .sl-icon { stroke: var(--sl-icon); }
.stack-svg .sl-icon-base { stroke: var(--sl-icon-base); }
.stack-svg .sl-icon-fill { fill: var(--sl-icon); fill-opacity: .25; }
.stack-svg .sl-icon-node { fill: var(--sl-node); fill-opacity: .5; }
.stack-svg text { font-family: var(--sans); }
.stack-svg .sl-label { fill: var(--sl-label); } .stack-svg .sl-label-base { fill: var(--sl-label-base); }
.stack-svg .sl-num { fill: var(--sl-num); } .stack-svg .sl-num-base { fill: var(--sl-num-base); }

.stack-story { position: relative; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper); margin: 32px 24px 0; border-inline: 1px solid var(--line); }
.architecture { position: relative; display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: center; gap: 0 24px; min-height: 560px; }
.layer-controls { position: relative; z-index: 3; padding: 16px 0 24px; }
.story-eyebrow { margin-bottom: 14px; }
.stack-heading { font-size: 30px; line-height: 1.06; letter-spacing: -.03em; font-weight: 400; margin-bottom: 28px; max-width: 340px; }
.mobile-story-copy { display: none; }
.layer { border-bottom: 1px solid var(--line); }
.layer button { width: 100%; padding: 11px 0; min-height: 48px; display: flex; align-items: center; gap: 18px; text-align: left; font-size: 15px; letter-spacing: -.01em; color: var(--ink); transition: color .18s ease; }
.layer button .number { font-family: var(--mono); font-size: 13px; color: var(--muted); width: 24px; flex: 0 0 24px; font-variant-numeric: tabular-nums; }
.layer button .symbol { margin-left: auto; display: inline-flex; color: var(--muted); }
.layer button .symbol svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.layer .sym-dash { display: none; }
.layer.active .sym-arrow { display: none; }
.layer.active .sym-dash { display: block; }
.layer.active button, .layer.active .symbol { color: var(--accent); }
.layer.active .number { color: var(--accent); }
.layer.active { border-bottom-color: var(--accent); }
.layer-content { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.2, .7, .2, 1); }
.layer-content > div { overflow: hidden; }
.layer-content p { font-size: 13px; line-height: 1.55; color: var(--muted); padding-left: 32px; margin: 0; }
.layer.active .layer-content { grid-template-rows: 1fr; }
.layer.active .layer-content p { margin-bottom: 16px; }
.layer-actions { display: flex; gap: 18px; margin: 20px 0 0 32px; }
.text-button { border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 13px; color: var(--muted); min-height: 44px; }
.text-button:hover { color: var(--ink); border-color: var(--ink); }

.stage { position: relative; height: 560px; min-width: 0; margin: 0 -50px 0 -25px; }
.stack-svg { width: 100%; height: 100%; overflow: visible; }
.slab { will-change: transform, opacity; cursor: pointer; }
.slab-highlight { pointer-events: none; }
.os-signature { position: absolute; bottom: 6%; left: 10%; right: 0; text-align: center; opacity: 0; transform: translateY(12px); pointer-events: none; }
.os-signature strong { font-size: 20px; font-weight: 500; letter-spacing: -.03em; }
.os-signature span { display: block; margin-top: 8px; font-size: var(--fs-note); color: var(--muted); letter-spacing: .02em; }
.stage-foot { position: absolute; bottom: 0; left: 17%; right: 9%; display: flex; justify-content: space-between; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.stage-foot span:first-child { display: flex; align-items: center; gap: 8px; }
.stage-foot i { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.stack-svg:not([data-ready]) + .os-signature + .stage-foot { opacity: 0; }
html:not(.scroll-stack) .layer-content { grid-template-rows: 1fr; }
html:not(.scroll-stack) .stage { margin: 0; }
html:not(.scroll-stack) .layer-content p { margin-bottom: 16px; }
html:not(.scroll-stack) .layer button { cursor: default; }
html:not(.scroll-stack) .layer button:disabled { opacity: 1; }
html:not(.scroll-stack) .slab { cursor: default; pointer-events: none; }
html:not(.scroll-stack) .layer-actions,
html:not(.scroll-stack) .story-progress { display: none; }

.story-progress { position: absolute; bottom: 28px; left: 0; right: 0; display: flex; align-items: center; gap: 22px; font-family: var(--mono); font-size: var(--fs-label); letter-spacing: .06em; color: var(--muted); }
.story-progress a { min-height: 44px; display: flex; align-items: center; gap: 14px; }
.story-track { height: 1px; flex: 1; background: var(--line); }
.story-track span { display: block; height: 2px; background: var(--accent); transform: scaleX(var(--story-progress, 0)); transform-origin: left; }

/* Desktop: a short scroll story. Compact screens animate without pinning the page. */
.scroll-stack .stack-story { height: calc(100svh + 560px); }
.scroll-stack .architecture { position: sticky; top: 64px; height: calc(100svh - 64px); min-height: 600px; padding-top: 32px; }
.scroll-stack .layer-controls { align-self: start; padding-top: 8px; }
.scroll-stack .stage { height: min(72svh, 650px); margin: 0; }
.scroll-stack .mobile-story-copy { display: block; margin: 0 0 36px; max-width: 320px; font-size: 15px; line-height: 1.6; color: var(--muted); }
.scroll-stack .layer-content { transition: none; }
.scroll-stack .layer-content[hidden] { display: none; }

@media (max-width: 1100px) {
  .scroll-stack .architecture { grid-template-columns: 260px minmax(0, 1fr); }
  .scroll-stack .stage { margin: 0 -12px; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-stack .stack-story { height: auto; }
  .scroll-stack .mobile-story-copy { display: none; }
  .scroll-stack .architecture { position: relative; top: 0; height: auto; min-height: 0; padding: 40px 0; }
  .scroll-stack .stage { height: 520px; }
  .scroll-stack .os-signature { bottom: 2%; opacity: 1; transform: none; }
  .scroll-stack .stage-foot, .scroll-stack .layer-actions, .story-progress { display: none; }
  .slab { will-change: auto; }
}

@media (max-width: 960px) {
  html:not(.scroll-stack) .architecture { grid-template-columns: minmax(0, 1fr); padding: 32px 0; }
  html:not(.scroll-stack) .layer-controls { display: contents; }
  html:not(.scroll-stack) .stage { grid-row: 3; height: clamp(240px, 54vw, 340px); margin: 12px 0 20px; }
  .scroll-stack .stack-story { height: auto; }
  .scroll-stack .architecture {
    position: relative;
    top: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 0 12px;
    height: auto;
    min-height: 0;
    padding: 32px 0;
  }
  .scroll-stack .layer-controls { display: contents; }
  .scroll-stack .story-eyebrow, .scroll-stack .stack-heading { grid-column: 1 / -1; }
  .scroll-stack .stack-heading { font-size: 28px; margin-bottom: 0; }
  .scroll-stack .stage {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: center;
    order: initial;
    width: 100%;
    max-width: 640px;
    height: clamp(240px, 54vw, 340px);
    margin: 12px 0 20px;
  }
  .scroll-stack .mobile-story-copy {
    display: block;
    grid-column: 1 / -1;
    grid-row: 4;
    font-size: 14px;
    line-height: 1.55;
    max-width: 62ch;
    margin-bottom: 20px;
  }
  .scroll-stack .layer { min-width: 0; align-self: stretch; }
  .scroll-stack .layer button { min-height: 48px; gap: 6px; font-size: 12px; }
  .scroll-stack .layer .number { font-size: 11px; }
  .scroll-stack .layer .symbol,
  .scroll-stack .layer-content,
  .scroll-stack .layer-actions,
  .scroll-stack .story-progress,
  .scroll-stack .stage-foot,
  .scroll-stack .os-signature { display: none; }
  .scroll-stack .slab { will-change: auto; }
}

@media (min-width: 961px) and (max-height: 860px) and (prefers-reduced-motion: no-preference) {
  .scroll-stack .layer-actions, .scroll-stack .stage-foot { display: none; }
  .scroll-stack .os-signature { bottom: 6%; }
  .scroll-stack .layer button { min-height: 46px; padding: 10px 0; font-size: 15px; }
  .scroll-stack .mobile-story-copy { margin-bottom: 20px; font-size: 15px; }
  .scroll-stack .stack-heading { margin-bottom: 16px; }
  .story-progress { bottom: 16px; }
}
@media (min-width: 961px) and (max-height: 760px) and (prefers-reduced-motion: no-preference) {
  .scroll-stack .stack-heading { font-size: 30px; }
  .scroll-stack .mobile-story-copy { font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
  .scroll-stack .layer button { min-height: 44px; padding: 9px 0; font-size: 14px; }
  .scroll-stack .story-eyebrow { margin-bottom: 10px; }
}


@media (max-width: 960px) {
  .scroll-stack .layer button { padding: 10px 0; min-height: 48px; gap: 6px; font-size: 12px; letter-spacing: 0; }
  .scroll-stack .layer .number { width: 18px; flex-basis: 18px; font-size: 11px; }
}
@media (max-width: 600px) {
  .scroll-stack .architecture { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scroll-stack .layer button { font-size: 12px; gap: 8px; }
  .scroll-stack .layer .number { width: 20px; flex-basis: 20px; }
}
@media (max-width: 960px) and (prefers-reduced-motion: no-preference) {
  .scroll-stack .layer-actions { display: flex; grid-column: 1 / -1; margin: 20px 0 0; }
}
@media print {
  .story-progress, .layer-actions, .stage-foot { display: none !important; }
  .scroll-stack .stack-story { height: auto; }
  .scroll-stack .architecture { position: static; height: auto; min-height: 0; padding: 24px 0; }
  .scroll-stack .stage { height: 420px; }
  .scroll-stack .mobile-story-copy { display: none; }
  .scroll-stack .layer-content, .layer-content { display: block; }
  .layer-content > div { overflow: visible; }
  .layer-content p { margin-bottom: 12px; }
}

@media (max-width:600px) { .stack-story { margin: 20px 16px 0; } .architecture.shell { width:calc(100% - 32px); } }
