/* ZoneTracker — Zone Medical house style (navy #0A133D + white, Inter; see DESIGN.md). */
:root {
  --color-navy: #0a133d;
  --color-navy-800: #131c4a;
  --color-navy-600: #26305f;
  --color-canvas: #f3f5fa;
  --color-surface: #ffffff;
  --color-photo: #ffffff;
  --color-ink: #14192b;
  --color-body: #333a4b;
  --color-muted: #5f6879;
  --color-line: #dde2ec;
  --color-line-strong: #c3cad8;
  --color-tag: #e6e9f3;
  --color-on-navy: #ffffff;
  --color-on-navy-muted: rgba(255, 255, 255, 0.72);
  --color-down: #b42318;        /* competitor is cheaper than Zone */
  --color-down-bg: #fdecea;
  --color-up: #157f3c;          /* Zone is cheapest */
  --color-up-bg: #e8f6ee;
  --color-neutral-bg: #eef1f6;
  --color-backdrop: rgba(10, 19, 61, 0.45);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sub: "Open Sans", "Avenir Next Condensed", "Arial Narrow", sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 9999px;

  --s-xxs: 4px;
  --s-xs: 8px;
  --s-sm: 12px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 32px;
  --s-xxl: 48px;

  --shadow-card: 0 1px 2px rgba(10, 19, 61, 0.06);
  --shadow-hover: 0 6px 20px rgba(10, 19, 61, 0.10);
  --shadow-sheet: -12px 0 40px rgba(10, 19, 61, 0.18);

  /* wordmark: real "zone" letters + "TRACKER" spaced like "MEDICAL" in the logo */
  --wm-zone-h: 30px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-body);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
a { color: var(--color-navy); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
.offer-links a, .zone-link { text-decoration: underline; text-decoration-color: var(--color-line-strong); text-underline-offset: 3px; }
.offer-links a:hover, .zone-link:hover { text-decoration-color: currentColor; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-navy); outline-offset: 2px; }
.topbar :focus-visible { outline-color: #ffffff; }
[hidden] { display: none !important; }

/* navy band */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--color-navy); }
.topbar-inner {
  max-width: 1440px; margin: 0 auto; height: 68px;
  padding: 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-sm);
}
.wordmark {
  display: inline-flex; flex-direction: column; flex: none;
  width: calc(var(--wm-zone-h) * 3.386);  /* logo "zone" is 2384 x 704 */
}
.wordmark:hover { text-decoration: none; }
.wordmark img { display: block; width: 100%; height: auto; }
.wordmark-sub {
  display: flex; justify-content: space-between;
  /* "MEDICAL" is inset 2.1% left / 1.7% right; cap height 0.312x and gap 0.108x the "zone" height */
  padding: 0 1.7% 0 2.1%;
  margin-top: calc(var(--wm-zone-h) * 0.108);
  height: calc(var(--wm-zone-h) * 0.312);
  font-family: var(--font-sub); font-weight: 400; font-stretch: 75%;
  font-size: calc(var(--wm-zone-h) * 0.312 / 0.714);   /* Open Sans cap height = 0.714em */
  line-height: calc(var(--wm-zone-h) * 0.312);
  color: var(--color-on-navy);
  text-box: trim-both cap alphabetic;
}
.wordmark-sub span { display: block; }
.checked { margin: 0; font-size: 13px; line-height: 1.3; color: var(--color-on-navy-muted); text-align: right; }
.checked.old { color: #ffb4ab; }

/* page */
.page { max-width: 1440px; margin: 0 auto; padding: 0 16px var(--s-xxl); }
.intro { padding: var(--s-xxl) 0 var(--s-lg); }
.intro h1 { margin: 0; color: var(--color-ink); font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.lead { margin: var(--s-xs) 0 0; font-size: 19px; line-height: 1.45; color: var(--color-muted); }

.controls { display: flex; flex-wrap: wrap; gap: var(--s-sm); align-items: center; margin-bottom: var(--s-lg); }
.search {
  flex: 1 1 320px; display: flex; align-items: center; gap: var(--s-xs);
  height: 44px; padding: 0 var(--s-md);
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--r-pill);
}
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--color-muted); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--color-ink); }
.search input::placeholder { color: var(--color-muted); }
.search:focus-within { border-color: var(--color-navy); }

.filters { display: flex; flex-wrap: wrap; gap: var(--s-xs); }
.chip {
  height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  background: var(--color-surface); border: 1px solid var(--color-line); color: var(--color-ink);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--color-line-strong); }
