/* Refera onboarding - the beautiful two-pane wizard.
 *
 * Layered ON TOP of the tokens + base styles declared inline in
 * site/onboard/index.html (loaded after that <style> so these rules win).
 * Invents no new colour or type: every value here resolves to an existing
 * :root token. New scoped tokens are limited to layout + the preview/seal
 * motion the design spec sanctions.
 *
 * Hard wall: administrative process-state only. Nothing here renders or
 * styles clinical, patient or referral content - the preview shows the
 * firmographics the person typed and nothing else.
 */

:root {
  --preview-w: 420px;
  --stagger: 40ms;
  --ink-signature: var(--teal);
  --seal-ring: var(--teal);
}

/* ================================================================
   Topbar: the first prominent trial surface + progress meter
   ================================================================ */

.chip.chip-trial {
  color: var(--amber);
  background: var(--amber-wash);
  border-color: #F0DCB8;
}

.progress {
  position: sticky;
  top: var(--topbar-h);
  z-index: 55;
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
}
.progress-inner {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: .5rem 24px;
  display: flex;
  align-items: center;
  gap: .8rem;
}
.progress-track {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--hair);
  overflow: hidden;
}
.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--teal);
  transition: width 300ms var(--spring);
}
.progress-label {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ================================================================
   Two-pane layout
   ================================================================ */

.wrap {
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.form-col { min-width: 0; }

/* Rail reframed as a concierge checklist inside the form column. */
nav.rail {
  position: static;
  margin: 0 0 1.4rem;
}
.rail-title {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .5rem;
}
.rail ol {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .35rem;
}
.rail li { margin: 0; }
.rail button {
  gap: .45rem;
  padding: .32rem .5rem;
  font-size: .82rem;
}
.rail .dot { width: 22px; height: 22px; font-size: .68rem; }
.rail li.done .dot::after {
  content: "";
  width: 9px; height: 5px;
  border: 1.5px solid var(--teal);
  border-top: 0; border-right: 0;
  transform: rotate(-45deg) translateY(-1px);
}
.rail li.done .dot { font-size: 0; }
.rail .step-label { white-space: nowrap; display: inline; }

.preview-pane { min-width: 0; }

/* The browser-framing reassurance already lives in the footer; the moved
   rail-note would duplicate it under the form. */
.rail-note { display: none; }

@media (min-width: 960px) {
  .wrap {
    grid-template-columns: minmax(0, 1fr) var(--preview-w);
    gap: 40px;
  }
  .preview-pane {
    position: sticky;
    top: calc(var(--topbar-h) + 56px);
    align-self: start;
  }
  .preview-toggle { display: none; }
}

/* ================================================================
   The editorial question voice
   ================================================================ */

.eyebrow {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 .5rem;
}
.step > h2 {
  font-size: clamp(1.45rem, 3.6vw, 1.95rem);
  max-width: 18ch;
}
.step .trust-line {
  font-size: .8rem;
  color: var(--ink-3);
  margin: -.2rem 0 1rem;
}

/* One-question-at-a-time step transition. */
.step.active { animation: step-in var(--dur) var(--ease-out) both; }
@keyframes step-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Gentle validation: border only, no red flash / wash. */
input[aria-invalid="true"],
select[aria-invalid="true"] {
  background: var(--surface);
  transition: border-color var(--dur) var(--ease-out);
}
.field-ok {
  font-size: .78rem;
  color: var(--teal);
  margin: .1rem 0 0;
}
.field-ok:empty { display: none; }

/* ABR reveal shimmer under the ABN field. */
.abn-hero label { font-size: .92rem; }
#f-practice-abn { font-size: 1.15rem; letter-spacing: .04em; }
.abr-found {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--teal);
  margin: .2rem 0 0;
  opacity: 0;
}
.abr-found.show { animation: fade-up var(--dur) var(--ease-out) forwards; }
.abr-found .tick {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: grid; place-items: center;
  font-size: .6rem;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   The live preview console - "Your Refera account, Staging"
   ================================================================ */

.preview-card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  box-shadow: var(--elev-1);
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease-out);
}
.preview-card.sealed { box-shadow: var(--elev-float); }
.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .7rem .95rem;
  border-bottom: 1px solid var(--hair);
  background: var(--paper);
}
.preview-head .pv-eyebrow {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.pv-staging {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--amber);
  background: var(--amber-wash);
  border: 1px solid #F0DCB8;
  border-radius: var(--r-pill);
  padding: .16rem .5rem;
}
.preview-body { padding: .95rem; display: grid; gap: .8rem; }
.pv-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0; }

/* Modules that appear as data arrives. */
.pv-mod {
  border: 1px solid var(--hair);
  border-radius: var(--r-input);
  padding: .7rem .8rem;
  background: var(--surface);
}
.pv-mod[hidden] { display: none !important; }
.pv-mod.pulse { animation: pulse-ring 600ms var(--ease-out); }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 2px var(--teal); }
  100% { box-shadow: 0 0 0 2px rgba(15,118,110,0); }
}

/* Empty state. */
.pv-empty {
  border: 1px dashed var(--hair);
  border-radius: var(--r-input);
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--ink-3);
  font-size: .86rem;
}
.pv-empty .mono {
  display: block;
  font-size: .72rem;
  color: var(--ink-3);
  margin-top: .35rem;
}

/* Entity header module. */
.pv-entity { display: flex; align-items: center; gap: .7rem; }
.pv-avatar {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--teal-wash);
  color: var(--teal);
  display: grid; place-items: center;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  border: 1px solid #BEE7E1;
}
.pv-entity-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1.02rem;
  line-height: 1.2;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.pv-entity-sub { font-size: .78rem; color: var(--ink-3); margin-top: .1rem; }
