@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=DM+Serif+Display&display=swap');

/* Eén accent: het bruin. Eén markeerkleur: het warme zand. Geen derde kleur.
   Contrast volgens WCAG 2.2 AA, gemeten tegen papier en zand:
   --inkt     15,2 / 13,0   tekst
   --bruin     8,3 /  7,1   tekst, knoppen, focusrand
   --gedempt   5,7 /  4,9   kleine tekst (eis 4,5)
   --rand      4,2 /  3,6   randen van knoppen en het vinkje (eis 3)
   --lijn      alleen decoratieve scheidingslijnen, geen informatie */
:root {
  --papier: #fffaf3;
  --inkt: #3b2a20;
  --bruin: #6b4226;
  --bruin-diep: #563419;
  --gedempt: #74614c;
  --rand: #8a7660;
  --lijn: #e2d5c3;
  --zand: #f3e8da;
  --zand-diep: #ecdcc7;
  --donker: #26150d;
}

* { -webkit-tap-highlight-color: transparent; }
html {
  background-color: var(--papier);
  -webkit-text-size-adjust: 100%;
  /* Bij tabben scrolt de browser een element in beeld. Deze marges houden het
     vrij van de vaste balk bovenin en de ronde knop onderin (WCAG 2.4.11). */
  scroll-padding-top: 84px;
  scroll-padding-bottom: 104px;
}

/* ---------- Alleen voor schermlezers ---------- */
.tobm-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Overslaglink, zichtbaar zodra hij focus krijgt ---------- */
.tobm-skip {
  position: fixed;
  z-index: 100;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  padding: 12px 18px;
  border-radius: 12px;
  background-color: var(--papier);
  color: var(--bruin);
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: 0 6px 18px rgba(38, 21, 13, 0.35);
  transform: translateY(calc(-100% - 24px));
}
.tobm-skip:focus {
  transform: none;
  outline: 2px solid var(--bruin);
  outline-offset: 2px;
}
body {
  margin: 0;
  padding: 0 0 calc(104px + env(safe-area-inset-bottom));
  background-color: var(--papier);
  font-family: 'DM Sans', Arial, sans-serif;
  color: var(--inkt);
  overflow-x: hidden;
}

/* ---------- Header met foto en logo ---------- */
.tobm-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(170px, 30vw, 250px);
  padding-top: env(safe-area-inset-top);
  margin-bottom: 40px;
  background-color: var(--donker);
  overflow: hidden;
}
.tobm-hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
}
.tobm-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(38, 21, 13, 0.45) 0%, rgba(38, 21, 13, 0.15) 45%, rgba(38, 21, 13, 0.45) 100%);
}
.tobm-hero-title {
  position: relative;
  margin: 0;
  padding: 0 24px;
  /* Kleur en lettertype zijn er voor het geval de logo-afbeelding niet laadt:
     dan staat de naam als witte tekst op de donkere header. */
  font-family: 'DM Serif Display', 'Georgia', serif;
  font-size: 30px;
  color: var(--papier);
  line-height: 1.2;
}
.tobm-hero-logo {
  display: block;
  width: min(260px, 58vw);
  height: auto;
}
.tobm-install-btn {
  display: none;
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 13px;
  color: var(--papier);
  background-color: rgba(38, 21, 13, 0.45);
  border: 1px solid rgba(255, 250, 243, 0.65);
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.tobm-install-btn:hover {
  background-color: var(--papier);
  color: var(--bruin);
}

/* ---------- Meelopende balk ---------- */
.tobm-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40; /* onder het bestelpaneel en zijn waas */
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding-top: env(safe-area-inset-top);
  background-color: var(--donker);
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}
body.tobm-topbar-zichtbaar .tobm-topbar {
  transform: translateY(0);
}
.tobm-topbar-logo {
  display: block;
  width: auto;
  height: 40px;
}

.tobm-offline-note {
  display: none;
  width: 100%;
  max-width: 660px;
  margin: 0 auto 20px;
  box-sizing: border-box;
  font-size: 14px;
  color: var(--bruin);
  background-color: var(--zand);
  border-radius: 12px;
  padding: 12px 16px;
}
body.tobm-is-offline .tobm-offline-note { display: block; }

/* ---------- Kaart ---------- */
.tobm-page {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}
.tobm-sectie {
  margin-top: 44px;
}
/* De eerste kop staat direct onder de foto. Marge op nul, zodat de afstand
   alleen van de header komt en niet afhangt van samenklappende marges. */
.tobm-sectie:first-of-type {
  margin-top: 0;
}
.tobm-page h2 {
  font-family: 'DM Serif Display', 'Georgia', serif;
  font-weight: normal;
  font-size: 34px;
  line-height: 1.1;
  color: var(--inkt);
  margin: 0 0 14px;
}
.tobm-subhead {
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gedempt);
  margin: 26px 0 6px;
}
.tobm-sectie-hint {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--gedempt);
}

