/* The five-layer stack (#inside): the block comes apart while its panel stays pinned. Loaded right
   after hero.css. */

.stack { height: 460vh; }
/* The heading stays put while the open layer grows below it, and the lede makes room once the
   block has come apart. */
.stack-sticky {
  position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; align-items: flex-start; overflow: hidden;
  padding-top: max(calc(var(--nav-h) + 24px), calc(50vh - 300px));
}
.stack-grid { display: grid; grid-template-columns: minmax(0, 470px) 1fr; gap: 40px; align-items: center; }
.stack-copy h2 { font-size: clamp(2.3rem, 4.4vw, 3.9rem); }
.stack-copy .lede { max-width: 26em; max-height: 8em; margin: 20px 0 30px; overflow: hidden; transition: max-height 0.5s var(--ease), opacity 0.35s, margin 0.4s var(--ease); }
.stack.apart .stack-copy .lede { max-height: 0; margin-bottom: 14px; opacity: 0; }
.layers { list-style: none; padding: 0 0 0 22px; position: relative; }
.layers::before, .layers::after { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; }
.layers::before { background: var(--line); }
.layers::after {
  background: linear-gradient(180deg, var(--copper-lite), var(--copper));
  transform-origin: top; transform: scaleY(clamp(0, (var(--progress, 0) - 0.14) / 0.8, 1)); transition: transform 0.15s linear;
}
.layer { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 11px 0; opacity: 0.5; transition: opacity 0.4s var(--ease); }
.layer h3 { font-size: 1.1875rem; }
.layer-n { font-weight: 700; color: var(--fog); padding-top: 1px; transition: color 0.3s; }
.layer p, .layer-fact { display: block; max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.5s var(--ease), opacity 0.35s, margin 0.4s var(--ease); }
.layer p { color: var(--mist); font-size: 0.98rem; line-height: 1.55; }
.layer-fact { font-size: 0.8125rem; font-weight: 600; color: var(--copper-lite); }
.layer.active { opacity: 1; }
.layer.active .layer-n { color: var(--copper-lite); }
.layer.active p { max-height: 7.5em; opacity: 1; margin-top: 6px; }
.layer.active .layer-fact { max-height: 3.2em; opacity: 1; margin-top: 8px; line-height: 1.4; }
.stack:not(.apart) .layer { opacity: 0.72; }

/* A piece of the open layer's work (stack.js), under its text. Its parts come in one by one. */
.specimen { max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.5s var(--ease), opacity 0.35s, margin 0.4s var(--ease); }
.layer.active .specimen { max-height: 160px; opacity: 1; margin-top: 16px; }
.specimen .st { opacity: 0; transform: translateY(6px); transition: opacity 0.4s var(--ease), transform 0.5s var(--ease); transition-delay: calc(150ms + var(--i) * var(--step, 50ms)); }
.layer.active .specimen .st { opacity: 1; transform: none; }
.sp-labs { display: flex; flex-wrap: wrap; gap: 6px; max-width: 440px; padding: 0; list-style: none; }
.sp-labs li {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(10, 17, 31, 0.72); font-size: 0.78rem; font-weight: 560; color: var(--mist);
}
.sp-labs li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 9px var(--c); }
.sp-labs .more { color: var(--copper-lite); font-weight: 650; }
.sp-labs .more::before { display: none; }
.sp-calls { display: grid; justify-items: start; gap: 10px; max-width: 440px; }
.sp-ask { padding: 7px 13px; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; background: rgba(10, 17, 31, 0.72); font-size: 0.84rem; color: var(--frost); }
.sp-parts { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-parts span {
  --step: 110ms; display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(6, 10, 18, 0.7); font-size: 0.78rem; font-weight: 560; color: var(--mist);
}
.sp-parts i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.layer.active .sp-parts i { box-shadow: 0 0 9px var(--c); }
.sp-parts svg { width: 13px; height: 13px; color: var(--copper-lite); }
.sp-notes { display: grid; gap: 5px; max-width: 420px; padding: 0; list-style: none; }
.sp-notes li {
  --step: 120ms; display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 6px 12px;
  border-left: 2px solid var(--copper); border-radius: 0 8px 8px 0; background: rgba(200, 144, 96, 0.08); font-size: 0.84rem; color: var(--frost);
}
.sp-notes small { flex: none; font-size: 0.74rem; color: var(--fog); }
.sp-term {
  max-width: 440px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #04070d;
  font-family: var(--mono); font-size: 0.76rem; line-height: 1.55;
}
.sp-term > div { --step: 420ms; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-cmd { color: var(--frost); }
.sp-cmd::before { content: "$ "; color: var(--copper-lite); }
.sp-err { color: #f08f9c; }
.sp-term .sp-note { font-family: var(--font); font-size: 0.8rem; color: var(--mist); white-space: normal; }
.sp-ok { color: #8fd6b0; }
.sp-ok::before { content: "✓ "; }
.sp-media { display: flex; gap: 10px; }
.sp-media figure { --step: 90ms; margin: 0; }
.sp-media img, .sp-media video, .sp-eq { display: block; width: 116px; height: 72px; border: 1px solid var(--line); border-radius: 8px; background: #04070d; object-fit: cover; }
.sp-media figcaption { margin-top: 5px; font-size: 0.74rem; color: var(--fog); }
.sp-eq { display: flex; align-items: flex-end; gap: 4px; padding: 12px 14px; }
.sp-eq i { flex: 1; height: 30%; border-radius: 2px; background: linear-gradient(0deg, #ff8038, #ffdb8f); animation: sp-eq 1.1s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -170ms); }
.layer:not(.active) .sp-eq i { animation-play-state: paused; }
@keyframes sp-eq { to { height: 92%; } }
/* Where the block stands above the text, or the screen is short, the list alone tells it. */
@media (max-width: 899px), (max-aspect-ratio: 23/20), (max-height: 759px) { .specimen { display: none; } }
.no-webgl .specimen { display: none; }

@media (max-width: 1099px) {
  .stack-grid { grid-template-columns: minmax(0, 420px) 1fr; gap: 20px; }
}
/* The same rule as the hero: where the block sits above, the text sits below it. The stage is
   the room the text leaves free, and the scene puts the block into it. */
@media (max-width: 899px), (max-aspect-ratio: 23/20) {
  .stack-sticky { align-items: stretch; padding-top: 0; padding-bottom: 22px; }
  .stack-grid { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 0; }
  .stack-stage { order: -1; flex: 1 1 0; min-height: 0; }
}
@media (max-width: 759px) {
  .stack-copy h2 { font-size: 2rem; }
  .stack-copy .lede { font-size: 0.98rem; margin: 12px 0 16px; }
  .stack.apart .stack-copy .lede { display: none; }
  .layer { padding: 7px 0; }
  .layer p { font-size: 0.9375rem; }
  .no-webgl .stack { height: auto; }
  .no-webgl .stack-sticky { position: static; height: auto; padding: 96px 0; }
}
.no-webgl .stack .layer p, .no-webgl .stack .layer-fact { max-height: none; opacity: 1; margin-top: 6px; }
.no-webgl .stack .layer { opacity: 1; }
.no-webgl .stack { height: auto; }
.no-webgl .stack-sticky { position: static; height: auto; padding: 120px 0; }
