@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin-ext.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #fff;
  --surface: #f3f4f0;   /* search, segmented track, chips at rest */
  --raised: #fff;       /* selected segment */
  --tint: rgb(60 80 20 / 0.06); /* laid over white photo tiles: the photo's white turns the same soft grey-green */
  --ink: #121612;
  --ink2: #535a53;
  --ink3: #6c736b;
  --line: #e3e6e0;
  --green: #0b6b45;
  --on-green: #fff;
  --green-soft: #e4f1e8;
  --green-ink: #0b6440;
  --warn-soft: #fceae6;
  --warn-ink: #9c2b19;
  --lime: #d5f36a;
  --lime-ink: #15280c;
  --shadow: 0 1px 2px rgb(18 22 18 / 0.08), 0 3px 10px rgb(18 22 18 / 0.06);
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1211;
    --surface: #1b201d;
    --raised: #2c332e;
    --tint: rgb(0 0 0 / 0.12); /* keeps the white photo tiles from glaring on the dark page */
    --ink: #eff2ee;
    --ink2: #b4bbb3;
    --ink3: #959c94;
    --line: #2a302c;
    --green: #45be84;
    --on-green: #06170e;
    --green-soft: #173323;
    --green-ink: #94e2b8;
    --warn-soft: #3b1d17;
    --warn-ink: #ffb4a4;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--ink3) var(--bg);
  scrollbar-gutter: stable; /* the page doesn't shift sideways when the sheet locks scrolling */
}
html:has(dialog[open]) { overflow: hidden; }
body { margin: 0; font: 400 16px / 1.4 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: var(--green); color: var(--on-green); }
:focus-visible { outline: 2.5px solid var(--green); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
p, h1, h2 { margin: 0; }
svg { display: block; flex: none; }
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.wrap { max-width: 1160px; margin: 0 auto; }

/* Header */
.top { padding: 14px var(--pad) 0; }
.store { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.store svg { width: 14px; height: 14px; }
h1 { margin-top: 6px; font-size: 28px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.dates { margin-top: 3px; font-size: 14px; color: var(--ink2); }
.controls { margin-top: 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: var(--surface); border-radius: 12px; }
.seg button {
  padding: 8px 0;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink2);
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg button[aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: var(--shadow); }
.search { position: relative; margin: 12px 0 0; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; translate: 0 -50%; color: var(--ink2); pointer-events: none; }
.search input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  font-size: 16px;
  caret-color: var(--green);
  transition: border-color 0.15s, background-color 0.15s;
}
.search input::placeholder { color: var(--ink2); opacity: 1; }
.search input:focus { outline: none; border-color: var(--green); background: var(--bg); }
.search input::-webkit-search-cancel-button {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--ink3);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 4.5l7 7m0-7-7 7' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  cursor: pointer;
}

/* Sort and diet chips share one scrolling row */
.diet { padding-top: 12px; }
.chips {
  display: flex;
  gap: 8px;
  min-height: 38px; /* holds the row's height while the chips load */
  padding: 0 var(--pad) 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chipset { display: contents; }
.chip, .sortsel {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, scale 0.12s;
}
.chip .n { font-weight: 500; color: var(--ink3); }
.chip svg { display: none; width: 14px; height: 14px; }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--on-green); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.8; }
.chip[aria-pressed="true"] svg { display: block; }
.chip:active:not(:disabled) { scale: 0.96; }
.chip:disabled { opacity: 0.45; cursor: default; }
.sortwrap { position: relative; flex: none; display: flex; }
.sortsel { padding: 0 30px 0 33px; appearance: none; cursor: pointer; }
.sortwrap svg { position: absolute; top: 50%; translate: 0 -50%; pointer-events: none; }
.sortwrap .sorticon { left: 12px; width: 15px; height: 15px; color: var(--ink2); }
.sortwrap .chev { right: 11px; width: 14px; height: 14px; }
.note { display: flex; align-items: center; gap: 6px; margin: 8px var(--pad) 0; font-size: 12.5px; color: var(--ink2); }
.note svg { width: 14px; height: 14px; }

/* Department tabs stay at the top while scrolling */
.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  min-height: 47px;
  margin-top: 10px;
  padding: 0 calc(var(--pad) - 6px);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative;
  flex: none;
  padding: 12px 6px 11px;
  border: 0;
  background: none;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink3);
  white-space: nowrap;
  transition: color 0.15s;
}
/* drawn inside the button, so the scrolling row can't clip it */
.tabs button:focus-visible { outline-offset: -3px; border-radius: 8px; }
.tabs button[aria-pressed="true"] { color: var(--ink); }
.tabs button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 0;
  height: 2.5px;
  border-radius: 2px;
  background: var(--ink);
}
.tabs .n { margin-left: 4px; font-weight: 500; color: var(--ink3); }