/* ---------- Een regel van de kaart ---------- */
.tobm-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 12px;
  margin: 0 -12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background-color 0.18s ease;
}
.tobm-item[role="button"]:hover {
  background-color: var(--zand);
}
.tobm-item:focus-visible {
  outline: 2px solid var(--bruin);
  outline-offset: 2px;
}
.tobm-item.tobm-gekozen {
  background-color: var(--zand);
}
.tobm-item-maten {
  cursor: default;
}
/* Is er een maat gekozen, dan kun je de regel aantikken om hem weer weg te
   halen, dus dan mag de muisaanwijzer dat ook laten zien. */
.tobm-item-maten.tobm-gekozen {
  cursor: pointer;
}
.tobm-item-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--zand-diep);
  color: var(--bruin);
  transition: background-color 0.18s ease;
}
.tobm-item.tobm-gekozen .tobm-item-icon {
  background-color: #e3d0b6;
}
.tobm-item-icon svg {
  width: 30px;
  height: 30px;
}
.tobm-item-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.tobm-item-name-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.tobm-item-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--inkt);
}
.tobm-item-desc {
  font-size: 14px;
  color: var(--gedempt);
  margin-top: 3px;
}

/* ---------- Het vinkje rechts ---------- */
.tobm-item-mark {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid var(--rand);
  color: var(--papier);
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
/* Het vinkje is er alleen als de regel gekozen is. Verbergen in plaats van
   doorzichtig kleuren: in Hoog Contrast-modus overschrijft Windows de kleur, en
   dan zou een doorzichtig vinkje ineens zichtbaar worden. */
.tobm-item-mark svg {
  width: 16px;
  height: 16px;
  visibility: hidden;
}
.tobm-item.tobm-gekozen .tobm-item-mark svg {
  visibility: visible;
}
.tobm-item.tobm-gekozen .tobm-item-mark {
  background-color: var(--bruin);
  border-color: var(--bruin);
  color: var(--papier);
}

/* ---------- Maten bij de filterkoffie ---------- */
.tobm-size-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.tobm-size-opt {
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 13px;
  color: var(--bruin);
  background: none;
  border: 1px solid var(--rand);
  border-radius: 22px;
  /* 13px boven en onder brengt de pil op 44px hoog, de ondergrens voor een
     vingertop. De rest van de kaart is één grote aanraakzone per regel. */
  padding: 13px 16px;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.tobm-size-opt:hover {
  border-color: var(--bruin);
}
.tobm-size-opt.tobm-size-active {
  background-color: var(--bruin);
  border-color: var(--bruin);
  color: var(--papier);
}

/* ---------- Welke koffie er vandaag op staat ---------- */
.tobm-bean-note {
  margin: 0 0 20px;
  padding: 16px 18px;
  box-sizing: border-box;
  border-radius: 16px;
  background-color: var(--zand);
}
.tobm-bean-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--inkt);
}
.tobm-bean-name a {
  color: var(--bruin);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.tobm-bean-name a:hover {
  color: var(--bruin-diep);
}
.tobm-bean-origin {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--gedempt);
}
.tobm-bean-taste {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--bruin);
}

/* ---------- Voettekst ---------- */
.tobm-footer {
  max-width: 660px;
  margin: 56px auto 0;
  padding: 0 20px;
  text-align: center;
}
.tobm-footer-logo {
  display: block;
  width: min(160px, 42vw);
  height: auto;
  margin: 0 auto;
}
.tobm-footer-version {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--gedempt);
}

