/* Eetrad: snackbar-bord. Ketchup, mayo, bonpapier en satésaus. */
:root {
  --ketchup: #d2331c;
  --ketchup-deep: #9a1d0e;
  --mayo: #ffd65c;
  --papier: #fff9ee;
  --sate: #3a1d10;
  --sate-soft: #6e4a3a;
  --sate-line: rgba(58, 29, 16, 0.22);
  --scrim: rgba(40, 10, 4, 0.55);

  --display: "Shrikhand", "Cooper Black", Georgia, serif;
  --ui: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: 20px;
  --wheel: clamp(230px, min(86vw, 420px, calc(100dvh - 426px)), 420px);
  --q-size: clamp(30px, 8.6vw, 42px);
  --ease-paper: cubic-bezier(0.2, 0.9, 0.25, 1.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ketchup: #b42813;
    --ketchup-deep: #7a1509;
    --scrim: rgba(20, 4, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  --ketchup: #b42813;
  --ketchup-deep: #7a1509;
  --scrim: rgba(20, 4, 0, 0.7);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ketchup);
  color: var(--papier);
  font: 400 16px/1.45 var(--ui);
  overscroll-behavior-y: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--papier);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  top: 0;
  left: 0;
  margin: -1px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Hoofdscherm ---------- */

.app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding:
    max(env(safe-area-inset-top), 12px)
    max(env(safe-area-inset-right), var(--gutter))
    max(env(safe-area-inset-bottom), 20px)
    max(env(safe-area-inset-left), var(--gutter));
  max-width: 560px;
  margin: 0 auto;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  gap: 12px;
}

.wordmark {
  font-family: var(--display);
  font-size: 24px;
  line-height: 1;
  color: var(--mayo);
  text-shadow: 0 3px 0 var(--ketchup-deep);
}

.place {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px 0 10px;
  border: 2px solid rgba(255, 249, 238, 0.55);
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  max-width: 62vw;
}
.place span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.place svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 8px 0 4px;
  text-align: center;
}

/* Vaste hoogte: bij Alle restaurants loopt hier de naam onder de wijzer mee, zonder dat het rad verspringt. */
.question-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: calc(var(--q-size) * 2.16);
}

.question {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--q-size);
  line-height: 1.08;
  letter-spacing: 0.005em;
  max-width: 11em;
  text-wrap: balance;
  text-shadow: 0 4px 0 var(--ketchup-deep);
}

/* Het rad */
.wheel-wrap {
  position: relative;
  width: var(--wheel);
  height: var(--wheel);
  margin-top: 10px;
  border-radius: 50%;
  box-shadow: 0 10px 0 var(--ketchup-deep);
  flex: none;
}

/* Houder die het draaiende canvas rond afsnijdt, anders steken de hoeken buiten beeld. */
.wheel-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
}

/* Aan het rad zelf draaien: vegen of tikken. */
.wheel-wrap {
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.wheel-wrap.is-dragging {
  cursor: grabbing;
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  will-change: transform;
  touch-action: manipulation;
}

.pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  width: 36px;
  height: 46px;
  margin-left: -18px;
  z-index: 2;
  transform-origin: 50% 12px;
  transition: transform 90ms ease-out;
  filter: drop-shadow(0 3px 0 var(--ketchup-deep));
}
.pointer::before,
.pointer::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 100% 34%, 50% 100%, 0 34%);
  border-radius: 6px;
}
.pointer::before {
  background: var(--sate);
}
.pointer::after {
  inset: 4px 5px 8px;
  background: var(--mayo);
}
.pointer.is-flick {
  transform: rotate(-16deg);
  transition-duration: 30ms;
}

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 27%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: var(--sate);
  color: var(--mayo);
  font-family: var(--display);
  font-size: clamp(15px, calc(var(--wheel) * 0.055), 22px);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 0 5px var(--mayo), 0 0 0 9px var(--sate);
  z-index: 1;
}
.hub:active {
  transform: translate(-50%, -48%);
}
.hub:disabled {
  cursor: default;
}

/* Knoppen */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 16px;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.btn-mayo {
  background: var(--mayo);
  color: var(--sate);
  box-shadow: 0 5px 0 var(--ketchup-deep);
}
.btn-mayo:active:not(:disabled),
.btn-mayo:disabled {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ketchup-deep);
}
.btn-mayo:disabled {
  opacity: 1;
}

.btn-sate {
  background: var(--sate);
  color: var(--mayo);
  box-shadow: 0 5px 0 #1c0c05;
}
.btn-sate:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #1c0c05;
}

