/* The difference: one lifter, twelve weeks, two ways, on one glass card. The chart (js/ba.js) draws the guessing line
   first, then SET's, each named at its end; the table under it sets the two ways side by side, moment by moment. */
.ba { position: relative; padding: calc(var(--section) * .8) 0 var(--section); }
.ba-head { display: grid; gap: clamp(20px, 2.4vw, 30px); max-width: 780px; }
.ba-eyebrow { margin: 0 0 -6px; color: var(--accent-text); font: 600 17px/1.2 var(--font); }
:root[data-theme="dark"] .ba-eyebrow { color: var(--ivory-2); }
.ba-head .lead { max-width: 48ch; }

.ba-card { --ba-s: var(--accent); --ba-w: var(--ink-3); --ba-bg: #FAF9F5;
  position: relative; margin: clamp(40px, 5vw, 64px) 0 0; padding: clamp(18px, 2.6vw, 34px) clamp(18px, 2.6vw, 34px) 0; border-radius: 30px;
  background: var(--glass-lit, transparent), var(--glass, var(--card)); box-shadow: var(--glass-edge, var(--shadow-card)); }
:root[data-theme="dark"] .ba-card { --ba-bg: #1E1E1C; }
.ba-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin: 0; }
.ba-note { color: var(--ink-3); font: 500 13px/1.3 var(--font); }

/* The chart: the plot sits inset, leaving room for the kg labels (left), the moment numbers (top), the end values (right)
   and the weeks (bottom). Points are placed in percent, so it fits any width without measuring. */
.ba-chart { position: relative; height: clamp(250px, 30vw, 360px); margin-top: clamp(14px, 2vw, 22px); }
.ba-plot { position: absolute; inset: 30px 110px 34px 46px; }
.ba-gy { position: absolute; left: 0; right: 0; top: var(--y); height: 0; border-top: 1px solid var(--line); }
.ba-gy b { position: absolute; right: calc(100% + 10px); top: 0; transform: translateY(-50%); color: var(--ink-3); font: 500 12px/1 var(--font); white-space: nowrap; }
.ba-wk { position: absolute; top: calc(100% + 12px); color: var(--ink-3); font: 500 12px/1 var(--font); white-space: nowrap; }
.ba-wk-0 { left: 0; }
.ba-wk-1 { right: 0; }

.ba-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ba-line polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ba-line-w polyline { stroke: var(--ba-w); stroke-width: 2; opacity: .75; }
.ba-line-s polyline { stroke: var(--ba-s); stroke-width: 3; }
.ba-line-s stop:first-child { stop-color: var(--ba-s); stop-opacity: .16; }
.ba-line-s stop:last-child { stop-color: var(--ba-s); stop-opacity: 0; }

.ba-dot { position: absolute; left: var(--x); top: var(--y); width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; }
.ba-dot-w { background: var(--ba-bg); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ba-w) 70%, transparent); }
.ba-dot-s { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; background: var(--ba-s); box-shadow: 0 0 0 3px var(--ba-bg); }
.ba-end { position: absolute; left: var(--x); top: var(--y); transform: translate(14px, -50%); font: 700 15px/1 var(--font); letter-spacing: -.01em; white-space: nowrap; }
.ba-end-s { color: var(--ink); }
.ba-end-w { color: var(--ink-3); font-weight: 600; }
.ba-end small { display: block; margin-bottom: 5px; font: 600 11px/1 var(--font); letter-spacing: .04em; text-transform: uppercase; }
.ba-end-s small { color: var(--accent-text); }
:root[data-theme="dark"] .ba-end-s small { color: var(--ivory-2); }

/* Drawn once in view: the guessing line wipes in, then SET's; dots, steps and marks arrive as the line reaches them. */
.js .ba-line { clip-path: inset(-20% 100% -20% 0); transition: clip-path var(--draw) linear var(--start); }
.ba-line-w { --draw: 1.1s; --start: 0s; }
.ba-line-s { --draw: 1.7s; --start: .5s; }
.js :is(.ba-dot, .ba-end) { opacity: 0; transition: opacity .35s ease var(--d), transform .5s var(--spring-bounce, ease) var(--d); }
.js .ba-dot { transform: scale(.4); }
.ba-card.is-drawn .ba-line { clip-path: inset(-20% -10% -20% 0); }
.ba-card.is-drawn :is(.ba-dot, .ba-end) { opacity: 1; }
.ba-card.is-drawn .ba-dot { transform: none; }
.ba-card.is-drawn .ba-end-w { opacity: .9; }

