/* ── Tutorial (splash + onboarding + permission explainers) ──────────────────
   Mobile-first, single self-contained page (frontend/tutorial.html) — no SPA
   dependency. Reuses component-library.css tokens/components (.cf-btn,
   .cf-pagination-dots) and style_v2.css's auth-card/auth-* look for visual
   consistency with the rest of the app; this file only adds what those two
   don't already cover. */

html, body {
  height: 100%;
  margin: 0;
  background: var(--surface-page);  /* white — every step is white except the splash, which overrides below */
  overflow: hidden;                 /* each step owns its own scroll if needed */
  font-family: var(--font-family-text);
}

.tut-step {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding: var(--scale-400) var(--scale-600);
  padding-top: calc(var(--scale-800) + max(env(safe-area-inset-top, 0), var(--scale-200)));
  padding-bottom: calc(var(--scale-600) + max(env(safe-area-inset-bottom, 0), var(--scale-200)));
  box-sizing: border-box;
}
.tut-step[hidden] { display: none; }

/* Honour the [hidden] attribute even when a component class sets its own
   `display` (.tut-perm-content is flex, .cf-btn is inline-flex). This page
   doesn't load profile.css, which carries the app-wide guard — without this,
   the denied-state text (#locationDenied) and the Open-Settings button
   (#locationSettingsBtn) stay visible despite their `hidden` attribute. */
[hidden] { display: none !important; }

/* ── Splash (Figma 2623:49917) — full-bleed brand orange, white logo/wordmark */
#step-splash { background: var(--surface-action); }
.tut-splash {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--scale-400);
}
.tut-splash-logo {
  width: var(--scale-1400); height: var(--scale-1400);  /* Figma splash Logo instance: 56×56 */
  opacity: 0; transform: scale(0.85);
  animation: tut-splash-logo-in 600ms cubic-bezier(.2,.8,.2,1) 100ms forwards;
}
.tut-splash-word {
  margin: 0; color: white;  /* font styling comes from the .h3 utility class in the markup */
  opacity: 0; transform: translateY(8px);
  animation: tut-splash-word-in 500ms cubic-bezier(.2,.8,.2,1) 380ms forwards;
}
@keyframes tut-splash-logo-in {
  to { opacity: 1; transform: scale(1); }
}
@keyframes tut-splash-word-in {
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .tut-splash-logo, .tut-splash-word { animation: none; opacity: 1; transform: none; }
}

/* ── Minimal top bar (Skip on onboarding) — full-bleed 44-px row ─────────── */
.tut-topbar {
  display: flex; align-items: center;
  height: var(--scale-1100);            /* 44 */
  padding: 0 var(--scale-200);
  flex-shrink: 0;
}
.tut-topbar-filler { flex: 1; }

/* ── Onboarding (3 screens, content swapped by tutorial.js) ───────────────
   The top bar is full-bleed, so this step drops the shared horizontal padding
   and each inner region pads itself; top padding is just the safe-area inset
   so the bar sits right under the status bar. */
.tut-ob {
  padding: 0;
  padding-top: max(env(safe-area-inset-top, 0), var(--scale-200));
  padding-bottom: max(env(safe-area-inset-bottom, 0), 0px);
}
.tut-ob-main {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding: 0 var(--scale-600) var(--scale-1000);   /* 24 sides, 40 bottom (Figma) */
}
.tut-ob-top {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--scale-1200);               /* 48 between visual and text */
  padding-top: var(--scale-1600);       /* 64 */
}
.tut-ob-image {
  width: 100%; max-width: 345px; height: 280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.tut-ob-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tut-ob-content {
  display: flex; flex-direction: column; gap: var(--scale-400);
  max-width: 400px; width: 100%; margin: 0 auto;
}
.tut-ob-content h2 { margin: 0; }    /* .h4 utility class carries the font styling */
.tut-ob-content p { margin: 0; color: var(--text-body); }   /* .body-lg carries font styling; body's own color rule wins otherwise */
/* Grid (not flex+absolute) so Back and Next sit on the exact same row as the
   dots, vertically centered together — the side columns size to their own
   button, the dots always land dead center. Back is hidden on screen 1 (the
   left column just stays empty, dots stay centered). */
.tut-ob-footer {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding-top: var(--scale-500);
  max-width: 400px; width: 100%; margin: 0 auto;
}
/* Pin each item to its own column so hiding Back (screen 1) doesn't let grid
   auto-flow slide the dots + Next leftward — the dots stay dead center and
   Next stays flush right regardless. */
.tut-ob-footer #obBackBtn { grid-column: 1; justify-self: start; }
.tut-ob-footer #obBackBtn[hidden] { display: none; }
.tut-ob-footer .cf-pagination-dots { grid-column: 2; justify-self: center; }
.tut-ob-footer #obNextBtn { grid-column: 3; justify-self: end; }

/* ── Permission explainer screens (location / notifications) ─────────────── */
.tut-perm-image {
  width: 100%; max-width: 345px; height: 280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.tut-perm-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tut-perm-content {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--scale-500);
  padding-top: var(--scale-600);
  max-width: 400px; width: 100%; margin: 0 auto;
}
.tut-perm-heading { margin: 0; }     /* .h6 utility class carries the font styling */
.tut-perm-note { margin: var(--scale-300) 0 0; color: var(--text-body-light); }
.tut-perm-row { display: flex; align-items: flex-start; gap: var(--scale-400); }
.tut-perm-avatar {
  flex-shrink: 0; width: var(--scale-900); height: var(--scale-900);
  border-radius: var(--radius-round);
  background: var(--surface-information); color: var(--icon-information);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--scale-500);
}
.tut-perm-row p { margin: 0; color: var(--text-body); }
.tut-perm-actions {
  display: flex; flex-direction: column; gap: var(--scale-300);
  padding-top: var(--scale-500);
  max-width: 400px; width: 100%; margin: 0 auto;
}
.tut-perm-actions .cf-btn { width: 100%; }
