/* Flows (light). Low fidelity on purpose: pencil-grey wireframes on a dot grid, one violet for decisions taken,
   one coral for failures. The finished UI is saved for the design chapter. */
:root { --pencil: #8E8E96; --pencil-2: #C4C4CA; --pencil-3: #E6E6EA; --grid: #E3E3E8; }

.fl-hero { padding-top: clamp(150px, 20vh, 210px); padding-bottom: clamp(40px, 6vw, 80px); }
.fl-hero__in { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(24px, 5vw, 80px); align-items: center; }
.fl-hero__t .display-serif { margin: 22px 0 24px; }
.fl-hero__t em { color: var(--accent); }
.fl-hero__v { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 20px; border-radius: 32px; background: radial-gradient(var(--grid) 1px, transparent 1px) 0 0 / 18px 18px, var(--tile); }
.hw .wf { width: 120px; height: 250px; }
.hw2 { transform: translateY(26px); }
.hw-arrow { width: 54px; height: 16px; flex: none; }
.hw-arrow path { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s var(--ease-out) forwards; }
.hw-arrow.a2 path { animation-delay: .9s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.hw-dia { position: relative; width: 84px; height: 84px; display: grid; place-items: center; font-size: 11.5px; font-weight: 500; text-align: center; line-height: 1.15; isolation: isolate; animation: pop .7s cubic-bezier(.3, 1.5, .5, 1) .55s both; }
.hw-dia::before { content: ""; position: absolute; inset: 14px; transform: rotate(45deg); border-radius: 9px; background: #EEE9FF; border: 1.5px solid var(--accent); z-index: -1; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
@media (max-width: 860px) { .fl-hero__in { grid-template-columns: minmax(0, 1fr); } .hw .wf { width: 92px; height: 192px; } }
@media (prefers-reduced-motion: reduce) { .hw-arrow path { stroke-dashoffset: 0; } }

.legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: clamp(40px, 5vw, 64px); padding: 16px 20px; border-radius: 18px; background: var(--tile); font-size: 14px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 9px; }
.lg { display: inline-block; flex: none; }
.lg--screen { width: 12px; height: 22px; border-radius: 3px; border: 1.5px solid var(--pencil); background: #fff; }
.lg--dec { width: 13px; height: 13px; transform: rotate(45deg); border: 1.5px solid var(--accent); background: #EEE9FF; border-radius: 2px; margin: 0 3px; }
.lg--sys { width: 26px; height: 16px; border-radius: 5px; background: #EEF0FF; border: 1px solid #C6D1FB; }
.lg--partner { width: 26px; height: 16px; border-radius: 5px; background: #F7F4FF; border: 1px dashed #CDBFFF; }
.lg--alt { width: 26px; border-top: 2px dashed #9A9AA2; }
.lg--edge { width: 26px; border-top: 2px solid var(--alert); }

/* ---------- a flow ---------- */
.fl { padding-top: clamp(80px, 10vw, 140px); }
.fl__h { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 26px; }
.fl__n { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 6px; }
.fl__h .h2s { font-size: clamp(32px, 4vw, 56px); margin-bottom: 10px; }
.fl__h .lede { max-width: 62ch; font-size: 17px; }
.fl__panel { margin-bottom: 26px; }
.fl-panel { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: end; margin: 0; }
.fl-panel img { width: 100%; height: auto; border: 2px solid #111113; border-radius: 3px; background: #fff; }
.fl-panel figcaption { font: 400 italic 20px/1.3 var(--font-serif); color: var(--ink-2); max-width: 26ch; }
@media (max-width: 760px) { .fl-panel { grid-template-columns: minmax(0, 1fr); } }
.fl__scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; cursor: grab; padding-inline: max(var(--gutter), calc((100vw - 1240px) / 2 + var(--gutter))); padding-bottom: 12px; }
.fl__scroll.is-drag { cursor: grabbing; user-select: none; }
.canvas { position: relative; border-radius: 28px; background: radial-gradient(var(--grid) 1px, transparent 1px) 0 0 / 20px 20px, #FAFAFB; box-shadow: inset 0 0 0 1px var(--line); }
.band { position: absolute; left: 14px; right: 14px; border-radius: 22px; background: rgba(110, 75, 255, .045); border: 1px dashed rgba(110, 75, 255, .18); }
.band span { position: absolute; left: 16px; top: 16px; width: 120px; font: 400 15px/1.25 var(--font-serif); font-style: italic; color: var(--ink-2); }

/* nodes */
.n { position: absolute; z-index: 2; width: 196px; font-size: 12px; line-height: 1.35; transition: opacity .6s var(--ease-out), transform .7s var(--ease-out); transition-delay: calc(var(--c, 0) * 110ms); }
.motion .canvas.is-pre .n, .motion .canvas.is-pre .lb { opacity: 0; transform: translateY(10px); }
.n .t { font-size: 13px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; }
.n .s { color: var(--ink-2); margin-top: 3px; }
.n .src { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 11px; font-weight: 500; color: var(--accent); }
.n .src::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.n.box { border-radius: 16px; padding: 11px 12px 12px; background: #fff; border: 1px solid var(--pencil-2); box-shadow: 0 1px 2px rgba(11,11,12,.04), 0 10px 20px -16px rgba(11,11,12,.3); }
.n--screen { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: start; }
.n--screen .wf { width: 54px; height: 116px; }
.n--sys { background: #EEF0FF !important; border-color: #C6D1FB !important; }
.n--partner { background: #F7F4FF !important; border: 1px dashed #CDBFFF !important; box-shadow: none !important; }
.n--alt { background: #F4F4F6 !important; border: 1px dashed #B9B9C0 !important; box-shadow: none !important; }
.n--edge { background: #FFF3EF !important; border-color: #FFC6B4 !important; }
.err { display: inline-block; font-size: 10.5px; font-weight: 500; color: var(--alert); padding: 2px 7px; border-radius: 99px; background: #fff; border: 1px solid #FFC6B4; margin-bottom: 6px; }
.n.pill { border-radius: 99px; padding: 12px 16px; text-align: center; }
.n--start { background: var(--ink) !important; color: #fff; border-color: var(--ink) !important; }
.n--start .s { color: #B7BAC2; }
.n--end { background: #fff; border: 2px solid var(--ink) !important; }
.n--dec { height: 112px; display: grid; place-items: center; text-align: center; padding: 0 16px; isolation: isolate; }
.n--dec::before { content: ""; position: absolute; inset: 17px; transform: rotate(45deg); border-radius: 12px; background: #EEE9FF; border: 1.5px solid var(--accent); z-index: -1; }
.n--dec .t { font-size: 12.5px; line-height: 1.2; }

svg.e { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: visible; }
svg.e path { fill: none; stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s cubic-bezier(.6, 0, .2, 1); transition-delay: calc(var(--c, 0) * 110ms + 200ms); }
.motion .canvas.is-pre svg.e path { stroke-dashoffset: 1; }
.k-main { stroke: #26262B; stroke-width: 1.6; }
.k-alt { stroke: #9A9AA2; stroke-width: 1.4; }
.k-err { stroke: var(--alert); stroke-width: 1.5; }
.lb { position: absolute; z-index: 3; transform: translate(-50%, -50%); font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 99px; background: #fff; box-shadow: 0 0 0 1px var(--line-2); white-space: nowrap; transition: opacity .6s var(--ease-out); transition-delay: calc(var(--c, 0) * 110ms + 500ms); }
.lb--err { color: var(--alert); box-shadow: 0 0 0 1px #FFC6B4; }
.lb--alt { color: var(--ink-2); }

/* ---------- the wireframe vocabulary ---------- */
.wf { position: relative; display: flex; flex-direction: column; gap: 5%; padding: 14% 9% 9%; border-radius: 16% / 7.5%; background: #fff; box-shadow: 0 0 0 1.5px var(--pencil); overflow: hidden; }
.wf i, .wf b, .wf s { display: block; font-style: normal; text-decoration: none; flex: none; }
.w-sb { position: absolute; top: 4%; left: 50%; translate: -50% 0; width: 32%; height: 3.2%; border-radius: 99px; background: var(--pencil-2); }
.w-home { position: absolute; bottom: 2.5%; left: 50%; translate: -50% 0; width: 34%; height: 1.6%; border-radius: 99px; background: var(--pencil); }
.w-sp { height: 2%; }
.w-grow { flex: 1 1 auto !important; }
.w-line { height: 3.6%; min-height: 3px; width: 70%; border-radius: 99px; background: var(--pencil-2); }
.w-line.m-thin { height: 2.4%; min-height: 2px; background: var(--pencil-3); }
.w-line.m-big { height: 6%; min-height: 5px; background: var(--pencil); }
.m-w30 { width: 30% !important; } .m-w40 { width: 40% !important; } .m-w50 { width: 50% !important; } .m-w60 { width: 60% !important; } .m-w70 { width: 70% !important; }
.m-c40, .m-c50, .m-c70 { margin-inline: auto; } .m-c40 { width: 40% !important; } .m-c50 { width: 50% !important; } .m-c70 { width: 70% !important; }
.w-circle { width: 34%; aspect-ratio: 1; margin-inline: auto; border-radius: 50%; background: var(--pencil-3); box-shadow: inset 0 0 0 1.5px var(--pencil-2); }
.w-btn { height: 7.5%; min-height: 6px; border-radius: 99px; background: var(--ink); opacity: .82; }
.w-pill { height: 7%; min-height: 6px; border-radius: 99px; box-shadow: inset 0 0 0 1.5px var(--pencil-2); }
.w-row { height: 6%; min-height: 4px; border-radius: 4px; background: var(--pencil-3); }
.w-duo { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6%; height: 30%; }
.w-duo b { border-radius: 8%; background: var(--pencil-3); box-shadow: inset 0 0 0 1px var(--pencil-2); }
.w-dots { height: 2.5%; width: 22%; margin-inline: auto; background: radial-gradient(circle, var(--pencil) 40%, transparent 45%) 0 50% / 33% 100% repeat-x; }
.w-tog { display: flex !important; align-items: center; justify-content: space-between; height: 6%; }
.w-tog b { width: 58%; height: 50%; border-radius: 99px; background: var(--pencil-2); }
.w-tog s { width: 20%; height: 100%; border-radius: 99px; background: var(--accent); opacity: .55; }
.w-ring { width: 60%; aspect-ratio: 1; margin-inline: auto; border-radius: 50%; background: conic-gradient(var(--accent) 0 72%, var(--pencil-3) 72% 100%); -webkit-mask: radial-gradient(circle, transparent 54%, #000 56%); mask: radial-gradient(circle, transparent 54%, #000 56%); }
.w-swipe { flex: 1 1 auto !important; border-radius: 10%; background: linear-gradient(160deg, var(--pencil-3), #fff); box-shadow: inset 0 0 0 1.5px var(--pencil-2); transform: rotate(-3deg); margin: 4% 2%; }
.w-pair { display: flex !important; justify-content: center; gap: 14%; height: 12%; }
.w-pair b { aspect-ratio: 1; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--pencil-2); }
.w-stack { position: relative; height: 46%; }
.w-stack b { position: absolute; left: 0; right: 0; height: 42%; border-radius: 10%; background: #fff; box-shadow: inset 0 0 0 1.5px var(--pencil-2), 0 2px 4px rgba(0,0,0,.05); }
.w-stack b:nth-child(1) { top: 0; background: var(--pencil-3); } .w-stack b:nth-child(2) { top: 22%; } .w-stack b:nth-child(3) { top: 46%; background: #EEE9FF; }
.w-bars { display: flex !important; align-items: flex-end; gap: 5%; height: 30%; }
.w-bars b { flex: 1; border-radius: 99px; background: var(--pencil-3); }
.w-bars b:nth-child(1) { height: 14%; } .w-bars b:nth-child(2) { height: 22%; } .w-bars b:nth-child(3) { height: 32%; } .w-bars b:nth-child(4) { height: 44%; } .w-bars b:nth-child(5) { height: 58%; } .w-bars b:nth-child(6) { height: 76%; } .w-bars b:nth-child(7) { height: 100%; background: var(--accent); opacity: .6; }
.w-chips { display: flex !important; gap: 6%; height: 6%; }
.w-chips b { flex: 1; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--pencil-2); }
.w-chips b:first-child { background: var(--pencil-3); }
.w-nums { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 6%; height: 8%; }
.w-nums b { border-radius: 3px; background: var(--pencil-2); }
.w-slider { position: relative; height: 10%; }
.w-slider b { position: absolute; left: 0; right: 0; top: 45%; height: 12%; border-radius: 99px; background: linear-gradient(90deg, var(--go) 0 58%, var(--pencil-3) 58%); opacity: .7; }
.w-slider s { position: absolute; left: 54%; top: 18%; width: 12%; aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px var(--pencil); }
.w-img { height: 30%; border-radius: 9%; background: linear-gradient(160deg, var(--pencil-3), var(--pencil-2)); }
.w-scores { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 5%; height: 9%; }
.w-scores b { border-radius: 4px; background: radial-gradient(circle, var(--pencil-2) 35%, transparent 40%) 0 0 / 30% 33%; }
.w-cal { height: 20%; background: linear-gradient(90deg, transparent 0 40%, rgba(110,75,255,.25) 40% 85%, transparent 85%), repeating-linear-gradient(90deg, var(--pencil-3) 0 11%, transparent 11% 14.3%); border-radius: 4px; }
.w-banner { height: 7%; border-radius: 6px; background: #E6F5E9; box-shadow: inset 0 0 0 1px #BEE3C6; }
.w-step { display: flex !important; align-items: center; gap: 8%; height: 7%; }
.w-step b { width: 12%; aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--pencil-2); }
.w-step s { flex: 1; height: 40%; border-radius: 99px; background: var(--pencil-3); }
.w-step.m-open { height: 20%; align-items: flex-start; padding: 5% 0; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--pencil-2); }
.w-step.m-open b { background: var(--ink); opacity: .7; margin-left: 4%; }
.w-poll { height: 7%; border-radius: 4px; background: var(--pencil-3); overflow: hidden; }
.w-poll b { height: 100%; width: 67%; background: var(--go); opacity: .55; }
.w-poll:nth-of-type(odd) b { width: 33%; background: var(--pencil-2); opacity: 1; }
.w-clock { height: 14%; width: 60%; margin-inline: auto; border-radius: 6px; background: var(--pencil-2); }
.w-note { height: 13%; border-radius: 9px; background: rgba(255,255,255,.8); box-shadow: inset 0 0 0 1px var(--pencil-2); }
.wf--lock { background: linear-gradient(180deg, #EEE9FF, #FFF1E8); }
.w-dim { position: absolute; inset: 0; background: rgba(17, 17, 19, .06); }
.w-sheet { display: flex !important; flex-direction: column; gap: 9%; height: 52%; margin: 0 -10% -10%; padding: 10% 12% 14%; border-radius: 14% 14% 0 0; background: #fff; box-shadow: 0 -1px 0 var(--pencil-2), 0 -8px 14px -10px rgba(0,0,0,.25); position: relative; }
.w-sheet .w-btn { margin-top: auto; }
.w-alert { height: 12%; border-radius: 8px; background: #FFF1EC; box-shadow: inset 0 0 0 1px #FFC2AD; }
