/* /agencies motion layer (this page only). The baseline here is the FINAL state
   of every mock-up (JavaScript off, reduced motion, script missing). Anything
   that hides or offsets sits under `html.ag-on`, which agencies.js sets only
   while it runs, and only on screen. Motion is transform and opacity; animated
   boxes have reserved dimensions, so nothing shifts the layout. */

/* -- Shared look of the mock-ups (brand tokens: navy #1b2a4a, amber #d4942a, charcoal #2d2d2d, slate #64748b, off-white #fafaf7) */

.ag-frame,
.ag-panel {
  overflow: hidden;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 20px 40px -15px rgb(0 0 0 / 0.05);
}

.ag-frame {
  border: 1px solid rgb(226 232 240 / 0.7);
}

.ag-vis {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  background: rgb(250 250 247 / 0.7);
}

.ag-wdots {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 1.75rem;
  border-radius: 9999px;
  background: #e2e8f0;
  box-shadow:
    0.875rem 0 #e2e8f0,
    1.75rem 0 #e2e8f0;
}

.ag-sbadge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 1.25rem;
  border-radius: 9999px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.ag-flag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.ag-flag-a {
  background: rgb(212 148 42 / 0.1);
  color: #d4942a;
}

.ag-flag-r {
  background: rgb(176 64 72 / 0.1);
  color: #b04048;
}

.ag-chip {
  flex: 0 1 7.5rem;
  min-width: 0;
  overflow: hidden;
  padding: 0.25rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  background: #fff;
  color: #2d2d2d;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The connector between two chips keeps a visible stub: below about 296px of
   card the chips shrink (their text ellipsises) before the line disappears. */
.ag-chip + .ag-gx {
  min-width: 1.5rem;
}

.ag-qbar {
  flex: 1 1 0%;
  border-radius: 0.125rem;
  background: rgb(27 42 74 / 0.8);
}

.ag-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  background: #cbd5e1;
}

.ag-fill {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: #1b2a4a;
}

.ag-rname {
  flex: 1 1 0%;
  overflow: hidden;
  color: #2d2d2d;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-rbar {
  width: 3rem;
  height: 0.25rem;
  overflow: hidden;
  border-radius: 9999px;
  background: #e2e8f0;
}

.ag-rfill {
  display: block;
  height: 100%;
  border-radius: 9999px;
}

/* ag-dN: a motion start offset of N * 50ms (agencies_ui.delay_class). */
.ag-d1 { --d: 50ms; }
.ag-d2 { --d: 100ms; }
.ag-d3 { --d: 150ms; }
.ag-d4 { --d: 200ms; }
.ag-d5 { --d: 250ms; }
.ag-d6 { --d: 300ms; }
.ag-d7 { --d: 350ms; }
.ag-d8 { --d: 400ms; }
.ag-d9 { --d: 450ms; }
.ag-d10 { --d: 500ms; }
.ag-d11 { --d: 550ms; }
.ag-d12 { --d: 600ms; }
.ag-d13 { --d: 650ms; }
.ag-d14 { --d: 700ms; }
.ag-d15 { --d: 750ms; }
.ag-d16 { --d: 800ms; }
.ag-d17 { --d: 850ms; }
.ag-d18 { --d: 900ms; }
.ag-d19 { --d: 950ms; }
.ag-d20 { --d: 1000ms; }
.ag-d21 { --d: 1050ms; }
.ag-d22 { --d: 1100ms; }
.ag-d23 { --d: 1150ms; }
.ag-d24 { --d: 1200ms; }
.ag-d25 { --d: 1250ms; }
.ag-d26 { --d: 1300ms; }
.ag-d27 { --d: 1350ms; }
.ag-d28 { --d: 1400ms; }
.ag-d29 { --d: 1450ms; }
.ag-d30 { --d: 1500ms; }
.ag-d31 { --d: 1550ms; }
.ag-d32 { --d: 1600ms; }
.ag-d33 { --d: 1650ms; }
.ag-d34 { --d: 1700ms; }
.ag-d35 { --d: 1750ms; }
.ag-d36 { --d: 1800ms; }
.ag-d37 { --d: 1850ms; }
.ag-d38 { --d: 1900ms; }
.ag-d39 { --d: 1950ms; }
.ag-d40 { --d: 2000ms; }
.ag-d41 { --d: 2050ms; }
.ag-d42 { --d: 2100ms; }
/* -- Funnel boards: baseline is the final state. Rows are bare tags styled by
   position: b rank, i badge (u score), strong name, small job and place, em
   ratio, mark pill. `--r` is a row's final rank; the rest is derived here. */