.chip span { color: var(--color-muted); margin-left: 2px; font-weight: 400; }
.chip[aria-pressed="true"] { background: var(--color-navy); color: var(--color-on-navy); border-color: var(--color-navy); }
.chip[aria-pressed="true"] span { color: var(--color-on-navy-muted); }

.selects { display: flex; gap: var(--s-xs); flex-wrap: wrap; }
select {
  height: 36px; padding: 0 32px 0 14px; border-radius: var(--r-pill);
  background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235f6879' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center / 11px 8px;
  border: 1px solid var(--color-line); color: var(--color-ink); font-size: 14px; font-weight: 500;
  appearance: none; -webkit-appearance: none; cursor: pointer;
}

/* product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; text-align: left;
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--r-lg);
  padding: var(--s-sm); color: var(--color-body); cursor: pointer; font-weight: 400;
  box-shadow: var(--shadow-card);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.card:hover { text-decoration: none; border-color: var(--color-line-strong); box-shadow: var(--shadow-hover); }
.card:active { transform: scale(0.985); }
.photo {
  aspect-ratio: 1 / 1; background: var(--color-photo); border-radius: var(--r-md);
  display: grid; place-items: center; overflow: hidden;
}
.photo img { width: 86%; height: 86%; object-fit: contain; }
.photo .noimg { color: var(--color-muted); font-size: 14px; }
.card-text { padding: var(--s-sm) var(--s-xxs) var(--s-xxs); display: flex; flex-direction: column; gap: 6px; flex: 1; border-top: 1px solid var(--color-line); margin-top: var(--s-xs); }
.brand { font-size: 12px; line-height: 1.3; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.name {
  color: var(--color-ink); font-weight: 600; font-size: 16px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.zone-price { font-size: 14px; color: var(--color-muted); }
.zone-price b { color: var(--color-navy); font-weight: 700; }
.status {
  margin-top: auto; align-self: flex-start;
  font-size: 12px; line-height: 1.3; font-weight: 600;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--color-neutral-bg); color: var(--color-muted);
}
.status.down { background: var(--color-down-bg); color: var(--color-down); }
.status.up { background: var(--color-up-bg); color: var(--color-up); }

.empty { color: var(--color-muted); padding: var(--s-xxl) 0; text-align: center; }
.foot { margin-top: var(--s-xxl); padding-top: var(--s-lg); border-top: 1px solid var(--color-line); font-size: 13px; line-height: 1.5; color: var(--color-muted); }

/* product panel */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: var(--color-backdrop); }
.sheet {
  position: fixed; z-index: 21; top: 0; right: 0; bottom: 0;
  width: min(760px, 100%); overflow-y: auto; overscroll-behavior: contain;
  background: var(--color-surface); box-shadow: var(--shadow-sheet);
  animation: slide .22s ease-out;
}
.sheet:focus { outline: none; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .card { transition: none; } }
.close {
  position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; z-index: 2;
  width: 44px; height: 44px; border-radius: var(--r-pill); border: 1px solid var(--color-line); cursor: pointer;
  background: rgba(255, 255, 255, 0.92); display: grid; place-items: center;
}
.close:hover { border-color: var(--color-line-strong); }
.close svg { width: 16px; height: 16px; stroke: var(--color-ink); stroke-width: 2; stroke-linecap: round; }
.sheet-body { padding: var(--s-xl) var(--s-xl) var(--s-xxl); }

.hero { display: grid; grid-template-columns: 200px 1fr; gap: var(--s-lg); align-items: center; clear: both; padding-top: var(--s-xs); }
.hero .photo { border: 1px solid var(--color-line); }
.hero h2 { margin: 6px 0 var(--s-xs); color: var(--color-ink); font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -0.015em; }
.hero .zone-link { font-size: 14px; }

.variants { margin-top: var(--s-xl); }
.variants h3, .section-title { margin: 0 0 var(--s-sm); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); }
.variant-chips { display: flex; flex-wrap: wrap; gap: var(--s-xs); }
.variant-chips .chip { height: auto; min-height: 36px; padding: 8px 14px; white-space: normal; text-align: left; line-height: 1.3; }
.variant-select { width: 100%; height: auto; min-height: 44px; padding: 10px 36px 10px 16px; border-radius: var(--r-md); font-size: 15px; line-height: 1.35; white-space: normal; }

