/* SLANT · Conik M1 · Part 6 · Direction B · The Seam. Lifted from parts/p6/directions/b (part.css), scoped to .how-b / .box-b.
   #how runs on bone: the brand's 8° diagonal is the cut between bike and on foot; the amber-ruled seam travels across one frame
   as the scene slides under it, and the heading's amber block walks from "Ride it." to "walk it." at the same time.
   #box runs on black: a filmstrip scrubbed by scroll under a pinned head.
   Page fit (6 Nov build): the stage pins under the fixed header (--nav-h) and keeps the dock's space (--dock-space) clear;
   the stage's single column is minmax(0, 1fr), so the long card row can no longer widen it and push the heading off-screen;
   the card size follows the height left for it (container query units), so a card and its title always fit the window. */

/* =====================================================================
   01 · HOW · bone, the seam
   ===================================================================== */
.how-b { padding-block: clamp(5.5rem, 3rem + 9vw, 11rem); }
.how-b .eyebrow { color: var(--ink-2); }
/* the heading is the caption: two phrases, one amber block that walks between them */
.how-b .how-title { font-family: var(--font-display); font-size: clamp(2.75rem, 1.2rem + 7.2vw, 7.25rem); font-weight: 700; line-height: 1.02; letter-spacing: -.035em; margin-top: var(--s4); max-width: 14ch; text-wrap: balance; }
.how-b .hlw { position: relative; isolation: isolate; z-index: 0; display: inline-block; padding: .02em .3em .06em .14em; margin-left: -.14em; color: var(--ink); transition: color 0s linear 260ms; }
.how-b .hlw::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--amber); clip-path: polygon(0 0, 100% 0, calc(100% - .16em) 100%, 0 100%); transform: scaleX(0); transform-origin: right; transition: transform 700ms var(--ease-expo); }
.how-b .hlw.is-on::before { transform: scaleX(1); transform-origin: left; }
.how-b .how-title[data-dir="back"] .hlw::before { transform-origin: left; }
.how-b .how-title[data-dir="back"] .hlw.is-on::before { transform-origin: right; }
html:not(.js) .how-b .hlw::before { transition: none; }

.how-b .how-grid { display: grid; gap: var(--s8); margin-top: clamp(2rem, 1rem + 4vw, 4rem); }
/* 8 Nov: Tarun's animations are wide (2.5:1), so the pan runs the full width and the copy sits below in two columns */
@media (min-width: 1024px) {
  .how-b .how-copy { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: var(--s12); align-items: start; }
  .how-b .how-copy > .lead, .how-b .how-copy > .seg { grid-column: 1; }
  .how-b .how-copy > .how-points, .how-b .how-copy > .panel { grid-column: 2; }
  .how-b .how-copy > .how-points { grid-row: 1 / span 2; }
}
.how-b .how-copy .lead { color: var(--ink); max-width: 36ch; }
.how-b .how-copy .seg { margin-top: var(--s6); }

/* ---- the pan: one frame, two scenes, an 8° seam between them ----
   All lengths in frame widths. sx = (frame height × tan 8°) / 2:
     4:5 frame (phone, 350 × 437): h = 1.25 w → sx = .0878 w  → 8.8 %
     4:3 frame (desktop, ≈ 735 × 551): h = .75 w → sx = .0527 w → 5.3 %
   bike layer:  x ∈ [0, 1 + 2sx]
   skew box:    x ∈ [1 + sx, 2 + 4sx], skewed −8° about its centre → bottom-left lands at 1, top-left at 1 + 2sx
   walk shift:  −(1 + 2sx) so the frame shows [1 + 2sx, 2 + 2sx]. */
