/* =====================================================================
   qoom.life · "How Qoom works" section · NOT DEPLOYED
   Sits between "What we're up for" (.territories) and "The question" (.platform-section).
   Depends only on what the live stylesheet already defines:
     :root  --ink --bone --wake --move --play --together --line
     .page-width  .section-label
   and the site's breakpoints (900 px, 620 px) for the intro and foot. Square corners, 1 px ink rules,
   flat colour only as blocks (never text), as on the territories grid.
   Cards, by width (review fix, 26 Oct):
     >= 1200 px: the five cards side by side, like the territory grid (cards >= 240 px wide).
     <= 1199 px: a swipeable row of 300 px cards, with a tab index above and position + progress below.
   In both, the cards are one grid with three shared rows (head · screen · label, via subgrid), so all
   five screenshots start on the same line whatever the length of each card's sentence.
   ===================================================================== */

.how-section {
  --how-soft: #55514b;               /* 6.99:1 on bone: lede, card lines, labels */
  --how-pad: clamp(22px, 2.4vw, 38px); /* = .territory padding */
  --how-gutter: 24px;                /* = half of .page-width's 48 px */
  --how-card-w: min(300px, 80vw);    /* swipe layout card width */
  --how-focus: 3px solid var(--play);/* = the site's :focus-visible outline */
  background: var(--bone);
  color: var(--ink);
  padding-block: clamp(88px, 9vw, 150px) 0;
}

/* one accent per tab, from the site's territory colours */
.how-section .wake     { --how-accent: var(--wake); }
.how-section .plans    { --how-accent: var(--move); }
.how-section .people   { --how-accent: var(--together); }
.how-section .insights { --how-accent: var(--play); }
.how-section .you      { --how-accent: var(--ink); }

/* ---- intro: label column + copy, the statement section's grid ---- */
.how-intro {
  display: grid;
  grid-template-columns: minmax(150px, 2fr) minmax(0, 10fr);
  gap: 40px;
  align-items: start;
  padding-bottom: clamp(48px, 5.6vw, 84px);
}
.how-intro > * { min-width: 0; }
.how-intro .section-label { padding-top: 13px; }
.how-intro h2 {
  margin: 0;
  font-size: clamp(56px, 7.4vw, 118px);
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: -0.075em;
  overflow-wrap: break-word;         /* last resort: never wider than its column */
}
.how-lede {
  max-width: 560px;
  margin: clamp(28px, 3vw, 44px) 0 0;
  font-size: clamp(19px, 1.7vw, 25px);
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--how-soft);
}

/* ---- the cards: territory cells continued (full bleed, 1 px ink rules, 10 px bar) ---- */
.how-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: auto auto auto;  /* head · screen · label, shared by every card */
  position: relative;                 /* offsetParent for the JS */
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.how-row:focus-visible { outline: var(--how-focus); outline-offset: -3px; }
.how-card {
  position: relative;
  isolation: isolate;
  grid-row: span 3;
  display: flex;                      /* fallback; subgrid below where supported */
  flex-direction: column;
  min-width: 0;
  padding-bottom: calc(10px + var(--how-pad));
  border-right: 1px solid var(--ink);
  scroll-margin-top: 96px;
}
@supports (grid-template-rows: subgrid) {
  /* minmax(0, 1fr): the card's one column is the card's width, so a nowrap label can never widen it
     (at 1200-1219 px "App screen · demo account" did, and pushed the screenshot 3-4 px over the next rule) */
  .how-card { display: grid; grid-template-rows: subgrid; grid-template-columns: minmax(0, 1fr); row-gap: 0; align-content: start; }
}
.how-card:last-child { border-right: 0; }
.how-card::before {                 /* = .territory:before at rest */
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 10px;
  background: var(--how-accent);
}
.how-card-head { padding: var(--how-pad) var(--how-pad) 0; }
.how-card-number {                  /* = .territory-number; decorative (aria-hidden): the <ol> gives the position */
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  font-variant-numeric: tabular-nums;
}
.how-card-number::before { content: ""; width: 10px; height: 10px; background: var(--how-accent); }
/* Five across (>= 1200 px), the cards read "01" ... "05": no "/05", so the section's numbers don't read as
   one series with the territory grid's "01"-"04" directly above. The swipe layout below keeps "01/05". */
