/* ==========================================================================
   BagsakanVeggies storefront
   ========================================================================== */

:root {
  /* Surfaces */
  --paper: #f7f4ec;
  --paper-2: #efeadd;
  --surface: #ffffff;
  --line: #e4ddcc;
  --line-strong: #cfc6af;

  /* Text */
  --ink: #17231a;
  --ink-2: #4a584c;
  --ink-3: #647066;

  /* Brand */
  --green-950: #10291a;
  --green-900: #163a24;
  --green-800: #1f4a2e;
  --green-700: #26603a;
  --green-100: #e3eddc;
  --green-50: #f0f5eb;
  --cream: #f1ead6;
  --tomato: #c8432b;
  --tomato-700: #a8361f;

  /* Status */
  --danger: #b42318;
  --danger-50: #fdf0ee;
  --warn-50: #fbf3dd;
  --warn-line: #ecd9a4;
  --warn-ink: #6f4d0c;
  --messenger: #0866ff;

  /* Type */
  --font-body: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;

  /* Shape & depth */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgb(23 35 26 / 0.06);
  --shadow-2: 0 10px 30px -12px rgb(23 35 26 / 0.22);
  --shadow-3: 0 24px 48px -20px rgb(16 41 26 / 0.45);

  --container: 1200px;
  --header-h: 68px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Keep anchor targets clear of the sticky header. This is set on the targets, not as scroll-padding on html,
   because html padding made the browser scroll to the top whenever focus returned to the header's cart button. */
main,
main [id] { scroll-margin-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

[x-cloak] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--green-700);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.15s var(--ease-out);
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-800); }
.btn-primary:disabled { opacity: 0.6; }

.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-3); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }

.btn-messenger { background: var(--messenger); color: #fff; }
.btn-messenger:hover { background: #0057e0; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
}

.icon-button:hover { background: var(--paper-2); color: var(--ink); }

.link-button {
  padding: 4px 0;
  border: 0;
  background: none;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-danger { color: var(--danger); }
.link-button:disabled { opacity: 0.5; }

/* Announcement bar
   ========================================================================== */

.announcement {
  background: var(--green-900);
  color: var(--cream);
  font-size: 0.875rem;
}

.announcement-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding-block: 8px;
  text-align: center;
}

.announcement strong { color: #fff; font-weight: 600; }

/* Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  padding-block: 8px;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* The shop's logo emblem (public/images/logo-mark.png, transparent background) */
.brand-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }

.brand-word span { color: var(--green-700); }

.primary-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  margin-left: auto;
}

.primary-nav a {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: background-color 0.15s, color 0.15s;
}

.primary-nav a:hover { background: var(--paper-2); color: var(--ink); }

.primary-nav a[aria-current="page"] { background: var(--green-50); color: var(--green-800); font-weight: 600; }

.cart-button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cart-button:hover { border-color: var(--ink-3); box-shadow: var(--shadow-1); }

.cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--tomato);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cart-count.is-empty { background: var(--paper-2); color: var(--ink-3); }

.header-back { margin-left: auto; }
.header-back-short { display: none; }

/* Notices
   ========================================================================== */

.notice,
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

.notice {
  margin-top: 20px;
  background: var(--warn-50);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
}

.notice svg, .alert svg { margin-top: 2px; }

.alert-error {
  margin-bottom: 16px;
  background: var(--danger-50);
  border: 1px solid #f3c7c1;
  color: var(--danger);
}

.alert-error strong { font-weight: 600; }

/* Hero
   ========================================================================== */

.hero {
  padding: 56px 0 64px;
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  display: grid;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tomato-700);
}

.hero-title {
  max-width: 13ch;
  margin-top: 14px;
  font-size: clamp(2.5rem, 6.2vw, 4.5rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.hero-lede {
  max-width: 34rem;
  margin-top: 20px;
  font-size: 1.125rem;
  color: var(--ink-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 40px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.hero-facts li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--ink-2);
}

.hero-facts strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.hero-fact-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--green-100);
  color: var(--green-800);
  flex-shrink: 0;
}

/* Price board */

.price-board {
  padding: 28px;
  border-radius: 20px;
  background: var(--green-900);
  color: var(--cream);
  box-shadow: var(--shadow-3);
}

.price-board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgb(241 234 214 / 0.2);
}

