/* The software factory. A long model of seven rooms: the first screen shows the whole line, the walk pins it and
   moves room to room, then the map of 23 stations, the same parts in goMoE, and the claim on the dark sheet.
   Dusk is the only accent, read as --step from data-step="build", and it marks what is live in the current step.
   Everything else is the kit. factory.js draws the map and drives the walk. */

/* ---------- motion shared with the other pages about things we built (page-built.js adds the classes) ---------- */
.is-rise { opacity: 0; translate: 0 22px; }
.is-rise.is-in { opacity: 1; translate: none; transition: opacity 0.6s var(--out) calc(var(--rise-i, 0) * 60ms), translate 0.7s var(--out) calc(var(--rise-i, 0) * 60ms); }

/* ---------- the first screen ---------- */
.fx-top .k-band-over > * { max-width: 36em; }
.fx-top .k-at-br { max-width: 31em; }
html:not(.js) .fx-top .k-mark > b { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .fx-top .k-display { animation: fx-up 0.7s var(--out) both; }
  @keyframes fx-up { from { opacity: 0; translate: 0 18px; } }
}

/* ---------- the walk ---------- */
.fx-walk { position: relative; background: var(--table); }
.fx-walk-stage { position: sticky; top: 0; height: 100svh; overflow: clip; font-size: 17px; line-height: 1.4; color: var(--ink); }
.fx-walk-stage[hidden] { display: none; }
/* The picture keeps its own shape and covers the stage, the way the kit's .k-cam does, so a room placed by percent
   stays on its spot. factory.js moves it with a transform. */