.ag-fun {
  --row-h: 52px;
  --hh: 36px;
  --c: 20;
  --fr: 7;
  --fpx: 15px;
  --fh: calc(var(--fr) * var(--fpx) + 8px);
}

@media (min-width: 640px) {
  .ag-fun {
    --row-h: 56px;
    --c: 28;
    --fr: 5;
  }
}

.ag-fun.ag-cmp {
  --row-h: 28px;
}

.ag-hero {
  --gap: 26px;
  --k: 10;
  --pile: 2.4;
}

.ag-pile {
  --pile: 0.6;
}

.ag-hero.ag-pile {
  --pile: 2.4;
}

/* Header rows: title and count chips; the label over the enquiry marks. */
.ag-bh,
.ag-fl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1rem;
}

.ag-bh {
  height: var(--hh);
  border-bottom: 1px solid #f1f5f9;
}

.ag-fl {
  height: 28px;
}

.ag-bt {
  overflow: hidden;
  font-family: Satoshi, "DM Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1b2a4a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-c {
  margin-left: 0.75rem;
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
}

.ag-fl .ag-c,
.ag-enq .ag-c {
  margin-left: 0;
}

.ag-c b {
  font-weight: 600;
  color: #1b2a4a;
  font-variant-numeric: tabular-nums;
}

.ag-dn {
  font-size: 0.75rem;
  color: #64748b;
}

/* The 140 enquiry marks: the 35 that apply stay solid, the rest fade. */
.ag-field {
  display: grid;
  grid-template-columns: repeat(var(--c), 1fr);
  grid-auto-rows: var(--fpx);
  align-items: center;
  justify-items: center;
  box-sizing: border-box;
  height: var(--fh);
  padding: 0 12px 8px;
}

.ag-field > i {
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  background: #1b2a4a;
}

.ag-field > i:not(:nth-child(4n + 2)) {
  opacity: 0.16;
}

.ag-field > i:nth-child(8n + 1) { --md: 0ms; }
.ag-field > i:nth-child(8n + 2) { --md: 280ms; }
.ag-field > i:nth-child(8n + 3) { --md: 120ms; }
.ag-field > i:nth-child(8n + 4) { --md: 400ms; }
.ag-field > i:nth-child(8n + 5) { --md: 60ms; }
.ag-field > i:nth-child(8n + 6) { --md: 340ms; }
.ag-field > i:nth-child(8n + 7) { --md: 180ms; }
.ag-field > i:nth-child(8n + 8) { --md: 220ms; }

/* Rows sit at their rank's offset (--y), plus the divider's gap past the shortlist. */
.ag-rows {
  position: relative;
  height: calc(var(--row-h) * var(--vis, 6) + var(--gap, 0px));
}

.ag-rows > div {
  --i: mod(calc(var(--r) * 11 + 7), 35);
  --px: calc(mod(var(--i) * 37, 41) * 1px - 20px);
  --jy: calc(mod(var(--i) * 53, 49) * 1px - 24px);
  --pr: calc((mod(var(--i) * 29, 7) - 3) * 0.5deg);
  --y: calc(
    var(--r) * var(--row-h) + var(--gap, 0px) *
      clamp(0, var(--r) - var(--k, 99) + 1, 1)
  );
  --ox: var(--px);
  --oy: calc(var(--row-h) * var(--pile, 1) + var(--jy) - 28px);
  --sx: 1;
  --sy: 1;
  position: absolute;
  /* Decorative, and the empty ones sit over whatever follows the board (the
     caption), so they never take the pointer. */
  pointer-events: none;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--row-h);
  padding: 0 0.75rem;
  transform: translate(0, var(--y)) rotate(0deg) scale(1, 1);
}

