/* ============================================================================
   MAITRI ONBOARDING — shared styles for the first-run flow
   Linked after tokens.css by every onboarding screen. Screen-specific styles
   live in a small inline <style> per page. One cached file across all screens
   keeps repeat-view payload tiny (good on slow networks).
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font-sans); font-size: var(--fs-body);
  line-height: var(--lh-relaxed); color: var(--color-text);
  background:
    radial-gradient(900px 540px at 84% -10%, rgba(46,139,127,0.10), transparent 60%),
    radial-gradient(820px 520px at -8% 6%, rgba(224,116,74,0.07), transparent 55%),
    var(--color-bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  display: flex; justify-content: center;
  padding: var(--space-8) var(--space-5) var(--space-16);
}
::selection { background: var(--color-primary-soft); color: var(--color-primary-text); }

/* Accessibility baseline — every focusable element gets a visible ring (0-specificity
   :where() so component-specific focus styles still win). Audited gap fix. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-xs);
}

.screen { width: 100%; max-width: 660px; }

/* top bar + step indicator */
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-12); }
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand__word { font-family: var(--font-display); font-weight: var(--fw-medium); font-size: 1.4rem; letter-spacing: var(--tracking-tight); color: var(--color-text); }
.steps { display: flex; align-items: center; gap: 7px; }
.steps i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); display: block; transition: width var(--dur-base) var(--ease-emphasized); }
.steps i.on { width: 22px; border-radius: var(--radius-pill); background: var(--maitri-aura); }
.steps i.done { background: var(--color-primary); }
.steps span { font-size: var(--fs-caption); color: var(--color-text-subtle); margin-left: var(--space-2); font-family: var(--font-mono); }
.skip { font-size: var(--fs-caption); color: var(--color-text-subtle); text-decoration: none; }
.skip:hover { color: var(--color-text); }

/* the presence orb */
.orb {
  position: relative; width: 96px; height: 96px; border-radius: var(--radius-round);
  background: var(--maitri-aura); box-shadow: var(--maitri-glow); flex: none;
  animation: breathe var(--dur-ambient) var(--ease-in-out) infinite alternate;
}
.orb::before { content: ""; position: absolute; inset: -20px; border-radius: inherit; background: var(--maitri-aura); filter: blur(26px); opacity: 0.5; z-index: -1; animation: aura 3.4s var(--ease-in-out) infinite alternate; }
.orb::after { content: ""; position: absolute; inset: 14% 18% 50% 16%; border-radius: var(--radius-round); background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.72), transparent 70%); }
.orb--sm { width: 30px; height: 30px; box-shadow: 0 4px 14px rgba(46,139,127,0.28); }
.orb--lg { width: 120px; height: 120px; }
@keyframes breathe { from { transform: scale(0.96); } to { transform: scale(1.04); } }
@keyframes aura { from { opacity: 0.34; transform: scale(0.9); } to { opacity: 0.6; transform: scale(1.08); } }

/* shared atoms */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); font-weight: var(--fw-semibold); color: var(--color-primary-text); background: var(--color-surface); border: 1px solid color-mix(in srgb, var(--color-primary) 32%, var(--color-surface)); padding: 6px var(--space-3); border-radius: var(--radius-pill); }
.label { font-family: var(--font-mono); font-size: var(--fs-eyebrow); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); color: var(--color-primary-text); margin: 0 0 var(--space-4); }
.ic { width: 18px; height: 18px; }

