/* The stack page (tools/stack-page.js, behaviour in assets/fz-stack.js). Built on the tokens
   in assets/fz-ui.css: black ground, hairlines, square tiles, one tint per venture. */

.st-page [hidden] { display: none !important; }

/* ---------- hero: the headline and the KPI band ---------- */
.st-hero .h1 { max-width: 20ch; }
.st-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: clamp(44px, 5vw, 72px); border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); background: var(--bg-1); }
.st-kpi { min-width: 0; padding: clamp(18px, 2vw, 28px); border-right: 1px solid var(--hair); }
.st-kpi:last-child { border-right: 0; }
.st-kpi-l { margin: 0; font: 400 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.st-kpi-v { margin: 14px 0 0; font: 800 clamp(34px, 3.8vw, 58px)/.95 var(--sans); letter-spacing: -.04em; color: var(--fg); font-variant-numeric: tabular-nums; }
.st-kpi-s { margin: 10px 0 0; font: 400 10.5px/1.5 var(--mono); letter-spacing: .06em; color: var(--fg-3); }
@media (max-width: 1000px) {
  .st-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-kpi { border-bottom: 1px solid var(--hair); }
  .st-kpi:nth-child(2n) { border-right: 0; }
  .st-kpi:last-child { grid-column: 1 / -1; border-bottom: 0; }
}
@media (max-width: 560px) { .st-kpi-v { font-size: clamp(32px, 11vw, 44px); } }

/* ---------- filters ---------- */
.st-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.st-chip { appearance: none; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 13px; border: 1px solid var(--hair-2); background: none; color: var(--fg-2); font: 500 14px/1 var(--sans); letter-spacing: -.005em; cursor: pointer; transition: border-color .2s, color .2s, background-color .2s; }
.st-chip .n { font: 500 11px/1 var(--mono); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.st-chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.st-chip[aria-pressed="true"] .n { color: var(--bg-3); }
@media (hover: hover) { .st-chip:hover { border-color: var(--hair-3); color: var(--fg); } }
.st-chip:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
.st-status { min-height: 1.4em; margin: 0 0 22px; font: 400 12px/1.4 var(--mono); letter-spacing: .04em; color: var(--fg-3); }

/* ---------- the stage: the map and the details panel ---------- */
.st-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); border: 1px solid var(--hair); background: var(--bg); min-width: 0; }
.st-map { position: relative; min-width: 0; }
.st-lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.st-line { fill: none; stroke: var(--hair-3); stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 0; opacity: .2; transition: opacity .35s var(--ease), stroke .35s var(--ease); }
.st-line.is-planned { opacity: .1; }
.st-line.is-on { stroke: var(--t); stroke-width: 1.75; opacity: 1; animation: st-draw .9s var(--ease) both; }
.st-line.is-off { opacity: .04; }
@keyframes st-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.st-map.in .st-line { animation: st-draw 1.1s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.st-map.in .st-line.is-on { animation: st-draw .9s var(--ease) both; }

/* shelves: a stack of layers, the foundation at the bottom */
.st-shelf { position: relative; z-index: 2; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px; padding: 26px clamp(16px, 2vw, 28px); border-top: 1px solid var(--hair); }
.st-map > .st-shelf:first-of-type { border-top: 0; }
.st-shelf--base { border-bottom: 0; background: linear-gradient(180deg, transparent, rgba(241, 239, 233, .025)); }
.st-shelf--base::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--hair-3); }
.st-shelf-h { display: grid; align-content: start; gap: 8px; min-width: 0; }
.st-layer { margin: 0; font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.st-shelf-name { margin: 0; font: 600 19px/1.2 var(--sans); font-stretch: 112%; letter-spacing: -.01em; color: var(--fg); }
.st-count { margin: 0; font: 400 12px/1.4 var(--mono); letter-spacing: .04em; color: var(--fg-3); }
.st-count > span:first-child { color: var(--fg-2); font-variant-numeric: tabular-nums; }
.st-tiles { position: relative; z-index: 4; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px 12px; align-content: flex-start; min-width: 0; }
.st-tiles > li { min-width: 0; }

/* a tile: the mark on black, its name under it; the tint is the venture's own */
.st-tile { display: grid; gap: 10px; width: 128px; color: var(--fg-2); text-decoration: none; outline: none; transition: opacity .35s var(--ease), translate .35s var(--ease); }
.st-tile-art { position: relative; display: block; aspect-ratio: 1; background: var(--bg-1); border: 1px solid var(--hair-2); transition: border-color .3s var(--ease), box-shadow .35s var(--ease), background-color .3s; }
.st-tile-art .vicon { position: absolute; inset: 0; display: grid; place-items: center; width: auto; height: auto; background: none; border: 0; }
.st-tile-art .vicon img { width: 56%; height: auto; transition: scale .5s var(--ease); }
.st-tile-art .vicon--full img { width: 100%; height: 100%; }
.st-tile-art .vicon--mono { font: 300 44px/1 var(--sans); letter-spacing: -.04em; color: var(--fg); }
.st-tile-art .vicon[style*="--z"] img { scale: var(--z, 1); }
.st-tile-name { font: 500 14px/1.25 var(--sans); letter-spacing: -.005em; color: var(--fg-2); overflow-wrap: anywhere; transition: color .25s; }
@media (hover: hover) {
  .st-tile:hover .st-tile-art { border-color: var(--t); }
  .st-tile:hover .st-tile-art .vicon img { scale: 1.06; }
  .st-tile:hover .st-tile-name { color: var(--fg); }
}
.st-tile:focus-visible .st-tile-art { box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--t); }
.st-tile.is-link .st-tile-art { border-color: var(--t); }
.st-tile.is-active .st-tile-art { border-color: var(--t); background: color-mix(in srgb, var(--t) 9%, var(--bg)); box-shadow: inset 0 0 0 1px var(--t), 0 18px 40px -22px var(--t); }
.st-tile.is-active .st-tile-name { color: var(--fg); }
.st-tile.is-dim { opacity: .26; }

