/* =========================================================================
   AI Clinic — Patient Intake · "Consultation Letter" design system
   Warm paper · editorial serif · one calm chapter at a time.
   ========================================================================= */

:root {
  /* warm paper palette */
  --paper:      #f3ecdf;
  --paper-2:    #fbf6ec;
  --paper-edge: #e9dfc9;
  --ink:        #241f17;
  --ink-soft:   #6b6253;
  --ink-faint:  #9a8f7c;
  --line:       #ddd1b8;
  --line-soft:  #e8dfca;

  /* one confident accent: deep viridian */
  --accent:       #1c6e5a;
  --accent-press: #155446;
  --accent-tint:  rgba(28, 110, 90, 0.10);
  --accent-glow:  rgba(28, 110, 90, 0.22);

  --danger:     #b23a2e;
  --danger-tint:rgba(178, 58, 46, 0.10);

  --radius:   14px;
  --radius-lg:20px;
  --shadow-1: 0 1px 2px rgba(40,33,20,.05), 0 4px 14px rgba(40,33,20,.05);
  --shadow-2: 0 10px 40px rgba(40,33,20,.13), 0 2px 8px rgba(40,33,20,.06);

  --ease:        cubic-bezier(.22,.61,.36,1);     /* gentle ease-out */
  --ease-spring: cubic-bezier(.34,1.56,.64,1);    /* slight overshoot */

  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --stage-w: 40rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  /* warm vignette so the page feels lit, not flat */
  background-image:
    repeating-linear-gradient(90deg, rgba(120,96,52,.022) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(0deg, rgba(120,96,52,.014) 0 1px, transparent 1px 6px),
    radial-gradient(120% 80% at 50% -10%, #f8f2e6 0%, var(--paper) 55%, #ece2cd 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  line-height: 1.55;
  font-size: 17px;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint paper grain — pure CSS, very subtle, never moves */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .7; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

/* ============================ top bar ============================ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(16px, 5vw, 40px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: radial-gradient(circle at 32% 30%, #2a8a72, var(--accent) 70%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 1px 4px var(--accent-glow);
  transform: rotate(-8deg);
}
.brand-name {
  font-family: var(--font-display); font-weight: 500; font-size: 1.02rem;
  letter-spacing: .01em;
}
.rail { flex: 1 1 auto; height: 3px; border-radius: 99px; background: var(--line); overflow: hidden; }
.rail-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #2a8a72, var(--accent));
  border-radius: 99px;
  transition: width .6s var(--ease);
}
.icon-btn {
  flex: 0 0 auto; width: 38px; height: 38px; border: none; cursor: pointer;
  border-radius: 11px; background: transparent; color: var(--ink-soft);
  display: grid; place-items: center;
  transition: background .25s var(--ease), color .25s var(--ease), transform .15s var(--ease);
}
.icon-btn:hover { background: var(--accent-tint); color: var(--accent); }
.icon-btn:active { transform: scale(.9); }
.ico-sound {
  width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask: center/contain no-repeat var(--snd-on);
  mask: center/contain no-repeat var(--snd-on);
  --snd-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7'/%3E%3Cpath d='M19 5a9 9 0 0 1 0 14'/%3E%3C/svg%3E");
  --snd-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cline x1='22' y1='9' x2='16' y2='15'/%3E%3Cline x1='16' y1='9' x2='22' y2='15'/%3E%3C/svg%3E");
}
.icon-btn[aria-pressed="false"] .ico-sound {
  -webkit-mask-image: var(--snd-off); mask-image: var(--snd-off);
}

/* ============================ stage / chapters ============================ */
.stage {
  position: relative; z-index: 1;
  max-width: var(--stage-w);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) clamp(18px, 5vw, 40px) 140px;
}
.chapter { display: none; }
.chapter.is-active { display: block; animation: chapterIn .5s var(--ease) both; }
.chapter.is-leaving { display: block; animation: chapterOut .32s var(--ease) both; }

@keyframes chapterIn {
  from { opacity: 0; transform: translateY(14px) scale(.992); filter: blur(2px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes chapterOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-10px); }
}
/* children rise in sequence for a hand-set, intentional feel */
.chapter.is-active > * { animation: riseIn .55s var(--ease) both; }
.chapter.is-active > *:nth-child(1){ animation-delay:.02s }
.chapter.is-active > *:nth-child(2){ animation-delay:.07s }
.chapter.is-active > *:nth-child(3){ animation-delay:.12s }
.chapter.is-active > *:nth-child(4){ animation-delay:.17s }
.chapter.is-active > *:nth-child(5){ animation-delay:.22s }
.chapter.is-active > *:nth-child(6){ animation-delay:.27s }
.chapter.is-active > *:nth-child(n+7){ animation-delay:.3s }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================ type ============================ */
.kicker {
  font-size: .76rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .6rem;
}
.display {
  font-family: var(--font-display);
  font-weight: 480; font-optical-sizing: auto;
  font-size: clamp(2rem, 6.4vw, 3rem); line-height: 1.04;
  letter-spacing: -.018em; margin: 0 0 .7rem;
}
h1.display { font-size: clamp(2.3rem, 8vw, 3.5rem); }
.lede { font-size: 1.06rem; color: var(--ink-soft); margin: 0 0 2rem; max-width: 34rem; }
.aside { font-size: .85rem; color: var(--ink-faint); margin: .9rem 0 0; }
.hint { color: var(--ink-faint); font-weight: 400; }
.lede strong, .lede em { color: var(--ink); font-style: normal; font-weight: 600; }

/* ============================ fields ============================ */
.field { position: relative; margin: 0 0 1.35rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.1rem; }
@media (max-width: 540px) { .grid-2 { grid-template-columns: 1fr; } }

.label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 .6rem; color: var(--ink); }

/* floating-label input */
.inp {
  width: 100%; font: inherit; color: var(--ink);
  background: transparent; border: none;
  border-bottom: 1.5px solid var(--line);
  padding: .55rem .1rem .5rem; outline: none;
  transition: border-color .3s var(--ease);
}
.field > .inp + label {
  position: absolute; left: .1rem; top: .55rem; pointer-events: none;
  color: var(--ink-faint); font-size: 1.02rem;
  transform-origin: left center;
  transition: transform .25s var(--ease), color .25s var(--ease);
}
.field > .inp:focus + label,
.field > .inp:not(:placeholder-shown) + label {
  transform: translateY(-1.5rem) scale(.78);
  color: var(--accent); font-weight: 600;
}
/* the underline that draws in from the centre on focus */
.field > .inp { background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0% 1.5px; background-position: 50% 100%; background-repeat: no-repeat; }
.field > .inp:focus { background-size: 100% 1.5px; transition: background-size .35s var(--ease), border-color .3s var(--ease); }

.inp--area { resize: vertical; min-height: 3rem; border: 1.5px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; background-image: none; background: var(--paper-2); }
.inp--area:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.field--stack .label + .inp--area { margin-top: 0; }

.inp--native {
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: .65rem .8rem; background: var(--paper-2); background-image: none;
  color: var(--ink);
}
.inp--native:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }

