/* How it works: the Set goals / Decide / Deliver / Learn loop.
 *
 * --ring is the ring's width in px. The SVG's viewBox is 420 wide, so a line
 * drawn N units wide shows as N * ring / 420 px. --k is 420 / ring: multiply
 * a stroke by it and the line keeps its weight (2px grey, 3px coral) at every
 * ring size. The arrowheads are markers sized from the stroke, so they hold
 * their size too.
 *
 * The four stops sit at the 45 degree points of a 200-unit circle in the 420
 * box: 16.33% and 83.67% of the ring each way.
 *
 * Coral lines: the arc from Learn back to Set goals, and nothing else on the
 * ring. Coral also marks stage 4's number, the Live Activation chip, the
 * Proven formats source and Learn's closing line.
 */
.loop {
  background: var(--paper);
  padding: clamp(calc(64px * var(--s, 1)), calc(8vw * var(--s, 1)), calc(120px * var(--s, 1))) 0;
}
.loop__title { text-align: center; margin-bottom: clamp(calc(36px * var(--s, 1)), calc(5vw * var(--s, 1)), calc(64px * var(--s, 1))); }

.loop__grid {
  --ring: calc(280px * var(--s, 1)); --k: 1.5;
  --face: calc(62px * var(--s, 1));            /* 30% bigger (Tom, 15 Nov 2026): a 58px photo plus its 2px white ring */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  row-gap: calc(36px * var(--s, 1));
}

/* The ring ------------------------------------------------------------- */
.loop__ring {
  position: relative;
  width: var(--ring); height: var(--ring);
  margin-bottom: calc(4px * var(--s, 1));
}
.loop__svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%; max-width: none;
  overflow: visible;
}
.loop__arc {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: calc(2 * var(--k));
  stroke-linecap: round;
}
.loop__arc--coral { stroke: var(--coral); stroke-width: calc(3 * var(--k)); }
.loop__head { fill: var(--ink-3); stroke: none; }
.loop__head--coral { fill: var(--coral); }

/* The centre: the wordmark on the ring's centre point, with the five sources
   Fantenna draws on around it: two above, two below, Proven formats last.
   The two groups hang off the wordmark, so it stays centred whatever they
   hold. A row that is too long for the ring (a longer language) wraps and
   stays centred. */
.loop__centre {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}
.loop__mark { display: block; width: calc(124px * var(--s, 1)); height: auto; }
.loop__mark--f { width: clamp(calc(72px * var(--s, 1)), 9vw, calc(112px * var(--s, 1))); }
/* Proven formats is a different kind of input: the coral tint sets it apart,
   on a row of its own. The margins take the row; the pill hugs its words. */
@media (min-width: 375px) {
  .loop__grid { --ring: calc(300px * var(--s, 1)); --k: 1.4; }
}

/* The people ------------------------------------------------------------
   One group per stage: its photo or photos, and the stage number as a badge.
   It appears on the ring (.loop__stop) and before each stage's heading. */
.loop__who {
  position: relative;
  display: inline-flex; flex: none;
}
.loop__face {
  position: relative; overflow: hidden;
  box-sizing: border-box;
  width: var(--face); height: var(--face); flex: none;
  border-radius: 50%;
  border: 2px solid var(--paper);
  background: color-mix(in srgb, var(--ink) 9%, var(--paper));
}
.loop__face + .loop__face { margin-left: calc(-18px * var(--s, 1)); }
.loop__face img { position: absolute; display: block; max-width: none; }
/* A photo after "You" overlaps it less, so the word stays readable. */
.loop__face--you + .loop__face { margin-left: calc(-8px * var(--s, 1)); }
/* "You" written in the disc, in the reader's own word (Tom, 16 Nov 2026). */
.loop__you {
  font-family: var(--display);
  font-size: calc(16px * var(--s, 1)); line-height: 1;
  font-weight: 800; letter-spacing: -0.02em;
  color: var(--ink);
}
/* You: an outlined disc, no photo. */
.loop__face--you {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper);
  border-color: var(--ink);
}
.loop__face--you svg {
  width: calc(31px * var(--s, 1)); height: calc(31px * var(--s, 1));
  fill: none; stroke: var(--ink); stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.loop__badge {
  position: absolute; left: calc(-9px * var(--s, 1)); top: calc(-9px * var(--s, 1));
  box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  width: calc(31px * var(--s, 1)); height: calc(31px * var(--s, 1));
  border-radius: 50%;
  border: 2px solid var(--paper);
  background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-size: calc(17px * var(--s, 1)); font-weight: 700;
  letter-spacing: 0; line-height: 1;
}
.loop__badge--coral { background: var(--coral-fill); color: var(--on-coral); }

/* On the ring. A phone's ring is too small for photos beside the sources, so
   each stop is its number alone; the photos sit by the headings below. */
.loop__stop { position: absolute; transform: translate(-50%, -50%); }
.loop__stop--1 { left: 16.33%; top: 16.33%; }
.loop__stop--2 { left: 83.67%; top: 16.33%; }
.loop__stop--3 { left: 83.67%; top: 83.67%; }
.loop__stop--4 { left: 16.33%; top: 83.67%; }
.loop__stop .loop__face { display: none; }
.loop__stop .loop__badge {
  position: static;
  width: calc(36px * var(--s, 1)); height: calc(36px * var(--s, 1)); border: 0;
  font-size: calc(19px * var(--s, 1));
}

/* An agent's photo is a button: it opens the agent card. */
.loop__agent {
  appearance: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: inherit;
  transition: box-shadow 0.15s;
}
.loop__agent:hover, .loop__agent[aria-expanded="true"] { z-index: 1; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--coral); }
/* The stage number always sits above a photo's hover ring. */
.loop__stop .loop__badge { z-index: 2; }
.loop__agent:focus-visible { z-index: 1; outline: 2px solid var(--coral-ink); outline-offset: 2px; }

