:root {
  --paper: #F2FAFD;
  --paper-raised: #FFFFFF;
  --ink: #1E2B38;
  --ink-soft: #56707D;
  --sky: #8FDBF5;
  --sky-deep: #3FAED9;
  --awning: #2FA35E;
  --awning-dark: #227C48;
  --tag-yellow: #FFCF3F;
  --tag-yellow-hover: #FFDD70;
  --tag-red: #E0524A;
  --line: #D8ECF3;

  --font-display: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

a { color: inherit; }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 14px;
  height: 14px;
  background: var(--tag-yellow);
  border: 2px solid var(--ink);
  transform: rotate(45deg);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.02em;
}

.header-nav {
  display: flex;
  gap: 28px;
  font-size: 14px;
  font-weight: 500;
}

.header-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.header-nav a:hover {
  color: var(--ink);
  border-color: var(--tag-yellow);
}

/* ---------- Hero ---------- */

.hero {
  background: var(--sky);
  color: var(--ink);
  padding: 72px 0 56px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(30,43,56,0.04) 0px,
    rgba(30,43,56,0.04) 2px,
    transparent 2px,
    transparent 14px
  );
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: start;
  position: relative;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--awning-dark);
  margin: 0 0 14px;
  position: relative;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(38px, 6.5vw, 76px);
  line-height: 0.98;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  position: relative;
}

.hero-slogan {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(18px, 2.4vw, 26px);
  margin: 0 0 20px;
  position: relative;
}

.hero-accent {
  background: var(--tag-yellow);
  padding: 0 8px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.hero-sub {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 48ch;
  margin: 0 0 28px;
  position: relative;
}

.search-form {
  display: flex;
  gap: 0;
  max-width: 480px;
  border: 2px solid var(--ink);
  background: var(--paper-raised);
}

.search-form input {
  flex: 1;
  border: none;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 15px;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.search-form input::placeholder {
  color: #8FA3AF;
}

.search-form button {
  border: none;
  border-left: 2px solid var(--ink);
  background: var(--tag-yellow);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 0 22px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-form button:hover { background: var(--tag-yellow-hover); }

.hero-note {
  font-size: 13px;
  color: rgba(239,241,236,0.6);
  margin: 14px 0 0;
}

/* ---------- Store picker ---------- */

.store-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 13px;
}

.store-bar-label {
  font-family: var(--font-mono);
  color: rgba(239,241,236,0.6);
}

.store-bar-name {
  font-weight: 600;
  color: var(--tag-yellow);
}

.store-bar-change {
  border: 1px solid rgba(239,241,236,0.4);
  background: transparent;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.store-bar-change:hover {
  border-color: var(--tag-yellow);
  background: rgba(244,180,0,0.1);
}

.store-panel {
  background: var(--ink);
  border: 2px solid var(--tag-yellow);
  padding: 16px;
  margin-bottom: 24px;
  max-width: 480px;
}

.store-zip-form {
  display: flex;
  gap: 0;
  border: 2px solid var(--paper);
  margin-bottom: 4px;
}

.store-zip-form input {
  flex: 1;
  border: none;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  background: transparent;
  color: var(--paper);
  outline: none;
}

.store-zip-form input::placeholder {
  color: rgba(239,241,236,0.4);
}

.store-zip-form button {
  border: none;
  border-left: 2px solid var(--paper);
  background: var(--tag-yellow);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 0 16px;
  cursor: pointer;
}

.store-zip-form button:hover { background: var(--tag-yellow-hover); }

.store-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.store-result-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  border: 1px dashed rgba(239,241,236,0.3);
  background: transparent;
  color: var(--paper);
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.store-result-btn:hover {
  border-color: var(--tag-yellow);
  background: rgba(244,180,0,0.08);
}

.store-result-name {
  font-weight: 600;
  font-size: 13.5px;
}

.store-result-address {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: rgba(239,241,236,0.6);
}

.store-panel-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(239,241,236,0.6);
  margin: 6px 0 0;
}

.results-head-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.watch-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  border: 2px solid var(--ink);
  background: var(--tag-yellow);
  color: var(--ink);
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.watch-btn:hover { background: var(--tag-yellow-hover); }
.watch-btn:active { transform: translateY(1px); }
.watch-btn.watched {
  background: var(--paper-raised);
  color: var(--ink-soft);
  border-color: var(--line);
  cursor: default;
}

/* ---------- Watchlist section ---------- */

.watchlist-section {
  background: var(--paper-raised);
  border-top: 2px solid var(--ink);
  padding: 56px 0 64px;
}

.watchlist-intro {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: -12px 0 24px;
}

.watchlist-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.watch-entry {
  border: 2px solid var(--ink);
  background: var(--paper);
}

.watch-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--ink);
}