.pv-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.pv-chip {
  font-size: .68rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: var(--r-chip);
  padding: .16rem .5rem;
}
.pv-chip.gst { color: var(--green); background: var(--green-wash); border-color: #CBEBD3; }

.pv-mod-title {
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .4rem;
}
.pv-row { font-size: .84rem; color: var(--ink); overflow-wrap: anywhere; }
.pv-row + .pv-row { margin-top: .25rem; }
.pv-row .muted { color: var(--ink-3); }

/* Channel chip strip. */
.pv-channels { display: flex; flex-wrap: wrap; gap: .35rem; }
.pv-ch {
  font-size: .72rem;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-wash);
  border: 1px solid #BEE7E1;
  border-radius: var(--r-chip);
  padding: .2rem .55rem;
  animation: chip-in var(--dur) var(--spring) both;
}
@keyframes chip-in {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* Trial + plan module. */
.pv-trial { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pv-plan-name { font-family: 'Fraunces', Georgia, serif; font-size: 1rem; }
.pv-plan-price { font-size: .78rem; color: var(--ink-3); }
.pv-trial-pill {
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-wash);
  border: 1px solid #CBEBD3;
  border-radius: var(--r-pill);
  padding: .2rem .55rem;
  white-space: nowrap;
}
.pv-trial-note { font-size: .74rem; color: var(--ink-3); margin: .45rem 0 0; }

/* Signature line. */
.pv-sign { border-top: 1px dashed var(--hair); padding-top: .7rem; }
.pv-sign-ink {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-signature);
  min-height: 1.4em;
  line-height: 1.4;
}
.pv-sign-line { font-size: .72rem; color: var(--ink-3); margin-top: .2rem; }
.pv-sealed { font-size: .72rem; color: var(--teal); margin-top: .3rem; overflow-wrap: anywhere; }
.pv-sealed:empty { display: none; }

/* ================================================================
   Mobile: preview collapses to a sticky summary bar
   ================================================================ */

@media (max-width: 959px) {
  .preview-pane {
    order: -1;
    position: sticky;
    top: calc(var(--topbar-h) + 42px);
    z-index: 50;
    margin: 0 0 1.4rem;
  }
  .preview-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    font: inherit;
    font-size: .84rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: var(--r-input);
    box-shadow: var(--elev-1);
    padding: .6rem .8rem;
    min-height: 44px;
    cursor: pointer;
  }
  .preview-toggle .pt-caret { color: var(--ink-3); transition: transform var(--dur) var(--ease-out); }
  .preview-pane.open .preview-toggle .pt-caret { transform: rotate(180deg); }
  .preview-card { margin-top: .5rem; }
  .preview-pane:not(.open) .preview-card { display: none; }
}

/* ================================================================
   Plan step: trial gets loud but tasteful (second prominent surface)
   ================================================================ */

.trial-banner {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  background: var(--teal-wash);
  border: 1px solid #BEE7E1;
  border-radius: var(--r-card);
  padding: .9rem 1.1rem;
  margin: 0 0 1.1rem;
}
.trial-banner .tb-pill {
  flex: none;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-wash);
  border: 1px solid #CBEBD3;
  border-radius: var(--r-pill);
  padding: .22rem .6rem;
  margin-top: .1rem;
}
.trial-banner p { margin: 0; font-size: .88rem; color: var(--ink-2); }
.trial-banner strong { color: var(--ink); }
.plan-card .pc-trial {
  align-self: flex-start;
  margin: .4rem 0 0;
  font-size: .58rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-wash);
  border: 1px solid #CBEBD3;
  border-radius: var(--r-pill);
  padding: .18rem .5rem;
}

/* ================================================================
   The signature plate on the sign step (typed-name legal path)
   ================================================================ */

.sign-plate {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: var(--r-input);
  padding: 1.2rem 1rem .7rem;
  margin: .3rem 0 .2rem;
}
.sign-plate .sp-ink {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.6rem;
  color: var(--ink-signature);
  min-height: 1.5em;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.sign-plate .sp-baseline {
  border-top: 1px solid var(--ink-3);
  margin-top: .2rem;
  padding-top: .3rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .74rem;
  color: var(--ink-3);
}
.sign-plate .sp-x {
  position: absolute;
  left: 1rem;
  bottom: 1.05rem;
  font-size: .9rem;
  color: var(--ink-3);
}

/* The one theatrical beat: the wax seal. */
.seal {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  margin-right: .6rem;
  vertical-align: middle;
}
.seal svg { width: 44px; height: 44px; }
.seal .seal-ring { stroke: var(--seal-ring); stroke-width: 2; fill: none; }
.seal.draw .seal-ring {
  stroke-dasharray: 126;
  stroke-dashoffset: 126;
  animation: seal-draw 800ms var(--spring) forwards;
}
.seal.draw { animation: seal-press 800ms var(--spring); }
@keyframes seal-draw { to { stroke-dashoffset: 0; } }
@keyframes seal-press {
  0%   { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.seal .seal-r {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.1rem;
  fill: var(--teal);
}

/* ================================================================
   Motion + transparency honoured on every new surface
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  .step.active,
  .abr-found.show,
  .pv-mod.pulse,
  .pv-ch,
  .seal.draw,
  .seal.draw .seal-ring { animation: none !important; }
  .abr-found.show { opacity: 1; }
  .seal.draw .seal-ring { stroke-dashoffset: 0; }
  .progress-bar { transition: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .progress { background: var(--surface); }
}
