/* TrueVision QR: shadcn/ui-stijl tokens en componenten in gewone CSS, met het
   palet van Gemeente Utrecht. Beweging naar het voorbeeld van het Files portal. */

:root {
  color-scheme: light;
  /* Gemeente Utrecht */
  --rood: #cc0000; --wit: #ffffff; --zwart: #000000; --geel: #ffcc00; --blauw: #006dff;
  --oranje: #ff6e00; --groen: #32ab27; --cyaan: #009ed4; --marine: #1c4181; --paars: #762cd1;
  --bruin: #ad643b; --grijs: #757575;

  --background: color-mix(in srgb, var(--zwart) 3%, var(--wit));
  --foreground: var(--zwart);
  --card: var(--wit);
  --muted: color-mix(in srgb, var(--zwart) 6%, var(--wit));
  --muted-foreground: var(--grijs);
  --border: color-mix(in srgb, var(--zwart) 13%, var(--wit));
  --primary: var(--rood);
  --primary-foreground: var(--wit);
  --ring: var(--blauw);
  --status-negative: var(--rood);
  --status-neutral: var(--geel);
  --status-positive: var(--groen);
  --shadow-sm: 0 1px 2px color-mix(in srgb, var(--zwart) 6%, transparent);
  --shadow-md: 0 1px 3px color-mix(in srgb, var(--zwart) 8%, transparent), 0 8px 24px -8px color-mix(in srgb, var(--zwart) 14%, transparent);

  --radius: 0.75rem;
  --font-sans: "Lucida Sans", "Lucida Sans Unicode", "Lucida Grande", sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --ease-spring-soft: cubic-bezier(0.34, 1.2, 0.64, 1);
}
@supports (animation-timing-function: linear(0, 1)) {
  :root {
    --ease-spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121,
      1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%,
      0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1);
    --ease-spring-soft: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%,
      0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.9%, 1);
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --dark: 1; }
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: var(--zwart);
    --foreground: var(--wit);
    --card: color-mix(in srgb, var(--wit) 7%, var(--zwart));
    --muted: color-mix(in srgb, var(--wit) 11%, var(--zwart));
    --muted-foreground: color-mix(in srgb, var(--wit) 62%, var(--zwart));
    --border: color-mix(in srgb, var(--wit) 17%, var(--zwart));
    --shadow-md: 0 8px 24px -8px color-mix(in srgb, var(--zwart) 70%, transparent);
  }
}
:root[data-theme="dark"] {
  --background: var(--zwart);
  --foreground: var(--wit);
  --card: color-mix(in srgb, var(--wit) 7%, var(--zwart));
  --muted: color-mix(in srgb, var(--wit) 11%, var(--zwart));
  --muted-foreground: color-mix(in srgb, var(--wit) 62%, var(--zwart));
  --border: color-mix(in srgb, var(--wit) 17%, var(--zwart));
  --shadow-md: 0 8px 24px -8px color-mix(in srgb, var(--zwart) 70%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.5; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column;
}
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
p { margin: 0 0 0.75rem; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.icon { flex: none; }
.visually-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Entrance: .reveal stijgt in met fade en blur, gespreid per --i (70 ms). */
.reveal { animation: reveal 0.7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + 40ms); }
@keyframes reveal {
  from { opacity: 0; transform: translateY(10px) scale(0.99); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- Opbouw ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--primary); color: var(--primary-foreground);
}
.stage {
  flex: 1; width: 100%; max-width: 32rem; margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.view[hidden] { display: none; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-md);
}
.hero { padding: 36px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; margin-top: 8vh; }
.hero p { color: var(--muted-foreground); max-width: 24rem; }
.hero .hint { font-size: 0.875rem; }
.hero-icon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 999px; margin-bottom: 16px;
  background: color-mix(in srgb, var(--blauw) 12%, transparent); color: var(--blauw);
}
.hero-icon--warn { background: color-mix(in srgb, var(--geel) 28%, transparent); color: var(--foreground); }
.hero-icon--ok { width: 80px; height: 80px; background: color-mix(in srgb, var(--groen) 16%, transparent); color: var(--groen); animation: pop 0.7s var(--ease-spring) both; }
.hero-icon--pulse { animation: pulse 1.8s var(--ease-in-out) infinite; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--blauw) 45%, transparent); } 70%, 100% { box-shadow: 0 0 0 18px transparent; } }
.hero--done .thanks { color: var(--foreground); font-size: 1.25rem; font-weight: 700; line-height: 1.35; max-width: 22rem; margin-bottom: 1.25rem; }
.hero--done .hero-icon--ok .icon-circle-check path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw 0.6s var(--ease-out) 0.3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.intro { margin: 8px 0 16px; }
.intro p { color: var(--muted-foreground); margin: 0; }

