/* =========================================================
   Quick Delivery — one stylesheet for every page.
   Mobile first: the base rules are for phones, and the
   @media (min-width: ...) blocks at the bottom add the
   tablet / desktop layout.
   ========================================================= */

/* ---------- 1. Design tokens (change colours here only) ---------- */
:root {
  --blue: #0B4A8B;        /* dominant: header text, buttons, links */
  --blue-dark: #083766;   /* button pressed state */
  --blue-soft: #E8F0FA;   /* light background behind selected items */
  --marigold: #F4A300;    /* accent: demo strip, 30 min badge */
  --ink: #1A1D21;         /* main text */
  --ink-2: #4A5058;       /* secondary text (still high contrast) */
  --line: #DDE2E8;        /* borders */
  --page: #F3F5F7;        /* page background */
  --white: #FFFFFF;
  --ok: #1E7B34;          /* "done" ticks on the status page */

  --radius: 10px;
  --tap: 48px;            /* minimum height of anything you tap */
  --font: system-ui, -apple-system, "Roboto", "Segoe UI", "Noto Sans",
          "Noto Sans Malayalam", sans-serif;
}

/* ---------- 2. Basics ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--page);
  /* leave room at the bottom for the fixed bottom navigation */
  padding-bottom: 76px;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--blue); }

h1, h2, h3 { line-height: 1.2; margin: 0; }

.wrap {               /* centres content and adds side gutters */
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.visually-hidden {    /* text for screen readers only */
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 3. Demo strip (remove at launch) ---------- */
.demo-strip {
  background: var(--marigold);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  margin: 0;
  padding: 6px 16px;
}

/* ---------- 4. Header: promise + cart + search ---------- */
.site-header {
  position: sticky;   /* stays at the top while scrolling */
  top: 0;
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 8px;
}

.brand {
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.brand-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.01em;
}
.brand-promise {
  display: block;
  font-size: 20px;
  white-space: nowrap;
  font-weight: 800;
}

.header-links { display: flex; align-items: center; gap: 8px; }

.header-help { display: none; }   /* shown on desktop only (see bottom) */

.cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  flex: none;
  border-radius: var(--radius);
  background: var(--blue);
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
}
.cart-btn svg { width: 22px; height: 22px; }

.search {
  position: relative;
  padding-bottom: 10px;
}
.search svg {
  position: absolute;
  left: 14px; top: 13px;
  width: 22px; height: 22px;
  color: var(--ink-2);
  pointer-events: none;
}
.search input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px 0 46px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.search input:focus { outline: 3px solid var(--blue); outline-offset: 0; background: var(--white); }

/* ---------- 5. Sections and headings ---------- */
.section { padding-top: 18px; padding-bottom: 6px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 21px; font-weight: 800; }
.section-head a {
  font-weight: 700;
  text-decoration: none;
  padding: 10px 0;      /* bigger tap area without looking big */
}

/* ---------- 6. Category tiles (home) ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.cat-tile {
  display: block;
  text-decoration: none;
  color: var(--ink);
  text-align: center;
}
.cat-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--blue-soft);
}
.cat-tile span {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
}

/* ---------- 7. Product cards ---------- */
/* a row you can swipe sideways (home page) */
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px;  /* cards snap 16px in from the edge */
  list-style: none;
  margin: 0 -16px;
  padding: 0 16px 8px;
}
.rail > li { scroll-snap-align: start; }

/* a normal grid (category page) */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.product {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}
.product img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--page);
}
.product .unit {
  margin-top: 8px;
  font-size: 15px;
  color: var(--ink-2);
}
.product h2, .product h3 {   /* h2 on category pages, h3 on home */
  font-size: 17px;
  font-weight: 600;
  margin: 2px 0 8px;
  /* keep long names to two lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}
.product .buy {
  margin-top: auto;     /* pushes price + ADD to the bottom of the card */
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;      /* on very narrow cards ADD drops below the price */
  gap: 6px;
}
.price { font-size: 18px; font-weight: 800; }

.add-btn {
  min-height: var(--tap);
  min-width: 64px;
  padding: 0 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  color: var(--blue);
  background: var(--white);
  border: 2px solid var(--blue);
  border-radius: 8px;
  cursor: pointer;
}
.add-btn:active { background: var(--blue-soft); }

.no-results {
  padding: 24px 0;
  font-weight: 600;
  color: var(--ink-2);
}

/* ---------- 8. Category page: left list + products ---------- */
.cat-layout {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 0;
  background: var(--white);
  min-height: 70vh;
}
.cat-side {
  list-style: none;
  margin: 0;
  padding: 0;
  border-right: 1px solid var(--line);
}
.cat-side a {
  display: block;
  padding: 10px 6px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  border-right: 4px solid transparent;
}
.cat-side img {
  width: 56px; height: 56px;
  margin: 0 auto 4px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--blue-soft);
}
.cat-side a[aria-current="page"] {
  background: var(--blue-soft);
  border-right-color: var(--blue);
  color: var(--blue);
  font-weight: 800;
}
.cat-main { padding: 12px 10px 16px; background: var(--page); }
.cat-main h1 { font-size: 22px; font-weight: 800; margin-bottom: 12px; }

