/* How it was made: a sticky page on the left, steps scrolling past on the right. */
.how .topbar { width: min(1100px, calc(100% - 24px)); margin: 14px auto 0; display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); }
.how .topbar a { color: var(--text); font-weight: 600; text-decoration: none; }
.topbar-sep { width: 1px; height: 14px; background: #c9cfd8; }
.how-intro { width: min(1100px, calc(100% - 24px)); margin: 28px auto 8px; }
.how-intro .title { height: 84px; margin: 0; color: #000; }
.how-intro .title svg { height: 100%; width: auto; display: block; overflow: visible; }
.how-intro p { max-width: 60ch; color: #3a3f48; margin: 6px 0 0; }

.story { width: min(1100px, calc(100% - 24px)); margin: 20px auto 60px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; }
.story-fig { position: sticky; top: 16px; height: calc(100vh - 32px); margin: 0; display: flex; flex-direction: column; gap: 12px; }
.story-page {
  flex: 1 1 auto; min-height: 0; background: #fff; border-radius: 3px; padding: 18px;
  box-shadow: 0 1px 2px rgba(29, 32, 38, 0.06), 0 8px 28px -12px rgba(29, 32, 38, 0.22);
  display: flex; align-items: center; justify-content: center;
}
#page-svg { width: 100%; height: 100%; overflow: visible; }
.steps { padding: 30vh 0 40vh; }
.step { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; opacity: 0.35; transition: opacity 0.4s; }
.step.on { opacity: 1; }
.step .n { font: 400 40px/1.1 "Stavan", cursive; margin: 0 0 8px; color: #000; }
.step p { margin: 0; max-width: 44ch; font-size: 17px; color: #3a3f48; }

/* layers of the page drawing */
.story-page svg .pst { fill: none; stroke: #111; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.5s, opacity 0.5s; }
.story-page svg .wbox, .story-page svg .lbox { fill: none; rx: 4; opacity: 0; transition: opacity 0.5s; vector-effect: non-scaling-stroke; }
.story-page svg .wbox { stroke: #007aff; stroke-width: 1.4; }
.story-page svg .lbox { stroke: #d10000; stroke-width: 1; }
.story-page svg .lab { font: 600 22px var(--ui); fill: #d10000; opacity: 0; transition: opacity 0.5s; }
.story-page svg .pick { fill: rgba(244, 153, 35, 0.18); stroke: #f49923; stroke-width: 2.5; rx: 6; opacity: 0; transition: opacity 0.5s; vector-effect: non-scaling-stroke; }

.story-fig[data-step="2"] .pst { stroke: var(--c); }
.story-fig[data-step="3"] .wbox { opacity: 0.85; }
.story-fig[data-step="3"] .pst, .story-fig[data-step="4"] .pst { stroke: #7d8592; }
.story-fig[data-step="4"] .lbox { opacity: 0.8; }
.story-fig[data-step="4"] .lab { opacity: 1; }
.story-fig[data-step="5"] .pst, .story-fig[data-step="6"] .pst { opacity: 0.22; }
.story-fig[data-step="5"] .pst.kept, .story-fig[data-step="6"] .pst.kept { opacity: 1; stroke: #000; }
.story-fig[data-step="5"] .pick, .story-fig[data-step="6"] .pick { opacity: 1; }

.glyph-row { flex: 0 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; opacity: 0; max-height: 0; overflow: hidden; transition: opacity 0.5s, max-height 0.5s; }
.story-fig[data-step="6"] .glyph-row { opacity: 1; max-height: 340px; }
.glyph-card { background: #fff; border-radius: 10px; padding: 10px 8px 8px; border: 1px solid #dfe5ee; }
.glyph-card p { margin: 0 0 4px; text-align: center; font-size: 13px; color: var(--muted); }
.row-note { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); }
.glyph-card .vers { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; }
.glyph-card svg { width: 100%; height: 78px; overflow: visible; color: #b9c1cc; }
.glyph-card svg.here { color: #000; }
.story-fig[data-step="6"] .story-page { flex-basis: 50%; }

.how-end { text-align: left; }
.btn.primary { background: #000; border-color: #000; color: #fff; }

@media (max-width: 820px) {
  .story { grid-template-columns: 1fr; gap: 0; }
  .story-fig { height: 64vh; top: 8px; z-index: 1; }
  .steps { padding: 0 0 20vh; position: relative; z-index: 2; margin-top: -40vh; }
  .step { min-height: 100vh; justify-content: flex-end; padding-bottom: 4vh; opacity: 1; }
  .step > * { background: rgba(255, 255, 255, 0.95); padding: 10px 14px; border-radius: 10px; }
  .step .n { border-radius: 10px 10px 0 0; margin: 0; padding-bottom: 0; }
  .step p:last-child { border-radius: 0 0 10px 10px; box-shadow: 0 8px 20px -10px rgba(0,0,0,.25); }
  .glyph-row { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .glyph-card svg { height: 40px; }
}
@media (prefers-reduced-motion: reduce) { #page-svg * { transition: none !important; } }
