/* audience-brief.css: the homepage's "A brief written for each audience" (#audience, .ab).
 *
 * One muted stage, three steps: collect (the people behind your posts are found and analysed),
 * segment (the profiles gather into named segments) and personalise (pick a segment and the brief
 * is rewritten for it). The profiles are dots that audience-brief.js places; everything else is laid
 * out here at a fixed design size (880 by 520 wide, 360 by 520 on phones) and scaled to fit (--k).
 * Greyscale throughout; brand blue only on the segment the brief is written for.
 * Linked with a ?v= query: bump it on change.
 */
.ab { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: center;
  padding: 28px; border-radius: 28px; background: var(--muted); font-family: var(--font-sans); }

/* the steps: number, title, one line; the running one is dark and carries the progress line */
.ab-steps { display: flex; flex-direction: column; margin: 0; padding: 0 0 0 8px; list-style: none; }
.ab-step { position: relative; display: block; width: 100%; padding: 20px 0 22px; border: 0; background: none;
  text-align: left; font: inherit; color: var(--text-tertiary); cursor: pointer; transition: color .35s ease; }
.ab-step::before, .ab-step::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; border-radius: 2px; }
.ab-step::before { width: 100%; background: var(--surface-border); }
.ab-step::after { width: 100%; background: var(--text-primary); transform: scaleX(0); transform-origin: 0 50%; }
.ab-step.is-on { color: var(--text-primary); }
.ab-step.is-on.is-running::after { animation: ab-progress var(--ab-dur, 6s) linear both; }
.ab-step.is-on:not(.is-running)::after { transform: none; }
.ab-step:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 6px; }
@keyframes ab-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ab-step-n { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 500; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.ab-step-t { display: block; font-family: var(--font-heading); font-size: 22px; font-weight: 500; letter-spacing: -0.4px; line-height: 1.2; }
.ab-step-p { display: grid; grid-template-rows: 0fr; margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-secondary);
  opacity: 0; transition: grid-template-rows .5s var(--bz-out), opacity .35s ease, margin-top .5s var(--bz-out); }
.ab-step-p > span { overflow: hidden; }
.ab-step.is-on .ab-step-p { grid-template-rows: 1fr; margin-top: 8px; opacity: 1; }

/* the canvas: a fixed design size, scaled */
.ab-canvas { position: relative; height: calc(var(--ab-h, 520) * 1px * var(--k, 1)); overflow: hidden;
  border-radius: 20px; background: var(--background); border: 1px solid var(--surface-border); }
.ab-stage { position: absolute; left: 0; top: 0; width: calc(var(--ab-w, 880) * 1px); height: calc(var(--ab-h, 520) * 1px);
  transform: scale(var(--k, 1)); transform-origin: 0 0; color: var(--text-primary); }

/* the layer the camera moves: the profiles */
.ab-world { position: absolute; inset: 0; z-index: 2; pointer-events: none; transform-origin: 0 0; transition: transform 1.15s cubic-bezier(.65, 0, .35, 1); }
/* a profile */
.ab-dot { position: absolute; left: 0; top: 0; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: oklch(0.84 0 0);
  transition: transform 1.15s var(--bz-out) calc(var(--i) * .3s), background-color .45s ease, box-shadow .7s var(--bz-out), opacity .5s ease; }
/* close up: the profiles in view are drawn as people */
.ab-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; opacity: 0; transition: opacity .4s ease;
  background: center / cover no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Ccircle cx='14' cy='11' r='4.6' fill='%23fff'/%3E%3Cpath d='M5 28c0-5.6 4-9.4 9-9.4s9 3.8 9 9.4z' fill='%23fff'/%3E%3C/svg%3E"); }
/* grown with a ring of its own colour: a scale here would also multiply the dot's position */
.ab[data-zoom="1"] .ab-dot.is-picked { box-shadow: 0 0 0 3px var(--text-primary); }
.ab[data-zoom="1"] .ab-dot.is-picked::after { opacity: 1; transition-delay: .45s; }
/* collecting: nobody yet, then the profiles arrive, the nearest to the close-up first */
.ab[data-phase="collect"] .ab-dot { opacity: 0; }
.ab[data-phase="collect"][data-here="1"] .ab-dot { opacity: 1; transition-delay: calc(var(--i) * .3s), 0s, 0s, calc(var(--p) * 1.8s); }
.ab[data-phase="collect"] .ab-dot.is-picked { background: var(--text-primary); }
/* analysed: each profile takes its group's shade as the scan passes over it */
.ab[data-tint="1"] .ab-dot { transition-delay: calc(var(--i) * .3s), calc(var(--x) * .9s); }
.ab[data-tint="1"] .ab-dot.g0 { background: oklch(0.22 0 0); }
.ab[data-tint="1"] .ab-dot.g1 { background: oklch(0.52 0 0); }
.ab[data-tint="1"] .ab-dot.g2 { background: oklch(0.74 0 0); }
/* personalise: the picked segment is the one blue thing; the others step back */
.ab[data-step="3"] .ab-dot { transition-delay: calc(var(--i) * .3s), 0s; }
.ab[data-step="3"][data-sel="0"] .ab-dot.g0,
.ab[data-step="3"][data-sel="1"] .ab-dot.g1,
.ab[data-step="3"][data-sel="2"] .ab-dot.g2 { background: var(--brand); }