/* Each card leaves its own mark (4i + 1 of 140): offsets are that mark's centre relative to the row. */
.ag-hero .ag-rows > div {
  --d4: calc(var(--i) * 4 + 1);
  --mc: mod(var(--d4), var(--c));
  --mr: calc((var(--d4) - var(--mc)) / var(--c));
  --ox: calc(((var(--mc) + 0.5) / var(--c) - 0.5) * (100% - 24px));
  --oy: calc(
    (var(--mr) + 0.5) * var(--fpx) - var(--fh) - var(--hh) - var(--row-h) / 2
  );
  --sx: 0.02;
  --sy: 0.2;
}

.ag-rows > div:empty {
  opacity: 0;
}

/* ::before is the card in the pile, ::after the divider once ranked (the top row's is the amber accent). */
.ag-rows > div::before {
  content: "";
  position: absolute;
  inset: 3px 6px;
  border-radius: 0.6rem;
  background: #fff;
  border: 1px solid rgb(226 232 240 / 0.8);
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.08);
  opacity: 0;
}

.ag-rows > div::after {
  content: "";
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: rgb(241 245 249);
}

.ag-rows > div:first-child::after {
  top: 6px;
  bottom: 6px;
  left: 0;
  right: auto;
  width: 2px;
  height: auto;
  border-radius: 1px;
  background: #d4942a;
}