.zone-row {
  margin-top: var(--s-xl); padding: var(--s-lg);
  background: var(--color-navy); color: var(--color-on-navy); border-radius: var(--r-lg);
  display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-md); flex-wrap: wrap;
}
.zone-row .label { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-on-navy-muted); }
.zone-row .big { font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.zone-row .basis { font-size: 13px; color: var(--color-on-navy-muted); margin-top: 2px; }

.changed { margin-top: var(--s-sm); padding: var(--s-sm) var(--s-md); border-radius: var(--r-md); background: var(--color-canvas); border-left: 3px solid var(--color-navy); font-size: 14px; color: var(--color-ink); }

.offers { margin-top: var(--s-xl); }
.offer {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s-xxs) var(--s-md);
  padding: var(--s-md) 0; border-top: 1px solid var(--color-line);
}
.offer:last-child { border-bottom: 1px solid var(--color-line); }
.offer-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-xs); }
.offer-name { color: var(--color-ink); font-weight: 700; }
.tag { font-size: 12px; line-height: 1.3; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); background: var(--color-neutral-bg); color: var(--color-muted); white-space: nowrap; }
.tag.exact { background: var(--color-tag); color: var(--color-navy); }
.offer-title { grid-column: 1; font-size: 14px; line-height: 1.45; color: var(--color-body); }
.offer-why { grid-column: 1; font-size: 13px; line-height: 1.45; color: var(--color-muted); }
.offer-price { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
.offer-price .amt { color: var(--color-ink); font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
.offer-price .amt.none { font-size: 14px; font-weight: 500; color: var(--color-muted); letter-spacing: 0; }
.offer-price .diff { font-size: 13px; font-weight: 600; margin-top: 3px; color: var(--color-muted); }
.offer-price .diff.down { color: var(--color-down); }
.offer-price .diff.up { color: var(--color-up); }
.offer-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-md); font-size: 14px; }
.offer-links .muted { color: var(--color-muted); font-size: 13px; }
.offer.missing .offer-name { color: var(--color-muted); font-weight: 500; }

.notes { margin-top: var(--s-lg); font-size: 13px; line-height: 1.5; color: var(--color-muted); }

@media (max-width: 640px) {
  :root { --wm-zone-h: 26px; }
  .topbar-inner { height: 60px; }
  .intro { padding: var(--s-xl) 0 var(--s-md); }
  .intro h1 { font-size: 32px; }
  .lead { font-size: 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 8px; border-radius: 12px; }
  .name { font-size: 15px; }
  .controls .search { flex-basis: 100%; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; width: calc(100% + 32px); }
  .filters::-webkit-scrollbar { display: none; }
  .selects { width: 100%; flex-wrap: nowrap; }
  .selects select { flex: 1 1 0; min-width: 0; }
  .checked { max-width: 55%; font-size: 12px; }
  .sheet-body { padding: var(--s-lg) 16px var(--s-xxl); }
  .hero { grid-template-columns: 1fr; }
  .hero .photo { width: 100%; max-width: 280px; }
  .hero h2 { font-size: 22px; }
  .zone-row .big { font-size: 28px; }
}
.no-match { margin: 0; padding: var(--s-md) 0; border-top: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line); color: var(--color-muted); font-size: 14px; line-height: 1.5; }

/* categories: sidebar on wide screens, two dropdowns on phones */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.content { min-width: 0; }
.intro h1, .lead { overflow-wrap: anywhere; }
.sidebar { display: none; }
.cat-selects { width: 100%; flex-wrap: nowrap; }
.cat-selects select { flex: 1 1 0; min-width: 0; }
.lead a { color: var(--color-navy); }
.crumbs { font-size: 13px; color: var(--color-muted); margin-bottom: 6px; }
.crumbs a { font-weight: 500; }
@media (min-width: 1000px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); gap: var(--s-xl); }
  .sidebar {
    display: block; position: sticky; top: 68px; align-self: start;
    max-height: calc(100vh - 68px); overflow-y: auto; padding: var(--s-xl) 4px var(--s-xl) 0;
    scrollbar-width: thin;
  }
  .cat-selects { display: none; }
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar h4 {
  margin: var(--s-lg) 0 var(--s-xs); padding: 0 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted);
}
.sidebar a {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-xs);
  padding: 7px 10px; border-radius: var(--r-sm); color: var(--color-ink); font-size: 14px; font-weight: 500; line-height: 1.35;
}
.sidebar a:hover { background: var(--color-surface); text-decoration: none; }
.sidebar a.active { background: var(--color-navy); color: var(--color-on-navy); }
.sidebar a.active .side-count { color: var(--color-on-navy-muted); }
.sidebar a.zero { color: var(--color-muted); }
.side-count { color: var(--color-muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.side-all { font-weight: 700 !important; }
.side-subs { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 10px; padding-left: 8px; border-left: 2px solid var(--color-line); }
.side-subs a { font-size: 13px; font-weight: 400; padding: 6px 10px; }