/* ---------- 9. Plain content pages (cart, checkout, status, help) ---------- */
.page-title { font-size: 24px; font-weight: 800; padding: 18px 0 12px; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.panel h2 { font-size: 19px; font-weight: 800; margin-bottom: 10px; }

/* cart rows */
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.cart-item .name { font-weight: 600; }
.cart-item .unit { font-size: 15px; color: var(--ink-2); }
.cart-item .price { display: block; margin-top: 2px; }

.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--blue);
  color: var(--white);
  border-radius: 8px;
  overflow: hidden;
}
.stepper button {
  width: 44px; height: var(--tap);
  font: inherit; font-size: 24px; font-weight: 700;
  color: var(--white);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.stepper output { min-width: 26px; text-align: center; font-weight: 800; }

/* bill lines */
.bill { margin: 0; }
.bill div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}
.bill dt { color: var(--ink-2); }
.bill dd { margin: 0; font-weight: 600; }
.bill .total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.bill .total dt, .bill .total dd { color: var(--ink); font-weight: 800; font-size: 20px; }

.note { font-size: 16px; color: var(--ink-2); margin: 8px 0 0; }

/* big main button */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  font: inherit;
  font-size: 19px;
  font-weight: 800;
  color: var(--white);
  background: var(--blue);
  border: 0;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}
.btn:active { background: var(--blue-dark); }
.btn[disabled] { background: #8A9AAD; cursor: not-allowed; }
.btn-outline { color: var(--blue); background: var(--white); border: 2px solid var(--blue); }

/* forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { display: block; font-size: 15px; color: var(--ink-2); font-weight: 400; }
.field input, .field textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 8px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue); }

.cod {
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 700;
}
.cod svg { width: 32px; height: 32px; flex: none; color: var(--ok); }

/* confirmation */
.done-head { text-align: center; padding: 24px 0 8px; }
.done-head svg { width: 72px; height: 72px; color: var(--ok); margin: 0 auto 8px; display: block; }
.done-head h1 { font-size: 26px; font-weight: 800; }
.order-no { font-size: 30px; font-weight: 800; letter-spacing: 0.04em; }

.eta {
  display: inline-block;
  background: var(--marigold);
  color: var(--ink);
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
}

/* status steps */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  position: relative;
  padding: 0 0 26px 48px;
  min-height: 36px;
}
.steps li::before {             /* the circle */
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: var(--white);
}
.steps li::after {              /* the line to the next step */
  content: "";
  position: absolute;
  left: 15px; top: 34px; bottom: 2px;
  width: 3px;
  background: var(--line);
}
.steps li:last-child::after { display: none; }
.steps .step-name { display: block; font-size: 19px; font-weight: 800; color: var(--ink-2); }
.steps .step-text { display: block; font-size: 16px; color: var(--ink-2); }
.steps li.is-done::before { background: var(--ok); border-color: var(--ok); }
.steps li.is-done::after { background: var(--ok); }
.steps li.is-done .step-name { color: var(--ink); }
.steps li.is-now::before { border-color: var(--blue); border-width: 6px; }
.steps li.is-now .step-name { color: var(--blue); }

/* help */
.help-actions { display: grid; gap: 10px; }

/* ---------- 10. Bottom navigation (phones) ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--white);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
  text-decoration: none;
}
.bottom-nav svg { width: 26px; height: 26px; }
.bottom-nav a[aria-current="page"] { color: var(--blue); }

/* ---------- 11. Small message that pops up at the bottom ---------- */
.toast {
  position: fixed;
  left: 16px; right: 16px; bottom: 84px;
  z-index: 40;
  max-width: 420px;
  margin: 0 auto;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
  text-align: center;
}

/* keyboard users: always show where focus is */
a:focus-visible, button:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

/* ---------- 12. Bigger screens ---------- */
@media (min-width: 600px) {
  .rail { grid-auto-columns: 170px; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cat-grid { gap: 16px; max-width: 640px; }
  .cat-layout { grid-template-columns: 120px minmax(0, 1fr); }
  .cat-side img { width: 72px; height: 72px; }
  .cat-side a { font-size: 16px; }
}

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }      /* desktop uses the header links */
  .toast { bottom: 24px; }

  .header-row { padding-top: 12px; padding-bottom: 12px; }
  .site-header .wrap.top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; }
  .site-header .header-row { display: contents; }
  .search { padding: 0; order: 2; }      /* search sits in the middle */
  .header-links { order: 3; }
  .header-help {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    padding: 0 12px;
    font-weight: 700;
    text-decoration: none;
  }

  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cat-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .cat-side a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 12px;
  }
  .cat-side img { width: 48px; height: 48px; margin: 0; }

  .narrow { max-width: 640px; }
}

/* the hidden attribute must always win */
[hidden] { display: none !important; }
