/* How we work, as one continuous journey (spec 2026-11-03 S10).
   Linked from how-we-work.html only, after style.css.

   A loop of six stages that closes back on Discovery, then one flowing
   column with a spine and a numbered node at each heading. No cards, no
   alternating bands: the sequence is carried by the line, not by boxes.
   The main loop always arrives drawn in full, in blue (fix round 1: a grey
   ring that only filled once it had scrolled away read as unfinished). The
   scroll fill and the lit current node live on the spine, the docked loop and
   the phone bar, which js/loop.js drives; with scripting off or reduced
   motion those are drawn in full too. Any grey left (tracks, unlit node
   rings) is a 3:1 graphic on its ground in both themes.

   Colour: brand v2 only. The site's role variables (--fg, --muted, --accent,
   --ground) already resolve per scheme in style.css; the two values this page
   adds are mixes of --th-* tokens. */

.hww{
  --hww-ink: var(--accent);                 /* the fill, lit nodes, numerals */
  --hww-track: color-mix(in srgb, var(--th-grey) 70%, var(--th-black)); /* 3.4:1 on black */
  --hww-on-ink: var(--th-black);            /* numeral on a lit node, dark: 6.6:1 */
  --hww-node-ground: var(--ground);
  --hww-h2: var(--t-head);
  --hww-ease: cubic-bezier(0.25, 1, 0.5, 1); /* ease-out-quart */
  --rail: 76px;                             /* spine + node + air, left of the text */
  --node: 40px;
  --stage-pt: clamp(48px, 6.5vw, 96px);
  --stage-pb: 0px;
  padding-bottom: var(--sec);
}
@media (prefers-color-scheme: light){
  .hww{
    --hww-track: var(--th-grey);            /* 3.4:1 on paper */
    --hww-on-ink: var(--th-paper);          /* paper on blue, 5.1:1 */
  }
}

/* ---- The loop ------------------------------------------------------------ */
.hww-top{ padding-bottom: clamp(24px, 4vw, 56px); }
.hww-loop__stage{
  position: relative;
  width: min(420px, 100% - 320px);
  aspect-ratio: 1;
  margin-inline: auto;
}
.hww-loop__art{ display: block; width: 100%; height: auto; overflow: visible; }

.hww-loop__track{ fill: none; stroke: var(--hww-track); stroke-width: 2; }
.hww-loop__fill{
  fill: none; stroke: var(--hww-ink); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 0;   /* drawn in full until JS takes over */
}
.hww-loop__arrow{
  fill: none; stroke: var(--hww-ink); stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round;
}

.hww-loop__dot{ fill: var(--hww-node-ground); stroke: var(--hww-ink); stroke-width: 3; }
.hww-loop__disc{ fill: var(--hww-node-ground); stroke: var(--hww-ink); stroke-width: 2.5; }
.hww-loop__num{
  font-size: 17px; font-variation-settings: 'wght' 700;
  fill: var(--hww-ink); font-variant-numeric: tabular-nums;
}
.js .hww-loop__art--dock .hww-loop__disc{ stroke: var(--hww-track); }
.js .hww-loop__art--dock .is-on .hww-loop__disc{ stroke: var(--hww-ink); }
.js .hww-loop__art--dock .is-cur .hww-loop__disc{ fill: var(--hww-ink); stroke: var(--hww-ink); }
/* Only the dock changes state; the main loop is static, so it needs no transition. */
.hww-loop__art--dock .hww-loop__dot, .hww-loop__art--dock .hww-loop__disc,
.hww-loop__art--dock .hww-loop__num, .hww-loop__art--dock .hww-loop__arrow{
  transition: fill .2s var(--hww-ease), stroke .2s var(--hww-ease);
}
/* Wide screens: small dots on the ring, the names carry the numerals. */
.hww-loop__art--main .hww-loop__disc,
.hww-loop__art--main .hww-loop__num{ display: none; }

.hww-loop__core{
  font-size: 22px; font-variation-settings: 'wght' 600;
  fill: var(--muted); letter-spacing: -.01em;
}
.hww-loop__core + .hww-loop__core{ fill: var(--fg); }