.inp--bare {
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: .6rem .8rem; background: var(--paper-2); background-image: none;
}
.inp--bare:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }

/* stacked field: label sits above (used for selects/dates/areas) */
.field--stack { margin-bottom: 1.5rem; }

/* ============================ choice chips (single-select) ============================ */
.choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font: inherit; font-size: .95rem; font-weight: 500;
  border: 1.5px solid var(--line); background: var(--paper-2); color: var(--ink-soft);
  border-radius: 99px; padding: .5rem .95rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: transform .18s var(--ease-spring), border-color .2s var(--ease),
              background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.chip:active { transform: scale(.94); }
.chip[aria-pressed="true"], .chip.is-on {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
  animation: chipPop .3s var(--ease-spring);
}
@keyframes chipPop { 0%{transform:scale(.92)} 60%{transform:scale(1.05)} 100%{transform:scale(1)} }

/* multi-select chips (built by JS as label>input+span) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips .chip-check { position: relative; cursor: pointer; }
.chips .chip-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.chips .chip-check > span {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .95rem; font-weight: 500; color: var(--ink-soft);
  border: 1.5px solid var(--line); background: var(--paper-2);
  border-radius: 99px; padding: .5rem .95rem;
  transition: transform .18s var(--ease-spring), border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.chips .chip-check:hover > span { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.chips .chip-check > input:checked + span {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow); animation: chipPop .3s var(--ease-spring);
}
.chips .chip-check > input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================ scale (segmented) ============================ */
.scale { display: flex; gap: .35rem; }
.scale-seg {
  flex: 1 1 0; min-width: 0; font: inherit; font-weight: 600; font-size: .95rem;
  border: 1.5px solid var(--line); background: var(--paper-2); color: var(--ink-soft);
  border-radius: 11px; padding: .6rem .2rem; cursor: pointer; text-align: center;
  transition: transform .16s var(--ease-spring), background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.scale-seg:hover { border-color: var(--accent); color: var(--accent); }
.scale-seg:active { transform: scale(.92); }
.scale-seg.is-on {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow); animation: chipPop .3s var(--ease-spring);
}
.scale-ends { display: flex; justify-content: space-between; font-size: .76rem; color: var(--ink-faint); margin-top: .4rem; }