.price-board-title { font-size: 1.625rem; color: #fff; }

.price-board-meta {
  font-size: 0.8125rem;
  color: rgb(241 234 214 / 0.72);
}

.price-table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.price-table th,
.price-table td {
  padding: 11px 0;
  border-bottom: 1px dashed rgb(241 234 214 / 0.2);
  text-align: left;
  font-weight: 500;
}

.price-table td.num,
.price-table th.num { text-align: right; padding-left: 16px; }

.price-table thead th {
  padding-top: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(241 234 214 / 0.72);
}

.price-table tbody th { color: #fff; }

.price-table td { color: #fff; font-weight: 600; }
.price-table tbody tr:last-child > * { border-bottom: 0; }

.price-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 10px 2px 0;
  border-radius: 50%;
  background: var(--swatch);
  vertical-align: middle;
}

.price-board-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 6px 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #f5d98b;
}

.price-board-link:hover { color: #fff; }

/* Sections
   ========================================================================== */

.section { padding: 64px 0; }

.section-muted {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}

#products { background: var(--surface); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 28px;
}

.section-title { font-size: clamp(1.75rem, 3vw, 2.25rem); }

.section-lede { color: var(--ink-2); }

/* Category links remain available above the shop list on every screen size. */
.shelf-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
}

.shelf-tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 22px;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 600;
  transition: background-color 0.15s, color 0.15s;
}

.shelf-tab:hover { background: var(--paper-2); color: var(--ink); }

.shelf-tab[aria-current="page"] {
  background: var(--green-800);
  color: #fff;
  box-shadow: var(--shadow-1);
}

/* Product grid
   ========================================================================== */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 32px 24px;
}

/* No frames, plain white: the only color on the page comes from the vegetable photos (client request). */
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.product-media { background: var(--surface); }

.product-photo-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  color: var(--line);
}

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 8px 0 0;
}

.product-name { font-size: 1rem; line-height: 1.2; }

.product-note {
  margin-top: 1px;
  font-size: 0.75rem;
  color: var(--ink-2);
}

.variant-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.variant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.variant-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.25;
  color: var(--ink-2);
  cursor: pointer;
}

.variant-price {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.variant-hint {
  flex-basis: 100%;
  font-size: 0.6875rem;
  color: var(--ink-3);
}

.qty-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.qty-caption { font-size: 0.6875rem; color: var(--ink-3); }

.qty-box {
  width: 44px;
  height: 30px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.qty-box::-webkit-outer-spin-button,
.qty-box::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.qty-box::placeholder { color: var(--line-strong); }

.qty-box:focus { outline: 2px solid var(--green-700); outline-offset: 0; border-color: var(--green-700); }

.btn-add {
  margin-top: auto;
  min-height: 38px;
  padding: 6px 10px;
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
}

.variant-list { margin-bottom: 12px; }

.btn-add:hover:not(:disabled) { border-color: var(--ink-3); }

.btn-add-label { display: inline-flex; align-items: center; gap: inherit; }
.btn-add-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.btn-add-total::before { content: "·"; margin-right: 8px; font-weight: 400; color: var(--ink-3); }
.btn-add:disabled { color: var(--ink-3); opacity: 1; }

/* End-of-list cart total + ORDER */

.order-summary {
  display: grid;
  justify-items: center;
  gap: 16px;
  max-width: 420px;
  margin: 56px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.order-summary-total { display: grid; gap: 2px; }
.order-summary-label { font-size: 0.9375rem; color: var(--ink-2); }

.order-summary-amount {
  font-family: var(--font-display);
  font-size: 2.25rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.order-summary-count { font-size: 0.875rem; color: var(--ink-3); }

.order-summary-btn {
  width: 100%;
  min-height: 56px;
  font-size: 1.125rem;
  letter-spacing: 0.06em;
}

.order-summary-btn.is-disabled { opacity: 0.45; cursor: not-allowed; }
.order-summary-hint { margin: 0; font-size: 0.875rem; color: var(--ink-3); }

/* Stepper */

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  flex-shrink: 0;
}

.stepper-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  transition: background-color 0.15s, color 0.15s;
}

.stepper-btn:hover:not(:disabled) { background: var(--green-50); color: var(--green-700); }
.stepper-btn:disabled { color: var(--line-strong); }

.qty-value {
  width: 40px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stepper-sm .stepper-btn { width: 36px; height: 36px; }
.stepper-sm .qty-value { width: 32px; }

/* How it works
   ========================================================================== */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink-2);
}

.step-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--green-900);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
}