/* step 1: what is happening, and the scan */
.ab-pill { position: absolute; z-index: 3; left: 50%; top: 28px; translate: -50% 0; display: inline-flex; align-items: center; gap: 8px; height: 30px;
  padding: 0 13px; border-radius: 999px; background: var(--surface-subtle); font-size: 12.5px; font-weight: 500; color: var(--text-secondary);
  white-space: nowrap; box-shadow: 0 0 0 8px var(--background); transition: opacity .3s ease; }
.ab-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-primary); }
.ab[data-phase="auto"] .ab-pill::before { animation: ab-blink 1s ease-in-out infinite; }
@keyframes ab-blink { 50% { opacity: .25; } }
.ab-pill.is-swap, .ab:not([data-step="1"]) .ab-pill { opacity: 0; }
.ab-scan { position: absolute; top: 76px; bottom: 44px; left: 0; width: 1px; background: var(--text-primary); opacity: 0; }
.ab-scan.is-on { animation: ab-scan 1.15s cubic-bezier(.45, 0, .55, 1) both; }
@keyframes ab-scan { 0% { translate: calc(var(--ab-w, 880) * .06px) 0; opacity: 0; } 12%, 88% { opacity: .5; }
  100% { translate: calc(var(--ab-w, 880) * .94px) 0; opacity: 0; } }
.ab-cursor { position: absolute; left: 0; top: 0; z-index: 6; width: 18px; height: 18px; opacity: 0; pointer-events: none;
  transition: transform .9s var(--bz-out), opacity .3s ease; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.ab-cursor.is-on { opacity: 1; }

/* a segment: a card under its cluster (step 2), then a row to pick (step 3) */
.ab-seg { position: absolute; left: var(--x2); top: 312px; width: 230px; height: 124px; padding: 16px 18px; border-radius: 16px;
  background: var(--background); border: 1px solid var(--surface-border); box-shadow: var(--bz-shadow-panel);
  opacity: 0; translate: 0 10px;
  transition: left 1.1s var(--bz-out), top 1.1s var(--bz-out), width 1.1s var(--bz-out), height 1.1s var(--bz-out), padding 1.1s var(--bz-out),
    opacity .5s ease, translate .8s var(--bz-out), box-shadow .4s ease, border-color .4s ease, background-color .4s ease; }
.ab-seg:nth-of-type(1) { --x2: 55px; --y3: 115px; --d: .45s; }
.ab-seg:nth-of-type(2) { --x2: 325px; --y3: 215px; --d: .6s; }
.ab-seg:nth-of-type(3) { --x2: 595px; --y3: 315px; --d: .75s; }
.ab[data-step="2"] .ab-seg { opacity: 1; translate: 0 0; transition-delay: 0s, 0s, 0s, 0s, 0s, var(--d), var(--d), 0s, 0s, 0s; }
.ab-seg b { display: block; font-size: 15px; font-weight: 500; letter-spacing: -0.2px; line-height: 1.25; white-space: nowrap; }
.ab-seg small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-tertiary); white-space: nowrap; }
.ab-ocean { position: absolute; left: 18px; right: 18px; bottom: 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  transition: opacity .3s ease; }
.ab-ocean i { position: relative; height: 4px; border-radius: 4px; background: var(--surface-subtle); overflow: hidden; }
.ab-ocean i::before { content: ""; position: absolute; inset: 0; width: var(--v); border-radius: inherit; background: var(--text-primary); }
.ab-ocean i::after { content: attr(data-t); position: absolute; left: 0; bottom: 9px; font-size: 10px; font-style: normal; color: var(--text-tertiary); }
.ab-ocean i { overflow: visible; }
.ab[data-step="3"] .ab-seg { left: 30px; top: var(--y3); width: 290px; height: 84px; padding: 22px 18px 0 100px; opacity: 1; translate: 0 0;
  box-shadow: none; background: transparent; }
.ab[data-step="3"] .ab-ocean { opacity: 0; }
.ab[data-step="3"][data-sel="0"] .ab-seg:nth-of-type(1),
.ab[data-step="3"][data-sel="1"] .ab-seg:nth-of-type(2),
.ab[data-step="3"][data-sel="2"] .ab-seg:nth-of-type(3) { background: var(--background); border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--bz-shadow-panel); }

/* step 3: the question, and the brief that answers it */
.ab-who { position: absolute; left: 32px; top: 72px; font-size: 12.5px; font-weight: 500; color: var(--text-tertiary);
  opacity: 0; transition: opacity .4s ease; }
