:root {
  --bg: #efe6d4;
  --bg-raise: #fffaf3;
  --ink: #1b140f;
  --paper: #fffaf3;
  --paper-2: #f6efe2;
  --red: #e52521;
  --red-dark: #9e1512;
  --gold: #f2c14e;
  --green: #1f8a4c;
  --muted: #5c5348;
  --line: #1b140f;
  --header: #fffaf3;
  --shadow: 4px 4px 0 #1b140f;
  --font: "Avenir Next", "Segoe UI", sans-serif;
  --mono: "Courier New", Courier, monospace;
  --max: 1120px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.55;
}

img { max-width: 100%; height: auto; }
a { color: var(--red-dark); }
a:hover { color: #7d100e; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--gold);
  color: var(--ink);
  padding: 0.5rem 0.8rem;
  z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

.container {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  background: var(--header);
  border-bottom: 6px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.logo-mark {
  width: 18px;
  height: 18px;
  background: var(--red);
  box-shadow: inset 0 -4px 0 #7d100e, 3px 3px 0 #000;
}
.logo-word {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.05rem;
}
.logo-word span { color: var(--red-dark); }

.nav-toggle {
  display: none;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

.header-nav ul,
.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.header-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.header-nav a:hover { color: #7d100e; }

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}
.search-container { width: min(280px, 46vw); }
.cart-link {
  color: var(--ink);
  background: var(--gold);
  text-decoration: none;
  font-weight: 800;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 #000;
  padding: 0.45rem 0.7rem;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.home-shell { padding-bottom: 3rem; }

.hero {
  padding: 2.5rem 0 1.5rem;
  background:
    linear-gradient(180deg, rgba(229, 37, 33, 0.08), transparent 42%),
    repeating-linear-gradient(0deg, rgba(27, 20, 15, 0.04) 0 1px, transparent 1px 7px);
}
.hero-kicker,
.card-kicker {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--red-dark);
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
}
.hero h1,
.page-intro h1,
.site-main h1 {
  font-family: var(--mono);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.7rem); max-width: 16ch; }
.lede { max-width: 42rem; font-size: 1.15rem; margin-top: 0; }
.hero-search { max-width: 36rem; margin: 1.25rem 0; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; padding: 0; margin: 0; list-style: none; }
.hero-links a { color: var(--red-dark); font-weight: 700; }

.categories-section { padding: 1rem 0 2rem; }
.section-intro h2,
.sub-categories h2,
.products h2 {
  font-family: var(--mono);
  margin-bottom: 0.35rem;
}
.section-intro p { margin-top: 0; color: var(--muted); }

.category-grid,
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.category-card,
.product-card,
.site-main,
.cart-summary {
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--line);
  box-shadow: var(--shadow);
}

.category-card {
  display: flex;
  flex-direction: column;
  min-height: 160px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
}
.category-card h3 { margin: 0.2rem 0; font-size: 1.35rem; }
.category-card p { margin: 0; color: var(--muted); }
.category-card .card-kicker { color: var(--red-dark); }
.category-count { margin-top: auto; padding-top: 0.8rem; font-family: var(--mono); font-size: 0.85rem; }

.site-main {
  width: min(var(--max), calc(100% - 2rem));
  margin: 1.25rem auto 2.5rem;
  padding: 1.25rem 1.25rem 2rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 0.5rem; color: var(--muted); }

.page-intro h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }

.subcategory-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.6rem;
  list-style: none;
  padding: 0;
}
.subcategory-list a {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  background: var(--paper-2);
  border: 3px solid var(--line);
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  padding: 0.7rem 0.8rem;
  min-height: 44px;
}
.subcat-count {
  font-family: var(--mono);
  background: var(--red);
  color: white;
  min-width: 1.8rem;
  text-align: center;
  padding: 0.1rem 0.35rem;
}

.title-index h2,
.title-group h2 {
  font-family: var(--mono);
  margin-bottom: 0.6rem;
}
.title-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.75rem;
}
.title-jump a {
  display: grid;
  place-items: center;
  min-width: 2.6rem;
  min-height: 44px;
  padding: 0 0.45rem;
  background: var(--paper-2);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--line);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 700;
}
.title-jump a:hover,
.title-jump a:focus-visible {
  background: var(--red);
  color: #fff;
}
.title-group { scroll-margin-top: 5.5rem; }
.title-group h2 { font-size: 1.7rem; }
.title-group .product-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.title-rule {
  border: 0;
  height: 12px;
  margin: 2.25rem 0 1.75rem;
  background:
    linear-gradient(var(--gold), var(--gold)) center / 0.7rem 12px no-repeat,
    linear-gradient(var(--red), var(--red)) center / 3.4rem 12px no-repeat,
    linear-gradient(var(--line), var(--line)) center / 100% 4px no-repeat;
}

.category-content h2,
.product-description h2 { font-size: 1.25rem; }
.category-content li,
.product-description li { margin: 0.25rem 0; }

.product-card { padding: 0.8rem; display: flex; flex-direction: column; }
.product-image-container {
  display: grid;
  place-items: center;
  background: #fff;
  border: 3px solid var(--line);
  min-height: 180px;
  margin-bottom: 0.75rem;
}
.product-image { width: 100%; height: 180px; object-fit: contain; }
.product-card-link { display: block; color: inherit; text-decoration: none; }
.product-card-link:hover h3 { color: var(--red-dark); }
.product-card h3 { font-size: 1.05rem; margin: 0 0 0.5rem; }
.product-card .price { margin-top: auto; }

