/* ==========================================================================
   First-run onboarding (see js/onboarding.js)

   Full-screen steps, not a dialog: this is the first thing the app shows, so
   it owns the whole viewport instead of floating over an empty home page.
   ========================================================================== */

body.onboarding-active {
  overflow: hidden;
}

.onb-screen {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal, 1000) + 10);
  display: flex;
  flex-direction: column;
  padding:
    calc(env(safe-area-inset-top, 0px) + var(--space-10))
    var(--space-5)
    calc(env(safe-area-inset-bottom, 0px) + var(--space-6));
  background: var(--bg-color);
  animation: onb-fade 220ms ease-out;
}

@keyframes onb-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.onb-skip {
  position: absolute;
  inset-block-start: calc(env(safe-area-inset-top, 0px) + var(--space-4));
  inset-inline-start: var(--space-5);
  padding: var(--space-2);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-base);
  cursor: pointer;
}

.onb-skip:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.onb-body {
  flex: 1 1 auto;
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
}

/* Intro screens have no controls, so their content sits centred in the space
   rather than stacked at the top. */
.onb-screen.is-intro .onb-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.onb-hero {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--space-6);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(var(--primary-rgb), 0.16), rgba(var(--primary-rgb), 0.04));
  color: var(--primary-color);
  font-size: 3rem;
}

.onb-icon {
  width: 64px;
  height: 64px;
  margin: var(--space-2) auto var(--space-4);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-color);
  font-size: 1.6rem;
}

.onb-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-color);
}

.onb-text {
  margin: 0 0 var(--space-6);
  font-size: var(--text-md);
  line-height: var(--leading-snug);
  color: var(--text-secondary);
}

.onb-hint {
  margin: var(--space-4) 0 0;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

/* Choices ----------------------------------------------------------------- */
.onb-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

.onb-swatch {
  width: 56px;
  height: 56px;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--elev-2);
  transition: box-shadow 0.15s, transform 0.15s;
}

.onb-swatch.is-active {
  border-color: var(--surface-1);
  box-shadow: var(--elev-3), 0 0 0 3px var(--text-color);
}

.onb-swatch:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 3px; }

.onb-card-option {
  flex: 1 1 130px;
  max-width: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 14px);
  background: var(--surface-1);
  color: var(--text-color);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.onb-card-option.is-active {
  border-color: var(--primary-color);
  background: rgba(var(--primary-rgb), 0.07);
}

.onb-card-option:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.onb-card-sample {
  font-size: 1.6rem;
  line-height: 1.8;
  color: var(--primary-dark);
}

.onb-card-icon {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.onb-card-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

.onb-card-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.onb-location-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 48px;
  padding-inline: var(--space-5);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-md, 14px);
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary-dark);
  font: inherit;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

.onb-location-btn[disabled] { opacity: 0.6; cursor: default; }
.onb-location-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.onb-location-state {
  margin: var(--space-3) 0 0;
  min-height: 1.2em;
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

.onb-location-state.is-ok { color: var(--success); font-weight: var(--weight-semibold); }
.onb-location-state.is-error { color: var(--danger); }

/* Footer ------------------------------------------------------------------ */
.onb-footer {
  flex: 0 0 auto;
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  padding-block-start: var(--space-5);
}

.onb-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-block-end: var(--space-5);
}

.onb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface-3);
  transition: width 0.2s, background 0.2s;
}

.onb-dot.is-active {
  width: 22px;
  border-radius: 999px;
  background: var(--primary-color);
}

.onb-actions {
  display: flex;
  gap: var(--space-3);
}

.onb-btn {
  flex: 1 1 0;
  min-height: 52px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 14px);
  background: var(--surface-2);
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.onb-btn[hidden] { display: none; }
.onb-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.onb-btn-primary {
  flex: 2 1 0;
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--on-primary);
  font-weight: var(--weight-semibold);
}

/* On the first screen there is no "back", so the single action is centred
   instead of stretching the full width. */
.onb-screen.is-first .onb-actions { justify-content: center; }

.onb-screen.is-first .onb-btn-primary {
  flex: 0 1 auto;
  min-width: 220px;
  padding-inline: var(--space-8);
}

@media (prefers-reduced-motion: reduce) {
  .onb-screen { animation: none; }
  .onb-dot { transition: none; }
}