.step-title {
  margin-bottom: 6px;
  font-size: 1.1875rem;
  color: var(--ink);
}

/* Cart drawer
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(16 41 26 / 0.5);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  background: var(--surface);
  box-shadow: -24px 0 48px -24px rgb(16 41 26 / 0.4);
}

.drawer-enter { transition: transform 0.32s var(--ease-out); }
.drawer-leave { transition: transform 0.2s ease-in; }
.drawer-closed { transform: translateX(100%); }
.drawer-opened { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 14px 24px;
  border-bottom: 1px solid var(--line);
}

.drawer-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1.375rem;
}

.drawer-count {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 24px;
}

.drawer-foot {
  display: grid;
  gap: 12px;
  padding: 16px 24px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.drawer-foot .totals { margin-top: 0; padding-top: 0; border-top: 0; }

/* Checkout review dialog (reuses drawer head/foot)
   ========================================================================== */

.review-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  transform: translate(-50%, -50%);
}

.review-enter { transition: opacity 0.24s var(--ease-out), transform 0.24s var(--ease-out); }
.review-leave { transition: opacity 0.16s ease-in, transform 0.16s ease-in; }
.review-closed { opacity: 0; transform: translate(-50%, calc(-50% + 16px)); }
.review-opened { opacity: 1; transform: translate(-50%, -50%); }

.review-body {
  flex: 1;
  display: grid;
  gap: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 24px;
}

.review-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1.0625rem;
}

.review-body .receipt { margin-top: 4px; }

.review-details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  margin-top: 12px;
}

.review-details dd { overflow-wrap: anywhere; white-space: pre-line; }
.review-span { grid-column: 1 / -1; }

.review-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .review-dialog {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: none;
  }

  .review-closed { transform: translateY(100%); opacity: 1; }
  .review-opened { transform: translateY(0); }

  .review-body { padding: 16px 20px 20px; }
  .review-details { grid-template-columns: 1fr; }
  .review-actions { grid-template-columns: 1fr; }
  .review-actions .btn-secondary { order: 2; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 64px 16px;
  text-align: center;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--green-50);
  color: var(--green-700);
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.empty-state-text {
  max-width: 28ch;
  margin-bottom: 12px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

/* Cart lines (drawer + checkout) */

.cart-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cart-line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.cart-line:last-child { border-bottom: 0; }

.cart-line-tile {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--swatch) 18%, var(--surface));
}

.cart-line-tile::after {
  content: '';
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: var(--swatch);
}

.cart-line-name { font-weight: 600; }

.cart-line-meta {
  margin: 2px 0 10px;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.cart-line-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
}

.cart-line-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Totals */

.totals {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.totals-row dt, .totals-row dd { margin: 0; }
.totals-row dd { font-variant-numeric: tabular-nums; }

.totals-grand {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.0625rem;
}

/* Total is now the only line: one separator above it, not two */
.totals-grand:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.fine-print {
  font-size: 0.8125rem;
  color: var(--ink-3);
  text-align: center;
}

/* Mobile cart bar
   ========================================================================== */

.cart-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 10px 12px 10px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--green-900);
  color: #fff;
  text-align: left;
  box-shadow: var(--shadow-3);
}

.cart-bar-info { display: grid; line-height: 1.25; }
.cart-bar-count { font-size: 0.8125rem; color: rgb(241 234 214 / 0.8); }
.cart-bar-info strong { font-size: 1.0625rem; font-variant-numeric: tabular-nums; }

.cart-bar-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--cream);
  color: var(--green-900);
  font-weight: 600;
}

/* Toast
   ========================================================================== */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-3);
  pointer-events: auto;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-700);
}

.toast-error .toast-icon { background: var(--danger); }

.toast-message { padding-right: 4px; }

.toast-action {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
}

.toast-action:hover { background: rgb(255 255 255 / 0.2); }

.toast-enter { transition: opacity 0.2s, transform 0.25s var(--ease-out); }
.toast-leave { transition: opacity 0.15s; }
.toast-hidden { opacity: 0; transform: translateY(8px); }

/* Panels & page heads (checkout, confirmation)
   ========================================================================== */

.page-head { margin-bottom: 28px; }