.price-offer { display: flex; flex-wrap: wrap; gap: 0.35rem 0.7rem; align-items: baseline; }
.price-value { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; }
.list-price { color: var(--muted); text-decoration: line-through; }
.price-discount { color: var(--green); font-weight: 800; }
.product-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.35rem; }
.product-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border: 2px solid var(--line);
}
.product-badge-free { background: #d9f5e4; }
.product-badge-ltd { background: var(--gold); }
.out-of-stock { color: var(--red-dark); font-weight: 800; }
.empty-aisle { color: var(--muted); }

.product-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1.25rem;
  align-items: start;
}
.product-image {
  background: #fff;
  border: 4px solid var(--line);
  padding: 0.75rem;
}
.product-image img { width: 100%; max-height: 460px; object-fit: contain; }
.product-meta { color: var(--muted); }
.price-updated { color: var(--muted); font-size: 0.92rem; }
.tooltip-wrapper { position: relative; border-bottom: 1px dashed var(--muted); cursor: help; }
.tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: 1.4rem;
  width: min(280px, 70vw);
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--line);
  padding: 0.6rem 0.7rem;
  z-index: 5;
  font-size: 0.85rem;
}
.tooltip-wrapper:hover .tooltip,
.tooltip-wrapper:focus-within .tooltip { display: block; }

.action-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.quantity-container { display: flex; align-items: center; gap: 0.35rem; }
.qty-btn,
.add-to-cart,
.btn,
.remove-item,
.contact-form button {
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  min-width: 44px;
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--line);
  cursor: pointer;
}
.qty-btn { background: var(--paper-2); }
.qty-input {
  width: 3.2rem;
  min-height: 44px;
  text-align: center;
  font: inherit;
  border: 3px solid var(--line);
}
.add-to-cart,
.btn.primary,
.contact-form button {
  background: var(--red);
  color: white;
  padding: 0.55rem 1rem;
}
.btn.secondary { background: #d7d0c4; color: var(--ink); padding: 0.55rem 1rem; }
.remove-item { background: var(--ink); color: white; padding: 0.4rem 0.7rem; }
.product-associate-note,
.amazon-associate-note { color: var(--muted); font-size: 0.92rem; }
.out-of-stock-notice { color: var(--red-dark); font-weight: 800; }

.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th,
.cart-table td { text-align: left; padding: 0.75rem 0.4rem; border-bottom: 2px solid #e4dccb; vertical-align: middle; }
.cart-summary { padding: 1rem; margin: 1rem 0; }
.summary-row { display: flex; justify-content: space-between; gap: 1rem; }
.summary-row.grand { font-size: 1.25rem; font-weight: 800; border-top: 3px solid var(--line); margin-top: 0.5rem; padding-top: 0.6rem; }
.cart-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: flex-end; }
.cart-empty { padding: 1rem 0 0.5rem; }

.site-footer {
  border-top: 6px solid var(--red);
  padding: 1.5rem 0 2rem;
}
.footer-nav a { color: var(--ink); }
.site-footer p { color: var(--muted); }

.cart-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
  width: min(360px, calc(100% - 2rem));
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--red);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
}
.cart-toast.visible { display: block; }
.toast-view-cart { color: var(--red-dark); font-weight: 800; }

.contact-form { max-width: 640px; }
.form-group { margin-bottom: 1rem; }
.contact-form label { display: block; font-weight: 800; margin-bottom: 0.3rem; }
.contact-form input,
.contact-form textarea {
  width: 100%;
  font: inherit;
  padding: 0.7rem;
  border: 3px solid var(--line);
  background: white;
}
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.contact-feedback { padding: 0.8rem 1rem; border: 3px solid var(--line); margin-bottom: 1rem; }
.contact-feedback--success { background: #d9f5e4; }
.contact-feedback--error { background: #ffd9d4; }

.pagefind-ui { --pagefind-ui-scale: 0.9; color: var(--ink); }
.pagefind-ui .pagefind-ui__search-input {
  font: inherit;
  border: 3px solid var(--line);
  background: white;
  color: var(--ink);
  width: 100%;
  min-height: 44px;
}
.hero .pagefind-ui,
.site-header .pagefind-ui { color: var(--ink); }
.site-header .pagefind-ui .pagefind-ui__search-input,
.hero .pagefind-ui .pagefind-ui__search-input { background: var(--paper); color: var(--ink); }
.pagefind-ui .pagefind-ui__result-link { color: var(--red-dark); }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .header-nav {
    display: none;
    width: 100%;
    order: 5;
  }
  .header-nav.is-open { display: block; }
  .header-nav ul { flex-direction: column; }
  .header-tools { width: 100%; }
  .search-container { width: auto; flex: 1; }
  .product-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .cart-table thead { display: none; }
  .cart-table,
  .cart-table tbody,
  .cart-table tr,
  .cart-table td { display: block; width: 100%; }
  .cart-table tr {
    border: 3px solid var(--line);
    margin-bottom: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
  .cart-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: 0;
    padding: 0.4rem 0;
  }
  .cart-table td::before {
    content: attr(data-label);
    font-weight: 800;
  }
  .cart-actions { justify-content: stretch; }
  .cart-actions .btn { flex: 1; }
}

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