/* The step-by-step start (/incepe). One question per screen, sized to the visible height: 100dvh on phones that know it,
   100vh before. Content that does not fit (a very short screen, the keyboard open) makes the page scroll; nothing is
   clipped. Choices are big white cards on the mint ground; the progress is the liquid bar; steps slide in. */
.intro { background: radial-gradient(130% 60% at 50% -8%, var(--mint-2), var(--brand-soft) 38%, var(--paper) 72%) fixed; overscroll-behavior: none; }
.intro__shell { width: min(100% - 32px, 540px); margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }

/* top: back (or the brand on the first screen) and the progress */
.intro__top { display: flex; align-items: center; gap: 14px; min-height: 60px; }
.intro__brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font: 500 1.3rem/1 var(--font-display); }
.intro__back { display: inline-flex; align-items: center; gap: 2px; min-height: 48px; padding: 0 12px 0 4px; margin-left: -4px; border-radius: var(--r-pill);
  color: var(--ink); text-decoration: none; font: var(--w-label) 1rem/1 var(--font-display); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.intro__back .ico { rotate: 180deg; }
@media (hover: hover) and (pointer: fine) { .intro__back:hover { background: color-mix(in srgb, var(--card) 60%, transparent); } }
.intro__back:active { scale: .96; }
.intro__progress { flex: 1; display: flex; align-items: center; gap: 10px; view-transition-name: intro-bar; }
.intro__bar { flex: 1; height: 8px; --lq-accent: var(--brand); --lq-accent-2: var(--mint); }
.intro__count { font: var(--w-label) .9rem/1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }

/* the step itself: centred in the free height, no taller than it needs */
.intro__main { display: flex; flex-direction: column; justify-content: center; padding: 8px 0 12px; }
.intro__step { view-transition-name: intro-step; }
.intro__h { font-size: clamp(1.55rem, 6.6vw, 2.25rem); font-weight: var(--w-text); margin: 0 0 8px; }
.intro__h b { font-weight: var(--w-bold); }
.intro__sub { color: var(--muted); font-size: 1.02rem; margin: 0 0 18px; max-width: 46ch; }
.intro__h + .ichoices, .intro__h + .intro__form { margin-top: 18px; }
.intro__hero3d { width: 76px; height: 76px; margin: 0 0 8px -6px; }

/* choices: a whole card is the button */
.ichoices { display: grid; gap: 10px; border: 0; padding: 0; margin: 0; min-width: 0; }
.ichoices--grid { grid-template-columns: 1fr 1fr; }
.ichoice { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; width: 100%; min-height: 64px;
  padding: 10px 16px 10px 12px; border: 0; border-radius: 20px; background: var(--card); color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
  font: inherit; box-shadow: var(--edge), 0 1px 2px rgb(21 60 48 / .05), 0 12px 26px -20px rgb(21 60 48 / .45);
  transition: scale var(--dur-press) var(--ease), box-shadow var(--dur-ui) var(--ease), background-color var(--dur-ui) var(--ease);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ichoice:not(:has(img), .ichoice--trial) { grid-template-columns: 1fr auto; padding-left: 18px; }
.ichoice img { width: 44px; height: 44px; }
.ichoice__text { display: grid; gap: 2px; min-width: 0; }
.ichoice__text b { font: var(--w-label) 1.08rem/1.25 var(--font-display); }
.ichoice__text small { color: var(--muted); font-size: .95rem; line-height: 1.35; }
.ichoice > .ico { color: var(--brand); }
@media (hover: hover) and (pointer: fine) { .ichoice:hover { box-shadow: var(--edge), inset 0 0 0 2px var(--mint-3), 0 14px 30px -20px rgb(21 60 48 / .5); } }
.ichoice:active { scale: .97; transition-duration: 90ms; }
.ichoice:focus-visible, .ichoice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.ichoice.on, .ichoice:has(input:checked) { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand), 0 12px 26px -20px rgb(21 60 48 / .45); }
.ichoices--grid .ichoice { min-height: 72px; }
.ichoice--big { min-height: 104px; padding: 14px 18px 14px 14px; border-radius: 24px; }
.ichoice--big img { width: 68px; height: 68px; }
.ichoice--big .ichoice__text b { font-size: 1.22rem; }

/* the tick: a round check that fills when chosen (multi-select, and the saved single answer) */
.ichoice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ichoice__tick { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line-strong); color: transparent;
  transition: background-color var(--dur-ui) var(--ease), box-shadow var(--dur-ui) var(--ease); }
.ichoice__tick .ico { width: 18px; height: 18px; }
.ichoice.on .ichoice__tick, .ichoice:has(input:checked) .ichoice__tick { background: var(--brand); box-shadow: none; color: var(--on-brand); }
.intro__next { margin-top: 16px; }