.ab[data-step="3"] .ab-who { opacity: 1; transition-delay: .5s; }
.ab-brief { position: absolute; left: 360px; top: 52px; width: 490px; height: 416px; padding: 24px 28px; border-radius: 20px;
  background: var(--background); border: 1px solid var(--surface-border);
  box-shadow: 0 30px 60px -24px rgba(15, 32, 96, .2), 0 8px 24px rgba(0, 0, 0, .05);
  opacity: 0; translate: 24px 0; transition: opacity .45s ease, translate .9s var(--bz-out); }
.ab[data-step="3"] .ab-brief { opacity: 1; translate: 0 0; transition-delay: .35s; }
.ab-brief-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ab-kicker { font-size: 12.5px; font-weight: 500; color: var(--text-tertiary); }
.ab-for { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--brand-light);
  font-size: 12.5px; font-weight: 500; color: var(--brand); white-space: nowrap; }
.ab-for::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.ab-brief-title { margin: 0; font-family: var(--font-heading); font-size: 24px; font-weight: 500; letter-spacing: -0.5px; line-height: 1.2; }
.ab-row { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--surface-border); }
.ab-eye { display: block; margin-bottom: 6px; font-size: 10.5px; font-weight: 500; letter-spacing: .07em; line-height: 1.2; text-transform: uppercase;
  color: var(--text-tertiary); }
.ab-row p { margin: 0; min-height: 42px; font-size: 15px; line-height: 1.4; }
.ab-row--short p { min-height: 21px; }
/* the lines that follow the audience are rewritten on each pick, top to bottom */
.ab-vary { transition: opacity .28s ease, translate .5s var(--bz-out); }
.ab-row:nth-of-type(2) .ab-vary { transition-delay: .07s; }
.ab-row:nth-of-type(3) .ab-vary { transition-delay: .14s; }
.ab-brief.is-swap .ab-vary { opacity: 0; translate: 0 5px; }

@media (max-width: 1080px) {
  .ab { grid-template-columns: 240px minmax(0, 1fr); padding: 22px; gap: 18px; }
  .ab-step-t { font-size: 19px; }
}
/* phones and narrow tablets: the steps become three tabs over the canvas, and the canvas is redrawn at 360 by 520 */
@media (max-width: 900px) {
  .ab { grid-template-columns: minmax(0, 1fr); padding: 14px; border-radius: 22px; gap: 14px; }
  .ab-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 10px; padding: 4px 4px 0; }
  .ab-step { padding: 0 0 10px; }
  .ab-step-n { margin-bottom: 3px; font-size: 11px; }
  .ab-step-t { font-size: 15px; letter-spacing: -0.2px; }
  /* the running step's line sits under all three tabs, at a fixed height so the canvas never jumps */
  .ab-steps { position: relative; padding-bottom: 54px; }
  .ab-step { position: static; }
  .ab-step-n, .ab-step-t { position: relative; }
  .ab-step::before, .ab-step::after { bottom: 54px; left: auto; width: calc((100% - 28px) / 3); }
  .ab-step-p { position: absolute; left: 4px; right: 4px; bottom: 0; height: 44px; display: block; margin: 0; font-size: 13.5px; line-height: 1.4;
    transition: opacity .35s ease; }
  .ab-step.is-on .ab-step-p { margin-top: 0; }
  .ab-canvas { --ab-w: 360; --ab-h: 520; border-radius: 16px; }
  .ab-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; }
  .ab-pill { top: 22px; }
  .ab-scan { top: 70px; bottom: 50px; }
  .ab-seg { top: 260px; width: 112px; height: 112px; padding: 12px 11px; border-radius: 14px; }
  .ab-seg:nth-of-type(1) { --x2: 8px; }
  .ab-seg:nth-of-type(2) { --x2: 124px; }
  .ab-seg:nth-of-type(3) { --x2: 240px; }
  .ab-seg b { font-size: 13px; white-space: normal; }
  .ab-seg small { font-size: 11.5px; }
  .ab-ocean { left: 11px; right: 11px; bottom: 12px; gap: 4px; }
  .ab-ocean i::after { display: none; }
  .ab[data-step="3"] .ab-seg { left: var(--x2); top: 20px; width: 112px; height: 112px; padding: 62px 8px 0; text-align: center; }
  .ab[data-step="3"] .ab-seg small { display: none; }
  .ab-who { display: none; }
  .ab-brief { left: 8px; top: 146px; width: 344px; height: 366px; padding: 18px 20px; border-radius: 16px; }
  .ab-brief-top { margin-bottom: 10px; }
  .ab-brief-title { font-size: 20px; }
  .ab-row { margin-top: 12px; padding-top: 12px; }
  .ab-row p { font-size: 14px; min-height: 40px; }
  .ab-row--short p { min-height: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .ab *, .ab *::before, .ab *::after { transition: none !important; animation: none !important; }
  .ab-cursor, .ab-scan { display: none; }
}