.watch-entry-title {
  font-weight: 600;
  font-size: 15px;
}

.watch-entry-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
}

.watch-entry-remove {
  border: 1px solid var(--tag-red);
  background: transparent;
  color: var(--tag-red);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 8px;
  cursor: pointer;
}

.watch-entry-remove:hover {
  background: rgba(193,67,46,0.08);
}

.watch-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
}

.watch-product {
  background: var(--paper);
  padding: 12px 16px;
}

.watch-product-image {
  display: block;
  width: 100%;
  height: 90px;
  object-fit: contain;
  background: var(--paper-raised);
  margin: 0 0 8px;
}

.watch-product-name {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 6px;
}

.watch-product-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin: -2px 0 8px;
}

.watch-product-prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.watch-product-price {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}

.watch-product-low {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}

.watch-product-deal {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tag-red);
  border: 1px solid var(--tag-red);
  padding: 2px 6px;
}

.watchlist-empty {
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---------- Ticker (signature element) ---------- */

.hero-ticker {
  background: var(--ink);
  border: 2px solid var(--tag-yellow);
  padding: 16px;
  position: relative;
}

.ticker-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--tag-yellow);
  margin-bottom: 10px;
}

.ticker-track {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticker-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--paper);
  border-bottom: 1px dashed rgba(239,241,236,0.2);
  padding-bottom: 8px;
}

.ticker-row:last-child { border-bottom: none; padding-bottom: 0; }

.ticker-name { color: rgba(239,241,236,0.7); }

.ticker-price {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ticker-price.drop { color: var(--tag-yellow); }

@keyframes flicker {
  0%, 92%, 100% { opacity: 1; }
  94% { opacity: 0.4; }
  96% { opacity: 0.85; }
}

.ticker-price {
  animation: flicker 4.5s infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ticker-price { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Results ---------- */

.results-section {
  padding: 56px 0;
}

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
  margin-bottom: 28px;
}

.results-head h2,
.results-head h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  margin: 0;
}

.results-count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.tag-card {
  background: var(--paper-raised);
  border: 2px solid var(--ink);
  padding: 18px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tag-card::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 18px;
  width: 14px;
  height: 14px;
  background: var(--paper-raised);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.tag-card:hover {
  transform: translateY(-3px);
  box-shadow: 4px 4px 0 var(--ink);
}

.tag-card-image {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: var(--paper);
  border: 1px solid var(--line);
  margin: 0 0 12px;
}

.tag-card-image-placeholder {
  background: repeating-linear-gradient(
    45deg,
    var(--paper),
    var(--paper) 6px,
    var(--paper-raised) 6px,
    var(--paper-raised) 12px
  );
}

.tag-card .item-name {
  font-weight: 600;
  font-size: 15px;
  margin: 6px 0 4px;
}

.tag-card .item-variant {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

.tag-card .item-store {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 14px;
}

.tag-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.tag-price {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
}

.tag-price-was {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: line-through;
}

.tag-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid currentColor;
}

.tag-badge.in-stock { color: var(--awning); }
.tag-badge.out-of-stock { color: var(--tag-red); }
.tag-badge.drop { color: var(--tag-red); background: rgba(193,67,46,0.08); }

.load-more-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.load-more-btn {
  display: inline-block;
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  border: 2px solid var(--ink);
  background: var(--paper-raised);
  color: var(--ink);
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.load-more-btn:hover { background: var(--paper); }
.load-more-btn:disabled { opacity: 0.5; cursor: default; }

.load-more-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- Catalog ---------- */

.catalog-section {
  padding: 56px 0;
  background: var(--paper-raised);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.gf-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  margin-bottom: 8px;
}

.gf-badge.certified {
  background: var(--awning);
  color: var(--paper);
  border: 1px solid var(--awning);
}

.gf-badge.labeled {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.category-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}

.category-tile {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.category-tile-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}

.category-tile.active {
  background: var(--awning);
  border-color: var(--awning);
  color: var(--paper);
}

.category-tile.active .category-tile-count {
  color: rgba(239,241,236,0.75);
}

.category-tile:hover:not(.active) { background: var(--line); }

.catalog-card {
  cursor: pointer;
}

/* ---------- Editorial picks ---------- */

.picks-strip {
  margin: 20px 0 32px;
}

.picks-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--awning);
  margin-bottom: 10px;
}

.picks-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.pick-card {
  flex: 0 0 200px;
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pick-card:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.pick-card-image {
  display: block;
  width: 100%;
  height: 90px;
  object-fit: contain;
  background: var(--paper-raised);
  margin: 0 0 10px;
}

.pick-card-name {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
}

.pick-card-blurb {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Product detail modal ---------- */

.product-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.product-modal[hidden] {
  display: none;
}

.product-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30,43,56,0.7);
}

.product-modal-panel {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
}

.product-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  background: var(--paper-raised);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.product-modal-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  margin: 0 0 8px;
  padding-right: 32px;
}