/* Under the chart: three moments, each answered in a few words, with where guessing would have left you underneath. */
.ba-out { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 8px calc(clamp(18px, 2.6vw, 34px) * -1) 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ba-out li { display: grid; align-content: start; gap: 4px; padding: 18px clamp(18px, 2.6vw, 34px) 22px; }
.ba-out li + li { border-left: 1px solid var(--line); }
.ba-out-l { color: var(--ink-3); font: 500 13px/1.3 var(--font); }
.ba-out b { color: var(--ink); font: 650 17px/1.3 var(--font); letter-spacing: -.015em; }
.ba-out-w { color: var(--ink-3); font: 400 14px/1.4 var(--font); }
.ba-foot { margin-top: clamp(32px, 4vw, 52px); color: var(--ink); font: 600 clamp(19px, 1.8vw, 24px)/1.35 var(--font); letter-spacing: -.015em; text-wrap: balance; }

@media (max-width: 760px) {
  .ba-chart { height: 248px; }
  .ba-plot { inset: 26px 92px 30px 34px; }
  .ba-gy b, .ba-wk { font-size: 11px; }
  .ba-gy b { right: calc(100% + 7px); }
  .ba-end { transform: translate(10px, -50%); font-size: 13px; }
  .ba-dot-s { width: 8px; height: 8px; margin: -4px 0 0 -4px; box-shadow: 0 0 0 2px var(--ba-bg); }
  .ba-line-s polyline { stroke-width: 2.5; }
  .ba-end small { font-size: 10px; }
  /* Narrow: the three moments as compact rows. */
  .ba-out { grid-template-columns: minmax(0, 1fr); }
  .ba-out li { padding-top: 14px; padding-bottom: 14px; gap: 2px; }
  .ba-out li + li { border-left: 0; border-top: 1px solid var(--line); }
  .ba-out b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .js .ba-line, .js :is(.ba-dot, .ba-end) { transition: none; }
}

/* The wink before the close: phase 0 is the tracker alone (line one lit), phase 1 grows SET's advice into it (line two lit). */
.outro { padding: clamp(80px, 11vw, 160px) 0 clamp(56px, 7vw, 100px); }
.outro-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: start; gap: clamp(40px, 6vw, 96px); }
.outro-title { color: var(--ink); font: 700 clamp(36px, 4.6vw, 72px)/1.04 var(--font); letter-spacing: -.045em; text-wrap: balance; }
.outro-title .line { display: block; }
.outro-title .line > span { transition: color .7s ease, transform 1.05s var(--ease-pres); }
.outro:is([data-phase="0"], [data-phase="-1"]) .l1 > span { color: var(--ink); }
.outro:is([data-phase="0"], [data-phase="-1"]) .l2 > span { color: var(--ink-3); opacity: .55; }
.outro[data-phase="1"] .l1 > span { color: var(--ink-3); font-weight: 600; }
.outro-smart { display: inline-flex; align-items: baseline; gap: .12em; white-space: nowrap; transition: color .6s ease; }
.outro[data-phase="1"] .outro-smart { color: var(--accent-text); }
:root[data-theme="dark"] .outro[data-phase="1"] .outro-smart { color: var(--mint); }
.outro-smart .signal { width: .62em; height: .62em; transform: translateY(.02em); }
.outro-smart .signal path { transform-box: fill-box; transform-origin: bottom; transform: scaleY(.25); transition: transform .6s var(--spring-bounce, ease); }
.outro[data-phase="1"] .outro-smart .signal path { transform: none; }
.outro[data-phase="1"] .outro-smart .signal path:nth-child(2) { transition-delay: .08s; }
.outro[data-phase="1"] .outro-smart .signal path:nth-child(3) { transition-delay: .16s; }

/* The stage: three real screens fan out (beautiful), then SET's advice, cut from the app, lands on top (smart). */
.outro-stage { position: relative; width: min(100%, 560px); aspect-ratio: 1 / 1.02; justify-self: center; container-type: inline-size; }
.os-screen, .os-card { position: absolute; margin: 0; overflow: hidden; }
.os-screen { top: 4%; left: 30%; width: 40%; aspect-ratio: 880 / 1912; border-radius: 5.4cqi;
  box-shadow: 0 0 0 1px rgb(21 21 20 / .08), 0 30px 60px -28px rgb(18 38 29 / .45);
  transition: transform 1.1s var(--ease-pres, cubic-bezier(.2,.8,.2,1)), filter .8s ease, opacity .8s ease; }
:root[data-theme="dark"] .os-screen { box-shadow: 0 0 0 1px rgb(255 255 255 / .1), 0 30px 60px -28px rgb(0 0 0 / .9); }
.os-screen .shot, .os-card .shot { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
:root:not([data-theme="dark"]) .outro-stage .shot-d, :root[data-theme="dark"] .outro-stage .shot-l { display: none; }
.os-mid { z-index: 2; }
.os-left { z-index: 1; transform: translateX(-62%) translateY(7%) rotate(-8deg); }
.os-right { z-index: 1; transform: translateX(62%) translateY(7%) rotate(8deg); }
.os-card { z-index: 3; left: 12%; top: 50%; width: 76%; aspect-ratio: 1176 / 691; border-radius: 4.6cqi;
  box-shadow: 0 0 0 1px rgb(21 21 20 / .08), 0 40px 80px -30px rgb(18 38 29 / .6), 0 0 0 6px color-mix(in srgb, var(--accent) 16%, transparent);
  transition: transform .9s var(--spring-bounce, cubic-bezier(.34, 1.3, .64, 1)), opacity .5s ease; }
:root[data-theme="dark"] .os-card { box-shadow: 0 0 0 1px rgb(255 255 255 / .12), 0 40px 80px -30px rgb(0 0 0 / .95), 0 0 0 6px rgb(241 241 240 / .1); }
.os-card-glow { position: absolute; inset: -40%; z-index: -1; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent); pointer-events: none; }

/* Phases: -1 stacked (before it is seen), 0 fanned out, 1 SET's advice on top. */
.outro[data-phase="-1"] .os-left, .outro[data-phase="-1"] .os-right { transform: none; }
.outro[data-phase="-1"] .os-card, .outro[data-phase="0"] .os-card { opacity: 0; transform: translateY(14%) scale(.86); }
.outro[data-phase="1"] .os-screen { filter: saturate(.85) brightness(.97); }
:root[data-theme="dark"] .outro[data-phase="1"] .os-screen { filter: brightness(.82); }

@media (max-width: 900px) {
  .outro-grid { grid-template-columns: minmax(0, 1fr); }
  .outro-stage { justify-self: start; width: min(100%, 440px); }
}
@media (prefers-reduced-motion: reduce) {
  .os-screen, .os-card, .outro-smart .signal path, .outro-title .line > span { transition: none !important; }
}