.page-title {
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.page-lede {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 1.0625rem;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.panel-meta { font-size: 0.875rem; color: var(--ink-3); }

/* Checkout
   ========================================================================== */

.checkout { padding-block: 40px 72px; }

.checkout-grid {
  display: grid;
  gap: 24px;
}

.checkout-summary .cart-lines { margin-top: 4px; }

.payment-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--green-50);
  color: var(--green-800);
  font-size: 0.875rem;
}

.payment-note svg { margin-top: 1px; }
.payment-note strong { font-weight: 600; }

.dispatch-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  background: var(--warn-50);
  color: var(--warn-ink);
  font-size: 0.9375rem;
}

.dispatch-note svg { flex-shrink: 0; margin-top: 2px; }
.dispatch-note p { margin: 0; }
.dispatch-note strong { font-weight: 700; }

.form-section {
  min-width: 0;
  margin: 0 0 16px;
}

.form-section legend {
  float: left;
  width: 100%;
  margin-bottom: 20px;
  padding: 0;
}

.form-section legend + * { clear: both; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.field:last-child { margin-bottom: 0; }

.field label {
  font-size: 0.875rem;
  font-weight: 600;
}

.field-optional {
  margin-left: 4px;
  font-weight: 400;
  color: var(--ink-3);
}

.field-hint {
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.field-error {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--danger);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.field-row .field { margin-bottom: 0; }

.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder { color: #9a9f96; }
.input:hover { border-color: var(--ink-3); }

.input:focus {
  outline: none;
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgb(38 96 58 / 0.18);
}

.input[aria-invalid='true'] { border-color: var(--danger); }
.input[aria-invalid='true']:focus { box-shadow: 0 0 0 3px rgb(180 35 24 / 0.15); }

textarea.input { resize: vertical; }

.place-order {
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
}

.place-order-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--ink-2);
}

.place-order-total strong {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Confirmation
   ========================================================================== */

.confirm {
  display: grid;
  gap: 20px;
  justify-items: start;
  max-width: 880px;
  padding-block: 40px 72px;
}

.confirm > .panel { width: 100%; }

.confirm-hero { padding: 32px; }

.confirm-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-700);
}

.confirm-hero .page-title { margin-top: 8px; max-width: 22ch; }

.messenger-cta {
  display: grid;
  gap: 12px;
  max-width: 420px;
  margin-top: 24px;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  background: var(--warn-50);
  color: var(--warn-ink);
  font-size: 0.875rem;
}

.callout svg { margin-top: 1px; }
.messenger-cta .fine-print { text-align: left; }

.backup-message {
  display: grid;
  gap: 10px;
  max-width: 420px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px dashed var(--line-strong);
}

.backup-title { margin: 0; font-weight: 600; }
.backup-text { margin: 0; font-size: 0.9375rem; color: var(--ink-2); }
.backup-text a { color: var(--messenger); font-weight: 600; }

.backup-textarea {
  font-size: 0.875rem;
  line-height: 1.45;
  resize: vertical;
  background: var(--paper);
}

.confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
}

.detail-list {
  display: grid;
  gap: 14px;
  margin: 16px 0 0;
}