.btn-line {
  background: transparent;
  color: var(--sate);
  box-shadow: inset 0 0 0 2px var(--sate);
}
.btn-line:active {
  background: rgba(58, 29, 16, 0.08);
}

.btn-big {
  width: 100%;
  min-height: 60px;
  font-size: 19px;
  border-radius: 18px;
}

.btn-small {
  min-height: 40px;
  padding: 0 16px;
  font-size: 15px;
}

.actions {
  width: min(100%, 380px);
  display: grid;
  gap: 14px;
  margin-top: 6px;
}

.status {
  margin: 0;
  min-height: 1.45em;
  font-size: 15px;
  color: rgba(255, 249, 238, 0.88);
}

.question.is-reading {
  max-width: 100%;
  font-size: calc(var(--q-size) * 0.7);
  line-height: 1.12;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* Keuze tussen per keuken of alle restaurants, op het rode scherm */
.mode {
  display: grid;
  grid-template-columns: repeat(3, auto);
  padding: 4px;
  border-radius: 16px;
  box-shadow: inset 0 0 0 2px rgba(255, 249, 238, 0.5);
}
.mode label {
  position: relative;
  display: grid;
  cursor: pointer;
}
.mode input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.mode span {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 12px;
  font-weight: 800;
  font-size: clamp(13px, 3.9vw, 15px);
  white-space: nowrap;
}
.mode input:checked + span {
  background: var(--papier);
  color: var(--sate);
}
.mode input:focus-visible + span {
  outline: 3px solid var(--papier);
  outline-offset: 2px;
}

/* Keuzelijst voor Eén keuken: op de telefoon opent de eigen picker van het systeem. */
.single {
  position: relative;
}
.single select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 50px;
  padding: 0 46px 0 16px;
  border: 0;
  border-radius: 16px;
  background: var(--papier);
  color: var(--sate);
  font: 800 17px/1.2 var(--ui);
  cursor: pointer;
}
.single::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 20px;
  width: 9px;
  height: 9px;
  border-right: 3px solid var(--sate);
  border-bottom: 3px solid var(--sate);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* Met de keuzelijst erbij krimpt het rad een stukje, zodat alles op één scherm blijft. */
.app.is-one {
  --wheel: clamp(196px, min(86vw, 420px, calc(100dvh - 494px)), 420px);
}

/* Keukens en Filters onder de draaiknop */
.tools {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 249, 238, 0.55);
  color: var(--papier);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.tool:active {
  background: rgba(255, 249, 238, 0.12);
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--mayo);
  color: var(--sate);
  font-size: 13px;
  font-weight: 800;
}
.badge:empty {
  display: none;
}

/* Knop op het rode scherm zonder vulling */
.btn-ghost {
  background: transparent;
  color: var(--papier);
  box-shadow: inset 0 0 0 2px rgba(255, 249, 238, 0.55);
}
.btn-ghost:active {
  background: rgba(255, 249, 238, 0.12);
}
.locate svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}
#settingsLocate {
  justify-self: start;
}

/* Melding bovenin, met ongedaan maken */
.toast {
  position: fixed;
  z-index: 30;
  top: max(env(safe-area-inset-top), 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 480px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 16px;
  background: var(--sate);
  color: var(--papier);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  font-weight: 600;
  font-size: 15px;
}
.toast span {
  flex: 1;
}
.toast button {
  flex: none;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--mayo);
  color: var(--sate);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

/* Postcode bij de eerste keer */
.start {
  width: min(100%, 380px);
  display: grid;
  gap: 10px;
  margin-top: 6px;
  text-align: left;
}
.start label,
.field label[for] {
  font-weight: 600;
  font-size: 15px;
}
.start-row {
  display: flex;
  gap: 10px;
}
.start-row input {
  width: 6.2ch;
  flex: none;
  min-height: 56px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: var(--papier);
  color: var(--sate);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.08em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.start-row input::placeholder {
  color: rgba(58, 29, 16, 0.3);
}
.start-row .btn {
  flex: 1;
  min-height: 56px;
}
.hint {
  margin: 0;
  font-size: 14px;
  min-height: 0;
}
.start .hint {
  color: var(--mayo);
  font-weight: 600;
}
.start .hint:empty {
  display: none;
}

/* ---------- Sheets ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 10;
  opacity: 0;
  transition: opacity 240ms ease-out;
}
.scrim.is-open {
  opacity: 1;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 11;
  width: min(100%, 520px);
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px var(--gutter) max(env(safe-area-inset-bottom), 22px);
  background: var(--papier);
  color: var(--sate);
  transform: translate(-50%, 104%);
  transition: transform 420ms var(--ease-paper);
}
.sheet.is-open {
  transform: translate(-50%, 0);
}
.sheet :focus-visible {
  outline-color: var(--sate);
}

.sheet h2 {
  margin: 0;
}
/* Titels krijgen focus zodat schermlezers ze voorlezen, maar zijn zelf niet bedienbaar. */
.sheet h2[tabindex="-1"]:focus {
  outline: none;
}

/* Het bonnetje */
.bon {
  overflow: visible;
  display: grid;
  gap: 18px;
  padding-top: 22px;
  box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.04);
}
.bon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
  background: conic-gradient(from 135deg at 50% 0, var(--papier) 90deg, #0000 0) 0 0 / 20px 10px repeat-x;
}

.bon-cuisine {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
  color: var(--sate-soft);
}
.bon-cuisine strong {
  color: var(--sate);
  font-weight: 800;
}

.bon-head {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
}
.bon-head img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
  box-shadow: inset 0 0 0 1px var(--sate-line), 0 0 0 1px var(--sate-line);
}
.bon-head h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(24px, 6.8vw, 30px);
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.bon-address {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--sate-soft);
}