/* A card ranked out of view is an empty div: a card with analysing dots in the pile, invisible once ranked. */
.ag-rows > div:empty::after {
  top: 50%;
  left: 18px;
  right: auto;
  width: 2.5rem;
  height: 1.25rem;
  margin-top: -0.625rem;
  border-radius: 9999px;
  background:
    radial-gradient(circle at 30% 50%, #64748b 2px, transparent 2.6px),
    radial-gradient(circle at 50% 50%, #64748b 2px, transparent 2.6px),
    radial-gradient(circle at 70% 50%, #64748b 2px, transparent 2.6px), #e2e8f0;
  opacity: 0;
}

/* Row contents (fonts as tailwind.config.js: Satoshi/DM Sans headline, Geist Mono). */
.ag-rows > div > * {
  position: relative;
  z-index: 1;
  font-style: normal;
  text-decoration: none;
}

.ag-rows > div > b,
.ag-rows > div > em {
  display: none;
  font-family: "Geist Mono", monospace;
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
}

.ag-rows > div > b {
  width: 1.5rem;
  text-align: right;
  color: #64748b;
}

.ag-rows > div > em {
  color: #2d2d2d;
}

@media (min-width: 640px) {
  .ag-rows > div > b,
  .ag-rows > div > em {
    display: block;
  }
}

/* Score badge: a fixed box with the analysing dots (::before) and the settled score (u). */
.ag-rows > div > i {
  position: relative;
  flex: none;
  width: 2.5rem;
  height: 1.25rem;
}

.ag-rows > div > i::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background:
    radial-gradient(circle at 30% 50%, #64748b 2px, transparent 2.6px),
    radial-gradient(circle at 50% 50%, #64748b 2px, transparent 2.6px),
    radial-gradient(circle at 70% 50%, #64748b 2px, transparent 2.6px), #e2e8f0;
  opacity: 0;
}

.ag-rows > div > i > u {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.ag-strong {
  background: #2d8a7e;
}

.ag-review {
  background: #c4922a;
}

.ag-weak {
  background: #b04048;
}

/* Job and place under the name on detailed rows. */
.ag-rows > div > strong,
.ag-rows > div > span {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-rows > div strong {
  font-family: Satoshi, "DM Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2d2d2d;
}

.ag-cmp .ag-rows > div strong {
  font-size: 0.8125rem;
}

.ag-rows > div > span > strong,
.ag-rows > div > span > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ag-rows > div > span > small {
  font-size: 0.75rem;
  color: #64748b;
}

/* On compact rows they follow the name, on wide screens. */
.ag-cmp .ag-rows > div > span > strong,
.ag-cmp .ag-rows > div > span > small {
  display: inline;
}

.ag-cmp .ag-rows > div > span > small {
  display: none;
  margin-left: 0.5rem;
}

@media (min-width: 640px) {
  .ag-cmp .ag-rows > div > span > small {
    display: inline;
  }
}

/* Status pills as the product's: Shortlisted (amber), Reviewing (navy). */
.ag-rows > div > mark {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: rgb(212 148 42 / 0.1);
  color: #d4942a;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.ag-rows > div > mark.ag-pr {
  background: rgb(27 42 74 / 0.1);
  color: #1b2a4a;
}

/* The line between shortlist and reserve; the soft edge under rows that continue. */
.ag-div {
  position: absolute;
  top: calc(var(--row-h) * var(--k));
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: var(--gap);
  padding: 0 1rem;
  color: #64748b;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ag-div::after {
  content: "";
  flex: 1 1 0%;
  height: 1px;
  background: #e2e8f0;
}

.ag-div b {
  font-weight: 600;
  color: #1b2a4a;
}

.ag-fade-edge {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3rem;
  pointer-events: none;
  background: linear-gradient(to top, #fff, rgb(255 255 255 / 0));
}

/* Step three: status moves to Viewing held, then the reference checks. */
.ag-view {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.75rem 1rem 0.875rem;
  border-top: 1px solid #f1f5f9;
}

.ag-stp {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.75rem;
}

.ag-who2 {
  font-family: Satoshi, "DM Sans", sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1b2a4a;
}

.ag-stp > span {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.125rem;
}

.ag-stp > span > span {
  position: relative;
  padding-left: 0.875rem;
  color: #64748b;
  white-space: nowrap;
}

.ag-stp > span > span::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: -0.25rem;
  border-radius: 9999px;
  background: #1b2a4a;
}

.ag-stp > span > .ag-cur {
  font-weight: 600;
  color: #1b2a4a;
}

.ag-stp > span > .ag-cur::before {
  background: #d4942a;
}

.ag-refs {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #64748b;
}

.ag-refs b {
  font-weight: 600;
  color: #1b2a4a;
}

/* The hero's caption. */
.ag-cap {
  margin: 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #64748b;
}

/* Step one: enquiries, the link going back, the optional reminder. */
.ag-enq {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.ag-enq .ag-fl {
  height: auto;
  padding: 0;
}

.ag-er {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.375rem;
  border-top: 1px solid #f1f5f9;
}

.ag-em {
  overflow: hidden;
  font-family: "Geist Mono", monospace;
  font-size: 0.75rem;
  color: #2d2d2d;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-lk,
.ag-rm {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.ag-lk {
  padding: 0 0.5rem;
  border: 1px solid rgb(212 148 42 / 0.45);
  border-radius: 9999px;
  color: #1b2a4a;
}

.ag-rm {
  color: #2d8a7e;
}

.ag-rem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.625rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: rgb(250 250 247 / 0.7);
}

.ag-rl {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1b2a4a;
}

.ag-sw {
  position: relative;
  width: 1.75rem;
  height: 1rem;
  border-radius: 9999px;
  background: #2d8a7e;
}

.ag-sw::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  background: #fff;
}

/* Rules gated on html.ag-on are screen-only, so a printed page shows the final
   states. A board's phases are classes agencies.js adds one by one and never
   removes (`p-go` is only a lead-in hold, then `p-apply`, `p-pile`, `p-rank`,
   `p-short`, `p-view`, `p-refs`): "from phase X on" is `.p-X`. Only a board's own
   elements wait on the phases its data-ag-board lists. */
@media screen {

/* -- Enquiry marks (hero): they arrive on load (a plain animation, so a phone shows
   stage one before the visitor scrolls to the rest); phases take over at `p-apply`. */

@keyframes ag-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

@keyframes ag-in-fade {
  from {
    opacity: 0;
  }
}

html.ag-on .ag-hero .ag-field > i {
  animation: ag-in 520ms cubic-bezier(0.22, 0.7, 0.2, 1) var(--md, 0ms) backwards;
}

html.ag-on .ag-hero .ag-fl {
  animation: ag-in-fade 500ms ease backwards;
}

html.ag-on .ag-hero .ag-field > i,
html.ag-on .ag-hero .ag-dn,
html.ag-on .ag-hero .ag-ca,
html.ag-on .ag-hero .ag-cs,
html.ag-on .ag-hero .ag-div {
  transition: opacity 520ms ease;
}

html.ag-on .ag-hero:not(.p-apply) .ag-field > i:not(:nth-child(4n + 2)) {
  opacity: 1;
}

html.ag-on .ag-hero:not(.p-apply) .ag-dn,
html.ag-on .ag-hero:not(.p-apply) .ag-ca,
html.ag-on .ag-hero:not(.p-short) .ag-cs,
html.ag-on .ag-hero:not(.p-short) .ag-div {
  opacity: 0;
}

/* -- Cards and rows (pile boards) */

html.ag-on .ag-rows > div {
  transition:
    transform 780ms cubic-bezier(0.22, 0.7, 0.2, 1) var(--td, 0ms),
    opacity 420ms ease var(--td, 0ms);
}

/* Before the pile: cards wait where they come from, invisible. */
html.ag-on .ag-pile:not(.p-pile) .ag-rows > div {
  opacity: 0;
  transform: translate(var(--ox), var(--oy)) rotate(var(--pr))
    scale(var(--sx), var(--sy));
}

/* Pile: each application lands as a tilted card. */
html.ag-on .ag-pile.p-pile .ag-rows > div {
  opacity: 1;
  transform: translate(
      var(--px),
      calc(var(--row-h) * var(--pile) + var(--jy))
    )
    rotate(var(--pr)) scale(0.7, 1);
  --td: calc(var(--i) * 18ms);
}

/* Ranked: cards slide into rank order; those below the fold fade out. */
html.ag-on .ag-pile.p-rank .ag-rows > div {
  transform: translate(0, var(--y)) rotate(0deg) scale(1, 1);
  --td: calc(var(--r) * 16ms);
}

html.ag-on .ag-pile.p-rank .ag-rows > div:empty {
  opacity: 0;
}

/* A card shows its contents once grown, and its late parts once ranked. */
html.ag-on .ag-rows > div > *,
html.ag-on .ag-rows > div::before,
html.ag-on .ag-rows > div::after,
html.ag-on .ag-rows > div > i::before {
  transition: opacity 380ms ease calc(var(--td, 0ms) + 300ms);
}

html.ag-on .ag-pile:not(.p-pile) .ag-rows > div > * {
  opacity: 0;
}

html.ag-on .ag-pile:not(.p-rank) .ag-rows > div > b,
html.ag-on .ag-pile:not(.p-rank) .ag-rows > div > em,
html.ag-on .ag-pile:not(.p-rank) .ag-rows > div > i > u,
html.ag-on .ag-pile:not(.p-rank) .ag-rows > div > mark.ag-pr {
  opacity: 0;
}

html.ag-on .ag-fun:not(.p-short) .ag-rows > div > mark:not(.ag-pr) {
  opacity: 0;
}

/* Cards in the pile, list rows once ranked; analysing dots until the score settles. */
html.ag-on .ag-pile:not(.p-rank) .ag-rows > div::before,
html.ag-on .ag-pile:not(.p-rank) .ag-rows > div > i::before,
html.ag-on .ag-pile:not(.p-rank) .ag-rows > div:empty::after {
  opacity: 1;
}

html.ag-on .ag-pile:not(.p-rank) .ag-rows > div:not(:empty)::after {
  opacity: 0;
}

html.ag-on .ag-pile.p-pile:not(.p-rank) .ag-rows > div > i::before {
  animation: ag-pulse 1.1s ease-in-out infinite;
}

@keyframes ag-pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* -- Step three */

html.ag-on .ag-stp > span > .ag-cur,
html.ag-on .ag-refs {
  transition:
    opacity 450ms ease,
    transform 450ms cubic-bezier(0.22, 0.7, 0.2, 1);
}

html.ag-on .ag-fun:not(.p-view) .ag-stp > span > .ag-cur {
  opacity: 0;
  transform: translate(-6px, 0);
}

html.ag-on .ag-fun:not(.p-refs) .ag-refs {
  opacity: 0;
  transform: translate(0, 6px);
}

}

/* -- Scene primitives: final states */

.ag-gx {
  transform-origin: left center;
}

.ag-gy {
  transform-origin: center bottom;
}

/* Grows downward from its top end (link connectors). */
.ag-gyt {
  transform-origin: center top;
}

.ag-dim {
  opacity: 0.28;
}

.ag-mark {
  position: relative;
  z-index: 0;
  white-space: nowrap;
}

/* A highlighted run that must wrap: its own box, one rectangle. */
.ag-mark-wrap {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  word-break: break-all;
}

.ag-mark::before {
  content: "";
  position: absolute;
  inset: -1px -2px;
  z-index: -1;
  border-radius: 3px;
  background: rgb(212 148 42 / 0.3);
  transform-origin: left center;
}

/* -- Scene primitives: motion (screen, motion on) */
@media screen {

html.ag-on .ag-fade,
html.ag-on .ag-pop,
html.ag-on .ag-gx,
html.ag-on .ag-gy,
html.ag-on .ag-gyt,
html.ag-on .ag-dim,
html.ag-on .ag-mark::before {
  transition:
    transform 650ms cubic-bezier(0.22, 0.7, 0.2, 1) var(--d, 0ms),
    opacity 650ms ease var(--d, 0ms);
}

html.ag-on [data-ag-scene]:not(.ag-live) .ag-fade {
  opacity: 0;
  transform: translate(0, 10px);
}

html.ag-on [data-ag-scene]:not(.ag-live) .ag-pop {
  opacity: 0;
  transform: scale(0.8);
}

html.ag-on [data-ag-scene]:not(.ag-live) .ag-gx {
  transform: scaleX(0);
}

html.ag-on [data-ag-scene]:not(.ag-live) .ag-gy,
html.ag-on [data-ag-scene]:not(.ag-live) .ag-gyt {
  transform: scaleY(0);
}

html.ag-on [data-ag-scene]:not(.ag-live) .ag-dim {
  opacity: 1;
}

html.ag-on [data-ag-scene]:not(.ag-live) .ag-mark::before {
  transform: scaleX(0);
}

/* Cards rise as they scroll into view. */
html.ag-on .ag-card {
  transition:
    opacity 700ms ease var(--card-d, 0ms),
    transform 700ms cubic-bezier(0.22, 0.7, 0.2, 1) var(--card-d, 0ms);
}

html.ag-on .ag-card:not(.ag-live) {
  opacity: 0;
  transform: translate(0, 16px);
}

}

/* -- How it works: pinned device (desktop, motion on) */

.ag-device,
.ag-rail {
  display: none;
}

@media screen and (min-width: 1024px) and (min-height: 640px) {
  html.ag-on .ag-how {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 4rem;
    align-items: start;
  }

  html.ag-on .ag-device {
    display: block;
    position: sticky;
    top: 6rem;
    height: min(31rem, calc(100vh - 8.5rem));
  }

  html.ag-on .ag-step-vignette {
    display: none;
  }

  html.ag-on .ag-step {
    min-height: 70vh;
    align-items: center;
  }

  html.ag-on .ag-step-body {
    display: block;
  }

  html.ag-on .ag-step-badge {
    position: relative;
    z-index: 1;
    transition: transform 400ms cubic-bezier(0.22, 0.7, 0.2, 1);
  }

  html.ag-on .ag-step.is-active .ag-step-badge {
    transform: scale(1.12);
  }

  html.ag-on .ag-rail {
    display: block;
    position: absolute;
    left: 17px;
    top: 18px;
    bottom: 18px;
    width: 2px;
    border-radius: 1px;
    background: rgb(226 232 240);
  }

  html.ag-on .ag-rail-fill {
    position: absolute;
    inset: 0;
    border-radius: 1px;
    background: #d4942a;
    transform-origin: center top;
    transform: scaleY(var(--p, 0));
  }

  .ag-screens {
    flex: 1 1 auto;
    min-height: 0;
  }

  .ag-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 450ms ease,
      visibility 0s linear 450ms;
  }

  .ag-screen.is-current {
    opacity: 1;
    visibility: visible;
    transition:
      opacity 450ms ease 150ms,
      visibility 0s;
  }
}