/* The agent card: the agent's video as a thumbnail with a play button, then
   name, role and the one line on what they do. home.js fills it and opens it
   towards the ring's centre, covering the F. */
.agent-card {
  position: absolute; z-index: 40; left: 0; top: 0;
  box-sizing: border-box;
  width: calc(264px * var(--s, 1)); max-width: calc(100vw - calc(24px * var(--s, 1)));
  padding: calc(10px * var(--s, 1)) calc(10px * var(--s, 1)) calc(14px * var(--s, 1));
  background: var(--paper);
  border: 1px solid var(--rule-strong, #E4E4EA);
  border-radius: calc(16px * var(--s, 1));
  box-shadow: 0 2px 4px rgba(10, 10, 10, 0.06), 0 12px 32px rgba(10, 10, 10, 0.14);
  font-size: calc(17px * var(--s, 1)); line-height: 24px;
}
.agent-card[hidden] { display: none; }
.agent-card p { margin: 0; padding: 0 calc(4px * var(--s, 1)); }
.agent-card__thumb {
  appearance: none; cursor: pointer; position: relative; display: block;
  width: 100%; aspect-ratio: 4 / 3; margin: 0 0 calc(12px * var(--s, 1)); padding: 0;
  border: 0; border-radius: calc(10px * var(--s, 1));
  /* The drawing's white multiplies onto the page grey, so the picture
     reads as a picture, not a box inside the card. */
  background: var(--paper-2); overflow: hidden;
}
.agent-card__thumb img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 18%;
  mix-blend-mode: multiply;
}
/* One play control, clear of the face. */
.agent-card__pill {
  position: absolute; left: calc(10px * var(--s, 1)); bottom: calc(10px * var(--s, 1));
  display: inline-flex; align-items: center; gap: calc(8px * var(--s, 1));
  padding: calc(7px * var(--s, 1)) calc(14px * var(--s, 1)) calc(7px * var(--s, 1)) calc(12px * var(--s, 1)); border-radius: calc(999px * var(--s, 1));
  background: var(--coral-fill); color: var(--on-coral);
  font-size: calc(15px * var(--s, 1)); font-weight: 700; line-height: 18px;
  transition: background 0.15s, transform 0.15s;
}
.agent-card__pill svg { fill: currentColor; }
.agent-card__thumb:hover .agent-card__pill { background: var(--coral-fill-hover); transform: translateY(-1px); }
.agent-card__video { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; background: #fff; }
.agent-card__video[hidden], .agent-card__thumb img[hidden] { display: none; }
.agent-card.is-playing .agent-card__pill { opacity: 0; }
/* Playing, the frame grows to the video's own shape so nothing is cropped. */
.agent-card.is-playing .agent-card__thumb { aspect-ratio: 426 / 690; max-height: calc(100vh - calc(200px * var(--s, 1))); }
.agent-card.is-playing .agent-card__video { object-fit: contain; }
.agent-card__thumb:focus-visible { outline: 2px solid var(--coral-ink); outline-offset: 2px; }
.agent-card__name { font-weight: 700; color: var(--ink); }
.agent-card__role { font-weight: 400; color: var(--ink-3); }
.agent-card__line { margin-top: calc(4px * var(--s, 1)) !important; color: var(--ink-2); }
@keyframes agent-card-in { from { opacity: 0; translate: 0 4px; } }
@media (prefers-reduced-motion: no-preference) {
  .agent-card { animation: agent-card-in 0.14s ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  .loop__agent, .agent-card__pill { transition: none; }
}

/* The four stages -------------------------------------------------------- */
.loop__stage {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  max-width: calc(360px * var(--s, 1));
}
.loop__head { display: flex; align-items: center; gap: calc(14px * var(--s, 1)); }
.loop__name {
  font-family: var(--display);
  font-size: calc(28px * var(--s, 1)); line-height: 36px;
  font-weight: 800; letter-spacing: -0.03em;
  margin: 0;
}
.loop__role {
  margin: calc(8px * var(--s, 1)) 0 0;
  font-size: calc(17px * var(--s, 1)); line-height: 24px;
  color: var(--ink-3);
  text-wrap: balance;
}
.loop__body {
  font-size: calc(17px * var(--s, 1)); line-height: 24px;
  color: var(--ink-2);
  margin: calc(6px * var(--s, 1)) 0 0;
  text-wrap: pretty;
}
.loop__chips {
  display: flex; flex-wrap: wrap; justify-content: center; gap: calc(8px * var(--s, 1));
  list-style: none; margin: calc(16px * var(--s, 1)) 0 0; padding: 0;
}
.loop__chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: calc(36px * var(--s, 1)); padding: calc(5px * var(--s, 1)) calc(16px * var(--s, 1));
  background: var(--paper);
  border: 1px solid color-mix(in srgb, var(--ink) 24%, var(--paper));
  border-radius: calc(999px * var(--s, 1));
  font-size: calc(17px * var(--s, 1)); line-height: 24px; font-weight: 600;
  text-align: center;
}
.loop__chip { gap: calc(8px * var(--s, 1)); }
.loop__chip-icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* The Plan and the Spec are documents you are handed: a page icon and a
   squarer tag. The Live Activation is the thing fans use: a phone icon, and
   the coral edge that ties it to the Learn arc. */
.loop__chip--doc { border-radius: calc(6px * var(--s, 1)); padding: calc(5px * var(--s, 1)) calc(14px * var(--s, 1)) calc(5px * var(--s, 1)) calc(12px * var(--s, 1)); }
.loop__chip--doc .loop__chip-icon { color: var(--ink-2); }
.loop__chip--live { border: 2px solid var(--coral); padding: calc(4px * var(--s, 1)) calc(15px * var(--s, 1)) calc(4px * var(--s, 1)) calc(13px * var(--s, 1)); }
.loop__chip--live .loop__chip-icon { color: var(--coral-ink); }
.loop__strong {
  margin: calc(10px * var(--s, 1)) 0 0;
  font-size: calc(17px * var(--s, 1)); line-height: 24px; font-weight: 700;
  color: var(--coral-ink);
}
/* One sentence to a line: the line only breaks between the two. */
.loop__strong span { display: inline-block; white-space: nowrap; }

/* Tablet: the ring on top with the photos on it, the stages in two columns
   under it, laid out as the ring is: 1 and 2 above, 4 and 3 below. */
@media (min-width: 760px) {
  .loop__grid {
    --ring: calc(360px * var(--s, 1)); --k: 1.1667;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "ring ring" "s1 s2" "s4 s3";
    column-gap: calc(40px * var(--s, 1)); row-gap: calc(44px * var(--s, 1));
    align-items: start;
  }
  .loop__ring { grid-area: ring; margin-bottom: calc(8px * var(--s, 1)); }
  .loop__stage--1 { grid-area: s1; }
  .loop__stage--2 { grid-area: s2; }
  .loop__stage--3 { grid-area: s3; }
  .loop__stage--4 { grid-area: s4; }

  .loop__mark--f { width: calc(96px * var(--s, 1)); }

  /* The first photo is centred on the stop; a second one sits outside it. */
  .loop__stop { transform: translate(calc(var(--face) / -2), calc(var(--face) / -2)); }
  /* Plan has "You" ahead of its two photos: the group starts one disc
     further left, so the photos stay on the stop and clear the heading. */
  .loop__stop--2 { transform: translate(calc(var(--face) / -2 - var(--face) + 8px * var(--s, 1)), calc(var(--face) / -2)); }
  .loop__stop .loop__face { display: block; }
  .loop__stop .loop__face--you { display: inline-flex; }
  .loop__stop .loop__badge {
    position: absolute;
    width: calc(31px * var(--s, 1)); height: calc(31px * var(--s, 1)); border: 2px solid var(--paper);
    font-size: calc(17px * var(--s, 1));
  }
}

/* Desktop: a letterbox. Set goals and Learn to the left of the ring, Decide
   and Deliver to the right, each heading level with its stop. The people are
   on the ring here, so the headings drop theirs. */
@media (min-width: 1024px) {
  .loop__grid {
    --ring: calc(360px * var(--s, 1)); --k: 1.1667;
    --head: calc(36px * var(--s, 1));          /* the heading's line height */
    grid-template-columns: minmax(0, 1fr) var(--ring) minmax(0, 1fr);
    /* Row one is the drop from the top stops to the bottom ones, so a stage
       in row two starts level with its stop. It grows if a stage needs it. */
    grid-template-rows: minmax(calc(var(--ring) * 0.6734), auto) auto;
    grid-template-areas: "s1 ring s2" "s4 ring s3";
    column-gap: calc(16px * var(--s, 1)); row-gap: 0;
  }
  .loop__ring { margin-bottom: 0; align-self: start; }
  .loop__head .loop__who { display: none; }
  .loop__name { font-size: calc(30px * var(--s, 1)); line-height: var(--head); }
  .loop__role { margin-top: calc(4px * var(--s, 1)); }
  .loop__stage { margin-top: calc(var(--ring) * 0.1633 - var(--head) / 2); }
  .loop__stage--1, .loop__stage--4 {
    justify-self: end;
    align-items: flex-end; text-align: right;
  }
  .loop__stage--2, .loop__stage--3 {
    justify-self: start;
    align-items: flex-start; text-align: left;
  }
  .loop__stage--2 .loop__chips, .loop__stage--3 .loop__chips { justify-content: flex-start; }
}
@media (min-width: 1200px) {
  .loop__grid { --ring: calc(420px * var(--s, 1)); --k: 1; --head: calc(40px * var(--s, 1)); column-gap: calc(28px * var(--s, 1)); }
  .loop__name { font-size: calc(36px * var(--s, 1)); }
  .loop__mark--f { width: calc(112px * var(--s, 1)); }
}

/* Arriving ----------------------------------------------------------------
   The diagram is complete at rest. home.js adds .loop--anim only when the
   section starts below the fold and the visitor has not asked for reduced
   motion, then .loop--in the first time the ring scrolls into view. Each
   piece waits, paused, on its first keyframe until then. One pass, about
   1.6s: the wordmark and its sources, then each arc clockwise with its stop
   and its stage's text, the coral arc last. Opacity, translate, scale and dash offset only,
   so nothing moves the layout. */
@keyframes loop-rise { from { opacity: 0; translate: 0 8px; } }
@keyframes loop-pop  { from { opacity: 0; scale: 0.9; } }
@keyframes loop-fade { from { opacity: 0; } }
@keyframes loop-draw { from { stroke-dashoffset: 1; opacity: 0; } 1% { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .loop--anim :is(.loop__mark, .loop__stage) { animation: loop-rise 0.45s ease-out both paused; }
  .loop--anim .loop__stop { animation: loop-pop 0.35s ease-out both paused; }
  .loop--anim .loop__arc { stroke-dasharray: 1; animation: loop-draw 0.4s ease-in-out both paused; }
  .loop--anim .loop__tip { stroke-dasharray: none; animation: loop-fade 0.15s ease-out both paused; }
  .loop--anim.loop--in :is(.loop__mark, .loop__stage, .loop__stop, .loop__arc) { animation-play-state: running; }

  .loop--anim :is(.loop__stop--1, .loop__stage--1) { animation-delay: 0.3s; }
  .loop--anim .loop__arc--1 { animation-delay: 0.85s; }
  .loop--anim :is(.loop__tip--1, .loop__stop--2, .loop__stage--2) { animation-delay: 1.25s; }
  .loop--anim .loop__arc--2 { animation-delay: 1.8s; }
  .loop--anim :is(.loop__tip--2, .loop__stop--3, .loop__stage--3) { animation-delay: 2.2s; }
  .loop--anim .loop__arc--3 { animation-delay: 2.75s; }
  .loop--anim :is(.loop__tip--3, .loop__stop--4, .loop__stage--4) { animation-delay: 3.15s; }
  .loop--anim .loop__arc--4 { animation-delay: 3.7s; animation-duration: 0.5s; }
  .loop--anim .loop__tip--4 { animation-delay: 4.2s; }
}

/* Build has four outputs in two rows: the documents, then the experiences.
   Each row wraps by itself on a narrow screen. */
.loop__chips--next { margin-top: calc(8px * var(--s, 1)); }