.how-card-of { display: none; }
.how-card h3 {
  margin: clamp(34px, 3.4vw, 54px) 0 0;
  font-size: clamp(34px, 3vw, 46px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.065em;
}
.how-card-line {
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--how-soft);
}
@supports not (grid-template-rows: subgrid) {
  .how-card-line { min-height: calc(5 * 1.4em); }   /* fallback alignment: the longest line wraps to 5 at 240 px */
}
/* the screen: full cell width, framed only by the cell's own rules */
.how-shot {
  align-self: start;
  margin: 22px 0 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: var(--bone);
  display: flex;
  flex-direction: column;
  box-sizing: content-box;          /* the ratio sizes the image area itself, not its 1 px rules */
  aspect-ratio: 600 / 512;          /* every card's screen is the same height. The web crops are 600 x 507-509
                                       plus a 1 px join rule; 512 leaves room for both, so nothing is clipped. */
  overflow: hidden;
}
.how-shot img { display: block; width: 100%; height: auto; flex: none; }
.how-shot img:last-child { flex: 1 1 auto; min-height: 0; object-fit: cover; object-position: top; }
.how-shot img + img { border-top: 1px solid var(--ink); }   /* a visible break where part of the screen is left out */
.how-label {
  margin: 14px 12px 0 var(--how-pad);   /* left-aligned: a 12 px right margin gives "demo account" room at 1200 px */
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--how-soft);
}
.how-label b { font-weight: 800; color: var(--ink); }   /* the disclosure word, as on the stories */

/* swipe-only navigation, hidden while all five cards are visible */
.how-index, .how-controls { display: none; }

/* ---- footer of the section (the site's "Up for it? · Stay close" CTA follows directly) ---- */
.how-foot {
  display: grid;
  grid-template-columns: minmax(150px, 2fr) minmax(0, 10fr);
  gap: 40px;
  padding-block: clamp(48px, 5vw, 72px) clamp(24px, 3vw, 48px);   /* .platform-section below brings its own space */
}
.how-foot-body { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; min-width: 0; }
.how-beta {
  max-width: 560px;
  margin: 0;
  font-size: clamp(17px, 1.4vw, 20px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.015em;
}
.how-small {
  max-width: 560px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--how-soft);
}
.how-small a { border-bottom: 1px solid; }
.how-small a:focus-visible,
.how-index a:focus-visible { outline: var(--how-focus); outline-offset: 4px; }

/* ====================== <= 1199 px: the swipe layout ====================== */
@media (max-width: 1199.98px) {
  /* tab index: every card is one tap away */
  .how-index {
    display: flex;
    flex-wrap: wrap;
    column-gap: 36px;
  }
  .how-index a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--how-soft);
    box-shadow: inset 0 -2px 0 transparent;
  }
  .how-index a::before { content: ""; width: 8px; height: 8px; flex: none; background: var(--how-accent); }
  .how-index a[aria-current="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

  /* the swipeable row: 300 px cards, the next one peeks in. The last, empty track is the end gutter
     (a grid track always counts towards the scroll width, in Safari too). */
  .how-row {
    grid-template-columns: repeat(5, var(--how-card-w)) var(--how-gutter);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--how-gutter);
    padding-inline-start: var(--how-gutter);
    scrollbar-width: none;
  }
  .how-row::-webkit-scrollbar { display: none; }
  .how-card {
    scroll-snap-align: start;
    border-right: 1px solid var(--ink);
  }
  .how-card:first-child { border-left: 1px solid var(--ink); }
  .how-card:last-child { border-right: 1px solid var(--ink); }
  .how-card-of { display: inline; }   /* one card in view at a time: "01/05", as before */
  .how-card h3 { margin-top: 26px; }
  @supports not (grid-template-rows: subgrid) {
    .how-card-line { min-height: calc(3 * 1.4em); }   /* the longest line (Insights) wraps to 3 at 300 px */
  }

  /* position, progress and the swipe cue */
  .how-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    min-height: 56px;
  }
  .how-count { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
  .how-count b { font-weight: 800; }
  .how-count span { color: var(--how-soft); }
  .how-progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .how-progress span { height: 3px; background: var(--line); }
  .how-progress span.is-on { background: var(--ink); }
  .how-swipe {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: opacity 0.2s;
  }
  .how-swipe svg { width: 18px; height: 18px; }
  .how-controls.is-end .how-swipe { opacity: 0; }   /* nothing more to swipe to on the last card */
}

/* =========================== <= 900 px (site) =========================== */
@media (max-width: 900px) {
  .how-section { --how-gutter: 16px; --how-pad: 18px; }
  .how-intro { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .how-intro .section-label { padding-top: 0; }
  .how-intro h2 { font-size: clamp(40px, 12.5vw, 96px); }   /* 320 px: 40 px, "one morning." fits its 292 px column */
  .how-index { display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; column-gap: 0; }

  .how-foot { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .how-foot > .section-label { display: none; }
}

@media (max-width: 620px) {
  .how-section { --how-gutter: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .how-row { scroll-behavior: auto; }
  .how-swipe { transition: none; }
}