.how-b .pan { position: relative; overflow: hidden; aspect-ratio: 5 / 2; background: var(--bone); --sx: 2.8%; --nw: 110px; --nh: 15px; clip-path: polygon(0 0, 100% 0, 100% 100%, var(--nw) 100%, 0 calc(100% - var(--nh))); }
@media (min-width: 640px) { .how-b .pan { --nw: 180px; --nh: 25px; } }   /* 5:2 frame: sx = (0.4 w × tan 8°) / 2 = 2.8 % */
.how-b .pan-strip { position: absolute; inset: 0; transform: translateX(0); transition: transform 1100ms var(--ease-expo); will-change: transform; }
.how-b .pan-strip[data-mode="walk"] { transform: translateX(calc(-100% - 2 * var(--sx))); }
.how-b .pan-layer { position: absolute; top: 0; bottom: 0; left: 0; width: calc(100% + 2 * var(--sx)); overflow: hidden; background: var(--graphite); }
.how-b .pan-layer img, .how-b .pan-layer video, .how-b .pan-inner img, .how-b .pan-inner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #16171B; }   /* contain: the animations are never cropped; their ground is the panel graphite */
.how-b .how-hi { opacity: 0; transition: opacity 600ms var(--ease); }
.how-b .how-hi.is-loaded { opacity: 1; }
.how-b .pan-skew { position: absolute; top: 0; bottom: 0; left: calc(100% + var(--sx) + 2px); width: calc(100% + 3 * var(--sx)); transform: skewX(calc(-1 * var(--slant))); transform-origin: 50% 50%; overflow: hidden; border-left: 2px solid var(--amber); background: #0D1118; }
.how-b .pan-inner { position: absolute; top: 0; bottom: 0; left: -12%; right: -12%; transform: skewX(var(--slant)); transform-origin: 50% 50%; }
.how-b .how-vid { opacity: 0; transition: opacity 300ms var(--ease); }
.how-b .how-vid.is-on { opacity: 1; }
/* the scene drifts a little against the strip, so the pan reads as a camera move rather than a slide */
.js .how-b .pan-layer--bike img, .js .how-b .pan-layer--bike video, .js .how-b .pan-inner img, .js .how-b .pan-inner video { transition: transform 1100ms var(--ease-expo), opacity 300ms var(--ease); }
.js .how-b .pan-strip[data-mode="walk"] .pan-layer--bike img, .js .how-b .pan-strip[data-mode="walk"] .pan-layer--bike video { transform: translateX(-4%); }
.js .how-b .pan-strip[data-mode="bike"] .pan-inner img, .js .how-b .pan-strip[data-mode="bike"] .pan-inner video { transform: translateX(4%); }
.how-b .pan .chip { position: absolute; left: 14px; bottom: calc(var(--nh) + 12px); z-index: 2; margin: 0; display: inline-flex; gap: var(--s2); align-items: baseline; padding: 6px 9px; background: rgba(11, 11, 13, .78); color: var(--bone); font-family: var(--mono); font-weight: 500; font-size: var(--fs-mono); letter-spacing: .12em; text-transform: uppercase; max-width: calc(100% - 28px); }
.how-b .pan .chip .accent { color: var(--amber); }

/* the switch on bone */
.how-b .seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0; padding: 3px; border: 1px solid var(--line-2); background: var(--bg-2); max-width: 360px; min-width: 0; }
.how-b .seg legend { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.how-b .seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); background: var(--amber); clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%); transition: transform 600ms var(--ease-expo); pointer-events: none; }
.how-b .seg[data-mode="walk"] .seg-thumb { transform: translateX(100%); }
.how-b .seg label { position: relative; z-index: 1; }
.how-b .seg input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.how-b .seg span { display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 var(--s5); font-weight: 700; font-size: 1rem; color: var(--ink-2); transition: color 300ms var(--ease) 140ms; }
.how-b .seg input:checked + span { color: var(--black); }
.how-b .seg input:focus-visible + span { outline: 2px solid var(--black); outline-offset: 3px; }

/* the three points, ruled in goldenrod */
.how-b .how-points { display: grid; gap: 0; margin-top: var(--s6); border-top: 2px solid var(--goldenrod); }
.how-b .how-points[hidden] { display: none; }
.how-b .how-points li { display: grid; grid-template-columns: 2.4rem 1fr; align-items: baseline; gap: var(--s3); padding: var(--s4) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-lead); font-weight: 500; letter-spacing: -.01em; line-height: 1.35; }
.how-b .how-points li .n { font-family: var(--mono); font-weight: 500; font-size: var(--fs-mono); letter-spacing: .14em; color: var(--ink-2); }
/* tonal panel, no hairline, goldenrod rule */
.how-b .panel { margin-top: var(--s8); padding: var(--s6); background: var(--bg-2); border-top: 2px solid var(--goldenrod); display: grid; gap: var(--s3); }
.how-b .panel .h3 { font-size: var(--fs-h3); }
.how-b .panel p + p { color: var(--ink-2); max-width: 44ch; }

