/* site\assets\css\pages\how-it-works.css: How it works (plan.md). The thread composition's CSS first, then the page's
   own: its line in the arrow's orange, a zigzag that settles into each number; the parts. Tokens only. */
@import url("../arsenal/thread.css");

/* ---- the thread ---- */
.hw {
  --thread-ink: var(--c-arrow-1);
  --thread-track-ink: color-mix(in srgb, var(--c-arrow-1) 36%, transparent);
  --thread-bg: var(--c-paper);
  --thread-w: 2.5px;
  --thread-amp: 6px;
  --thread-wave: 40px;
  --thread-radius: 56px;
  --lane: 104px;              /* the middle lane the line runs down on a computer */
}
/* Below 1000 px the line rests (data-narrow="hide"): the parts stack, and the numbers still light as the reader scrolls. */
@media (max-width: 999px) { .hw { --thread-narrow: 1; } }

/* Inside the thread each band paints its ground under the line and its words and pictures over it: the band makes no
   stacking context (thread README, "What it needs from a page"); its ground is a layer of its own, under its rings. */
.hw > .band { isolation: auto; background: none; }
.hw-ground { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.hw-ours > .hw-ground, .hw-team > .hw-ground { background: var(--g-night); }
.hw-plan > .hw-ground { background: var(--c-paper-alt); }

/* The numbers and the nodes the line plugs into: a paper disc ringed in the arrow's orange; lit, the arrow's gradient,
   one ring spreading out as the head plugs in. */
.hw-num, .hw-node { position: relative; z-index: 1; isolation: isolate; display: grid; place-items: center; border-radius: 50%;
  background: var(--c-paper); color: var(--c-ink);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-arrow-1) 70%, transparent), 0 10px 26px -10px color-mix(in srgb, var(--c-ink) 55%, transparent); }
.hw-num::before, .hw-node::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--g-arrow); opacity: var(--lit, 1); }
.hw-num::after, .hw-node::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px var(--c-arrow-2);
  opacity: calc(var(--lit, 1) * (1 - var(--lit-after, 1)));
  transform: scale(calc(1 + var(--lit-after, 1) * .9)); }
.hw-num { width: 60px; height: 60px; font: 800 1.3125rem/1 var(--font-display); letter-spacing: -0.01em; }
.hw-node { width: 46px; height: 46px; margin: 0 auto clamp(36px, 4vw, 56px); }
.hw-node .mark { width: 24px; height: 24px; color: var(--c-ink); }

/* The small tags under a part's words */
.hw-tag { display: inline-flex; align-items: center; gap: 10px; margin: 0; font: 700 var(--fs-small)/1.3 var(--font-ui); color: var(--c-brand-text); }
.hw-tag__icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.band--night .hw-tag { color: var(--c-accent-on-ink); margin-top: var(--space-4); }

/* ---- hero: a plumber smiling on his phone at his truck (F6, Lara's Nov 27 note), the words over the street at the
   right, the notifications at the lower left ---- */
.hw-hero { position: relative; overflow: hidden; color: var(--c-on-ink); display: grid; align-items: start;
  min-height: clamp(640px, calc(100svh - 80px), 860px); padding: clamp(64px, 8vw, 120px) var(--gutter) clamp(120px, 12vw, 176px); }
/* the clip (3:2, played once: how-it-works.js) and its first frame under it fill the part from their top, so his face
   (x 26-40%, y 3-25%) stays above the notifications; --pos is also the kit's poster's position */
.hw-hero__media { position: absolute; inset: 0; z-index: -1; margin: 0; background: var(--c-ink); --pos: 30% 0%; }
.hw-hero__clip { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); max-width: none; object-fit: cover; object-position: var(--pos); }
.hw-hero__shade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(270deg, color-mix(in srgb, var(--c-ink) 90%, transparent) 0%, color-mix(in srgb, var(--c-ink) 74%, transparent) 34%, color-mix(in srgb, var(--c-ink) 20%, transparent) 60%, transparent 78%),
              linear-gradient(0deg, color-mix(in srgb, var(--c-ink) 50%, transparent) 0%, transparent 36%); }