/* Product grid */
.dept { display: flex; align-items: baseline; gap: 8px; padding: 24px var(--pad) 0; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.dept .n { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--ink3); }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 12px;
  margin: 0;
  padding: 12px var(--pad) 6px;
  list-style: none;
}
/* Off-screen cards are skipped until scrolled near; the 8px of room keeps the card's focus ring visible. */
.grid > li { content-visibility: auto; contain-intrinsic-size: auto 340px; margin: -8px; padding: 8px; }
.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: none;
  text-align: left;
}
.card:focus-visible { outline-offset: 4px; }
.tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  transition: scale 0.15s var(--ease);
}
.tile::after, .big::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--tint);
  pointer-events: none;
}
.tile img { width: 76%; height: 76%; object-fit: contain; transition: scale 0.4s var(--ease); }
.card:active .tile { scale: 0.97; }
.badge { position: absolute; left: 8px; top: 8px; z-index: 1; padding: 3px 8px; border-radius: 999px; background: var(--lime); color: var(--lime-ink); font-size: 12.5px; font-weight: 800; }
/* Time left sits on the light photo tile in both colour schemes, so its colours are fixed. */
.time {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.94);
  color: #3d443d;
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgb(18 22 18 / 0.08);
}
.time svg { width: 12px; height: 12px; }
.time.soon { background: #ffe5cc; color: #8a3a00; }
.time.later { background: #e6edfb; color: #284384; }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; margin-top: 10px; }
.price b { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.price s { font-size: 13px; color: var(--ink3); font-variant-numeric: tabular-nums; }
.cardp { margin-top: 2px; font-size: 12.5px; font-weight: 650; color: var(--green-ink); }
.name {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card .de { margin-top: 3px; overflow: hidden; font-size: 12.5px; color: var(--ink3); white-space: nowrap; text-overflow: ellipsis; }
.unit { margin-top: 1px; font-size: 12.5px; color: var(--ink2); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag { padding: 3px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green-ink); font-size: 12px; font-weight: 700; line-height: 1.3; }
.tag.warn { background: var(--warn-soft); color: var(--warn-ink); }

/* Loading placeholder tiles */
.skeleton li { animation: pulse 1.4s ease-in-out infinite; }
.skeleton .tile { display: block; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* Empty, error */
.empty { padding: 56px var(--pad); text-align: center; }
.empty p { max-width: 34ch; margin: 0 auto 16px; color: var(--ink2); }
.btn { height: 42px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 700; }
.btn:active { scale: 0.97; }

.foot { margin-top: 28px; padding: 20px var(--pad) 40px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink2); }
.foot p { max-width: 72ch; margin-bottom: 6px; }

/* Product sheet: rises from the bottom on phones, drag down or tap outside to close */
#sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 -10px 40px rgb(0 0 0 / 0.18);
  transition: translate 0.3s var(--ease), opacity 0.3s var(--ease);
}
#sheet[open] { animation: sheet-up 0.45s var(--ease); }
#sheet::backdrop { background: rgb(10 14 12 / 0.45); animation: fade 0.3s ease-out; transition: opacity 0.24s; }
#sheet.dragging { transition: none; }
#sheet.closing { translate: 0 100%; transition: translate 0.24s cubic-bezier(0.4, 0, 1, 1); }
#sheet.closing::backdrop { opacity: 0; }
@keyframes sheet-up { from { translate: 0 100%; } }
@keyframes fade { from { opacity: 0; } }
.sheet-in { padding: 0 20px calc(28px + env(safe-area-inset-bottom)); }
.grab { display: grid; place-items: center; height: 26px; margin: 0 -20px; touch-action: none; cursor: grab; }
.grab::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.big { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 20px; background: #fff; }
.big img { width: 76%; height: 84%; object-fit: contain; }
.close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.94);
  color: #121612;
  box-shadow: 0 1px 3px rgb(18 22 18 / 0.15);
}
.close svg { width: 16px; height: 16px; }
.close:active { scale: 0.94; }
.sheet-price { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 16px; }
.sheet-price b { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sheet-price s { font-size: 15px; color: var(--ink3); }
.sheet-price .badge { position: static; }
#sheet h2 { margin-top: 6px; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
#sheet .de { margin-top: 4px; font-size: 14px; color: var(--ink2); }
#sheet .details { margin-top: 10px; font-size: 15px; }
#sheet .tags { margin-top: 12px; }
.why { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--green-soft); color: var(--green-ink); font-size: 13.5px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 18px; margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14.5px; }
.facts dt { color: var(--ink2); }
.facts dd { margin: 0; font-weight: 550; }

/* Hover effects only where there is a pointer that hovers, so they never stick after a tap */
@media (hover: hover) {
  .card:hover .tile img { scale: 1.045; }
  .chip:hover:not(:disabled), .sortsel:hover { border-color: var(--ink3); }
  .tabs button:hover { color: var(--ink); }
  .btn:hover { opacity: 0.88; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, #sheet, #sheet::backdrop { animation: none !important; transition: none !important; }
}

/* Wider screens: more columns, controls side by side, every department tab visible */
@media (min-width: 760px) {
  :root { --pad: 28px; }
  .top { padding-top: 32px; }
  h1 { font-size: 38px; }
  .controls { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
  .seg { flex: none; width: 300px; }
  .search { flex: 1; max-width: 520px; margin: 0; }
  .chips { flex-wrap: wrap; overflow: visible; }
  .tabs { flex-wrap: wrap; overflow: visible; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 30px 20px; }
  #sheet { margin: auto; border-radius: 24px; }
  #sheet[open] { animation: sheet-in 0.4s var(--ease); }
  #sheet.closing { translate: 0 24px; opacity: 0; transition: translate 0.2s ease-in, opacity 0.2s ease-in; }
  @keyframes sheet-in { from { translate: 0 24px; opacity: 0; } }
  .grab { display: none; }
  .sheet-in { padding: 20px 24px 28px; }
}
