/* ==========================================================================
   ai-coach.css — bespoke visuals for /work/ai-coach/
   Tokens only, except inside .phone__screen (mock UI).
   ========================================================================== */

.ac-before { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--before); }
.ac-results-prose { margin-top: clamp(32px, 5vw, 56px); }

/* ---------- Fig 01: time to first workout ---------- */
.ttw { display: grid; gap: clamp(20px, 3vw, 32px); }
.ttw__top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; }
.ttw .seg { flex-wrap: wrap; border-radius: 22px; }
.ttw__readout { display: grid; gap: .35rem; text-align: right; }
.ttw__readout strong {
  font: 400 clamp(2.2rem, 5vw, 3.2rem)/.9 var(--font-serif); letter-spacing: -.03em; color: var(--ink);
  transition: color .5s var(--ease-out);
}
.ttw[data-mode="after"] .ttw__readout strong { color: var(--signal); }
@media (max-width: 559px) { .ttw__readout { text-align: left; } }

.ttw__chart { position: relative; }
.ttw__legend { display: flex; align-items: center; gap: .55rem; margin-bottom: .6rem; }
.ttw__key { width: 22px; height: 2px; background: var(--ink); opacity: .7; }
.ttw__svg { width: 100%; height: auto; overflow: visible; }
.ttw__wait { fill: var(--line); transition: opacity .6s var(--ease-out); }
.ttw__waitlabel { font: 500 17px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; fill: var(--muted); transition: opacity .6s var(--ease-out); }
.ttw[data-mode="after"] .ttw__wait, .ttw[data-mode="after"] .ttw__waitlabel { opacity: 0; }
.ttw__base { stroke: var(--line-strong); stroke-width: 1; }
.ttw__curve { fill: none; stroke: var(--ink); stroke-opacity: .7; stroke-width: 2.5; stroke-linecap: round; }
.ttw__drop, .ttw__level { stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 4 5; }
.ttw__dot { fill: var(--before); stroke: var(--ink); stroke-opacity: .55; stroke-width: 2.5; transition: fill .4s, stroke .4s; }
.ttw[data-mode="after"] .ttw__dot { stroke: var(--surface); stroke-opacity: 1; stroke-width: 3; }
.ttw[data-mode="after"] .ttw__dot { fill: var(--signal); }
.ttw__axis { display: flex; justify-content: space-between; margin-top: .5rem; }

.ttw__steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.ttw__step {
  position: relative; display: grid; gap: .25rem; align-content: start; padding: .2rem 0 1.1rem 1.4rem;
  border-left: 2px solid var(--line-strong); opacity: .3;
  transition: opacity .5s var(--ease-out), border-color .5s var(--ease-out);
}
.ttw__step::before {
  content: ""; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px; border-radius: 50%;
  background: var(--paper-2); border: 2px solid var(--line-strong); transition: background-color .4s, border-color .4s;
}
.ttw__step.is-on { opacity: 1; border-left-color: var(--ink); }
.ttw__step.is-on::before { background: var(--ink); border-color: var(--ink); }
.ttw__step--wait { border-left-style: dashed; }
.ttw__step--end.is-on::before { background: var(--before); border-color: var(--before); }
.ttw[data-mode="after"] .ttw__step--end.is-on::before { background: var(--signal); border-color: var(--signal); }
.ttw__step .mono { color: var(--muted); }
.ttw__step--end.is-on .mono { color: var(--ink); }
.ttw[data-mode="after"] .ttw__step--end.is-on .mono { color: var(--signal-ink); }
.ttw__step h4 { font-size: 1rem; }
.ttw__step p { font-size: .88rem; line-height: 1.45; color: var(--ink-2); }
@media (min-width: 720px) {
  .ttw__steps { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1rem; }
  .ttw__step { padding: 1rem 0 0; border-left: 0; border-top: 2px solid var(--line-strong); }
  .ttw__step::before { left: 0; top: -6px; }
  .ttw__step.is-on { border-top-color: var(--ink); }
  .ttw__step--wait { border-top-style: dashed; grid-column: span 2; }
}