.hw-hero__in { position: relative; display: flex; justify-content: flex-end; }
.hw-hero__copy { width: min(600px, 48%); }
.hw-hero__title { font: 800 var(--fs-h1)/1.02 var(--font-display); letter-spacing: -0.025em; text-wrap: balance; }
.hw-hero__line { margin: 20px 0 30px; max-width: 480px; font-size: var(--fs-body); color: color-mix(in srgb, var(--c-on-ink) 92%, transparent); text-wrap: pretty; }
.hw-hero__act { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.hw-hero__note { margin: 0; font: 600 var(--fs-small)/1.4 var(--font-ui); color: color-mix(in srgb, var(--c-on-ink) 88%, transparent); }
.hw-hero__notes { position: absolute; left: max(var(--gutter), calc((100% - var(--max-w)) / 2)); bottom: clamp(48px, 5vw, 72px); width: clamp(400px, 38vw, 500px); }
.scene.hw-hero__wyw { width: 100%; height: 360px; }
.hw-hero__stop { top: 8px; right: -52px; }

/* ---- the steps: the number in the middle lane, the words on one side, the picture on the other ---- */
.hw-rows { display: grid; gap: clamp(64px, 7vw, 112px); }
.hw-head { margin: 0; max-width: min(580px, calc(50% - var(--lane) / 2)); }
.hw-step { display: grid; grid-template-columns: minmax(0, 1fr) var(--lane) minmax(0, 1fr); align-items: start; }
.hw-step > .hw-num { grid-column: 2; grid-row: 1; justify-self: center; }
.hw-step > .hw-step__text { grid-column: 1; grid-row: 1; padding-top: 10px; max-width: 520px; }
.hw-step > :last-child { grid-column: 3; grid-row: 1; justify-self: center; }
.hw-step--flip > .hw-step__text { grid-column: 3; padding-left: 8px; }
.hw-step--flip > :last-child { grid-column: 1; }
.hw-step__title { font: 800 var(--fs-h3)/1.12 var(--font-display); letter-spacing: -0.015em; color: var(--c-wordmark); text-wrap: balance; }
.hw-step__line { margin-top: 12px; font-size: var(--fs-body); color: var(--c-ink-soft); text-wrap: pretty; }
.band--night .hw-step__title { color: var(--c-on-ink); }
.band--night .hw-step__line { color: color-mix(in srgb, var(--c-on-ink) 84%, transparent); }

/* yours: the three demos, each in a framed panel of the paper's designed ground that fills its side of the lane */
.hw-yours .hw-step { align-items: center; }
.hw-step__pic { position: relative; width: 100%; display: grid; place-items: center; min-height: 380px; padding: clamp(24px, 3vw, 40px);
  border-radius: var(--radius-l); border: 1px solid color-mix(in srgb, var(--c-brand) 12%, transparent);
  background:
    repeating-radial-gradient(circle at 100% 0%, transparent 0 46px, color-mix(in srgb, var(--c-brand) 9%, transparent) 46px 48px),
    linear-gradient(160deg, var(--c-paper) 0%, color-mix(in srgb, var(--c-brand-light) 60%, var(--c-paper)) 100%);
  box-shadow: 0 34px 64px -40px color-mix(in srgb, var(--c-brand) 55%, transparent); }
.hw-pic--goal { place-items: start center; height: 350px; }
.scene.hw-goal { width: min(100%, 420px); }
.scene.hw-scan { width: min(100%, 420px); }
.scene.hw-bars { width: min(100%, 520px); }
.hw-yours__stop { top: 12px; right: 12px; }
.hw-tag--yours { margin-top: calc(var(--space-4) * -1); }

/* ours: a framed photo per step, each with its scene in glass clear of the face */
.hw-ours .hw-step { align-items: center; }
.hw-frame { position: relative; width: 100%; margin: 0; aspect-ratio: 5 / 3; }
.hw-frame__photo { position: absolute; inset: 0; border-radius: var(--radius-l); overflow: hidden; background: var(--c-night-2);
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--c-ink) 85%, transparent); }
.hw-frame__photo img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover;
  filter: saturate(calc(.6 + var(--lit, 1) * .4)); }
.scene.hw-frame__scene { position: absolute; width: min(300px, 70%); } /* the scenes' stages need 260 px or more, also in a 1000 px window */
.hw-frame--launch img { object-position: 30% 40%; }
.scene.hw-launch { right: 3.5%; top: 6%; min-height: 304px; } /* each line on one line at its foot, the note's room above them */
.hw-frame--leads img { object-position: 50% 40%; }
.scene.hw-leads { left: 3%; top: 6%; width: min(340px, 70%); height: 280px; }
.hw-frame--tune img { object-position: 50% 30%; }
.scene.hw-tune { left: 3%; top: 46%; }
.hw-ours__stop { top: 12px; left: 12px; }
.hw-step--tune { padding-bottom: 96px; }
/* ---- plan: the free plan building itself, beside its words ---- */
.hw-plan__in { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 4vw, 64px); align-items: center; }
.hw-plan__card { position: relative; }
.scene.hw-plan__scene { width: 100%; height: 700px; }
.hw-plan__stop { top: -52px; right: 0; }
.hw-plan__copy .head__line { margin-top: var(--space-3); max-width: 460px; }
.hw-plan__act { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: var(--space-5); }
.hw-plan__note { margin: 0; font: 600 var(--fs-small)/1.4 var(--font-ui); color: var(--c-ink-soft); }
@media (min-width: 1200px) {
  .hw-plan__in { grid-template-columns: minmax(0, 720px) minmax(0, 1fr); }
  .scene.hw-plan__scene { height: 560px; }
}

