/* RedClinic pilot application — one question at a time, nothing else on screen.
   White, charcoal ink, one red for actions and ticks. Figtree throughout. */

@font-face {
  font-family: "Figtree";
  src: url(/assets/figtree-var.woff2) format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --ink: #16191e;
  --ink-2: #555c66;
  --ink-3: #8a9099;
  --line: #e4e5e8;
  --line-2: #d3d5d9;
  --soft: #f6f6f4;
  --red: #de0a12;
  --red-deep: #b8070e;
  --red-tint: #fdf2f2;
  --font: "Figtree", "Segoe UI", Roboto, system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --col: 520px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: #fff; color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(222, 10, 18, .35); outline-offset: 2px; }
.hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { display: block; }

/* ---------- Frame ---------- */
.app {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  max-width: calc(var(--col) + 48px); margin: 0 auto;
  padding: 0 24px env(safe-area-inset-bottom);
}
@media (min-width: 720px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, #fff 40%, var(--soft) 100%) fixed; }
  .app { justify-content: center; padding-top: 48px; padding-bottom: 48px; }
  .flow { background: #fff; border: 1px solid var(--line); border-radius: 28px; padding: 44px 48px 40px; box-shadow: 0 1px 2px rgba(22,25,30,.04), 0 24px 60px -28px rgba(22,25,30,.18); }
}

/* ---------- Top: back, progress, count ---------- */
.top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px; height: 72px; }
@media (min-width: 720px) { .top { height: auto; margin-bottom: 20px; } }
.top.is-hidden { visibility: hidden; }
.back { grid-column: 1; width: 44px; height: 44px; margin-left: -10px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.back:hover { background: var(--soft); }
.back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.progress { grid-column: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.progress span { height: 4px; border-radius: 4px; background: var(--line); position: relative; overflow: hidden; }
.progress span::after { content: ""; position: absolute; inset: 0; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.progress span.on::after { transform: scaleX(1); }
.step-count { grid-column: 3; margin: 0; text-align: right; font-size: .85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Steps and transitions ---------- */
.flow { flex: 1; display: flex; flex-direction: column; position: relative; }
@media (min-width: 720px) { .flow { flex: 0 0 auto; } }
.step { display: flex; flex-direction: column; flex: 1; padding-bottom: 24px; }
.step.enter { animation: enter .42s var(--ease) both; }
.step.enter-back { animation: enter-back .42s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.step.enter > :not(.error), .step.enter-back > :not(.error) { animation: rise .5s var(--ease) both; }
.step.enter > *:nth-child(2), .step.enter-back > *:nth-child(2) { animation-delay: .04s; }
.step.enter > *:nth-child(3), .step.enter-back > *:nth-child(3) { animation-delay: .08s; }
.step.enter > *:nth-child(4), .step.enter-back > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { margin: 0; font-weight: 650; font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.15rem); line-height: 1.15; letter-spacing: -.022em; text-wrap: balance; }
h1:focus { outline: none; }
.sub { margin: 12px 0 0; color: var(--ink-2); font-size: 1.05rem; text-wrap: pretty; }

/* Seats */
.seats { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; margin: 8px 0 22px; padding: 7px 14px 7px 12px; border-radius: 999px; background: var(--red-tint); color: var(--ink); font-size: .9rem; line-height: 1.2; }
.seats b { font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--red); position: relative; flex: none; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--red); opacity: 0; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.5); opacity: .6; } 80%, 100% { transform: scale(1.6); opacity: 0; } }

/* ---------- Step 1: choices ---------- */
.choices { display: grid; gap: 12px; margin-top: 28px; }
.choice { position: relative; display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 14px 18px; border: 1.5px solid var(--line); border-radius: 18px; background: #fff; cursor: pointer; transition: border-color .2s, background-color .2s, transform .15s var(--ease), box-shadow .2s; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:hover { border-color: var(--line-2); box-shadow: 0 6px 20px -12px rgba(22,25,30,.25); }
.choice:active { transform: scale(.985); }
.choice:has(input:focus-visible) { outline: 3px solid rgba(222,10,18,.35); outline-offset: 2px; }
.choice-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; flex: none; transition: background-color .2s, color .2s; }
.choice-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.choice-text { flex: 1; font-weight: 600; font-size: 1.08rem; }
.choice-go { color: var(--ink-3); transition: transform .2s var(--ease), color .2s; }
.choice-go svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.choice:hover .choice-go { transform: translateX(3px); color: var(--ink); }
.choice:has(input:checked) { border-color: var(--ink); background: #fff; }
.choice:has(input:checked) .choice-icon { background: var(--red); color: #fff; }
.choice:has(input:checked) .choice-go { color: var(--red); transform: translateX(3px); }
.choice-quiet .choice-text { font-weight: 500; color: var(--ink-2); }
.choice-quiet:has(input:checked) .choice-icon { background: var(--ink); }

/* ---------- Step 2: fields ---------- */
.fields { display: grid; gap: 20px; margin-top: 28px; }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 8px; }
.field input, .phone { width: 100%; height: 56px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.field input { padding: 0 16px; font-size: 1.08rem; }
.field input::placeholder { color: #b3b7bd; }
.field input:hover, .phone:hover { border-color: var(--line-2); }
.field input:focus, .phone:focus-within { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(22,25,30,.06); }
.phone { display: flex; align-items: center; overflow: hidden; }
.phone span { padding: 0 4px 0 16px; color: var(--ink-2); font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.phone input { flex: 1; height: 100%; border: 0; border-radius: 0; padding-left: 8px; box-shadow: none !important; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.field.invalid input, .field.invalid .phone { border-color: var(--red); }
.field.invalid .phone input { border: 0; }
.error { margin: 8px 0 0; color: var(--red-deep); font-size: .9rem; }

/* ---------- Step 3: outcome tiles ---------- */
.chips { border: 0; padding: 0; margin: 24px 0 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.chip { position: relative; cursor: pointer; display: flex; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font-size: .95rem; font-weight: 500; line-height: 1.25; user-select: none; transition: border-color .2s, background-color .2s, transform .15s var(--ease); }
.chip span::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-2); background: #fff center/12px no-repeat; transition: background-color .2s, border-color .2s, transform .25s var(--ease); }
.chip:hover span { border-color: var(--line-2); }
.chip:active span { transform: scale(.97); }
.chip input:focus-visible + span { outline: 3px solid rgba(222,10,18,.35); outline-offset: 2px; }
.chip input:checked + span { border-color: var(--ink); background: var(--red-tint); }
.chip input:checked + span::before { border-color: var(--red); background-color: var(--red); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E"); animation: pop .3s var(--ease); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (max-width: 340px) { .chips { grid-template-columns: 1fr; } }
@media (min-width: 720px) { .chip span { font-size: 1rem; padding: 12px 14px; } }

/* ---------- Buttons ---------- */
.bar { margin-top: auto; padding-top: 28px; }
@media (max-width: 719px) {
  .bar { position: sticky; bottom: 0; margin-left: -24px; margin-right: -24px; padding: 16px 24px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(to top, #fff 72%, rgba(255,255,255,0)); }
}
@media (min-width: 720px) { .bar { margin-top: 32px; padding-top: 0; } }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 28px; border: 0; border-radius: 16px; font-weight: 600; font-size: 1.05rem; text-decoration: none; cursor: pointer; transition: background-color .2s, transform .15s var(--ease), box-shadow .2s; }
.btn:active { transform: scale(.985); }
.btn-block { width: 100%; }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 10px 24px -12px rgba(222,10,18,.6); }
.btn-red:hover { background: var(--red-deep); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #000; }
.btn-text { border: 0; background: none; padding: 10px 4px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: .25em; cursor: pointer; font-size: .98rem; }
.btn-text:hover { color: var(--ink); text-decoration-color: currentColor; }
.btn-inline { padding: 0; font-size: inherit; color: var(--ink); font-weight: 600; }
.fine { margin: 12px 0 0; text-align: center; font-size: .88rem; color: var(--ink-3); }
.spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn.is-busy { pointer-events: none; }
.btn.is-busy .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Not for you ---------- */
.step-center { align-items: center; text-align: center; justify-content: center; }
.step-center .sub { max-width: 26em; }
.badge-neutral { width: 64px; height: 64px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; margin-bottom: 24px; color: var(--ink-2); }
.badge-neutral svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.ring { width: 40px; height: 40px; margin: 24px 0 8px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 113.1; stroke-dashoffset: 0; stroke-linecap: round; }
.ring.run circle { animation: drain 5s linear forwards; }
@keyframes drain { to { stroke-dashoffset: 113.1; } }
.actions-col { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 16px; width: 100%; max-width: 320px; }
.actions-col .btn { width: 100%; }

/* ---------- Done ---------- */
.step-done { padding-top: 8px; }
.logo { width: 176px; height: auto; margin: 8px 0 40px; }
.tick { width: 72px; height: 72px; margin-bottom: 24px; }
.tick svg { width: 100%; height: 100%; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tick circle { stroke: var(--red); stroke-width: 2.5; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .7s var(--ease) .15s forwards; }
.tick path { stroke: var(--red); stroke-width: 3.5; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s var(--ease) .7s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.receipt { margin: 28px 0 0; width: 100%; max-width: 360px; border-top: 1px solid var(--line); text-align: left; }
.receipt div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.receipt dt { color: var(--ink-3); }
.receipt dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.seats-done { align-self: center; margin: 28px 0 8px; }

.noscript { max-width: 520px; margin: 40px auto; padding: 0 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .pulse::after { display: none; }
}
.chip em { font-style: normal; min-width: 0; }
.nw { font-style: normal; white-space: nowrap; }
