/* how-it-works.css: How it works (src\pages\how-it-works.mjs; plan.md, "How it works (Part 2)"). Tokens only. */
@import url("../arsenal/thread.css");

/* the kit's header that changes its picture (kit.md), as it gives it */
[data-kit-scene="rotate"] [data-kit-slide] { position: absolute; inset: 0; margin: 0; visibility: hidden; overflow: hidden; }
[data-kit-scene="rotate"] [data-kit-slide][data-kit-on] { visibility: visible; z-index: 2; opacity: var(--kit-move, 1); transform: translateX(var(--kit-glide, calc((1 - var(--kit-move, 1)) * 4%))); }
[data-kit-scene="rotate"]:not(:has([data-kit-slide][data-prev])) [data-kit-slide][data-kit-on] { transform: none; opacity: 1; }
[data-kit-scene="rotate"] [data-kit-slide][data-prev] { visibility: visible; z-index: 1; }
[data-kit-scene="rotate"] [data-kit-slide] video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
[data-kit-scene="rotate"]:not(:has([data-kit-slide][data-kit-on])) [data-kit-slide]:not([data-kit-slide] ~ [data-kit-slide]) { visibility: visible; }
[data-kit-scene="rotate"] [data-kit-slide] video { inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); max-width: none; clip-path: inset(2px); }
[data-kit-scene="rotate"] [data-kit-slide] video[data-kit-shown] { clip-path: none; }
[data-kit-scene="rotate"] [data-kit-slide][data-prev] { opacity: clamp(0, (1 - var(--kit-move, 0)) * 1000, 1); }

/* ---------- the thread: one green line down the page's middle, its head the logo's up-arrow. A band paints its own
   ground over the line (it is positioned: the thread's README, "What it needs from a page"), so here each band's
   ground and key field lie in a layer under it; the team's footage covers it (the line runs behind it, as behind a
   photo), and the close lies under it whole, so the line ends in its push button. ---------- */
.hiw { --thread-ink: var(--c-brand); --thread-w: 2.5px; --thread-radius: 40px; --lane: clamp(88px, 9vw, 128px); }
.hiw > .band { background: none; }
.hiw > .band::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--c-paper); }
.hiw > .band--alt::before { background: var(--c-paper-alt); }
.hiw > .band--ink::before { background: var(--c-ink); }
.hiw > .band > .keyfield { z-index: -1; }
.hiw > .close { z-index: -1; }
.hiw-go { display: inline-flex; }

/* a step's key: white and up until the line reaches it, then orange and pressed, one ring spreading as it plugs in */
.hiw-key { --l: calc(var(--lit, 0) * var(--lit, 0) * (3 - 2 * var(--lit, 0))); position: relative; width: 62px; height: 60px; }
.hiw-key::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 54px; border-radius: 16px; background: color-mix(in srgb, var(--c-key-base) calc(var(--l) * 100%), var(--c-line)); }
.hiw-key__cap { position: absolute; left: 0; right: 0; top: 0; height: 54px; display: grid; place-items: center; border-radius: 16px; font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 800; line-height: 1; color: var(--c-ink); background: linear-gradient(180deg, color-mix(in srgb, var(--c-key-top) calc(var(--l) * 100%), var(--c-paper)), color-mix(in srgb, var(--c-accent) calc(var(--l) * 100%), var(--c-paper)) 55%); box-shadow: inset 0 1.5px 0 color-mix(in srgb, var(--c-paper) 70%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--c-line) calc((1 - var(--l)) * 100%), transparent); transform: translateY(calc(var(--l) * 5px)); }
.hiw-key::after { content: ""; position: absolute; inset: -8px -8px -2px; border-radius: 22px; border: 2px solid var(--c-accent); opacity: calc((1 - var(--lit-after, 1)) * var(--l)); transform: scale(calc(.92 + var(--lit-after, 0) * .38)); pointer-events: none; }