/* ---- team: an owner in his truck, the team's answer landing beside him ---- */
.hw-team__in { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 4vw, 64px); align-items: center; }
@media (min-width: 1200px) { .hw-team__in { grid-template-columns: minmax(0, 760px) minmax(0, 1fr); } }
.hw-team__frame { position: relative; margin: 0; aspect-ratio: 16 / 10; }
.hw-team__photo { position: absolute; inset: 0; border-radius: var(--radius-l); overflow: hidden; background: var(--c-night-2);
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--c-ink) 85%, transparent); }
.hw-team__photo img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 30% 50%;
  filter: saturate(calc(.6 + var(--lit, 1) * .4)); }
.hw-team__stop { left: 14px; bottom: 14px; }
.hw-team__copy .head__line { margin-top: var(--space-3); max-width: 440px; }

/* the kit's chat, in glass over the photo's right side */
.hw-chat { position: absolute; z-index: 2; right: 3.5%; top: 10%; width: min(330px, 47%); display: grid; gap: 10px; padding: 14px;
  border-radius: 20px; color: var(--c-on-ink); font: 500 15px/1.35 var(--font-ui);
  background: color-mix(in srgb, var(--c-ink) 46%, transparent); border: 1px solid var(--c-glass-edge);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 24px 48px -20px color-mix(in srgb, var(--c-ink) 80%, transparent); }
.hw-chat [hidden] { display: none !important; }
.hw-chat [data-kit-msg] { opacity: var(--kit-in, 1); transform: translateY(calc((1 - var(--kit-in, 1)) * 10px)); }
.hw-chat__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--c-on-ink) 16%, transparent); }
.hw-chat__where { display: inline-flex; align-items: center; gap: 8px; font: 700 14px/1.2 var(--font-ui); }
.hw-chat__where .mark { width: 18px; height: 18px; color: var(--c-arrow-2); }
.hw-chat__human { flex: none; padding: 8px 12px; border-radius: 999px; font: 700 13px/1 var(--font-ui); white-space: nowrap;
  background: color-mix(in srgb, var(--c-on-ink) 14%, transparent); color: var(--c-on-ink);
  transition: background-color .35s var(--ease-out), color .35s var(--ease-out), box-shadow .35s var(--ease-out); }
.hw-chat__human[data-kit-on] { background: var(--c-arrow-2); color: var(--c-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-arrow-2) 30%, transparent); }
.hw-chat__msg { max-width: 88%; margin: 0; padding: 10px 13px; border-radius: 16px; }
.hw-chat__msg--you { justify-self: end; background: var(--c-paper); color: var(--c-ink); border-bottom-right-radius: 6px; }
.hw-chat__msg--team { justify-self: start; background: color-mix(in srgb, var(--c-brand) 80%, var(--c-ink)); border-bottom-left-radius: 6px; }
.hw-chat__msg--team b { display: block; margin-bottom: 3px; font: 700 13px/1.2 var(--font-ui); color: var(--c-accent-on-ink); }
.hw-chat__msg--typing { justify-self: start; display: inline-flex; gap: 5px; padding: 13px 15px; background: color-mix(in srgb, var(--c-brand) 60%, var(--c-ink)); border-bottom-left-radius: 6px; }
.hw-chat__msg--typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-on-ink); animation: hw-dot 1s ease-in-out infinite; }
.hw-chat__msg--typing i:nth-child(2) { animation-delay: .15s; }
.hw-chat__msg--typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hw-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ---- faq: the words on the left, the answers on the right, the line between them ---- */
.hw-faq__in { display: grid; grid-template-columns: minmax(0, 1fr) var(--lane) minmax(0, 1fr); align-items: start; }
.hw-faq__head { grid-column: 1; margin: 0; }
.hw-faq__list { grid-column: 3; }

/* ---- close: the handshake at her door, whole at the top, the words under it ---- */
.hw-close { position: relative; isolation: isolate; overflow: hidden; display: grid; place-items: end center; text-align: center;
  min-height: calc(41.7vw + 300px); padding: 0 var(--gutter) clamp(56px, 6vw, 84px); color: var(--c-on-ink); background: var(--c-ink); }