/* ============================ switches / checkboxes ============================ */
.switch { display: flex; align-items: flex-start; gap: .7rem; cursor: pointer; padding: .55rem 0; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  flex: 0 0 auto; margin-top: 1px;
  width: 44px; height: 26px; border-radius: 99px;
  background: var(--line); position: relative;
  transition: background .28s var(--ease);
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--paper-2); box-shadow: 0 1px 3px rgba(40,33,20,.3);
  transition: transform .3s var(--ease-spring), background .28s var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { font-size: .98rem; color: var(--ink); line-height: 1.45; }
.switch:hover .switch-text { color: var(--accent); transition: color .2s var(--ease); }
.checkstack { display: flex; flex-direction: column; gap: .1rem; }

/* big consent line */
.consent {
  display: flex; align-items: center; gap: .85rem; cursor: pointer;
  margin: 2rem 0 .3rem; padding: 1rem 1.1rem;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper-2);
  transition: border-color .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease);
}
.consent:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.consent input { position: absolute; opacity: 0; width: 0; height: 0; }
.consent-box {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid var(--line); background: var(--paper); position: relative;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.consent-box::after {
  content: ""; position: absolute; left: 8px; top: 3.5px; width: 7px; height: 13px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0);
  transition: transform .25s var(--ease-spring);
}
.consent input:checked + .consent-box { background: var(--accent); border-color: var(--accent); }
.consent input:checked + .consent-box::after { transform: rotate(45deg) scale(1); }
.consent input:focus-visible + .consent-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.consent-text { font-size: 1rem; }

/* ============================ repeater rows ============================ */
.rows { display: flex; flex-direction: column; gap: .8rem; margin-bottom: .8rem; }
.row-card {
  position: relative; border: 1.5px solid var(--line-soft); border-radius: var(--radius);
  background: var(--paper-2); padding: 1rem 1rem .9rem;
  box-shadow: var(--shadow-1);
  animation: cardIn .4s var(--ease-spring) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.row-card.is-removing { animation: cardOut .28s var(--ease) forwards; }
@keyframes cardOut { to { opacity: 0; transform: translateX(-16px) scale(.97); height: 0; margin: 0; padding-top: 0; padding-bottom: 0; } }
.row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .9rem; }
.row-grid .full { grid-column: 1 / -1; }
.row-grid label { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .02em; color: var(--ink-faint); margin: .3rem 0 .05rem; text-transform: uppercase; }
.row-grid input[type="text"], .row-grid select {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink);
  border: none; border-bottom: 1.5px solid var(--line); background: transparent;
  padding: .35rem .1rem; outline: none; transition: border-color .25s var(--ease);
}
.row-grid input:focus, .row-grid select:focus { border-color: var(--accent); }
.row-grid .check-row { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.row-grid .check-row span { text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--ink); margin: 0; }
.row-grid input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.btn-remove {
  position: absolute; top: .55rem; right: .6rem; border: none; background: transparent;
  color: var(--ink-faint); font: inherit; font-size: .8rem; cursor: pointer; padding: .25rem .4rem;
  border-radius: 8px; transition: color .2s var(--ease), background .2s var(--ease);
}
.btn-remove:hover { color: var(--danger); background: var(--danger-tint); }

/* add buttons */
.btn-add {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .95rem; color: var(--accent);
  background: var(--accent-tint); border: 1.5px dashed transparent; border-radius: 99px;
  padding: .6rem 1.1rem;
  transition: transform .18s var(--ease-spring), background .2s var(--ease), box-shadow .2s var(--ease);
}
.btn-add:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn-add:active { transform: scale(.95); }
.btn-add--ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-add--ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }
.plus { position: relative; width: 15px; height: 15px; flex: 0 0 auto; }
.plus::before, .plus::after { content: ""; position: absolute; background: currentColor; border-radius: 2px; }
.plus::before { left: 6.5px; top: 0; width: 2px; height: 15px; }
.plus::after  { top: 6.5px; left: 0; height: 2px; width: 15px; }