/* the details panel: beside the map on wide screens, a bottom sheet on phones */
.st-panel { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 116px); overflow: auto; background: var(--bg-1); border-left: 1px solid var(--hair); min-width: 0; z-index: 5; }
.st-panel-in { display: grid; align-content: start; gap: 0; padding: clamp(20px, 2.2vw, 30px); min-height: 100%; }
.st-panel-empty { margin: 0; font: 500 20px/1.35 var(--sans); letter-spacing: -.01em; color: var(--fg-2); }
.st-panel-hint { margin: 14px 0 0; font: 400 11px/1.6 var(--mono); letter-spacing: .06em; color: var(--fg-3); }
.st-p-bar { display: flex; justify-content: flex-end; margin: -4px 0 14px; }
.st-p-close { appearance: none; height: 34px; padding: 0 12px; border: 1px solid var(--hair-2); background: none; color: var(--fg-2); font: 500 12px/1 var(--mono); letter-spacing: .06em; cursor: pointer; }
@media (hover: hover) { .st-p-close:hover { border-color: var(--hair-3); color: var(--fg); } }
.st-p-close:focus-visible, .st-p-link:focus-visible, .st-panel a:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
.st-p-top { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; align-items: center; }
.st-p-art { display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid var(--t, var(--hair-2)); background: var(--bg); }
.st-p-art img { width: 46px; height: 46px; object-fit: contain; }
.st-p-initial { font: 300 34px/1 var(--sans); color: var(--fg); }
.st-p-kick { display: grid; gap: 6px; min-width: 0; }
.st-p-id { margin: 0; font: 500 12px/1 var(--mono); letter-spacing: .08em; color: var(--fg-3); }
.st-p-shelf { margin: 0; font: 500 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); }
.st-p-name { margin: 26px 0 0; font: 700 clamp(26px, 2.5vw, 34px)/1.02 var(--sans); font-stretch: 112%; letter-spacing: -.03em; color: var(--fg); outline: none; }
.st-p-role { margin: 10px 0 0; font: 600 15px/1.3 var(--sans); color: var(--t, var(--fg-2)); }
.st-p-pitch { margin: 16px 0 0; font-size: 16px; line-height: 1.55; color: var(--fg-2); }
.st-p-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.st-p-sec { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--hair); }
.st-p-sec h4 { margin: 0 0 6px; font: 500 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.st-p-list { list-style: none; margin: 0; padding: 0; }
.st-p-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hair); min-width: 0; }
.st-p-link { appearance: none; padding: 0; border: 0; background: none; color: var(--fg); font: 500 15px/1.3 var(--sans); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.st-p-list a { color: var(--fg); font: 500 15px/1.3 var(--sans); text-decoration: none; overflow-wrap: anywhere; }
@media (hover: hover) { .st-p-link:hover, .st-p-list a:hover { color: var(--t, var(--acc)); } }
.st-p-none { margin: 0; font-size: 14px; color: var(--fg-3); }
.st-p-links { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 24px 0 0; font: 500 13px/1.4 var(--sans); }
.st-p-links a { color: var(--fg); border-bottom: 1px solid var(--hair-3); text-decoration: none; }
@media (hover: hover) { .st-p-links a:hover { color: var(--t, var(--acc)); border-color: var(--t, var(--acc)); } }
.st-p-sec .chip { height: 22px; padding: 0 7px; font-size: 10px; }

.st-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(11, 11, 10, .62); }