.detail-list dt {
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.detail-list dd { margin: 2px 0 0; font-weight: 500; }

.receipt {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.receipt li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.receipt li:last-child { border-bottom: 0; }
.receipt-name { font-weight: 600; }
.receipt-meta { font-size: 0.8125rem; color: var(--ink-3); }
.receipt-total { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Footer
   ========================================================================== */

.site-footer {
  background: var(--green-950);
  color: rgb(241 234 214 / 0.8);
  font-size: 0.9375rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 32px;
  padding-block: 48px 32px;
}

.footer-brand { max-width: 360px; }
.footer-brand p { margin-top: 14px; }

.brand-inverse { color: #fff; }
.brand-inverse .brand-mark { padding: 4px; border-radius: 50%; background: #fff; }
.brand-inverse .brand-word span { color: #a9d19a; }

.footer-facts {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-facts li { display: flex; align-items: center; gap: 10px; }
.footer-facts a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding-block: 20px 28px;
  border-top: 1px solid rgb(241 234 214 / 0.12);
  font-size: 0.8125rem;
  color: rgb(241 234 214 / 0.6);
}

.footer-base p { margin: 0; }

/* Responsive
   ========================================================================== */

@media (min-width: 960px) {
  .hero { padding: 80px 0 88px; }
  .hero-inner { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 72px; }

  .checkout-grid {
    grid-template-columns: minmax(0, 1fr) 400px;
    align-items: start;
    gap: 32px;
  }

  .checkout-summary {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(var(--header-h) + 24px);
  }

  .checkout-form { grid-column: 1; grid-row: 1; }
}

@media (min-width: 768px) {
  .cart-bar { display: none !important; }
}

@media (max-width: 767px) {
  /* Phones: just the logo and the cart (client prefers no menu links here) */
  .primary-nav { display: none; }
  .cart-button { margin-left: auto; }

  /* Room for the floating "View cart" bar goes inside the footer, so the dark footer reaches the bottom
     of the screen (a gap on <body> showed as a white strip whenever the bar was hidden). */
  .has-cart-bar .footer-base { padding-bottom: calc(28px + 88px + env(safe-area-inset-bottom)); }
  .has-cart-bar .toast-region { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .steps { grid-template-columns: 1fr; }
  .confirm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --header-h: 60px; }

  .container { padding-inline: 16px; }
  .announcement { font-size: 0.8125rem; }
  .shelf-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; border-radius: 24px; }
  .shelf-tab { justify-content: center; padding-inline: 12px; text-align: center; }
  .brand { font-size: 1rem; white-space: nowrap; }
  /* Shorter back link so the longer shop name and the link fit one phone-wide row */
  .header-back { flex-shrink: 0; padding-inline: 8px; }
  .header-back-long { display: none; }
  .header-back-short { display: inline; }
  .brand-mark { width: 40px; height: 40px; }
  .cart-button-label { display: none; }

  .hero { padding: 40px 0 48px; }
  .hero-inner { gap: 36px; }
  .hero-lede { font-size: 1.0625rem; }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-facts { grid-template-columns: 1fr; gap: 14px; margin-top: 32px; }
  .price-board { padding: 22px 20px; }

  .section { padding: 48px 0; }
  .panel, .place-order { padding: 20px; }
  .confirm-hero { padding: 24px 20px; }
  .field-row { grid-template-columns: 1fr; }
  .drawer-body { padding-inline: 20px; }
  .drawer-foot { padding-inline: 20px; }
  .drawer-head { padding-left: 20px; }

  /* Product grid: 3 small cards per row, like the client's printed price sheet */
  #products .container { padding-inline: 12px; }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px 6px;
  }

  .product-body { padding: 4px 0 0; }
  .product-name { font-size: 0.6875rem; }   /* 11px, matching the client's price sheet */
  .product-note { font-size: 0.5625rem; }

  .variant-list { gap: 5px; margin-top: 6px; }
  .variant { gap: 3px; }
  /* "10 kg bag - ₱700" on one line (wraps only when a long price can't fit) */
  .variant-info { gap: 0 2px; font-size: 0.5625rem; line-height: 1.25; letter-spacing: -0.01em; }
  .variant-price { font-size: 0.5625rem; }
  .variant-hint { font-size: 0.5rem; }

  .qty-field { gap: 1px; }
  .qty-caption { font-size: 0.5rem; }
  .qty-box { width: 26px; height: 22px; padding: 0 1px; border-radius: 4px; font-size: 16px; }
  .variant-list { margin-bottom: 8px; }
  .btn-add { min-height: 28px; padding: 3px 4px; gap: 3px; font-size: 0.625rem; border-radius: 6px; }
  .btn-add svg { width: 12px; height: 12px; }
  .btn-add { flex-direction: column; gap: 0; line-height: 1.25; }
  .btn-add-label { gap: 3px; }
  .btn-add-total::before { content: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Product photo (uploaded from the admin page) */
.product-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--surface);
}

/* Very small phones (≤360px): let the longer shop name wrap so the cart button stays on screen */
@media (max-width: 360px) {
  .brand { white-space: normal; line-height: 1.15; }

  /* Long names ("Fresh Sili Pansigang") wrap here; give every name two lines so the sizes still line up */
  .product-name { min-height: 2.4em; }
}

/* "Powered by AVX" credit link: same muted colour as the text around it, underlined on hover */
.footer-credit { color: inherit; text-decoration: none; }
.footer-credit:hover,
.footer-credit:focus-visible { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