/* buttons */
.btn { font-family: var(--font-sans); font-size: var(--fs-body); font-weight: var(--fw-semibold); border-radius: var(--radius-pill); padding: var(--btn-pad-y, var(--space-3)) var(--btn-pad-x, var(--space-6)); border: 1px solid transparent; cursor: pointer; min-height: var(--btn-min-h, 44px); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); white-space: nowrap; text-decoration: none; transition: transform var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast), background var(--dur-fast); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:active { transform: translateY(1px) scale(0.995); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: default; box-shadow: none; pointer-events: none; }
/* completed CTA reads as a calm success, not an inert teal button */
.btn--done { background: var(--success-bg); color: var(--success-700); border-color: var(--success-border); box-shadow: none; }
.btn--done:hover { background: var(--success-bg); box-shadow: none; }
.btn--primary { background: var(--color-primary); color: var(--color-on-primary); box-shadow: var(--shadow-2); width: 100%; max-width: 360px; }
.btn--primary:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-3); }
.btn--ghost { background: transparent; color: var(--color-primary-text); min-height: 44px; }
.btn--ghost:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn--tonal { background: var(--color-primary-soft); color: var(--color-primary-text); }
.btn--tonal:hover { background: color-mix(in srgb, var(--color-primary) 18%, var(--color-surface)); }
/* reserved coral — RATIONED: a single primary "commit"/favorite action only,
   never a second primary on the same surface. */
.btn--accent { background: var(--color-accent); color: var(--color-on-accent); box-shadow: var(--shadow-2); }
.btn--accent:hover { background: var(--color-accent-text); box-shadow: var(--shadow-3); }
.btn--sm { padding: var(--space-2) var(--space-4); min-height: 44px; font-size: var(--fs-body-sm); }

/* accessible switch */
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; width: 52px; height: 30px; margin: 0; cursor: pointer; }
.switch label { display: block; width: 52px; height: 30px; border-radius: var(--radius-pill); background: var(--line-strong); transition: background var(--dur-base) var(--ease-standard); }
.switch label::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--color-surface); box-shadow: var(--shadow-1); transition: transform var(--dur-base) var(--ease-emphasized); }
.switch input:checked + label { background: var(--color-primary); }
.switch input:checked + label::after { transform: translateX(22px); }
.switch input:focus-visible + label { box-shadow: var(--shadow-focus); }

/* provenance indicator — makes the data-egress architecture visible on every suggestion.
   device  = worked out on your phone        (most private)
   enclave = reasoned privately in our cloud (operator-blind)
   cloud   = reasoned in the cloud WITHOUT your private details (tokenized) */
.prov { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); font-weight: var(--fw-medium); padding: 5px var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--color-border); color: var(--color-text-muted); background: var(--color-surface); }
.prov svg { width: 14px; height: 14px; flex: none; }
.prov--device  { color: var(--color-primary-text); background: var(--color-primary-soft);  border-color: color-mix(in srgb, var(--color-primary) 32%, var(--color-surface)); }
.prov--enclave { color: var(--color-primary-text); background: var(--color-surface); border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-surface)); }
.prov--cloud   { color: var(--info-700); background: var(--info-bg);  border-color: color-mix(in srgb, var(--info-500) 40%, var(--color-surface)); }

/* actions + footer */
.actions { display: flex; flex-direction: column; gap: var(--space-3); align-items: center; }
.foot { text-align: center; font-size: var(--fs-caption); color: var(--color-text-subtle); margin-top: var(--space-6); display: flex; align-items: center; justify-content: center; gap: 7px; }

/* staggered entrance */
.reveal { opacity: 0; transform: translateY(16px); animation: rise var(--dur-ambient) var(--ease-emphasized) forwards; }
.reveal:nth-child(1) { animation-delay: 60ms; }
.reveal:nth-child(2) { animation-delay: 140ms; }
.reveal:nth-child(3) { animation-delay: 220ms; }
.reveal:nth-child(4) { animation-delay: 300ms; }
.reveal:nth-child(5) { animation-delay: 380ms; }
.reveal:nth-child(6) { animation-delay: 460ms; }
.reveal:nth-child(7) { animation-delay: 540ms; }
.reveal:nth-child(8) { animation-delay: 620ms; }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .orb, .orb::before { animation: none !important; }
  .reveal { animation: none !important; opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