/* ---------- Knoppen ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  font-weight: 700; background: transparent; touch-action: manipulation;
  transition: transform 300ms var(--ease-spring), background 150ms var(--ease-out), box-shadow 200ms var(--ease-out), opacity 150ms var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(0.97); transition-duration: 100ms; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-lg { min-height: 56px; font-size: 1.0625rem; padding: 0 24px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--rood) 88%, var(--zwart)); box-shadow: var(--shadow-md); }
.btn-outline { border-color: var(--border); background: var(--card); }
.btn-outline:hover { background: var(--muted); }
.btn-ghost { color: var(--muted-foreground); }
.btn-ghost:hover { background: var(--muted); color: var(--foreground); }
.btn .icon { transition: transform 400ms var(--ease-spring); }
.btn:hover:not(:disabled) .icon-refresh-cw { transform: rotate(120deg); }
.btn.is-busy .btn-label { opacity: 0; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius); cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--foreground);
  transition: background 150ms var(--ease-out), transform 300ms var(--ease-spring);
}
.icon-btn:hover { background: var(--muted); }
.icon-btn:active { transform: scale(0.92); }
.theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: none; }
:root[data-theme="dark"] .theme-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: none; }
  :root:not([data-theme="light"]) .theme-moon { display: block; }
}

/* ---------- Keuzelijst ---------- */
.choices { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius);
  transition: transform 300ms var(--ease-spring), border-color 150ms var(--ease-out), background 150ms var(--ease-out), box-shadow 200ms var(--ease-out);
  animation: row-in 0.55s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + 80ms);
}
@keyframes row-in { from { opacity: 0; transform: translateY(12px) scale(0.98); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
.choice:hover { background: var(--muted); }
.choice:active { transform: scale(0.985); transition-duration: 100ms; }
.choice[aria-checked="true"] {
  border-color: var(--primary); background: color-mix(in srgb, var(--rood) 7%, var(--card));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rood) 16%, transparent);
}
.choice-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c, var(--grijs)); }
.choice-main { flex: 1; min-width: 0; }
.choice-title { font-weight: 700; overflow-wrap: anywhere; }
.choice-sub { font-size: 0.875rem; color: var(--muted-foreground); }
.choice-dist { font-size: 0.875rem; font-variant-numeric: tabular-nums; color: var(--muted-foreground); white-space: nowrap; }
.choice-check {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border);
  color: var(--primary-foreground); transition: background 200ms var(--ease-out), border-color 200ms var(--ease-out), transform 400ms var(--ease-spring);
}
.choice-check .icon { transform: scale(0); transition: transform 400ms var(--ease-spring); }
.choice[aria-checked="true"] .choice-check { background: var(--primary); border-color: var(--primary); transform: scale(1.1); }
.choice[aria-checked="true"] .choice-check .icon { transform: scale(1); }

.actions { display: grid; gap: 8px; justify-items: center; }
.actions .btn-block { justify-self: stretch; }

.notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin: 0 0 16px; border-radius: var(--radius);
  background: var(--muted); color: var(--foreground); animation: reveal 0.5s var(--ease-out) both;
}
.notice .icon { margin-top: 2px; }
.notice[hidden] { display: none; }
.notice--error { background: color-mix(in srgb, var(--rood) 10%, transparent); border: 1px solid color-mix(in srgb, var(--rood) 35%, transparent); }
.notice--error .icon { color: var(--rood); }
:root[data-theme="dark"] .notice--error .icon { color: color-mix(in srgb, var(--rood) 60%, var(--wit)); }

/* Aftellen op het bevestigingsscherm. */
.countdown { font-size: 0.875rem; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.progress { width: 100%; max-width: 16rem; height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; margin-bottom: 20px; }
.progress span { display: block; height: 100%; width: 100%; background: var(--groen); border-radius: inherit; transform-origin: left; }

/* Telefoonbreedte: de bevestiging en keuzes vullen de breedte. */
@media (max-width: 480px) { .hero { margin-top: 4vh; padding: 28px 18px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important;
    transition-duration: 0.01ms !important; transition-delay: 0ms !important;
  }
  .btn.is-busy::after { animation: spin 0.8s linear infinite !important; }
}