.hw-close__media { position: absolute; inset: 0 0 auto 0; z-index: -1; aspect-ratio: 3 / 2; background: var(--c-night-2); }
.hw-close__media::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 46%, color-mix(in srgb, var(--c-ink) 55%, transparent) 64%, var(--c-ink) 100%); }
.hw-close__clip { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); max-width: none; object-fit: cover; object-position: 50% 0%; }
.hw-close__in { position: relative; display: grid; justify-items: center; max-width: 720px; }
.hw-close__title { font: 800 clamp(2.5rem, 1.5rem + 3vw, 4.5rem)/1.02 var(--font-display); letter-spacing: -0.025em; text-wrap: balance; margin-bottom: 26px; }
.hw-close__note { margin: 12px 0 0; font: 600 var(--fs-small)/1.4 var(--font-ui); color: color-mix(in srgb, var(--c-on-ink) 88%, transparent); }
.hw-close__stop { top: 20px; right: 20px; }

/* ---- under 1000 px: the parts stack, the line rests ---- */
/* up to 1199 px the frame is too narrow to hold its scene beside the face (its stage needs 300 px or more):
   the photo on top, its scene from below the face down, at least half of it on the photo */
@media (max-width: 1199px) {
  .hw-frame { aspect-ratio: auto; max-width: 560px; padding: var(--y0) 12px 12px; border-radius: var(--radius-l); background: var(--c-night-2); }
  .hw-frame__photo { bottom: auto; height: var(--ph); }
  .scene.hw-frame__scene { position: relative; inset: auto; width: min(100%, 360px); margin-inline: auto; }
  .hw-frame--launch { --ph: 320px; --y0: 124px; }
  .hw-frame--leads { --ph: 320px; --y0: 112px; }
  .hw-frame--leads img { object-position: 100% 40%; }
  .scene.hw-leads { height: 280px; }
  .hw-frame--tune { --ph: 340px; --y0: 160px; }
  .hw-step--tune { padding-bottom: 0; }
}

@media (max-width: 999px) {
  .hw-hero { display: block; min-height: 0; padding: 0; }
  .hw-hero__media { position: relative; inset: auto; z-index: 0; height: clamp(300px, 62vw, 500px); overflow: hidden; }
  .hw-hero__shade { display: none; }
  .hw-hero__in { padding: 28px var(--gutter) 40px; background: var(--c-ink); }
  .hw-hero__copy { width: auto; max-width: 620px; margin-inline: auto; }
  .hw-hero__notes { left: var(--gutter); right: var(--gutter); top: calc(clamp(300px, 62vw, 500px) - 236px); bottom: auto; width: auto; max-width: 460px; }
  .scene.hw-hero__wyw { height: 206px; }
  .hw-hero__stop { top: 12px; right: 0; }

  .hw-node { display: none; }
  .hw-head { max-width: 640px; }
  .hw-rows { gap: clamp(48px, 8vw, 72px); }
  .hw-step { grid-template-columns: 52px minmax(0, 1fr); column-gap: 16px; row-gap: 22px; }
  .hw-step > .hw-num { grid-column: 1; grid-row: 1; justify-self: start; width: 50px; height: 50px; font-size: 1.125rem; }
  .hw-step > .hw-step__text, .hw-step--flip > .hw-step__text { grid-column: 2; grid-row: 1; padding: 4px 0 0; max-width: 560px; }
  .hw-step > :last-child, .hw-step--flip > :last-child { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .hw-tag--yours { margin-top: 0; }


  .hw-plan__in, .hw-team__in { grid-template-columns: minmax(0, 1fr); }
  .hw-plan__copy, .hw-team__copy { order: -1; max-width: 640px; }
  .hw-plan__card { width: min(100%, 720px); justify-self: center; margin-top: 52px; }
  .scene.hw-plan__scene { height: 560px; }
  .hw-team__frame { max-width: 760px; }

  .hw-faq__in { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .hw-faq__head, .hw-faq__list { grid-column: 1; }

  .hw-close { min-height: 0; place-items: start center; padding-top: calc(66.67vw + 32px); }
  .hw-close__media::after { background: linear-gradient(180deg, transparent 70%, var(--c-ink) 100%); }
}
@media (max-width: 659px) {
  .scene.hw-plan__scene { height: 700px; }
  .hw-plan__card { margin-top: 0; }
  .hw-plan__stop { top: 10px; right: 10px; }
}
@media (max-width: 600px) {
  /* the photo fills the frame, which keeps the room of the whole talk; the chat starts under his face */
  .hw-team__frame { aspect-ratio: auto; min-height: 552px; padding: 304px 12px 12px; }
  .hw-chat { position: relative; inset: auto; width: auto; max-width: 360px; margin-inline: auto; }
  .hw-team__stop { top: 12px; right: 12px; left: auto; bottom: auto; }
}
