/* Design tokens — 2026-first per design-modernization-findings.md. 8px spacing scale. */
:root {
  --color-accent: #0d6efd;
  --color-accent-hover: #0b5ed7;
  --color-neutral-50: #f8f9fa;
  --color-neutral-100: #f1f3f5;
  --color-neutral-200: #e9ecef;
  --color-neutral-500: #6b7280;
  --color-neutral-900: #212529;
  --color-success: #198754;
  --color-warn: #ffc107;
  --color-error: #dc3545;
  --section-bg: #f6f7f9;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --header-height: 56px;
  --header-utility-height: 36px;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
  font-family: var(--font-body);
  color: var(--color-neutral-900);
}

/* Shared components */
.btn-primary {
  background-color: var(--color-accent);
}
.btn-primary:hover {
  background-color: var(--color-accent-hover);
}

.card-storefront {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.card-storefront:hover {
  box-shadow: var(--shadow-md);
}

.badge-storefront {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

/* 2-line title clamp — Cart, Checkout Order Summary, mini-cart */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: 2;
}

/* Order summary line image — avoid layout shift */
.order-summary-line-img-wrap {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}
.order-summary-line-img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  display: block;
}

/* Mini-cart line image — consistent size */
.mini-cart-line-img {
  width: 50px;
  height: 50px;
  object-fit: cover;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-neutral-100);
  border-bottom: 1px solid var(--color-neutral-100);
}

/* Trust row 2026 — pill badges with icon slots */
.trust-row.trust-row--pills {
  background: var(--section-bg);
  border: none;
  padding: var(--space-4) 0;
  gap: var(--space-3);
  justify-content: center;
}
.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: white;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  color: var(--color-neutral-900);
  box-shadow: var(--shadow-sm);
}
.trust-pill .trust-pill__icon { width: 1rem; height: 1rem; flex-shrink: 0; }

/* Header 2026 — two-tier, sticky, shrink */
.header-2026 { position: relative; }
.header-2026__utility { background: var(--color-neutral-100); }
.header-2026__primary { transition: padding 0.25s ease, box-shadow 0.25s ease; }
.header-2026__search-input { max-width: 360px; border-radius: var(--radius-pill); padding-left: var(--space-4); }
.header-2026.header-sticky .header-2026__primary { position: sticky; top: 0; z-index: 1030; }
.header-2026.header-shrunk .header-2026__utility { display: none; }
.header-2026.header-shrunk .header-2026__primary { padding-top: var(--space-2); padding-bottom: var(--space-2); }
@media (prefers-reduced-motion: reduce) {
  .header-2026__primary { transition: none; }
}

/* Logo: dimensions + responsive (see header-logo-optimization.md) */
.header-2026__primary .navbar-brand img {
  height: 65px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
@media (max-width: 767.98px) {
  .header-2026__primary .navbar-brand img {
    height: 48px;
  }
}
.header-2026.header-shrunk .navbar-brand img {
  height: 48px;
}

.focus-visible:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Accessibility — WCAG 2.2, keyboard nav */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: white;
  z-index: 1100;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  transition: top 0.2s;
}
.skip-link:focus {
  top: var(--space-2);
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Touch targets ≥44px for primary interactive elements */
.navbar .nav-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}
.btn:not(.btn-sm) {
  min-height: 44px;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

/* Reduce layout shift — reserve space for images */
.card-storefront img {
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
}

/* Focus visible for keyboard users */
*:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Product media carousel — arrows-only overlay */
.product-media {
  position: relative;
  overflow: hidden;
}
.product-media__nav {
  display: none; /* shown by JS when multiple items */
}
.product-media__img,
.product-media__video {
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
  display: block;
}
.product-media__video {
  background: var(--color-neutral-50);
}
.product-media-card.js-carousel-ready .product-media__nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.product-media__btn {
  pointer-events: auto;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  margin: 0 var(--space-2);
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-neutral-900);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background 0.15s, transform 0.15s;
}
.product-media__btn:hover {
  background: white;
}
.product-media__btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .product-media__btn {
    transition: none;
  }
}