/* ---------- build on it: the walk from the foundation ---------- */
.st-flow { position: relative; display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.st-flow::before { content: ''; position: absolute; left: 0; right: 0; top: 6px; height: 1px; background: var(--hair-3); transform: scaleX(0); transform-origin: left center; transition: transform 1.5s var(--ease); }
.st-flow.in::before { transform: scaleX(1); }
.st-flow-step { position: relative; min-width: 0; padding: 40px 18px 0 0; overflow-wrap: anywhere; }
.st-flow-dot { position: absolute; left: 0; top: 0; width: 13px; height: 13px; background: var(--bg); border: 1px solid var(--t, var(--acc)); box-shadow: 0 0 0 4px var(--bg); scale: 0; transition: scale .5s var(--tick); }
.st-flow.in .st-flow-dot { scale: 1; transition-delay: calc(var(--i, 0) * 260ms + 220ms); }
.st-flow-k { margin: 0; font: 500 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.st-flow-name { margin: 12px 0 0; font: 600 clamp(19px, 1.65vw, 24px)/1.12 var(--sans); font-stretch: 112%; letter-spacing: -.02em; }
.st-flow-name a { color: var(--fg); text-decoration: none; }
@media (hover: hover) { .st-flow-name a:hover { color: var(--t, var(--acc)); } }
.st-flow-role { margin: 8px 0 0; font-size: 15px; color: var(--fg-3); }
.st-flow-link { margin: 14px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-2); }
@media (max-width: 860px) {
  .st-flow { grid-template-columns: minmax(0, 1fr); }
  .st-flow::before { top: 0; bottom: 0; left: 6px; right: auto; width: 1px; height: auto; transform: scaleY(0); transform-origin: top center; }
  .st-flow.in::before { transform: scaleY(1); }
  .st-flow-step { padding: 0 0 36px 36px; }
  .st-flow-step:last-child { padding-bottom: 0; }
  .st-flow-dot { top: 4px; }
}

/* ---------- the catalogue ---------- */
.st-cat + .st-cat { margin-top: 56px; }
.st-cat-h { display: flex; align-items: baseline; gap: 14px; margin: 0 0 18px; font: 600 clamp(20px, 2vw, 26px)/1.2 var(--sans); font-stretch: 112%; letter-spacing: -.02em; }
.st-cat-h .st-layer { font-size: 11px; }
.st-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hair); border-left: 1px solid var(--hair); }
.st-card { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); transition: background-color .3s var(--ease); }
@media (hover: hover) { .st-card:hover { background: var(--bg-1); } }
.st-card-a { display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; padding: 22px; color: var(--fg); text-decoration: none; }
.st-card-a:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
.st-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.st-card-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.st-card-top .vicon { position: relative; display: grid; place-items: center; width: 52px; height: 52px; background: none; border: 0; }
.st-card-top .vicon img { width: 100%; height: 100%; object-fit: contain; }
.st-card-top .vicon--mono { font: 300 34px/1 var(--sans); color: var(--fg); }
.st-card-id { font: 500 11px/1 var(--mono); letter-spacing: .08em; color: var(--fg-3); }
.st-card-name { display: block; font: 600 21px/1.2 var(--sans); font-stretch: 112%; letter-spacing: -.02em; transition: color .25s; }
.st-card-role { font: 500 14px/1.3 var(--sans); color: var(--fg-2); }
.st-card-pitch { font-size: 15px; line-height: 1.5; color: var(--fg-3); }
.st-card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 16px; }
.st-card-n { font: 400 11px/1.4 var(--mono); letter-spacing: .04em; color: var(--fg-3); }
.st-card-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0 22px 18px; font: 500 13px/1.4 var(--sans); }
.st-card-links a { color: var(--fg-2); }
@media (hover: hover) { .st-card:hover .st-card-name { color: var(--acc); } .st-card-links a:hover { color: var(--acc); } }
.st-cat-empty { margin: 24px 0 0; font: 400 13px var(--mono); color: var(--fg-3); }
.st-card .chip { height: 22px; padding: 0 7px; font-size: 10px; }