/* =====================================================================
   02 · BOX · black, the filmstrip scrubbed by scroll
   Track 310 svh; the stage pins under the header for (window − header) and keeps the dock's space clear at its foot.
   p = (header − track top) / (track height − stage height); row translate = −p × 3 × (card + gap).
   21 Nov: every frame is a square clip. Phone: the card is the square with its words under it, 84 vw and never taller than the
   height left (view height − words); the head scrolls up out of the pinned stage (--tuck) so the square keeps a usable size on a
   short screen. Desktop: the square takes the view's full height and the words sit beside it. The text of a card that would cross the window's edge fades out first,
   so a title is never cut (p6.js writes --to for the number and title, --tl for the line, per card).
   ===================================================================== */
.box-b { background: var(--black); color: var(--bone); padding: 0; }
.box-b .strip { position: relative; --lead: var(--gutter); }
@media (min-width: 1024px) { .box-b .strip { --lead: max(var(--gutter), calc((100vw - 1280px) / 2)); } }
.box-b .strip-stage { position: relative; padding-block: var(--sec); }
.box-b .strip-head .section-head { margin-bottom: clamp(1.25rem, .75rem + 2vw, 2.5rem); }
.box-b .strip-head .h1 { font-size: clamp(2rem, 1.2rem + 3vw, 4rem); }
@media (max-width: 639px) { .box-b .strip-head .lead { font-size: 1rem; max-width: 40ch; } }
.box-b .strip-view { position: relative; min-width: 0; }
.box-b .strip-row { --cw: 84vw; --cg: 4vw; display: flex; gap: var(--cg); padding-left: var(--lead); padding-right: var(--lead); margin: 0; }
@media (min-width: 640px) { .box-b .strip-row { --cw: min(52vw, 480px); --cg: 3vw; } }
.box-b .strip-card { flex: 0 0 var(--cw); width: var(--cw); display: grid; gap: var(--s4); align-content: start; transition: opacity 500ms var(--ease), transform 700ms var(--ease-expo); }
.box-b .strip-card .frame { position: relative; aspect-ratio: 1 / 1; margin: 0; background: #16171B; overflow: hidden; border: 1px solid var(--line); }
.box-b .strip-card .frame img, .box-b .strip-card .frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.box-b .strip-card .frame video { opacity: 0; transition: opacity 300ms var(--ease); }
.box-b .strip-card .frame video.is-on { opacity: 1; }
.box-b .strip-card .mono { display: flex; gap: var(--s3); color: var(--ink-2); justify-self: start; }
.box-b .strip-card .mono b { color: var(--amber); font-weight: 500; }
.box-b .strip-card .h2 { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.5rem); justify-self: start; }
.box-b .strip-card .lead { max-width: 36ch; }
.box-b .strip-text { display: grid; gap: var(--s2); }
/* the bar: continuous fill, four ticks, a readout */
.box-b .strip-bar { display: none; align-items: center; gap: var(--s5); margin-top: var(--s5); }
.box-b .strip-bar .bar { position: relative; flex: 1; height: 2px; background: var(--line); }
.box-b .strip-bar .fill { position: absolute; inset: 0; background: var(--amber); transform: scaleX(var(--p, 0)); transform-origin: left; }
.box-b .strip-bar .ticks { position: absolute; inset: -5px 0; display: grid; grid-template-columns: repeat(3, 1fr) 0; }
.box-b .strip-bar .ticks li { border-left: 1px solid var(--line-2); } .box-b .strip-bar .ticks li:first-child { border-left: 0; }
.box-b .strip-bar .readout { margin: 0; display: inline-flex; gap: var(--s3); align-items: baseline; padding: 6px 9px; border: 1px solid var(--line); font-family: var(--mono); font-weight: 500; font-size: var(--fs-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.box-b .strip-bar .readout output { color: var(--amber); font-variant-numeric: tabular-nums; }
.box-b .strip-bar .hint { display: inline-flex; gap: var(--s3); align-items: center; color: var(--ink-2); transition: opacity 400ms var(--ease); }
.box-b .strip-bar .hint::before { content: ""; width: 28px; height: 1px; background: var(--amber); }
.box-b .strip-stage.is-done .hint { opacity: 0; }
@media (max-width: 639px) { .box-b .strip-bar .hint { display: none; } }

/* No JS or reduced motion: nothing pins; the row is a native snap-scrolling list with the same cards. */
.box-b .strip-row { overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: var(--lead); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.box-b .strip-row::-webkit-scrollbar { display: none; }
.box-b .strip-card { scroll-snap-align: start; }

/* The pinned filmstrip (JS, motion allowed). */
@media (prefers-reduced-motion: no-preference) {
  .js .box-b .strip { height: 310svh; }
  .js .box-b .strip-stage { position: sticky; top: var(--nav-h); height: calc(100svh - var(--nav-h)); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; align-content: center; overflow: hidden;
    padding-block: clamp(1rem, 3svh, 2.5rem) calc(var(--dock-space, 0px) + clamp(.5rem, 1.5svh, 1.25rem)); }
  .js .box-b .strip-view { container-type: size; }
  .js .box-b .strip-row { --th: 172px; --cw: min(84vw, 480px, calc(100cqh - var(--th))); overflow: visible; scroll-snap-type: none; height: 100%; align-items: center; will-change: transform; transform: translateX(calc(-1 * var(--p, 0) * 3 * (var(--cw) + var(--cg)))); }
  .js .box-b .strip-text > .mono, .js .box-b .strip-text > .h2 { opacity: var(--to, 1); transition: opacity 200ms linear; }
  .js .box-b .strip-text > .lead { opacity: var(--tl, 1); transition: opacity 200ms linear; }
  /* 8 Nov: inactive cards fade their picture only; their words stay readable (WCAG 4.5:1; fading the whole card gave 2.3:1) */
  .js .box-b .strip-card:not(.is-on) { transform: scale(.975); }
  .js .box-b .strip-card:not(.is-on) .frame { opacity: .42; }
  .js .box-b .strip-card:not(.is-on) .h2 { color: var(--ink-2); }
  .js .box-b .strip-card .frame { transition: opacity 500ms var(--ease); }
  .js .box-b .strip-bar { display: flex; }
}
/* Desktop: the head and the card words scale with the window's height, so a short laptop window (1024 × 768) still gets a usable
   frame; --th is the card's words (number, title, two lines) at those sizes. */
@media (prefers-reduced-motion: no-preference) and (min-width: 1024px) {
  .js .box-b .strip-head .h1 { font-size: min(clamp(2rem, 1.2rem + 3vw, 4rem), 5.2svh); }
  .js .box-b .strip-head .lead { font-size: clamp(1rem, 2.3svh, var(--fs-lead)); }
  .js .box-b .strip-head .section-head { margin-bottom: clamp(.75rem, 2svh, 2.5rem); }
  .js .box-b .strip-card .h2 { font-size: max(2rem, min(clamp(2rem, 1.3rem + 2.4vw, 3.5rem), 4.6svh)); }
  .js .box-b .strip-card .lead { font-size: clamp(1rem, 2.3svh, var(--fs-lead)); }
  .js .box-b .strip-row { --fw: min(100cqh, 40vw, 560px); --tw: clamp(240px, 22vw, 340px); --cw: calc(var(--fw) + var(--s8) + var(--tw)); }
  .js .box-b .strip-card { grid-template-columns: var(--fw) minmax(0, var(--tw)); column-gap: var(--s8); align-items: end; }
}
/* A short, wide window below desktop width (a phone on its side): the same square-beside-words card, or the square has no height. */
@media (prefers-reduced-motion: no-preference) and (min-width: 640px) and (max-width: 1023px) and (max-height: 620px) {
  .js .box-b .strip-row { --fw: min(100cqh, 40vw); --tw: clamp(220px, 34vw, 320px); --cw: calc(var(--fw) + var(--s5) + var(--tw)); }
  .js .box-b .strip-card { grid-template-columns: var(--fw) minmax(0, var(--tw)); column-gap: var(--s5); align-items: end; }
}
/* Phone, or any short window: the head (eyebrow, title, lead) is read on the way in, then scrolls up under the header while the
   stage pins, so the cards get the screen. --tuck is the head's height, measured by p6.js. */
@media (prefers-reduced-motion: no-preference) and (max-width: 639px), (prefers-reduced-motion: no-preference) and (max-height: 620px) {
  .js .box-b .strip-stage { top: calc(var(--nav-h) - var(--tuck, 0px)); height: calc(100svh - var(--nav-h) + var(--tuck, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .how-b .pan-strip, .how-b .seg-thumb, .how-b .hlw::before, .how-b .seg span, .how-b .how-hi { transition: none; }
  .js .how-b .pan-layer--bike img, .js .how-b .pan-inner img, .js .how-b .pan-inner video { transition: none; transform: none; }
}
html:not(.js) .how-b .pan-skew, html:not(.js) .how-b .seg-thumb { display: none; }
html:not(.js) .how-b .how-points[hidden] { display: grid; }

/* 8 Nov: the bike layer is 1 + 2sx frames wide; size its picture to the visible frame so the bike's front wheel is never under the seam */
.how-b .pan-layer--bike img, .how-b .pan-layer--bike video { width: calc(100% / 1.056); right: auto; }
/* the caption chip sits in the empty top-left of both scenes, never over the trailer; on phones the switch below says the mode */
.how-b .pan .chip { top: 12px; bottom: auto; }
@media (max-width: 639px) { .how-b .pan .chip { display: none; } }
/* the corner cut stays the kit's motif but small enough to clear the trailer's back wheel in both scenes */
.how-b .pan { --nw: 56px; --nh: 8px; }
@media (min-width: 640px) { .how-b .pan { --nw: 72px; --nh: 10px; } }
.how-b .pan-layer--bike img, .how-b .pan-layer--bike video { left: 1.2%; width: calc(100% / 1.056 - 1.2%); }

/* ---- 10 Nov (Tarun): the scenes sit on a dark stage, no visible frame; a moving road under the wheels; the switch is big and
   sits right under the scene. The section graphite is the colour the animations were rendered on, so the frame disappears. ---- */
.how-b.how-dark { color: var(--bone); }
.how-b.how-dark .pan { background: transparent; clip-path: none; }
.how-b.how-dark .pan-layer--bike img, .how-b.how-dark .pan-layer--bike video { object-position: 50% 100%; }   /* wheels on the road */
.how-b .how-road { position: relative; height: 26px; margin-top: -1px; overflow: hidden; }
.how-b .how-road::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(239, 234, 224, .16); }
.how-b .how-road i { position: absolute; left: 0; width: calc(100% + 64px); top: 9px; height: 3px; background: repeating-linear-gradient(90deg, rgba(239, 234, 224, .30) 0 36px, transparent 36px 64px); animation: how-road 1.1s linear infinite; }
.how-b .how-grid:has(.pan-strip[data-mode="walk"]) .how-road i { animation-duration: 2.6s; }   /* walking pace */
@keyframes how-road { from { transform: translateX(0); } to { transform: translateX(-64px); } }
.how-b .how-switch { display: flex; justify-content: center; margin-top: var(--s4); }
.how-b .how-switch .seg { width: 100%; max-width: 460px; margin: 0; border-color: rgba(239, 234, 224, .26); background: var(--graphite-2); }
.how-b .how-switch .seg span { min-height: 60px; gap: var(--s3); font-size: 1.0625rem; color: var(--bone); }
.how-b .how-switch .seg span svg { width: 22px; height: 22px; flex: none; }
.how-b .how-switch .seg input:checked + span { color: var(--black); }
.how-b .how-switch .seg input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 3px; }
.how-b .how-switch .seg label:hover span { color: var(--amber); }
.how-b .how-switch .seg input:checked + span, .how-b .how-switch .seg label:hover input:checked + span { color: var(--black); }
@media (min-width: 1024px) {
  .how-b .how-copy { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .how-b .how-copy > .lead { grid-column: 1; grid-row: 1; }
  .how-b .how-copy > .panel { grid-column: 1; grid-row: 2; }
  .how-b .how-copy > .how-points { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { .how-b .how-road i { animation: none; } }

/* the whole scene, its road and the switch fit one desktop screen: cap the stage at 1120 px and centre it */
@media (min-width: 1024px) { .how-b .pan, .how-b .how-road { width: 100%; max-width: 1120px; margin-left: auto; margin-right: auto; } }   /* width:100%: auto margins in the grid otherwise shrink the stage to 0 (Tarun 10 Nov: animations not visible) */
/* Unbox card: the box is his AI-made concept (21 Nov), noted on the step line so nothing sits over the picture. */
.box-b .strip-card .mono { flex-wrap: wrap; }
.box-b .strip-card .mono .concept { color: var(--amber); }
/* dark stage: the highlighted word is dark on amber, the other light on graphite */
.how-b.how-dark .hlw { color: var(--bone); }
.how-b.how-dark .hlw.is-on { color: var(--black); }
.how-b.how-dark { background: #14161a; }   /* the animations' own ground as decoded (Chrome 20,22,26 / WebKit 20,23,28), so the film has no visible edge */