/* 2026 product card: title clamp, price prominence, actions on hover/focus */
.card-title--clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.card-actions--reveal {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.card-storefront:hover .card-actions--reveal,
.card-storefront:focus-within .card-actions--reveal {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .card-actions--reveal { transition: none; }
}
.product-card--zoom .card-img-top {
  transition: transform 0.35s ease;
}
.product-card--zoom:hover .card-img-top {
  transform: scale(1.05);
}
@media (prefers-reduced-motion: reduce) {
  .product-card--zoom .card-img-top { transition: none; }
  .product-card--zoom:hover .card-img-top { transform: none; }
}

/* Category tile 2026: image-led, top-3 emphasis */
.category-tile__img {
  aspect-ratio: 4/3;
  object-fit: cover;
}
.category-tile--emphasis .category-tile__placeholder,
.category-tile--emphasis .category-tile__img { min-height: 140px; }
.category-tile--emphasis .card-body { padding: var(--space-4); }

/* Hero 2026 split layout */
.hero-section--2026 { background: var(--section-bg); }
.hero-section__image-placeholder { background: var(--color-neutral-200); }

/* Category hero banner (Option 2: full-width 4:1, left overlay) */
.category-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 1800 / 450;
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.category-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.category-hero__overlay {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  max-width: 50%;
  min-width: min(400px, 45%);
  background: rgba(255, 255, 255, 0.6);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: var(--font-display);
  color: var(--color-neutral-900);
}
.category-hero__overlay .category-hero__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}
.category-hero__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--section-bg);
  border-radius: var(--radius-lg);
}
@media (max-width: 767px) {
  .category-hero__overlay {
    max-width: 85%;
    padding: var(--space-4);
  }
}