/* ---------- hero: centered, the words over a framed panorama of a schedule filling up, wyw over its left side ---------- */
.hiw-hero { padding-block: clamp(2rem, 1.2rem + 2.4vw, 3.5rem) var(--section-y); }
.hiw-hero__head { text-align: center; }
.hiw-hero__title { max-width: 15em; margin-inline: auto; font-size: var(--fs-h1); font-weight: 800; line-height: var(--lh-tight); letter-spacing: -0.04em; text-wrap: balance; }
.hiw-hero__line { max-width: 34em; margin: 1.1rem auto 0; font-size: var(--fs-lede); line-height: 1.5; color: var(--c-ink-soft); }
.hiw-hero__line strong { color: var(--c-ink); font-weight: 650; }
.hiw-hero__foot { margin-top: 1.75rem; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .75rem 1.5rem; }
.hiw-hero__foot .assure { margin: 0; }
.hiw-hero__tile { margin-top: clamp(2.5rem, 1.6rem + 2.4vw, 3.5rem); aspect-ratio: 21 / 9; }
.hiw-hero__slide video, .hiw-hero__slide .kit-first { object-position: var(--pos, 50% 50%); }
.hiw-hero__grade { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: color-mix(in srgb, var(--c-ink) 18%, transparent); }
/* the notifications stack in the panorama's upper left, so the first screen shows them */
.scene.hiw-hero__scene { position: absolute; left: 22px; top: 20px; height: 252px; width: min(400px, calc(100% - 44px)); z-index: 4; }
.hiw-hero__stop { top: 14px; right: 14px; }

/* ---------- the parts' heads, split by the line ---------- */
.hiw-head { display: grid; grid-template-columns: minmax(0, 1fr) var(--lane) minmax(0, 1fr); align-items: center; margin-bottom: clamp(2.5rem, 1.8rem + 2.4vw, 4rem); }
.hiw-head__title { grid-column: 1; grid-row: 1; text-align: right; font-size: var(--fs-h2); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -0.035em; text-wrap: balance; }
.hiw-head--right .hiw-head__title { grid-column: 3; text-align: left; }
.hiw-bracket { grid-column: 3; grid-row: 1; justify-self: start; display: grid; gap: .15rem; padding: .85rem 1.25rem .9rem 1.1rem; border-left: 3px solid var(--c-accent); border-radius: var(--radius-m); background: var(--c-paper); box-shadow: var(--shadow-s); }
.hiw-bracket b { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 800; line-height: 1.1; color: var(--c-ink); }
.hiw-bracket span { font: 650 var(--fs-small)/1.3 var(--font-ui); color: var(--c-ink-soft); }

/* ---------- the steps: the words on one side of the line, the picture on the other, the key on it ---------- */
.hiw-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(3rem, 2rem + 3vw, 5rem); }
.hiw-step { display: grid; grid-template-columns: minmax(0, 1fr) var(--lane) minmax(0, 1fr); align-items: start; }
.hiw-step__text { grid-column: 1; grid-row: 1; justify-self: end; max-width: 25rem; text-align: right; padding-top: .3rem; }
.hiw-step > .hiw-key { grid-column: 2; grid-row: 1; justify-self: center; }
.hiw-step > :last-child { grid-column: 3; grid-row: 1; justify-self: start; }
.hiw-step--flip .hiw-step__text { grid-column: 3; justify-self: start; text-align: left; }
.hiw-step--flip > :last-child { grid-column: 1; justify-self: end; }
.hiw-step__title { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--c-ink); text-wrap: balance; }
.hiw-step__time { display: inline-flex; margin-top: .6rem; padding: .42rem .75rem; border-radius: 999px; font: 650 var(--fs-small)/1 var(--font-ui); color: var(--c-brand-text); background: color-mix(in srgb, var(--c-brand) 13%, var(--c-paper)); }
.hiw-step__line { margin-top: .75rem; font-size: var(--fs-body); line-height: 1.55; color: var(--c-ink-soft); }

/* yours: the three base scenes on the key field */
.hiw-step__pic { position: relative; width: min(100%, 420px); }
.hiw-step__pic--goal { height: 300px; }
.scene.hiw-goal { position: absolute; left: 0; right: 0; top: 0; }
.scene.hiw-scan, .scene.hiw-leadbars { width: 100%; }
.hiw-yours__stop { top: -14px; right: -14px; }

/* ours: a framed photo per step, its scene in glass on the side clear of the face */
.hiw-photo { width: 100%; max-width: 560px; height: 500px; margin: 0; }
.hiw-photo > .tile__photo { inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); max-width: none; object-position: var(--obj, 50% 50%); }
.hiw-photo--launch { --obj: 72% 40%; }
.hiw-photo--tune { --obj: 62% 30%; }
.hiw-photo__shade { background: color-mix(in srgb, var(--c-ink) 12%, transparent); }
.scene.hiw-photo__scene { position: absolute; left: 16px; bottom: 16px; width: min(var(--scene-w, 300px), calc(100% - 32px)); }
.hiw-photo--launch { --scene-w: 320px; }
/* the salon: people sit behind her on both sides, so her board hangs off the photo's lower corner, over the counter */
.hiw-photo-hold { position: relative; width: 100%; max-width: 560px; margin-bottom: 110px; }
.hiw-photo--leads { --obj: 50% 30%; max-width: none; }
.scene.hiw-leads-board { position: absolute; right: -24px; bottom: -110px; width: 360px; z-index: 2; }
/* the board rests tilted, so its far (left) side reads a little smaller: one notch up there keeps every word at 13px or more */
.scene.hiw-leads-board .ld-top span, .scene.hiw-leads-board .ld-av { font-size: 14px; }
.hiw-ours__stop { right: 14px; bottom: 14px; }

