/**
 * Kwit Onboarding — Base Styles
 *
 * Global resets, typography defaults, app container layout,
 * progress bar, persistent Lottie layer, and utility classes.
 *
 * Layer order (z-index):
 *   0 — #persistent-lottie-bg (shared animation background)
 *   1 — #screen-container (all screen content)
 *  100 — #progress-bar-container (sticky top bar)
 */

/* ── Reset — normalize across browsers ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;    /* Prevent font scaling on orientation change (iOS) */
  -webkit-font-smoothing: antialiased;    /* Smoother font rendering (macOS/iOS) */
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography & Body Defaults ── */
body {
  font-family: var(--font-family);
  font-weight: var(--font-weight-regular);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: #EAF8FB;
  overflow-x: hidden;
  min-height: 100dvh;
  /* Native-app feel: nothing is selectable/copyable anywhere in the OB */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* no iOS long-press callout on links/images */
}

/* Exception: typing fields need selection to edit one's own text */
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* ── Element Resets — remove default styles for interactive elements ── */
img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: none;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

/* ── App Container — centered column, full height on mobile ── */
#app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #EAF8FB;
}

/* ── Desktop: simulate iPhone 14 Pro frame (390×844) ── */
@media (min-width: 600px) {
  body {
    background: #F0F2F5;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #app {
    width: 390px;
    max-width: 390px;
    height: 844px;
    max-height: 90vh;
    min-height: auto;
    border-radius: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin: var(--space-xl) auto;
  }

  #screen-container {
    overflow-y: auto;
  }
}

/* Progress bar */
#progress-bar-container {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--progress-height);
  background: var(--color-border);
}

#progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  transition: width var(--transition-slow);
  width: 0%;
}

/* Persistent Lottie background (shared by welcome + info screens) */
#persistent-lottie-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #EAF8FB;
}

#persistent-lottie-bg svg {
  width: 100% !important;
  height: 100% !important;
}

/* Screen container */
#screen-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 0;
  z-index: 1;
}

/* Utility classes */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Markdown-like bold in text */
.text-bold { font-weight: var(--font-weight-bold); }

/* ── Accessibility — reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