/* ---------- most used: a ranked list with bars ---------- */
.st-rank { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hair); }
.st-rank-row { border-bottom: 1px solid var(--hair); }
.st-rank-a { display: grid; grid-template-columns: 30px 48px minmax(0, 1fr) minmax(120px, 280px) auto; align-items: center; gap: 8px 22px; padding: 18px 0; color: var(--fg); text-decoration: none; }
.st-rank-id { font: 500 12px/1 var(--mono); letter-spacing: .06em; color: var(--fg-3); }
.st-rank-lead .vicon { position: relative; display: grid; place-items: center; width: 48px; height: 48px; background: none; border: 0; }
.st-rank-lead .vicon img { width: 100%; height: 100%; object-fit: contain; }
.st-rank-lead .vicon--mono { font: 300 28px/1 var(--sans); color: var(--fg); }
.st-rank-main { display: grid; gap: 4px; min-width: 0; }
.st-rank-name { font: 500 18px/1.25 var(--sans); letter-spacing: -.01em; transition: color .25s; }
.st-rank-sub { font-size: 14px; color: var(--fg-3); }
.st-rank-bar { position: relative; height: 6px; background: var(--hair); overflow: hidden; }
.st-rank-bar i { position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); background: var(--fg-2); transform: scaleX(0); transform-origin: left center; transition: transform 1.2s var(--ease) var(--d, 0) ; }
.st-rank-row.in .st-rank-bar i { transform: scaleX(1); transition-delay: calc(var(--d, 0) * 70ms + 120ms); }
.st-rank-n { font: 400 12px/1.4 var(--mono); letter-spacing: .03em; color: var(--fg-3); text-align: right; white-space: nowrap; }
@media (hover: hover) { .st-rank-a:hover .st-rank-name { color: var(--acc); } .st-rank-a:hover .st-rank-bar i { background: var(--acc); } }
.st-rank-a:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
@media (max-width: 760px) {
  .st-rank-a { grid-template-columns: 26px 40px minmax(0, 1fr); }
  .st-rank-bar, .st-rank-n { grid-column: 3; }
  .st-rank-n { text-align: left; }
}

/* ---------- phones: shelves stack, tiles in a grid of four, the panel is a sheet ---------- */
@media (max-width: 900px) {
  .st-stage { grid-template-columns: minmax(0, 1fr); border: 0; background: none; }
  .st-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 80vh; border-left: 0; border-top: 1px solid var(--hair-2); visibility: hidden; transform: translate3d(0, 104%, 0); transition: transform .5s var(--ease), visibility .5s; z-index: 50; }
  .st-panel.is-open { visibility: visible; transform: none; }
  .st-panel-in { padding: 14px 18px calc(28px + env(safe-area-inset-bottom)); }
  .st-p-bar { position: sticky; top: 0; background: var(--bg-1); padding: 4px 0 6px; margin-top: 0; }
  .st-map { border: 1px solid var(--hair); }
  .st-shelf { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 22px 16px; }
  .st-shelf-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .st-shelf-name { font-size: 18px; }
  .st-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 10px; }
  .st-tiles > li { min-width: 0; }
  .st-tile { width: 100%; }
  .st-tile-name { font-size: 12.5px; }
}
@media (max-width: 560px) {
  .st-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st-cards { grid-template-columns: minmax(0, 1fr); }
  .st-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gut) * -1); padding: 0 var(--gut) 4px; }
  .st-filter::-webkit-scrollbar { display: none; }
  .st-chip { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .st-line, .st-line.is-on, .st-map.in .st-line, .st-flow::before, .st-flow-dot, .st-rank-bar i, .st-rank-row.in .st-rank-bar i,
  .st-tile, .st-tile-art, .st-tile-art .vicon img, .st-chip, .st-card, .st-card-name, .st-panel, .st-tile-name { animation: none !important; transition: none !important; }
  .st-flow::before { transform: none; }
  .st-flow-dot { scale: 1; }
  .st-rank-bar i { transform: none; }
}