/* ---------- Why AI 4-up ---------- */
.why { display: grid; gap: 1rem; }
@media (min-width: 720px) { .why { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.why__card {
  display: grid; gap: .7rem; align-content: start; padding: clamp(20px, 2.4vw, 28px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.why__card h3 { font-size: 1.2rem; }
.why__card p { font-size: .96rem; line-height: 1.55; }
.why__n { color: var(--muted); }
.why__card--surprise { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
.why__card--surprise .why__n { color: var(--signal-ink); }
.why__viz { margin-top: .6rem; padding-top: 1rem; border-top: 1px dashed var(--line-strong); }

.why__viz--gap, .why__viz--repeat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem 1rem; align-items: center; }
.why__gapbar { display: block; height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.why__gapbar i { display: block; height: 100%; border-radius: inherit; transform-origin: left; transform: scaleX(0); transition: transform 1.2s var(--ease-out) .2s; }
.why__gapbar .b { width: 88%; background: var(--before); }
.why__gapbar .a { width: 4%; min-width: 8px; background: var(--signal); }
.is-in .why__gapbar i { transform: none; }

.clock24 { position: relative; height: 10px; margin-top: 1.8rem; border-radius: 999px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.clock24__mark { position: absolute; top: 50%; left: calc(var(--h) / 24 * 100%); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
.clock24__mark b { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font: 500 .72rem/1 var(--font-mono); color: var(--signal-ink); white-space: nowrap; }
.clock24__ticks { display: flex; justify-content: space-between; margin-top: .5rem; }

.why__cost { width: 100%; height: 80px; }
.why__cost line, .why__cost path { vector-effect: non-scaling-stroke; }
.why__cost .axis { stroke: var(--line-strong); stroke-width: 1; }
.why__cost .human { fill: none; stroke: var(--before); stroke-width: 3; stroke-linecap: round; }
.why__cost .ai { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round; }
.why__cost path { stroke-dasharray: 1000; stroke-dashoffset: 1000; transition: stroke-dashoffset 1.4s var(--ease-out) .2s; }
.is-in .why__cost path { stroke-dashoffset: 0; }
.why__costkey { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .6rem; text-transform: none; letter-spacing: .02em; }
.why__costkey span { display: inline-flex; align-items: center; gap: .4rem; }
.why__costkey i { width: 14px; height: 3px; border-radius: 2px; }
.why__costkey .k-h { background: var(--before); }
.why__costkey .k-a { background: var(--signal); }

.why__viz--repeat .once, .why__viz--repeat .many { display: flex; gap: 6px; }
.why__viz--repeat i { width: 10px; height: 10px; border-radius: 50%; background: var(--before); }
.why__viz--repeat .many i { background: var(--signal); }

/* ---------- Fig 02: AI Coach chat ---------- */
.coach { display: grid; gap: clamp(28px, 4vw, 48px); align-items: center; }
@media (min-width: 860px) { .coach { grid-template-columns: 300px minmax(0, 1fr); } }
.coach__side { display: grid; gap: 1.4rem; align-content: start; }
.coach__seg { justify-self: start; }
.coach__seg button { min-width: 72px; height: 40px; }
.coach__scene { display: grid; gap: .45rem; min-height: 9.5rem; }
.coach__scene h3 { font-size: 1.25rem; }
.coach__scene p { font-size: .96rem; line-height: 1.55; }
.coach__kicker { transition: color .3s; }
.coach[data-surprise="true"] .coach__kicker { color: var(--signal-ink); }
.coach__ctx { display: grid; gap: .6rem; }
.coach__ctx ul { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.coach__ctx li {
  display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: .6rem; align-items: center;
  padding: .6rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  font-size: .9rem; color: var(--ink-2);
  transition: border-color .4s var(--ease-out), background-color .4s var(--ease-out), color .4s;
}
.coach__ctx li.is-used { border-color: var(--signal); background: var(--signal-soft); color: var(--ink); }
.coach__ctx li.is-used .mono { color: var(--signal-ink); }
.coach__replay { justify-self: start; }

/* mock UI: hard-coded colours allowed inside .phone__screen */
.chat { position: absolute; inset: 0; display: flex; flex-direction: column; padding-top: 40px; font-family: var(--font-sans); }
.chat__bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px 12px; border-bottom: 1px solid rgba(21,20,15,.08); }
.chat__avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #ef4f16, #ff9a5c); color: #fff; font: 600 11px/1 var(--font-mono); letter-spacing: .04em;
}
.chat__who { display: grid; line-height: 1.2; }
.chat__who b { font-weight: 600; font-size: 13.5px; color: #15140f; }
.chat__who small { font: 500 10.5px/1.3 var(--font-mono); color: #6c685f; }
.chat__who small::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #2fbf71; vertical-align: 1px; }
.chat__log { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 7px; padding: 12px 12px 6px; }
.chat__input {
  display: flex; align-items: center; justify-content: space-between; margin: 6px 12px 16px; height: 38px; padding: 0 5px 0 14px;
  border-radius: 999px; background: #ece8de; color: #8b877d; font-size: 12.5px;
}
.chat__input i { width: 28px; height: 28px; border-radius: 50%; background: #15140f; }

.msg { max-width: 84%; padding: 8px 11px; border-radius: 16px; font-size: 12.3px; line-height: 1.42; animation: msg-in .45s var(--ease-out) both; }
.msg--u { align-self: flex-end; background: #15140f; color: #fbf9f4; border-bottom-right-radius: 5px; }
.msg--a { align-self: flex-start; background: #ece8de; color: #15140f; border-bottom-left-radius: 5px; }
.msg--card { align-self: flex-start; width: 86%; max-width: 86%; padding: 11px 12px; background: #fff; color: #15140f; border: 1px solid rgba(21,20,15,.1); border-bottom-left-radius: 5px; box-shadow: 0 6px 16px -10px rgba(21,20,15,.35); }
.msg--card .k { font: 500 9.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: #c63d0b; }
.msg--card .t { display: block; margin-top: 5px; font-weight: 600; font-size: 13.5px; }
.msg--card ul { margin: 7px 0 9px; padding: 0; list-style: none; display: grid; gap: 4px; }
.msg--card li { display: flex; gap: 8px; font-size: 11.5px; color: #3b3932; }
.msg--card li b { font: 500 10.5px/1.5 var(--font-mono); color: #15140f; min-width: 40px; }
.msg--card .cta { display: block; text-align: center; padding: 7px 0; border-radius: 999px; background: #ef4f16; color: #fff; font-weight: 600; font-size: 12px; }
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 11px 13px; border-radius: 16px; border-bottom-left-radius: 5px; background: #ece8de; animation: msg-in .3s var(--ease-out) both; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #8b877d; animation: typing 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Fig 03: aligned 14-day windows ---------- */
.align { display: grid; gap: 1.2rem; }
.align__top { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.align .seg { flex-wrap: wrap; border-radius: 22px; }
.align__count span { color: var(--signal-ink); font-size: .9rem; }
.align__grid { display: grid; gap: 10px; padding-top: 1.4rem; position: relative; }
.align__grid::before {
  content: "14-day window"; position: absolute; top: 0; left: calc(1.4rem + .6rem);
  font: 500 var(--fs-mono)/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--signal-ink);
}
.align__row { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) 2.6rem; gap: .6rem; align-items: center; }
.align__name { color: var(--ink); }
.align__track {
  position: relative; height: 18px;
  background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / 28));
}
.align__track::before {
  content: ""; position: absolute; left: -3px; top: -4px; bottom: -4px; width: calc(50% + 3px);
  border-radius: 5px; background: var(--signal-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--signal) 35%, transparent);
}
.align__strip {
  position: absolute; inset: 0 auto 0 0; width: 50%; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px;
  transform: translateX(calc(var(--off) * 100% / 14)); transition: transform 1s var(--ease-out);
}
.align[data-mode="own"] .align__strip { transform: none; }
.align__strip { align-items: center; }
.align__strip i { height: 4px; border-radius: 2px; background: var(--line-strong); transition: opacity .5s, background-color .4s; }
.align__strip i.on { height: 100%; border-radius: 3px; background: var(--ink); }
.align__strip i.out { opacity: .28; }
.align__row.is-hit .align__strip i.on:not(.out) { background: var(--signal); }
.align__res { text-align: right; color: var(--muted); }
.align__row.is-hit .align__res { color: var(--signal-ink); }
.align__note { font-size: .92rem; color: var(--ink-2); max-width: 60ch; min-height: 3em; }

@media (prefers-reduced-motion: reduce) {
  .msg, .typing { animation: none; }
  .why__gapbar i { transform: none; }
  .why__cost path { stroke-dashoffset: 0; }
}
@media (min-width: 900px) { .ttw__waitlabel { font-size: 13px; } }