.product-modal-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 14px;
}

.product-modal-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  margin: 0 0 14px;
}

.product-modal-description {
  font-size: 14px;
  color: var(--ink);
  margin: 0 0 18px;
}

.product-modal-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.product-modal-nowatch {
  font-size: 12.5px;
  color: var(--ink-soft);
  max-width: 32ch;
}

.product-alternatives {
  margin-top: 24px;
  border-top: 1px dashed var(--line);
  padding-top: 18px;
}

/* ---------- Shelfwatch tool panel ---------- */

.shelfwatch-panel {
  background: var(--ink);
  color: var(--paper);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.shelfwatch-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px;
  max-width: 1120px;
  margin: 0 auto;
}

.shelfwatch-summary::-webkit-details-marker { display: none; }

.shelfwatch-summary-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--paper);
}

.shelfwatch-summary-title::before {
  content: "+ ";
  color: var(--tag-yellow);
}

.shelfwatch-panel[open] .shelfwatch-summary-title::before {
  content: "− ";
}

.shelfwatch-summary-sub {
  font-size: 13px;
  color: rgba(239,241,236,0.65);
}

.shelfwatch-body {
  border-top: 1px dashed rgba(239,241,236,0.25);
  padding: 32px 0 48px;
}

.shelfwatch-body .watchlist-intro { color: rgba(239,241,236,0.75); }
.shelfwatch-body .results-head { border-bottom-color: rgba(239,241,236,0.3); }
.shelfwatch-body .results-count { color: rgba(239,241,236,0.6); }

.shelfwatch-ticker {
  margin: 20px 0 32px;
}

.shelfwatch-tool {
  margin-bottom: 40px;
}

.shelfwatch-tool h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  margin: 0 0 14px;
  color: var(--paper);
}

.shelfwatch-watchlist-head {
  margin-top: 48px;
}

/* ---------- How it works ---------- */

.how {
  background: var(--paper-raised);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  padding: 56px 0;
}

.how h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  margin: 0 0 32px;
}

.how-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.how-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--awning);
  border-bottom: 2px solid var(--tag-yellow);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.how-step p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 24px 0 40px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .how-steps { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .search-form { flex-direction: column; border: none; gap: 8px; }
  .search-form input, .search-form button { border: 2px solid var(--ink); }
}

/* ---------- Focus visibility ---------- */

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--tag-yellow);
  outline-offset: 2px;
}