/* ============================ optional disclosure ============================ */
.more { margin-top: 1.6rem; border-top: 1px solid var(--line-soft); }
.more > summary {
  list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem .6rem; padding: 1rem .55rem; font-weight: 600; color: var(--ink-soft);
  border-radius: 12px; transition: color .2s var(--ease), background .3s var(--ease);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after {
  content: ""; order: 3; margin-left: .5rem; width: 9px; height: 9px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform .3s var(--ease);
}
.more[open] > summary::after { transform: rotate(-135deg); }
.more > summary:hover { color: var(--accent); }
.more-tag {
  order: 0; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-tint); padding: .2rem .5rem; border-radius: 6px;
}
.more-est {
  order: 2; margin-left: auto; white-space: nowrap;
  font-size: .72rem; font-weight: 700; color: var(--accent);
  background: var(--accent-tint); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  padding: .14rem .5rem; border-radius: 99px;
}
.more-pitch {
  order: 4; flex-basis: 100%; margin: .1rem 0 0;
  font-weight: 500; font-size: .86rem; color: var(--ink-faint); display: none;
}
.more-pitch b { color: var(--accent); font-weight: 700; }
.more.is-nudged .more-pitch { display: block; color: var(--accent); animation: riseIn .4s var(--ease) both; }
.more.is-nudged > summary { background: var(--accent-tint); animation: nudgeGlow 1.5s var(--ease) 1; }
.more.is-nudged > summary::after { color: var(--accent); }
@keyframes nudgeGlow {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  35%  { box-shadow: 0 0 0 7px var(--accent-glow); background: color-mix(in srgb, var(--accent) 16%, transparent); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}
.more[open] .more-body { animation: riseIn .45s var(--ease) both; }
.more-body { padding: .3rem .1rem 1rem; }

/* ============================ footer nav ============================ */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 14px clamp(16px, 5vw, 40px);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(10px);
  border-top: 1px solid var(--line-soft);
}
.steps { flex: 1 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: all .35s var(--ease); }
.dot.is-done { background: var(--accent); }
.dot.is-current { background: var(--accent); transform: scale(1.7); box-shadow: 0 0 0 4px var(--accent-tint); }
.dot.is-optional { box-shadow: inset 0 0 0 1.5px var(--ink-faint); background: transparent; }

/* paired prev/next cluster — adjacent so the mouse barely moves */
.navpair { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.nav-arrow {
  font: inherit; font-weight: 600; cursor: pointer;
  height: 48px; min-width: 48px; padding: 0 14px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--paper-2); color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  transition: transform .16s var(--ease-spring), background .25s var(--ease),
              box-shadow .25s var(--ease), color .25s var(--ease), opacity .2s var(--ease);
}
.nav-arrow:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }
.nav-arrow:active { transform: scale(.92); }
.nav-arrow:disabled { opacity: .32; pointer-events: none; }
.nav-arrow--primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 18px var(--accent-glow); padding: 0 22px; }
.nav-arrow--primary:hover { background: var(--accent-press); color: #fff; transform: translateY(-2px); box-shadow: 0 10px 26px var(--accent-glow); }
.nav-arrow--primary:active { transform: translateY(0) scale(.96); }
.nav-arrow.is-bounce { animation: bounce .5s var(--ease-spring); }
.nav-arrow--primary:hover .arrow--right { transform: rotate(45deg) translate(2px, -2px); }
.nav-label { font-size: 1rem; }

.nav-btn {
  font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer;
  border-radius: 99px; padding: .7rem 1.3rem; border: 1.5px solid transparent;
  display: inline-flex; align-items: center; gap: .5rem;
  transition: transform .16s var(--ease-spring), background .25s var(--ease),
              box-shadow .25s var(--ease), color .25s var(--ease), opacity .2s var(--ease);
}
.nav-btn--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.nav-btn--ghost:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }
.nav-btn--ghost:disabled { opacity: 0; pointer-events: none; }
.nav-btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px var(--accent-glow); }
.nav-btn--primary:hover { background: var(--accent-press); transform: translateY(-2px); box-shadow: 0 10px 26px var(--accent-glow); }
.nav-btn--primary:active { transform: translateY(0) scale(.96); }
.nav-btn.is-bounce { animation: bounce .5s var(--ease-spring); }
@keyframes bounce { 0%{transform:scale(1)} 30%{transform:scale(.93)} 60%{transform:scale(1.04)} 100%{transform:scale(1)} }