/* ---------- inside: the plan builds on the key field (navy), the words left ---------- */
.hiw-inside__in { display: grid; gap: clamp(2rem, 1rem + 2.4vw, 3.5rem); align-items: center; }
@media (min-width: 901px) { .hiw-inside__in { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.hiw-inside__title { font-size: var(--fs-h2); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -0.035em; text-wrap: balance; }
.hiw-inside__line { margin-top: 1.1rem; font-size: var(--fs-lede); line-height: 1.5; color: color-mix(in srgb, var(--c-on-ink) 80%, var(--c-ink)); }
.hiw-inside__line strong { color: var(--c-on-ink); font-weight: 650; }
.hiw-inside__stage { position: relative; height: 560px; }
.scene.hiw-inside__scene { position: absolute; inset: 0; }
.hiw-inside__stop { top: -16px; right: -16px; }

/* the specs: three short facts, a figure and its label */
.hiw-specs { list-style: none; margin: 1.9rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 1.1rem 2.25rem; }
.hiw-specs li { display: grid; gap: .25rem; }
.hiw-specs b { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 800; line-height: 1.1; color: var(--c-accent-on-ink); }
.hiw-specs span { font-size: var(--fs-small); color: color-mix(in srgb, var(--c-on-ink) 76%, var(--c-ink)); }

/* ---------- team: the owner at his van, full-bleed; the dashboard's chat in glass over the van's side ---------- */
.hiw-team { min-height: 760px; display: grid; align-items: center; }
.hiw-team .chapter__bg { object-position: 60% 35%; }
@media (min-width: 901px) { .hiw-team__in { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); } }
.hiw-team__stage { position: relative; justify-self: start; width: min(330px, 100%); }
.hiw-team__stop { top: -16px; right: -16px; }
.hiw-chat { height: 440px; display: flex; flex-direction: column; padding: 12px; border-radius: 34px; color: var(--c-on-ink); background: color-mix(in srgb, var(--c-ink) 34%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); border: 1px solid color-mix(in srgb, var(--c-paper) 40%, transparent); box-shadow: var(--shadow-l); }
.hiw-chat__top { display: flex; align-items: center; gap: .7rem; padding: 8px 8px 14px; border-bottom: 1px solid color-mix(in srgb, var(--c-paper) 24%, transparent); }
.hiw-chat__app { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--c-accent); color: var(--c-ink); }
.hiw-chat__app .mark { width: 18px; height: 18px; }
.hiw-chat__top b { display: block; font: 650 1rem/1.2 var(--font-display); }
.hiw-chat__top small { display: block; font-size: var(--fs-small); color: color-mix(in srgb, var(--c-on-ink) 76%, var(--c-ink)); }
.hiw-chat__log { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .6rem; padding: 14px 4px 4px; overflow: hidden; opacity: calc(1 - var(--kit-out, 0)); }
.hiw-chat__log [data-kit-msg] { flex: none; opacity: min(1, calc(var(--kit-in, 1) * 1.6)); transform: translateY(calc((1 - var(--kit-in, 1)) * 10px)); }
.hiw-chat__human { align-self: center; margin: 2px 0 8px; }
.hiw-chat__human span { display: inline-flex; padding: .7rem 1.2rem; border-radius: 999px; font: 700 1rem/1 var(--font-display); color: var(--c-ink); background: linear-gradient(180deg, var(--c-key-top), var(--c-accent) 60%); box-shadow: 0 2px 0 var(--c-key-base); transform: translateY(2px); }
.hiw-chat__msg { max-width: 88%; padding: .65rem .9rem; border-radius: 18px; font-size: var(--fs-small); line-height: 1.45; }
.hiw-chat__msg--me { align-self: flex-end; background: var(--c-ink); color: var(--c-on-ink); border-bottom-right-radius: 6px; }
.hiw-chat__msg--team { align-self: flex-start; display: grid; gap: .2rem; background: var(--c-paper); color: var(--c-ink); border-bottom-left-radius: 6px; }
.hiw-chat__msg--team b { font: 650 var(--fs-small)/1.2 var(--font-display); color: var(--c-brand-text); }
.hiw-chat__msg--team small { justify-self: end; font-size: var(--fs-small); color: var(--c-ink-soft); }
.hiw-chat__typing { align-self: flex-start; display: flex; gap: 5px; padding: .8rem .95rem; border-radius: 18px; background: var(--c-paper); }
.hiw-chat__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-ink-soft); animation: hiw-dot 1s infinite ease-in-out; }
.hiw-chat__typing i:nth-child(2) { animation-delay: .15s; }
.hiw-chat__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hiw-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }
.hiw-chat__done { align-self: flex-start; display: inline-flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border-radius: 999px; font: 650 var(--fs-small)/1 var(--font-display); color: var(--c-ink); background: color-mix(in srgb, var(--c-brand) 22%, var(--c-paper)); }
.hiw-chat__done .mark { width: 16px; height: 16px; color: var(--c-brand-text); }
.hiw-specs--on-ink { margin-top: 1.6rem; }

