:root {
  --ink: #1c2321;
  --muted: #5b6663;
  --line: #dfe3e1;
  --accent: #2d6a4f;
  --accent-ink: #ffffff;
  --bg: #fbfaf8;
  --card: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fbeceb;
  --success-bg: #e8f3ec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.site-header-top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.brand { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--ink); white-space: nowrap; }

.header-search {
  flex: 1 1 auto;
  display: flex;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
/* Specificity note: the generic `form input[type="text"]` rule elsewhere in
   this file outranks a plain `.header-search input` selector (more type
   selectors), which would silently reintroduce its border/padding/margin
   here — matching the attribute selector too keeps this rule on top. */
.header-search input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  display: inline-block;
  margin-top: 0;
  border: none;
  border-radius: 0;
  padding: 0.55rem 0.8rem;
  font-size: 0.95rem;
  max-width: none;
}
.header-search input:focus { outline: none; }
.header-search button {
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 0;
  padding: 0 0.9rem;
  display: flex;
  align-items: center;
}

.header-nav { display: flex; align-items: center; gap: 1.5rem; white-space: nowrap; }
.header-nav a { text-decoration: none; color: var(--ink); }
.header-nav .cart-link { display: flex; align-items: center; gap: 0.4rem; }

.category-bar { background: var(--ink); }
.category-bar-inner {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding: 0.7rem 1.25rem;
}
.category-bar-inner a {
  color: #dfe6e2;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.category-bar-inner a.active, .category-bar-inner a:hover { color: #fff; font-weight: 600; }

@media (max-width: 640px) {
  .site-header-top { flex-wrap: wrap; row-gap: 0.75rem; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
}

main.wrap { padding-top: 2rem; padding-bottom: 4rem; min-height: 60vh; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--card);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}
.footer-col .brand { display: block; margin-bottom: 0.5rem; }
.footer-col h4 { margin: 0 0 0.75rem; color: var(--ink); font-size: 0.9rem; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Homepage: hero slider ---
   Vanilla CSS + JS carousel (assets/hero-slider.js) — no image files
   required; each slide is a gradient panel with an inline SVG icon, so
   there's nothing to source or license. Swap a slide's background for a
   real photo later by adding a `background-image` rule to its
   `.hero-slide--x` class and dropping the text/icon opacity down. */
.hero-slider {
  position: relative;
  margin: 0 0 2.5rem;
  border-radius: 10px;
  overflow: hidden;
}
.hero-slide {
  display: none;
  position: relative;
  min-height: 230px;
  padding: 3rem 2.5rem;
  color: #fff;
}
.hero-slide.is-active { display: block; }
.hero-slide--a { background: linear-gradient(115deg, var(--accent) 0%, var(--accent) 45%, #23543f 46%, #23543f 100%); }
.hero-slide--b { background: linear-gradient(115deg, #2d5566 0%, #2d5566 45%, #1e3a45 46%, #1e3a45 100%); }
.hero-slide--c { background: linear-gradient(115deg, #4f4a2d 0%, #4f4a2d 45%, #35311e 46%, #35311e 100%); }
.hero-slide-text { position: relative; z-index: 1; }
.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.85;
  margin: 0 0 0.5rem;
}
.hero-slide h1 { font-size: 2.1rem; max-width: 22ch; margin: 0 0 0.75rem; }
.hero-slide p { max-width: 46ch; margin: 0 0 1.25rem; opacity: 0.95; }
.hero-slide .button { background: #fff; color: var(--ink); }
.hero-slide-icon {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.22;
  pointer-events: none;
}
.hero-slide-icon svg { display: block; width: 140px; height: 140px; }
.hero-dots {
  position: absolute;
  z-index: 2;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}
.hero-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  border: none;
  padding: 0;
  cursor: pointer;
}
.hero-dot.is-active { background: #fff; }
.hero-dot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 640px) {
  .hero-slide { padding: 2rem 1.25rem; min-height: 260px; }
  .hero-slide h1 { font-size: 1.6rem; }
  .hero-slide-icon { display: none; }
}

/* --- Homepage: quick-link category cards --- */
.quicklinks { margin-bottom: 2.5rem; }
.quicklinks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.quicklink-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem;
}
.quicklink-card h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.quicklink-thumbs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.quicklink-thumbs a {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  background: #eef2f0;
}
.quicklink-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.quicklink-more { font-size: 0.85rem; font-weight: 600; text-decoration: none; }

/* --- Homepage: how-it-works steps --- */
.how-it-works { margin-bottom: 2.5rem; }
.how-it-works h2 { margin-bottom: 1rem; }
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.step { padding: 0.25rem 0; }
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.step h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.step p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* --- Homepage: value props band --- */
.value-props {
  background: var(--ink);
  color: #fff;
  margin: 0 0 2.5rem;
  padding: 2rem 0;
  border-radius: 10px;
}
.value-props-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 0 2rem;
}
.value-prop { text-align: left; }
.value-prop svg { color: #8fd9b8; margin-bottom: 0.6rem; }
.value-prop h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.value-prop p { margin: 0; font-size: 0.85rem; color: #cfe3d8; }

/* --- Homepage: shipping banner --- */
.shipping-banner {
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 1rem 1rem;
  border-radius: 10px;
  margin-bottom: 2.5rem;
}
.shipping-banner p { margin: 0; font-weight: 700; font-size: 1.05rem; }

.newest-parts { margin-top: 0; }

.button, button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.button:hover, button:hover { opacity: 0.92; }

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  text-decoration: none;
  color: var(--ink);
}

.product-image-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: #eef2f0;
  margin-bottom: 0.75rem;
}
.product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-image-wrap.large { max-width: 420px; }

.product-name { font-weight: 600; margin-bottom: 0.3rem; }
.product-meta { color: var(--muted); font-size: 0.85rem; }
.product-price { margin-top: 0.5rem; font-weight: 600; }
.product-price.large { font-size: 1.4rem; }

.badge.out-of-stock {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--danger);
  font-size: 0.85rem;
}

.filters {
  display: flex;
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
  flex-wrap: wrap;
}
.filters input, .filters select {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 2rem;
  margin-top: 1rem;
}
@media (max-width: 640px) {
  .product-detail { grid-template-columns: 1fr; }
}
.breadcrumb { color: var(--muted); font-size: 0.9rem; margin-top: 1rem; }
.breadcrumb a { color: var(--muted); }

form label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
}
form input[type="text"], form input[type="email"], form input[type="number"], form textarea {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 0.35rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: normal;
}

.cart-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.cart-table th, .cart-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.cart-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef2f0;
  display: block;
}
.cart-table .part-cell { display: flex; align-items: center; gap: 0.75rem; }

.cart-summary { max-width: 320px; margin-top: 1rem; }
.cart-summary .total { font-weight: 700; font-size: 1.15rem; }

.checkout-summary { margin-bottom: 1.5rem; }
.checkout-form { max-width: 480px; }

.payment-methods {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  max-width: 480px;
}
.payment-methods h2 { margin-top: 0; font-size: 1.1rem; }
#stripe-payment-element { margin-bottom: 1rem; }

.flash {
  background: var(--success-bg);
  border: 1px solid var(--accent);
  padding: 0.8rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.flash.success { font-weight: 600; }

.form-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.8rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