/* ---------- Zwevende knop ---------- */
.tobm-fab {
  position: fixed;
  z-index: 70;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background-color: var(--bruin);
  color: var(--papier);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(59, 42, 32, 0.35);
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.tobm-fab:hover {
  background-color: var(--bruin-diep);
}
.tobm-fab svg {
  width: 28px;
  height: 28px;
}
.tobm-fab-icon-close {
  display: none;
  font-size: 30px;
  line-height: 1;
}
body.tobm-sheet-open .tobm-fab-icon-cart { display: none; }
body.tobm-sheet-open .tobm-fab-icon-close { display: block; }
.tobm-fab-count {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 24px;
  height: 24px;
  box-sizing: border-box;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 2px solid var(--papier);
  background-color: var(--donker);
  color: var(--papier);
  font-size: 12px;
  font-weight: 700;
}
.tobm-fab-count[hidden] { display: none; }
@keyframes tobm-fab-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.tobm-fab.tobm-fab-pop {
  animation: tobm-fab-pop 0.4s ease;
}

/* ---------- Bestelpaneel ---------- */
.tobm-sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(38, 21, 13, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
body.tobm-sheet-open .tobm-sheet-scrim {
  opacity: 1;
  visibility: visible;
}
.tobm-cart-sheet {
  position: fixed;
  z-index: 60;
  display: flex;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: min(380px, calc(100vw - 32px));
  /* Nooit hoger dan wat er boven de ronde knop over is (92px onder, 16px
     boven), anders valt het paneel bij inzoomen boven het scherm uit. */
  max-height: min(70vh, 560px, calc(100vh - 108px - env(safe-area-inset-bottom)));
  max-height: min(70dvh, 560px, calc(100dvh - 108px - env(safe-area-inset-bottom)));
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}
body.tobm-sheet-open .tobm-cart-sheet {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.tobm-cart {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-family: 'DM Sans', Arial, sans-serif;
  color: var(--inkt);
  background-color: var(--papier);
  border-radius: 20px;
  padding: 22px 24px;
  box-sizing: border-box;
  box-shadow: 0 18px 44px rgba(59, 42, 32, 0.28);
}
.tobm-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.tobm-cart-head h2 {
  font-family: 'DM Serif Display', 'Georgia', serif;
  font-weight: normal;
  font-size: 24px;
  color: var(--inkt);
  margin: 0;
}
.tobm-sheet-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background-color: var(--zand);
  color: var(--gedempt);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.tobm-sheet-close:hover {
  background-color: var(--bruin);
  color: var(--papier);
}
.tobm-cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tobm-cart-empty {
  font-size: 15px;
  color: var(--gedempt);
  padding: 4px 0 8px;
}
.tobm-cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
}
.tobm-cart-row + .tobm-cart-row {
  border-top: 1px solid var(--lijn);
}
.tobm-cart-name {
  font-size: 16px;
}
.tobm-cart-remove-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background-color: var(--zand);
  color: var(--gedempt);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.tobm-cart-remove-btn:hover {
  background-color: #b03a2e;
  color: var(--papier);
}
.tobm-place-order-btn {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 15px 0;
  border: none;
  border-radius: 14px;
  background-color: var(--bruin);
  color: var(--papier);
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.tobm-place-order-btn:hover {
  background-color: var(--bruin-diep);
}
.tobm-clear-cart-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px 0;
  border: none;
  border-radius: 14px;
  background: none;
  color: var(--gedempt);
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.tobm-clear-cart-btn:hover {
  background-color: var(--zand);
  color: var(--bruin);
}
.tobm-order-confirmation {
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--bruin);
  text-align: center;
}
.tobm-order-confirmation[hidden] { display: none; }

/* ---------- Smal scherm ---------- */
@media (max-width: 640px) {
  .tobm-page, .tobm-footer {
    padding: 0 16px;
  }
  .tobm-page h2 {
    font-size: 28px;
  }
  .tobm-sectie {
    margin-top: 36px;
  }
  .tobm-cart-sheet {
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
    width: auto;
    max-height: min(72vh, calc(100vh - 108px - env(safe-area-inset-bottom)));
    max-height: min(72dvh, calc(100dvh - 108px - env(safe-area-inset-bottom)));
  }
  .tobm-cart {
    padding: 20px;
  }
}

/* Bij sterk inzoomen is het scherm maar een paar honderd pixels hoog. Dan
   neemt een vaste balk te veel van het beeld weg, dus die blijft weg. */
@media (max-height: 420px) {
  .tobm-topbar { display: none; }
  html { scroll-padding-top: 16px; }
}

/* Windows Hoog Contrast: achtergrondkleuren vallen weg, dus de gekozen staat
   moet ook met systeemkleuren te zien zijn. */
@media (forced-colors: active) {
  .tobm-item.tobm-gekozen {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
  .tobm-item-mark {
    border-color: CanvasText;
  }
  .tobm-item.tobm-gekozen .tobm-item-mark {
    forced-color-adjust: none;
    background-color: Highlight;
    border-color: Highlight;
    color: HighlightText;
  }
  .tobm-size-opt {
    border-color: ButtonText;
  }
  .tobm-size-opt.tobm-size-active {
    forced-color-adjust: none;
    background-color: Highlight;
    border-color: Highlight;
    color: HighlightText;
  }
  .tobm-fab {
    border: 2px solid ButtonText;
  }
  .tobm-cart {
    border: 1px solid CanvasText;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tobm-cart-sheet, .tobm-sheet-scrim, .tobm-item, .tobm-fab, .tobm-topbar, .tobm-item-mark {
    transition-duration: 0.01ms;
  }
  .tobm-fab.tobm-fab-pop {
    animation: none;
  }
}