.bon-rows {
  margin: 0;
  padding: 14px 0;
  border-top: 2px dashed var(--sate-line);
  border-bottom: 2px dashed var(--sate-line);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 16px;
}
.bon-rows dt {
  color: var(--sate-soft);
}
.bon-rows dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}
.bon-rows .is-closed {
  color: var(--ketchup);
}

.bon-more {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.bon-more.is-single {
  grid-template-columns: 1fr;
}
.bon-hide {
  justify-self: center;
  min-height: 40px;
  margin-top: -8px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--sate-soft);
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.bon-more .btn {
  font-size: 15px;
  padding: 0 10px;
  min-height: 52px;
}

/* Filters, keukens en instellingen */
.panel {
  border-radius: 24px 24px 0 0;
  display: grid;
  gap: 24px;
  align-content: start;
}
.panel > .about {
  color: var(--sate-soft);
}
/* Filters: de knop met het aantal restaurants blijft onderin staan terwijl je scrolt. */
.panel-filters {
  padding-bottom: 0;
}
.sheet-foot {
  position: sticky;
  bottom: 0;
  margin: 0 calc(-1 * var(--gutter));
  padding: 12px var(--gutter) max(env(safe-area-inset-bottom), 16px);
  background: var(--papier);
  box-shadow: 0 -2px 0 var(--sate-line);
}
.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sheet-top h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
}

.field {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
}
.field legend {
  padding: 0;
  margin-bottom: 10px;
  font-weight: 800;
  font-size: 17px;
}
.field .count {
  font-weight: 600;
  color: var(--sate-soft);
}
.field .hint {
  color: var(--sate-soft);
  margin-top: -4px;
}
.panel .start-row input {
  box-shadow: inset 0 0 0 2px var(--sate);
}
.panel .start-row .btn {
  flex: none;
  min-height: 56px;
}
#settingsHint {
  color: var(--ketchup);
  font-weight: 600;
}
#settingsHint:empty {
  display: none;
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}
.switch input {
  appearance: none;
  order: 2;
  flex: none;
  width: 52px;
  height: 32px;
  margin: 0;
  border-radius: 999px;
  background: var(--sate-line);
  position: relative;
  cursor: pointer;
  transition: background 160ms ease-out;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--papier);
  transition: transform 160ms ease-out;
}
.switch input:checked {
  background: var(--sate);
}
.switch input:checked::after {
  transform: translateX(20px);
  background: var(--mayo);
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px var(--sate);
}
.segmented label {
  position: relative;
  display: grid;
  cursor: pointer;
}
.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.segmented span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
}
.segmented input:checked + span {
  background: var(--sate);
  color: var(--mayo);
}
.segmented input:focus-visible + span {
  outline: 3px solid var(--sate);
  outline-offset: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--sate-line);
  color: var(--sate);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.chip small {
  font-size: 13px;
  font-weight: 600;
  color: var(--sate-soft);
  font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="true"] {
  background: var(--sate);
  box-shadow: none;
  color: var(--mayo);
}
.chip[aria-pressed="true"] small {
  color: rgba(255, 214, 92, 0.75);
}
.chip:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Lage schermen (iPhone SE en kleiner): alles wat dichter op elkaar. */
@media (max-height: 700px) {
  :root {
    --q-size: 28px;
  }
  .stage {
    gap: 14px;
  }
  .actions {
    gap: 8px;
  }
  .btn-big {
    min-height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .scrim,
  .pointer,
  .btn,
  .switch input,
  .switch input::after {
    transition: none;
  }
}