.arrow { width: 8px; height: 8px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; }
.arrow--right { transform: rotate(45deg); transition: transform .2s var(--ease); }
.arrow--left  { transform: rotate(-135deg); }
.nav-btn--primary:hover .arrow--right { transform: rotate(45deg) translate(2px,-2px); }

/* ============================ progress meter (review) ============================ */
.meter { margin: 2rem 0 1.4rem; }
.meter-head { font-size: .9rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .5rem; }
.progress-bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; box-shadow: inset 0 1px 2px rgba(40,33,20,.08); }
.progress-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #2a8a72, var(--accent));
  border-radius: 99px; transition: width .6s var(--ease-spring);
}

/* big submit */
.btn-submit {
  width: 100%; font: inherit; font-family: var(--font-display); font-weight: 500; font-size: 1.25rem;
  letter-spacing: .01em; color: #fff; cursor: pointer; border: none;
  background: linear-gradient(180deg, #237a64, var(--accent));
  border-radius: var(--radius-lg); padding: 1.05rem 1.4rem;
  box-shadow: 0 10px 30px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .16s var(--ease-spring), box-shadow .25s var(--ease), filter .2s var(--ease);
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 16px 40px var(--accent-glow); filter: brightness(1.04); }
.btn-submit:active { transform: translateY(0) scale(.985); }
.btn-submit:disabled { filter: grayscale(.3) brightness(.95); cursor: default; transform: none; }

/* ============================ errors ============================ */
.err { color: var(--danger); font-size: .82rem; font-weight: 600; min-height: 0; margin: .35rem 0 0; }
.err:empty { display: none; }
.err--submit { text-align: center; margin: 0 0 .8rem; }
.invalid, .choices.invalid, .scale.invalid { animation: shake .4s var(--ease); }
.field .inp.invalid { border-bottom-color: var(--danger); }
.invalid.choices .chip, .invalid.scale .scale-seg { border-color: var(--danger); }
@keyframes shake { 10%,90%{transform:translateX(-1px)} 30%,70%{transform:translateX(3px)} 50%{transform:translateX(-4px)} }

/* ============================ success overlay ============================ */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: 24px; background: rgba(36,31,23,.4); backdrop-filter: blur(5px);
  animation: fadeIn .3s var(--ease) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--paper-2); border-radius: var(--radius-lg); padding: 2.4rem 2rem 2rem;
  max-width: 30rem; width: 100%; text-align: center; box-shadow: var(--shadow-2);
  border: 1px solid var(--paper-edge);
  animation: sheetIn .5s var(--ease-spring) both;
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
.seal {
  width: 66px; height: 66px; margin: 0 auto 1.2rem; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #2a8a72, var(--accent));
  display: grid; place-items: center; box-shadow: 0 8px 22px var(--accent-glow);
  animation: sealPop .6s var(--ease-spring) both;
}
@keyframes sealPop { 0%{transform:scale(0) rotate(-30deg)} 60%{transform:scale(1.12)} 100%{transform:scale(1) rotate(0)} }
.seal-check { width: 16px; height: 28px; border: solid #fff; border-width: 0 4px 4px 0; transform: rotate(45deg) translateY(-3px); animation: drawCheck .4s .25s var(--ease) both; transform-origin: center; }
@keyframes drawCheck { from { height: 0; opacity: 0; } to { height: 28px; opacity: 1; } }
.sheet .display { font-size: 1.9rem; margin: 0 0 .6rem; }
.sheet p { color: var(--ink-soft); margin: 0 0 1.3rem; }
.dl-links { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.3rem; }
.dl-links a { color: var(--accent); font-weight: 600; text-decoration: none; padding: .55rem; border: 1.5px solid var(--line); border-radius: var(--radius); transition: border-color .2s var(--ease), background .2s var(--ease); }
.dl-links a:hover { border-color: var(--accent); background: var(--accent-tint); }
.sheet .nav-btn { width: 100%; justify-content: center; }

.hidden { display: none !important; }

/* ============================ reduced motion ============================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .chapter.is-active > * { animation: none; }
}