/* Skeleton loaders (for async sections) */
.skeleton {
  background: linear-gradient(90deg, var(--color-neutral-100) 25%, var(--color-neutral-200) 50%, var(--color-neutral-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--color-neutral-100); }
}
@keyframes skeleton-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Checkout payment: card logos and validation */
.checkout-card-logos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.checkout-card-logo {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-neutral-200);
  background: var(--color-neutral-50);
  color: var(--color-neutral-500);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.checkout-card-logo.active {
  border-color: var(--color-accent);
  background: rgba(13, 110, 253, 0.08);
  color: var(--color-accent);
}
.checkout-card-logo-active {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-neutral-500);
}
.checkout-card-logo-active.visa { color: #1a1f71; }
.checkout-card-logo-active.mastercard { color: #eb001b; }
.checkout-card-logo-active.amex { color: #006fcf; }
.checkout-card-logo-active.discover { color: #000; }
.checkout-exp.is-invalid,
#checkout-cvv.is-invalid { border-color: var(--color-error); }
.checkout-exp.is-valid,
#checkout-cvv.is-valid { border-color: var(--color-success); }
#checkout-cardnumber.is-invalid { border-color: var(--color-error); }
#checkout-cardnumber.is-valid { border-color: var(--color-success); }

/* Add-to-cart: header cart icon wiggle (Step 2 F) */
@keyframes cart-icon-wiggle {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
.cart-icon-wiggle {
  animation: cart-icon-wiggle 0.3s ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
  .cart-icon-wiggle { animation: none; }
}

/* Add-to-cart: PDP button micro-interaction (Step 1 D) — fixed width so "Added" doesn't resize */
#pdp-add-to-cart-btn {
  min-width: 10.5em;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
#pdp-add-to-cart-btn.add-to-cart-loading {
  cursor: not-allowed;
  opacity: 0.85;
}
#pdp-add-to-cart-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}
#pdp-add-to-cart-btn.pdp-add-to-cart--requires-selection {
  cursor: not-allowed;
  opacity: 0.7;
}
#pdp-add-to-cart-btn.add-to-cart-success {
  background-color: var(--color-success);
  border-color: var(--color-success);
  color: white;
}
#pdp-add-to-cart-btn.add-to-cart-success:hover {
  background-color: #157347;
  border-color: #157347;
  color: white;
}
@media (prefers-reduced-motion: reduce) {
  #pdp-add-to-cart-btn,
  #pdp-add-to-cart-btn.add-to-cart-loading,
  #pdp-add-to-cart-btn.add-to-cart-success { transition: none; }
}

/* PDP variant hint: reserve space so layout does not shift when hint is shown/hidden */
.pdp-variant-hint-wrap {
  min-height: 1.5em;
}
.pdp-variant-hint--hidden {
  visibility: hidden;
}

/* PDP variant: highlight first missing dropdown when user clicks Add to Cart without selecting */
.pdp-variant--highlight.form-select,
.form-select.pdp-variant--highlight {
  border-color: var(--bs-danger, #dc3545);
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* PDP gallery: fixed main image slot, scrollable thumbs, zoom modal */
.pdp-gallery {
  width: 100%;
}
.pdp-gallery__main-wrap {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-neutral-50);
  border-radius: var(--radius-md);
}
.pdp-gallery__main-wrap .pdp-gallery__main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.pdp-gallery__zoom-trigger {
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pdp-gallery__zoom-trigger:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.pdp-gallery__thumbs-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  position: relative;
}
.pdp-gallery__thumbs-viewport {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pdp-gallery__thumbs-viewport::-webkit-scrollbar {
  display: none;
}
.pdp-gallery__thumbs-wrap [data-pdp-thumbs] {
  flex-wrap: nowrap;
  min-width: min-content;
}
.pdp-gallery__thumb-btn {
  flex-shrink: 0;
}
.pdp-gallery__thumb-img {
  height: 70px;
  width: 70px;
  object-fit: cover;
  display: block;
}
.pdp-gallery__thumbs-nav {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  background: white;
  color: var(--color-neutral-900);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pdp-gallery__thumbs-nav:hover {
  background: var(--color-neutral-50);
  border-color: var(--color-neutral-500);
}
.pdp-gallery__thumbs-nav:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.pdp-gallery__thumbs-nav--prev::before {
  content: '';
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-right: 2px;
}
.pdp-gallery__thumbs-nav--next::before {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 2px;
}
.pdp-gallery__thumbs-nav:disabled,
.pdp-gallery__thumbs-nav[aria-hidden="true"] {
  opacity: 0.4;
  pointer-events: none;
}
/* Zoom modal: fixed viewport, nav arrows, prominent close */
#pdp-zoom-modal .modal-dialog {
  max-width: 95vw;
}
#pdp-zoom-modal .modal-content {
  background: transparent;
  box-shadow: none;
}
.pdp-gallery__zoom-modal-body {
  min-height: 80vh;
  padding: var(--space-6);
}
.pdp-gallery__zoom-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 10;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.pdp-gallery__zoom-close-x {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  width: 1em;
  height: 1em;
  margin: 0;
  padding: 0;
}
.pdp-gallery__zoom-close:hover {
  background: rgba(0, 0, 0, 0.75);
  border-color: white;
  color: white;
}
.pdp-gallery__zoom-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}
.pdp-gallery__zoom-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 25px;
}
.pdp-gallery__zoom-viewport {
  width: 75vmin;
  height: 75vmin;
  max-width: 900px;
  max-height: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.pdp-gallery__zoom-viewport .pdp-gallery__zoom-modal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  max-width: 100%;
  max-height: 100%;
}
.pdp-gallery__zoom-nav {
  flex-shrink: 0;
  z-index: 5;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: background 0.2s, border-color 0.2s;
}
.pdp-gallery__zoom-nav:hover {
  background: rgba(0, 0, 0, 0.75);
  border-color: white;
  color: white;
}
.pdp-gallery__zoom-nav:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}
.pdp-gallery__zoom-nav--prev::before {
  content: '';
  width: 12px;
  height: 12px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
  margin-right: 4px;
}
.pdp-gallery__zoom-nav--next::before {
  content: '';
  width: 12px;
  height: 12px;
  border-right: 3px solid currentColor;
  border-top: 3px solid currentColor;
  transform: rotate(45deg);
  margin-left: 4px;
}
.pdp-gallery__zoom-nav:disabled,
.pdp-gallery__zoom-nav[aria-hidden="true"] {
  opacity: 0.4;
  pointer-events: none;
}
#pdp-zoom-modal .modal-backdrop {
  background-color: rgba(0, 0, 0, 0.85);
}