/* Fine Food Primeur shop: same colours and fonts as the homepage. */
:root {
  --green: #2e7d3f;
  --green-dark: #256a34;
  --green-light: #5bb348;
  --green-tint: #f3f8f2;
  --orange: #ef7d1a;
  --orange-tint: #fdf3ea;
  --red: #c62828;
  --ink: #1f2a22;
  --muted: #5d6b61;
  --bg: #ffffff;
  --line: #e4ece5;
  --serif: "EB Garamond", Georgia, serif;
  --radius: 14px;
  --header: 64px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
h1, h2, h3 { font-family: var(--serif); color: var(--green); margin: 0; font-weight: 600; text-wrap: balance; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header);
  background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  height: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--green);
  font-family: var(--serif); font-weight: 600; font-size: 20px; white-space: nowrap;
}
.brand img { width: 34px; height: 34px; mix-blend-mode: multiply; }
.brand small { font-family: "Inter", sans-serif; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--orange); }
.header-actions { display: flex; align-items: center; gap: 6px; }
.header-link {
  display: inline-flex; align-items: center; gap: 8px; position: relative;
  color: var(--muted); text-decoration: none; font: inherit; font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; border: 0; background: none; cursor: pointer;
}
.header-link:hover { color: var(--green); background: var(--green-tint); }
.header-link svg { width: 22px; height: 22px; }
.basket-link { color: var(--green); font-weight: 600; }
.basket-count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--orange); color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
}
.basket-count[data-count="0"] { background: var(--line); color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .basket-link.bump svg { animation: bump .6s cubic-bezier(.3,.7,.3,1.4); }
  .basket-link.bump .basket-count { animation: pop .6s cubic-bezier(.3,.7,.3,1.4); }
  @keyframes bump { 0% { transform: none; } 30% { transform: translateY(-4px) rotate(-10deg); } 60% { transform: translateY(1px) rotate(6deg); } 100% { transform: none; } }
  @keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
  .fly-dot {
    position: fixed; z-index: 100; width: 14px; height: 14px; border-radius: 50%;
    background: var(--orange); pointer-events: none;
    transition: transform .65s cubic-bezier(.5,-0.3,.7,.9), opacity .65s ease-in;
  }
}

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
  padding: 12px 22px; border-radius: 999px; border: 1.5px solid var(--green);
  background: #fff; color: var(--green); transition: background .2s, color .2s;
}
.btn:hover { background: var(--green-tint); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

.form { display: grid; gap: 16px; }
.form label { display: grid; align-content: start; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.form input {
  font: inherit; font-weight: 400; font-size: 16px; color: var(--ink);
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; width: 100%;
}
.form input:focus { outline: none; border-color: var(--green-light); box-shadow: 0 0 0 3px rgba(91,179,72,.18); }
.form input[aria-invalid="true"] { border-color: var(--red); }
.form .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.form .hint a { font-weight: 500; }
.form .field-error { font-weight: 500; font-size: 13px; color: var(--red); }
.form .field-error:empty { display: none; }
.form .ok { color: var(--green); font-weight: 500; font-size: 13px; }
.form fieldset { border: 0; padding: 0; margin: 8px 0 0; display: grid; gap: 16px; }
.form legend { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--green); padding: 0; margin-bottom: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-zip { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; }
.alert { padding: 12px 16px; border-radius: 10px; font-size: 15px; }
.alert:empty { display: none; }
.alert-error { background: #fdecea; color: #8e1f1f; }
.alert-ok { background: var(--green-tint); color: var(--green); }
.alert-info { background: var(--orange-tint); color: #8a4a0f; }

/* ---------- Auth pages ---------- */
.auth { min-height: calc(100vh - var(--header)); display: grid; place-items: start center; padding: 56px 16px 80px; background: var(--green-tint); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 32px; }
.auth-card.wide { max-width: 640px; }
.auth-card h1 { font-size: 34px; line-height: 1.1; margin-bottom: 6px; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); }
.auth-switch { margin: 22px 0 0; text-align: center; font-size: 15px; color: var(--muted); }

/* ---------- Shop layout ---------- */
.shop { display: grid; grid-template-columns: 240px 1fr; max-width: 1280px; margin: 0 auto; min-height: calc(100vh - var(--header)); }
.side {
  border-right: 1px solid var(--line); padding: 28px 16px;
  position: sticky; top: var(--header); align-self: start; height: calc(100vh - var(--header)); overflow-y: auto;
}
.side h2 { font-family: "Inter", sans-serif; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 0 12px 12px; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side a {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  color: var(--ink); font-weight: 500; padding: 10px 12px; border-radius: 10px;
}
.side a svg { width: 22px; height: 22px; color: var(--green-light); flex: none; }
.side a .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.side a:hover { background: var(--green-tint); }
.side a[aria-current="page"] { background: var(--green); color: #fff; }
.side a[aria-current="page"] svg, .side a[aria-current="page"] .count { color: #fff; }
.side li.fav a svg { color: var(--orange); }
.side li.fav { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }

.main { padding: 28px 32px 64px; min-width: 0; }
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--green-tint); padding: 32px 36px; margin-bottom: 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.hero .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--orange); margin: 0 0 8px; }
.hero h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.05; margin-bottom: 8px; }
.hero p { margin: 0; color: var(--muted); max-width: 34em; }
.hero .hero-icon { width: 96px; height: 96px; flex: none; color: var(--green-light); opacity: .9; }
.hero.fav .hero-icon { color: var(--orange); }
.hero-delivery { display: inline-flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 13px; color: var(--green); background: #fff; border-radius: 999px; padding: 5px 12px; border: 1px solid var(--line); }

/* Product table */
.products { width: 100%; border-collapse: collapse; }
.products th {
  text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px; border-bottom: 1.5px solid var(--line); white-space: nowrap;
}
.products td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.products tbody tr:hover { background: #fbfdfb; }
.products tr.in-basket { background: var(--green-tint); }
.products .name { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.products .desc { color: var(--muted); font-size: 14px; margin-top: 2px; }
.products .num, .products th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.products .price { font-weight: 600; }
.products .origin { white-space: nowrap; font-size: 14px; }
.products .qty-cell { width: 1%; white-space: nowrap; }
.qty {
  width: 84px; font: inherit; font-size: 16px; text-align: right; font-variant-numeric: tabular-nums;
  padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
.qty:focus { outline: none; border-color: var(--green-light); box-shadow: 0 0 0 3px rgba(91,179,72,.18); }
.qty.saved { border-color: var(--green-light); }
.qty.error { border-color: var(--red); }
.fav-btn { border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 8px; color: #b9c4bb; line-height: 0; }
.fav-btn:hover { color: var(--orange); background: var(--orange-tint); }
.fav-btn[aria-pressed="true"] { color: var(--orange); }
.fav-btn svg { width: 22px; height: 22px; }
svg { fill: none; } /* icons are line drawings; the star is filled when it is a favourite */
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.empty h2 { font-size: 26px; margin-bottom: 6px; }

/* Basket */
.basket { display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; }
.summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; position: sticky; top: calc(var(--header) + 24px); }
.summary h2 { font-size: 26px; margin-bottom: 12px; }
.summary dl { margin: 0 0 20px; display: grid; grid-template-columns: 1fr auto; gap: 8px 0; font-variant-numeric: tabular-nums; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; padding-left: 12px; text-align: right; }
.summary .total { font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--green); border-top: 1px solid var(--line); padding-top: 10px; }
.summary .note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.remove-btn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; line-height: 0; }
.remove-btn:hover { color: var(--red); background: #fdecea; }
.remove-btn svg { width: 20px; height: 20px; }
.unavailable { color: var(--red); font-size: 13px; font-weight: 500; }

/* Toast (errors from the API) */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 15px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: calc(100vw - 32px);
}
.toast[hidden] { display: none; }

/* Stage marker */
.stage-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: var(--red); color: #fff; text-align: center; font-size: 14px; font-weight: 600; padding: 9px 16px; }
body.is-stage { padding-bottom: 40px; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .shop { grid-template-columns: 1fr; }
  .side { position: sticky; top: var(--header); z-index: 40; height: auto; background: #fff; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .side h2 { display: none; }
  .side ul { display: flex; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .side li.fav { margin: 0; padding: 0; border: 0; }
  .side a { white-space: nowrap; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; }
  .side a svg { width: 18px; height: 18px; }
  .side a .count { display: none; }
  .basket { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 680px) {
  .site-header .inner { padding: 0 12px; }
  .brand span { display: none; }
  .header-link .label { display: none; }
  .main { padding: 20px 16px 48px; }
  .hero { padding: 22px 20px; }
  .hero .hero-icon { display: none; }
  .auth-card { padding: 28px 20px; }
  .grid-2 { grid-template-columns: 1fr; }
  /* Product rows become cards: name + description on top, details in a line below. */
  .products thead { display: none; }
  .products, .products tbody, .products tr, .products td { display: block; }
  .products tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
  .products td { padding: 0; border: 0; }
  .products td.product { grid-column: 1 / 2; }
  .products td.fav-cell { grid-column: 2; grid-row: 1; text-align: right; }
  .products td.meta { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
  .products td.meta::before { content: attr(data-label) " · "; }
  .products td.meta.origin:empty, .products td.meta.pack:empty { display: none; }
  .products td.num { text-align: left; }
  .products td.price-cell { grid-column: 1; align-self: center; font-size: 17px; }
  .products td.qty-cell { grid-column: 2; grid-row: auto; text-align: right; }
  .products td.line-cell { grid-column: 1; font-size: 14px; }
  .products td.line-cell::before { content: "Total CHF "; font-weight: 400; color: var(--muted); }
  .products td.remove-cell { grid-column: 2; text-align: right; }
}