/* the trial choice: the number of free days is the headline of each card */
.ichoice--trial { grid-template-columns: auto 1fr auto; padding: 14px 14px 14px 12px; align-items: start; }
.ichoice--trial > .ico { align-self: center; }
.ichoice__days { display: grid; place-items: center; align-content: center; width: 74px; height: 70px; border-radius: 18px; background: var(--paper-2); color: var(--ink); }
.ichoice__days b { font: var(--w-bold) 1.75rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.ichoice__days small { font: var(--w-label) .72rem/1.1 var(--font-display); color: var(--muted); text-align: center; }
.ichoice--rec { box-shadow: inset 0 0 0 2px var(--brand), 0 14px 30px -20px rgb(21 60 48 / .55); }
.ichoice--rec .ichoice__days { background: linear-gradient(180deg, #2a8463, var(--brand)); color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / .3); }
.ichoice--rec .ichoice__days small { color: rgb(255 255 255 / .85); }
.intro .flash { margin: 0 0 12px; padding: 10px 14px; font: 400 .95rem/1.4 var(--font-body); }
.intro__fine { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: .88rem; line-height: 1.4; margin: 12px 0 0; }
.intro__fine .ico { margin-top: 1px; }
.intro__fine .ico { width: 18px; height: 18px; color: var(--brand); }

/* the account form: tighter than the workspace forms, so the five fields and the button fit a small phone */
.intro__account { display: grid; gap: 10px; }
.intro__account .field { gap: 4px; font-size: .95rem; }
.intro__account .field input { min-height: 50px; font-size: 16px; }   /* 16px: iOS does not zoom into the field */
.intro__pwrow { position: relative; display: block; }
.intro__pwrow input { width: 100%; padding-right: 84px; }
.intro__show { position: absolute; right: 4px; top: 50%; translate: 0 -50%; min-height: 42px; min-width: 64px; padding: 0 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--brand); font: var(--w-label) .95rem/1 var(--font-display); cursor: pointer; touch-action: manipulation; }
.intro__terms { align-items: flex-start; font: 400 .95rem/1.4 var(--font-body); margin-top: 2px; }
.intro__terms input { width: 24px; height: 24px; margin-top: 1px; }
.intro__account .intro__next { margin-top: 6px; }

/* the patient's screens */
.intro__actions { display: grid; gap: 10px; }
.intro__stores { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.intro__link { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; font: var(--w-label) 1rem/1.3 var(--font-display); text-align: center; }
.intro__msg { margin: 0 0 16px; padding: 14px 16px; border-radius: var(--r-md); background: var(--card); box-shadow: var(--edge); font-size: 1rem; line-height: 1.45; }
.intro__preview { margin: 0 0 18px; padding: 14px 16px; border-radius: var(--r-md); background: color-mix(in srgb, var(--card) 70%, transparent); box-shadow: var(--edge); }
.intro__preview .over { margin: 0 0 6px; }
.intro__preview ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.intro__demo { margin: 16px 0 0; padding: 12px 14px; border-radius: var(--r-sm); border: 2px dashed var(--warm); font-size: .95rem; }

/* bottom: sign in, languages */
.intro__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; padding: 6px 0 10px; color: var(--muted); font-size: .9rem; }
.intro__langs { display: flex; gap: 2px; margin-right: -8px; }
.intro__langs a { display: grid; place-items: center; min-width: 40px; min-height: 40px; border-radius: 10px; color: var(--muted); text-decoration: none; font: var(--w-label) .85rem/1 var(--font-display); }
.intro__langs a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand); }

/* short phones (iPhone SE and the like): less air, same content */
@media (max-height: 700px) {
  .intro__top { min-height: 50px; }
  .intro__h { font-size: clamp(1.4rem, 6vw, 1.9rem); }
  .intro__sub { margin-bottom: 12px; font-size: .98rem; }
  .ichoices { gap: 8px; }
  .ichoice { min-height: 58px; }
  .ichoice--big { min-height: 92px; }
  .intro__hero3d { width: 60px; height: 60px; }
  .intro__account { gap: 6px; }
  .intro__account .field input { min-height: 46px; }
  .intro__account .intro__next { margin-top: 4px; }
  .intro__foot { padding-bottom: 6px; }
}
@media (min-width: 900px) {
  .intro__main { padding-bottom: 6vh; }
  .ichoice--big { min-height: 116px; }
}

/* steps slide in from the side they come from; Back slides the other way. Movement only without reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(intro-step) { animation: intro-out 140ms cubic-bezier(.55, .055, .675, .19) both; }
  ::view-transition-new(intro-step) { animation: intro-in 340ms var(--ease) both; }
  :root:has(.intro--back)::view-transition-old(intro-step) { animation-name: intro-out-back; }
  :root:has(.intro--back)::view-transition-new(intro-step) { animation-name: intro-in-back; }
  ::view-transition-group(intro-bar) { animation-duration: 340ms; animation-timing-function: var(--ease); }
}
@keyframes intro-in { from { opacity: 0; translate: 32px 0; } }
@keyframes intro-out { to { opacity: 0; translate: -16px 0; } }
@keyframes intro-in-back { from { opacity: 0; translate: -32px 0; } }
@keyframes intro-out-back { to { opacity: 0; translate: 16px 0; } }
.intro__langs:only-child { margin-left: auto; }
@media (max-width: 420px) {
  .intro__foot { flex-wrap: nowrap; font-size: .85rem; gap: 8px; }
  .intro__foot > span { min-width: 0; }
  .intro__langs a { min-width: 34px; }
}

/* dark look: the recommended trial's day count is a flat mint badge with deep-green words */
@media screen {
  :root[data-theme=dark] .ichoice--rec .ichoice__days { background: var(--brand); color: var(--on-brand); box-shadow: none; }
  :root[data-theme=dark] .ichoice--rec .ichoice__days small { color: color-mix(in srgb, var(--on-brand) 80%, transparent); }
}