.fx-walk-pic { position: absolute; inset: 0; overflow: hidden; container-type: size; }
.fx-cam { --pic: 1.7768; --w: max(100cqw, 100cqh * var(--pic)); --h: max(100cqh, 100cqw / var(--pic)); position: absolute; left: calc((100cqw - var(--w)) / 2); top: calc((100cqh - var(--h)) / 2); width: var(--w); height: var(--h); transform-origin: 0 0; transition: transform 0.7s var(--out); }
.fx-cam > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
/* The cart's marker rides the track from room to room. */
.fx-cart { --sq-r: 7px; position: absolute; left: 21%; top: 74.5%; display: grid; place-items: center; width: 24px; height: 24px; translate: -50% -50%; scale: calc(1 / var(--z, 1)); background: var(--ink); transition: left 0.7s var(--out), top 0.7s var(--out); }
.fx-cart > i { --sq-r: 3.5px; display: block; width: 12px; height: 12px; background: #fff; }
.fx-lead { position: absolute; left: 0; top: 0; z-index: 2; width: 0; height: 1.5px; background: var(--ink); transform-origin: 0 50%; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.fx-lead.is-on { opacity: 1; }

.fx-walk-panel { --sq-fill: transparent; position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.fx-walk-panel > * { pointer-events: auto; }
.fx-walk-words { position: absolute; left: max(var(--m), (100% - var(--k-max)) / 2); top: var(--k-top); width: min(31em, 42%); }
.fx-walk-words .k-h2 { font-size: clamp(30px, 3.6vw, 66px); }
.fx-walk-card { --sq-r: 18px; --sq-fill: var(--white); --sq-shadow: var(--lift); position: absolute; left: 27%; bottom: calc(clamp(112px, 9.4vw, 150px) + clamp(30px, 3vw, 48px)); display: grid; gap: 8px; width: clamp(290px, 25vw, 380px); padding: 14px 16px 12px; font-size: 16px; line-height: 1.36; }
.fx-walk-card header { display: flex; justify-content: space-between; gap: 10px; font: 500 12px/1.2 var(--mono); color: var(--soft); }
.fx-walk-card header em { font-style: normal; }
.fx-walk-card .k-chip { background: var(--step); }
.fx-walk-where { font-weight: 600; }
.fx-walk-line { color: var(--text); }
.fx-walk-card .k-link { min-height: 36px; font-size: 15px; }
.fx-walk-nav { display: none; }

/* The seven parts along the bottom. The current one is in full ink, the ones behind it are filled. */
.fx-strip { --sq-r: 22px; --sq-fill: var(--white); --sq-shadow: var(--lift); position: absolute; z-index: 4; left: clamp(12px, 2.4vw, 40px); right: clamp(12px, 2.4vw, 40px); bottom: clamp(12px, 1.8vw, 28px); display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(6px, 0.8vw, 14px); padding: clamp(14px, 1.6vw, 24px) clamp(14px, 1.6vw, 24px); }
.fx-strip a { --sq-fill: transparent; --sq-r: 10px; display: grid; gap: 6px; align-content: start; height: 100%; padding: 0; text-decoration: none; color: var(--faint); transition: color 0.3s; }
.fx-strip a > i { display: block; height: 3px; background: var(--fog); transition: background-color 0.3s; }
.fx-strip a > span { font: 500 12px/1 var(--mono); }
.fx-strip a > b { font-size: clamp(14px, 1.12vw, 18px); font-weight: 500; line-height: 1.15; letter-spacing: -0.012em; }
.fx-strip a > small { font: 400 12px/1.3 var(--mono); }
.fx-strip a.is-past { color: var(--stone); }
.fx-strip a.is-past > i { background: var(--stone); }
.fx-strip a:hover, .fx-strip a[aria-current] { color: var(--ink); }
.fx-strip a[aria-current] > i { background: var(--ink); }
.fx-strip a[aria-current] > b { font-weight: 600; }

/* With script off, and under the pinned stage as the thing that scrolls: the same seven parts as a list. */
.fx-walk:not(.is-live) { background: var(--paper); }
.fx-walk-list { padding-block: var(--k-gap); }
.fx-parts { display: grid; margin-top: clamp(24px, 3vw, 44px); border-bottom: 1px solid var(--rule); }
.fx-parts > li { border-top: 1px solid var(--rule); scroll-margin-top: 96px; }
.fx-parts a { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 4px clamp(14px, 2vw, 32px); align-items: baseline; min-height: 48px; padding-block: 14px; text-decoration: none; }
.fx-part-title { font-size: clamp(19px, 1.62vw, 27px); font-weight: 500; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
.fx-part-where { font: 400 12px/1.45 var(--mono); color: var(--label); }
.fx-walk.is-live .fx-walk-list { padding: 0; }
.fx-walk.is-live .fx-walk-list-head { display: none; }
.fx-walk.is-live .fx-parts { margin-top: -100svh; border: 0; visibility: hidden; }
.fx-walk.is-live .fx-parts > li { height: 100svh; border: 0; scroll-margin-top: 0; }

/* ---------- the map ---------- */
.fx-grid { display: grid; grid-template-columns: minmax(0, 3.5fr) minmax(0, 8.5fr); gap: clamp(24px, 3.2vw, 56px); align-items: start; scroll-margin-top: 92px; }
.fx-side { position: sticky; top: 92px; display: grid; gap: clamp(22px, 2.4vw, 36px); }
.fx-console { display: grid; gap: 20px; }
.fx-console[hidden], .fx-stage[hidden], .fx-browse[hidden], .fx-more[hidden], .fx-filters[hidden] { display: none; }
.fx-now { display: grid; gap: 8px; }
.fx-about { display: grid; gap: 6px; font-size: 14px; line-height: 1.4; color: var(--body); }
.fx-about:empty { display: none; }
.fx-about > div { display: grid; grid-template-columns: 5.2em minmax(0, 1fr); column-gap: 10px; }
.fx-about dt { font: 500 12px/1.6 var(--mono); color: var(--label); }
.fx-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-keys .btn { min-height: 44px; }
.fx-keys .btn[aria-expanded="true"] { --sq-fill: var(--ink); color: #fff; }
.fx-step { display: grid; gap: 8px; }
.fx-scrub { display: flex; gap: 3px; }
.fx-scrub button { flex: 1; min-width: 0; height: 28px; display: grid; align-items: center; }
.fx-scrub i { display: block; height: 3px; background: var(--rule); transition: background-color 0.3s; }
.fx-scrub .is-past i { background: var(--stone); }
.fx-scrub [aria-current] i { height: 5px; background: var(--ink); }
.fx-scrub button:hover i { background: var(--ink); }
.fx-step-title { font-size: clamp(19px, 1.55vw, 25px); font-weight: 500; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
.fx-callout[hidden] { display: none; }
.fx-callout .k-tag { --sq-fill: var(--white); white-space: normal; padding-block: 6px; line-height: 1.3; }

.fx-stage { display: grid; gap: 10px; min-width: 0; }
.fx-sheet { --sq-r: clamp(18px, 1.6vw, 26px); --sq-fill: var(--white); --raise: var(--paper); --rule: var(--fog); display: grid; padding: clamp(16px, 2vw, 30px); }
.fx-bands { position: relative; display: grid; }
.fx-band { padding-block: 18px 16px; border-top: 1px solid var(--rule); }
.fx-band:first-child { padding-top: 2px; border-top: 0; }
.fx-band-head { display: flex; flex-wrap: wrap; gap: 2px 1.3em; margin-bottom: 10px; padding-inline: 8px; font: 400 12px/1.3 var(--mono); color: var(--stone); }
.fx-band-head b { font-weight: 500; color: var(--ink); }
.fx-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.fx-row + .fx-row { margin-top: 8px; }
/* A station is a small square and its name. Its state is the square's fill and a glyph, and never the fill alone. */
.fx-st { --sq-r: 12px; --sq-fill: transparent; display: grid; gap: 8px; align-content: start; justify-items: start; width: 100%; min-height: 78px; padding: 8px; text-align: left; transition: --sq-fill 0.2s; }
.fx-st:hover, .fx-st[aria-pressed="true"] { --sq-fill: var(--raise); }
.fx-st-chip { --sq-r: 7px; display: grid; place-items: center; width: 26px; height: 26px; background: var(--ink); transition: background-color 0.3s; }
.fx-st-chip svg { display: block; width: 14px; height: 14px; }
.fx-st-chip path { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: square; }
.fx-st[data-state="running"] .fx-st-chip { background: var(--step); }
.fx-st[data-state="running"] .fx-st-chip path { stroke-width: 5; }
.fx-st[data-state="skipped"] .fx-st-chip { background: var(--fog); }
.fx-st[data-state="skipped"] .fx-st-chip path { stroke: var(--stone); }
.fx-st-name { font: 400 12px/1.25 var(--mono); color: var(--stone); overflow-wrap: anywhere; }
.fx-st:is([aria-pressed="true"], [data-state="running"], [data-state="paused"]) .fx-st-name { font-weight: 500; color: var(--ink); }
.fx-st[data-state="done"] .fx-st-name { color: var(--text); }
.fx-st[data-state="skipped"] .fx-st-name { text-decoration: line-through; text-decoration-color: var(--faint); }
.fx-st-tag { font: 500 11px/1.2 var(--mono); color: var(--ink); }
.fx-st-tag:empty { display: none; }
/* The marker that moves from station to station as the run plays. It shows only on a station that is live. */
.fx-marker { --sq-r: 7px; position: absolute; left: 0; top: 0; z-index: 1; width: 26px; height: 26px; background: var(--step); opacity: 0; pointer-events: none; transition: translate 0.7s var(--out), opacity 0.2s; }
.fx-marker[data-state="running"] { opacity: 1; }
.fx-marker::after { content: ''; position: absolute; inset: 10.5px; background: #fff; }
.fx-legend { padding-inline: 4px; }

.fx-detail { display: grid; grid-template-columns: minmax(0, 3.2fr) minmax(0, 8fr); gap: 14px clamp(18px, 2vw, 32px); padding: 22px 8px 4px; border-top: 1px solid var(--rule); }
.fx-detail-name { display: grid; gap: 8px; align-content: start; }
.fx-detail-text { display: grid; gap: 8px; align-content: start; }
.fx-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px clamp(20px, 2.4vw, 40px); margin-top: 22px; padding: 22px 8px 4px; border-top: 1px solid var(--rule); scroll-margin-top: 96px; }
.fx-more-col { display: grid; gap: 8px; align-content: start; min-width: 0; }
.fx-facts { display: grid; margin-bottom: 14px; border-bottom: 1px solid var(--rule); }
.fx-facts > li { display: grid; gap: 4px; justify-items: start; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 14px; line-height: 1.4; color: var(--text); }
.fx-facts > li > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; }
.fx-facts b { font-weight: 600; color: var(--ink); }
.fx-facts small { font: 400 12px/1.3 var(--mono); color: var(--stone); }
.fx-facts .k-tag { --sq-fill: var(--paper); min-height: 32px; margin-top: 2px; cursor: pointer; }
.fx-outline { display: grid; border-bottom: 1px solid var(--rule); }
.fx-outline > li { border-top: 1px solid var(--rule); }
.fx-outline button { display: grid; grid-template-columns: 1.8em minmax(0, 1fr); width: 100%; min-height: 44px; padding: 9px 0; text-align: left; font-size: 14px; line-height: 1.4; color: var(--text); transition: background-color 0.2s; }
.fx-outline button > span:first-child { font: 500 12px/1.6 var(--mono); color: var(--stone); }
.fx-outline b { display: block; font-weight: 600; color: var(--ink); }
.fx-outline button:hover, .fx-outline [aria-current] { background: var(--raise); margin-inline: -8px; padding-inline: 8px; width: calc(100% + 16px); }

/* The list you browse: runs, playbooks, skills and principles. Picking one plays it on the map. */
.fx-browse { display: grid; gap: 14px; margin-top: clamp(24px, 3vw, 44px); padding-top: clamp(20px, 2.4vw, 32px); border-top: 1px solid var(--rule); scroll-margin-top: 84px; }
.fx-browse-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; }
.fx-browse .k-chips small { font: 400 12px/1 var(--mono); opacity: 0.6; }
.fx-search { flex: 0 1 19em; min-width: 12em; }
.fx-filters > button { min-height: 36px; font-size: 14px; }
.fx-list { --cols: minmax(0, 3fr) minmax(0, 7fr) minmax(0, 2.6fr); display: grid; }
.fx-list h4 { margin-top: 22px; padding-bottom: 8px; }
.fx-list h4:first-child { margin-top: 4px; }
.fx-item { width: 100%; text-align: left; cursor: pointer; }
.fx-item:hover { background: var(--raise); margin-inline: -12px; padding-inline: 12px; width: calc(100% + 24px); }
.fx-item.is-on { width: calc(100% + 24px); }

/* The whole map as text. Open with script off, shut under the live map. */
.fx-plain { margin-top: clamp(28px, 4vw, 56px); border-block: 1px solid var(--rule); }
.fx-plain > summary { position: relative; display: block; min-height: 52px; padding: 15px 30px 15px 0; font-size: 17px; font-weight: 600; list-style: none; cursor: pointer; }
.fx-plain > summary::-webkit-details-marker { display: none; }
.fx-plain > summary::before, .fx-plain > summary::after { content: ''; position: absolute; right: 2px; top: 25px; width: 12px; height: 2px; background: currentColor; transition: rotate 0.4s var(--out); }
.fx-plain > summary::after { rotate: 90deg; }
.fx-plain[open] > summary::after { rotate: 0deg; }
.fx-plain-body { padding-bottom: clamp(28px, 4vw, 56px); font-size: 15px; line-height: 1.45; color: var(--text); }
.fx-plain-body h3 { margin: 40px 0 6px; font-size: clamp(22px, 2.3vw, 36px); font-weight: 500; line-height: 1.05; letter-spacing: -0.028em; color: var(--ink); }
.fx-plain-body h3:first-child { margin-top: 12px; }
.fx-plain-body h4 { margin: 24px 0 8px; font-size: 17px; font-weight: 600; line-height: 1.25; color: var(--ink); }
.fx-plain-body ol { list-style: decimal; padding-left: 1.5em; }
.fx-plain-body li + li { margin-top: 6px; }
.fx-plain-body strong { font-weight: 600; color: var(--ink); }
.fx-plain-body section > p { margin-bottom: 6px; color: var(--stone); }
.fx-plain-meta { font: 400 12px/1.45 var(--mono); color: var(--label); }
.fx-plain-cols { columns: 3 21em; column-gap: clamp(24px, 3vw, 48px); }
.fx-plain-cols > section { break-inside: avoid; padding-bottom: 8px; }
.fx-plain-cols > section > h4 { margin-top: 14px; }
ul.fx-plain-cols > li { break-inside: avoid; margin: 0; padding-bottom: 8px; }
.fx-plain > .fx-plain-body > ol { max-width: 60em; }

/* ---------- the same parts in goMoE, and the claim ---------- */
.fx-same .k-text { max-width: 36em; }
.fx-claim .k-display { max-width: 12em; }
.fx-claim .k-lede { max-width: 36em; }
.fx-claim-on { justify-content: flex-end; }
.fx-seven a { display: grid; gap: 6px; min-height: 44px; align-content: start; text-decoration: none; }
.fx-seven b { font-size: clamp(15px, 1.2vw, 19px); }

/* ---------- narrower ---------- */
@media (max-width: 1099px) {
  .fx-grid { grid-template-columns: minmax(0, 1fr); }
  .fx-side { position: static; }
  .fx-strip a > small { display: none; }
}
@media (max-width: 899px) {
  .fx-claim-on { justify-content: flex-start; }
  .fx-more { grid-template-columns: minmax(0, 1fr); }
  .fx-detail { grid-template-columns: minmax(0, 1fr); }
  .fx-parts a { grid-template-columns: minmax(0, 1fr); }
}

/* A phone or an upright tablet. The line is long and thin, so the walk shows one room at a time: a band of the
   picture, seven numbered chips, and a card with Back and Next. Nothing is pinned. */
@media (max-width: 699px), (max-aspect-ratio: 41/50) {
  .fx-walk.is-live { background: var(--paper); }
  .fx-walk-stage { position: static; display: flex; flex-direction: column; height: auto; overflow: visible; scroll-margin-top: 0; }
  .fx-walk-pic { position: relative; inset: auto; height: 46svh; background: var(--table); touch-action: pan-y; }
  /* It stays positioned, because the corner the .sq class draws is placed against its own box. */
  .fx-strip { --sq-fill: transparent; --sq-shadow: none; position: relative; inset: auto; display: flex; gap: 6px; padding: 12px var(--m) 8px; overflow-x: auto; scrollbar-width: none; }
  .fx-strip::-webkit-scrollbar { display: none; }
  .fx-strip > li { flex: none; }
  .fx-strip a { --sq-fill: var(--white); place-items: center; width: 44px; height: 44px; color: var(--ink); transition: --sq-fill 0.25s, color 0.25s; }
  .fx-strip a > :is(i, b, small) { display: none; }
  .fx-strip a > span { font: 500 15px/1 var(--sans); }
  .fx-strip a.is-past { color: var(--ink); }
  .fx-strip a[aria-current] { --sq-fill: var(--ink); color: #fff; }
  .fx-strip a[aria-current] > span { font-weight: 600; }
  .fx-walk-panel { --sq-fill: var(--white); --sq-r: 26px; position: relative; inset: auto; display: grid; gap: 14px; margin: 4px 8px 12px; padding: 20px calc(var(--m) - 8px) 18px; pointer-events: auto; }
  .fx-walk-words, .fx-walk-card { position: static; width: auto; }
  .fx-walk-words .k-h2 { font-size: clamp(24px, 6.4vw, 38px); line-height: 1.04; }
  .fx-walk-card { --sq-fill: transparent; --sq-shadow: none; padding: 0; }
  .fx-walk-card header { display: none; }
  .fx-walk-card .k-link { min-height: 44px; }
  .fx-walk-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fx-walk-nav .btn { --sq-r: 14px; min-height: 56px; font-size: 17px; }
  .fx-lead { display: none; }
  .fx-walk.is-live .fx-walk-list { display: none; }
}

@media (max-width: 699px) {
  .fx-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .fx-sheet { padding: 14px 8px 16px; }
  .fx-st { padding: 8px 4px; }
  .fx-st-name { font-size: 11px; overflow-wrap: break-word; }
  .fx-scrub { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .fx-scrub button { height: 44px; }
  .fx-keys .btn { flex: 1 1 auto; }
  .fx-keys .btn:first-child { flex: 1 1 100%; --sq-r: 14px; min-height: 52px; font-size: 16px; }
  .fx-list { --cols-s: minmax(0, 1fr); }
  .fx-filters > button { min-height: 44px; }
  .fx-facts .k-tag { min-height: 44px; }
  .fx-plain-cols { columns: 1; }
}

@media (max-width: 359px) {
  .fx-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .fx-cam, .fx-cart, .fx-marker, .fx-lead, .fx-st, .fx-st-chip, .fx-scrub i, .fx-strip a, .fx-strip a > i, .fx-outline button, .fx-plain > summary::after { transition-duration: 0.01s; }
}

@media (forced-colors: active) {
  .fx-st-chip, .fx-marker, .fx-cart, .fx-scrub i, .fx-strip a > i { forced-color-adjust: none; }
  .fx-st[aria-pressed="true"] { outline: 2px solid CanvasText; outline-offset: -2px; }
}

@media print {
  .fx-walk-stage, .fx-console, .fx-stage, .fx-browse { display: none !important; }
  .fx-walk.is-live .fx-parts { margin-top: 0; visibility: visible; }
  .fx-walk.is-live .fx-parts > li { height: auto; }
}