.hww-loop__list{ list-style: none; margin: 0; padding: 0; }
.hww-loop__list a{
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--fg); text-decoration: none; white-space: nowrap;
  font-size: var(--t-body); font-variation-settings: 'wght' 600;
}
.hww-loop__n{
  color: var(--hww-ink); font-size: 13px; font-variation-settings: 'wght' 700;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.hww-loop__name{
  text-decoration: underline 2px transparent; text-underline-offset: 6px;
  transition: text-decoration-color .2s var(--hww-ease);
}
.hww-loop__list a:hover .hww-loop__name{ text-decoration-color: var(--hww-track); }
.hww-loop__list a[aria-current="step"] .hww-loop__name{ text-decoration-color: var(--hww-ink); }

@media (min-width: 768px){
  .hww-loop__list li{ position: absolute; left: var(--x); top: var(--y); }
  .hww-loop__list .is-t{ transform: translate(-50%, -100%); }
  .hww-loop__list .is-b{ transform: translate(-50%, 0); }
  .hww-loop__list .is-r{ transform: translate(0, -50%); }
  .hww-loop__list .is-l{ transform: translate(-100%, -50%); }
}

/* Phones: the ring shrinks to numbered nodes, the names list below it. */
@media (max-width: 767px){
  .hww-loop__stage{ width: 100%; aspect-ratio: auto; }
  .hww-loop__art--main{ width: min(300px, 100%); margin-inline: auto; }
  .hww-loop__art--main .hww-loop__dot{ display: none; }
  .hww-loop__art--main .hww-loop__disc,
  .hww-loop__art--main .hww-loop__num{ display: inline; }
  .hww-loop__list{
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px; margin: 28px auto 0; max-width: 360px;
  }
  .hww-loop__list a{ padding: 10px 4px; font-size: 15px; }
}

/* ---- The flow ------------------------------------------------------------ */
.hww-body{ position: relative; }
.hww-flow{ position: relative; max-width: 68ch; margin-inline: auto; }
.hww-dock{ display: none; }

/* The dock needs its own column; below 1180px it would squeeze the right
   gutter, so the bar does the job there instead. */
@media (min-width: 1180px){
  .hww-body{
    display: grid; grid-template-columns: 200px minmax(0, 68ch);
    column-gap: clamp(48px, 6vw, 112px); justify-content: center; align-items: start;
  }
  .hww-flow{ grid-column: 2; margin: 0; }
  .js .hww-dock{
    display: block; grid-column: 1; grid-row: 1;
    position: sticky; top: calc(var(--head-h, 62px) + 48px);
    opacity: 0; visibility: hidden; transform: translateY(12px);
    transition: opacity .25s var(--hww-ease), transform .25s var(--hww-ease), visibility 0s linear .25s;
  }
  .js .hww-dock.is-docked{
    opacity: 1; visibility: visible; transform: none;
    transition: opacity .4s var(--hww-ease), transform .4s var(--hww-ease), visibility 0s;
  }
}
.hww-loop__art--dock{ width: 128px; }
.hww-loop__art--dock .hww-loop__track{ stroke-width: 5; }
.hww-loop__art--dock .hww-loop__fill{ stroke-width: 10; }
.hww-loop__art--dock .hww-loop__arrow,
.hww-loop__art--dock .hww-loop__dot,
.hww-loop__art--dock .hww-loop__num{ display: none; }
.hww-loop__art--dock .hww-loop__disc{ stroke-width: 7; }
.hww-dock__list{ list-style: none; margin: 20px 0 0; padding: 0; }
.hww-dock__list a{
  display: flex; gap: 10px; align-items: baseline; padding: 5px 0;
  color: var(--muted); text-decoration: none;
  font-size: var(--t-small); font-variation-settings: 'wght' 500;
  transition: color .2s var(--hww-ease);
}
.hww-dock__list a:hover, .hww-dock__list a.is-cur{ color: var(--fg); }
.hww-dock__list a.is-cur{ font-variation-settings: 'wght' 700; }

/* The spine runs from the first node to the end of the last stage. */
.hww-spine{
  position: absolute; left: calc(var(--node) / 2 - 1px); width: 2px;
  top: calc(var(--stage-pt) + var(--hww-h2) * 0.56); bottom: 0;
  background: var(--hww-track);
}
.hww-spine__fill{
  position: absolute; inset: 0; background: var(--hww-ink);
  transform-origin: top; transform: scaleY(1);
}
.js .hww-spine__fill{ transform: scaleY(0); }
.hww-spine::after{
  content: ""; position: absolute; left: 50%; bottom: -5px;
  width: 10px; height: 10px; margin-left: -5px; border-radius: 50%;
  background: var(--hww-ink);
}
.js .hww:not(.is-closed) .hww-spine::after{ background: var(--hww-track); }

.hww-stage{
  position: relative;
  padding: var(--stage-pt) 0 var(--stage-pb) var(--rail);
}
.hww-stage:last-child{ padding-bottom: 8px; }
.hww-node{
  position: absolute; left: 0;
  top: calc(var(--stage-pt) + var(--hww-h2) * 0.56 - var(--node) / 2);
  width: var(--node); height: var(--node); border-radius: 50%;
  display: grid; place-items: center;
  background: var(--hww-node-ground); border: 2px solid var(--hww-ink); color: var(--hww-ink);
  font-size: 13px; font-variation-settings: 'wght' 700;
  font-variant-numeric: tabular-nums; line-height: 1;
  transition: background-color .2s var(--hww-ease), border-color .2s var(--hww-ease),
              color .2s var(--hww-ease), transform .3s var(--hww-ease);
}
.js .hww-node{ border-color: var(--hww-track); color: var(--muted); }
.js .is-past > .hww-node{ border-color: var(--hww-ink); color: var(--hww-ink); }
.js .is-current > .hww-node{
  background: var(--hww-ink); border-color: var(--hww-ink); color: var(--hww-on-ink);
  transform: scale(1.1);
}

.hww-stage h2{
  font-size: var(--hww-h2); line-height: 1.12; color: var(--fg);
  scroll-margin-top: 16px;  /* on top of style.css's scroll-padding-top */
}
.hww-icon{
  display: inline-block; width: .78em; height: .78em; margin-right: .4em;
  vertical-align: -.08em; color: var(--hww-ink); transition: none;
}
.hww-lede{
  margin-top: var(--sp-6); max-width: 60ch;
  font-size: var(--t-lead); line-height: 1.5; color: var(--fg);
}
.hww-stage [data-confirm]{ margin-top: var(--sp-4); max-width: 62ch; color: var(--muted); }

@media (max-width: 767px){
  .hww{ --rail: 52px; --node: 32px; --stage-pt: 56px; }
  .hww-node{ font-size: 12px; }
}

/* ---- Phones and tablets: a thin reading bar on the header's top edge ----- */
.hww-bar{ display: none; }
@media (max-width: 1179px){
  .js .hww-bar{
    display: block; position: fixed; top: 0; left: 0; right: 0; height: 3px;
    background: var(--hww-ink); transform-origin: left; transform: scaleX(0);
    z-index: 51; pointer-events: none;
  }
}

/* ---- Reduced motion: drawn in full by loop.js, nothing eases ------------- */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  .hww, .hww *, .hww *::before, .hww *::after{ transition: none !important; animation: none !important; }
}
