/* ==========================================================================
   HabitQuest — Reset, frame en typografie
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  /* Zero-typing: tekstselectie is zelden nodig en voelt "webby" op mobiel. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Op groot scherm: het mobiele frame gecentreerd tonen. */
@media (min-width: 520px) {
  body {
    background: var(--surface-sunken);
    display: grid;
    place-items: center;
  }
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

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

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* --------------------------------------------------------------------------
   Frame (US 6.1): max 414px breed, volledige hoogte, veilige zones
   -------------------------------------------------------------------------- */
.app-frame {
  position: relative;
  width: 100%;
  max-width: var(--frame-max);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 520px) {
  .app-frame {
    height: min(920px, 100dvh);
    border-radius: 44px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--hairline);
  }
}

.screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-top: var(--safe-top);
}

.screen::-webkit-scrollbar {
  display: none;
}

.screen__inner {
  padding: var(--s-6) var(--s-5) var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  min-height: 100%;
}

.screen--flush .screen__inner {
  padding-bottom: var(--s-6);
}

/* --------------------------------------------------------------------------
   Typografie-helpers
   -------------------------------------------------------------------------- */
/* Ook bruikbaar op een <span> binnen een flex-item. */
.display,
.title,
.heading {
  display: block;
}

.display {
  font-family: var(--font-display);
  font-size: var(--t-display);
  line-height: var(--lh-tight);
  font-weight: 640;
  letter-spacing: -0.028em;
}

.title {
  font-family: var(--font-display);
  font-size: var(--t-title);
  line-height: var(--lh-tight);
  font-weight: 620;
  letter-spacing: -0.022em;
}

.heading {
  font-size: var(--t-heading);
  line-height: var(--lh-snug);
  font-weight: 600;
  letter-spacing: -0.014em;
}

.body {
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--ink-2);
}

.sub {
  font-size: var(--t-sub);
  line-height: var(--lh-snug);
  color: var(--ink-2);
}

.caption {
  font-size: var(--t-caption);
  line-height: 1.45;
  color: var(--ink-3);
}

.micro {
  font-size: var(--t-micro);
  line-height: 1.4;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.eyebrow {
  font-size: var(--t-micro);
  font-weight: 640;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.center {
  text-align: center;
}

.stack {
  display: flex;
  flex-direction: column;
}

.stack-1 { gap: var(--s-1); }
.stack-2 { gap: var(--s-2); }
.stack-3 { gap: var(--s-3); }
.stack-4 { gap: var(--s-4); }
.stack-5 { gap: var(--s-5); }
.stack-6 { gap: var(--s-6); }

.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.row--between {
  justify-content: space-between;
}

.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }
.hidden { display: none !important; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Entree-animaties — kalm, nooit springerig
   -------------------------------------------------------------------------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.animate-in > * {
  animation: rise var(--dur-slow) var(--ease-out) both;
}

.animate-in > *:nth-child(1) { animation-delay: 0ms; }
.animate-in > *:nth-child(2) { animation-delay: 40ms; }
.animate-in > *:nth-child(3) { animation-delay: 80ms; }
.animate-in > *:nth-child(4) { animation-delay: 120ms; }
.animate-in > *:nth-child(5) { animation-delay: 160ms; }
.animate-in > *:nth-child(6) { animation-delay: 200ms; }
.animate-in > *:nth-child(n + 7) { animation-delay: 240ms; }

@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;
  }
}