/* ---------- faq: the head left, the questions right (the list is opaque: the line runs behind it) ---------- */
.hiw-faq__in { display: grid; gap: clamp(2rem, 1rem + 3vw, 4.5rem); align-items: start; }
@media (min-width: 901px) { .hiw-faq__in { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); } }
.hiw-faq__head { margin-bottom: 0; }
.hiw-faq__list { position: relative; z-index: 1; width: 100%; background: var(--c-paper); }
.hiw-faq__link { color: var(--c-ink); text-decoration: none; border-bottom: 2px solid var(--c-brand); }
.hiw-faq__link:hover { border-bottom-color: var(--c-accent); }

/* ---------- close: the deli owner greeting you, the words left; the line comes in from the right into the button ---------- */
.hiw-close .close__bg { object-position: 72% 30%; }
.hiw-close .close__copy { max-width: 500px; }
.hiw-close .close__foot { flex-direction: column; align-items: flex-start; }
.hiw-close .close__foot .assure { margin-top: 0; }

/* ---------- narrower screens ---------- */
@media (max-width: 1100px) {
  .hiw-inside__stage { height: 700px; }
}
@media (max-width: 900px) {
  .hiw-inside__stage { height: 560px; }
  .hiw-team .chapter__bg { object-position: 18% 40%; }
  /* one column: the words span the width, over the van's white door too, so the shade runs from the top */
  .hiw-team__shade { background: linear-gradient(180deg, color-mix(in srgb, var(--c-ink) 90%, transparent) 0%, color-mix(in srgb, var(--c-ink) 84%, transparent) 52%, color-mix(in srgb, var(--c-ink) 40%, transparent) 100%); }
  .hiw-team__stage { justify-self: center; }
}
/* the phone: the thread's short line beside each part, from its first key down; the keys in a column on the left */
@media (max-width: 759.98px) {
  .hiw.thread { --thread-narrow: 1; }
  .hiw-head { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  .hiw-head__title, .hiw-head--right .hiw-head__title { grid-column: 1; text-align: left; }
  .hiw-bracket { grid-column: 1; grid-row: 2; }
  .hiw-step { grid-template-columns: 48px minmax(0, 1fr); column-gap: 14px; row-gap: 1.4rem; }
  .hiw-step__text, .hiw-step--flip .hiw-step__text { grid-column: 2; grid-row: 1; justify-self: start; max-width: none; text-align: left; padding-top: 0; }
  .hiw-step > .hiw-key { grid-column: 1; grid-row: 1; width: 48px; height: 46px; }
  .hiw-key::before, .hiw-key__cap { height: 42px; border-radius: 12px; }
  .hiw-step > :last-child, .hiw-step--flip > :last-child { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .hiw-step__pic { width: 100%; }
  .hiw-photo { max-width: none; height: 460px; }
  .hiw-photo--tune { height: 600px; } /* the electrician's face stays above his card */
  .hiw-photo-hold { max-width: none; margin-bottom: 0; }
  .scene.hiw-leads-board { position: relative; right: auto; bottom: auto; width: min(340px, calc(100% - 24px)); margin: -56px auto 0; }
  .hiw-inside__stage { height: 700px; }
}
@media (max-width: 640px) {
  .hiw-hero__tile { aspect-ratio: auto; height: 420px; }
  .scene.hiw-hero__scene { left: 12px; top: 12px; bottom: 42px; height: auto; width: calc(100% - 24px); }
  .hiw-hero__stop { top: 10px; right: 10px; }
}
