/* =========================================================
   CircuitMax — clean, functional storefront styles
   ========================================================= */

:root {
  /* Neutral base palette */
  --white: #ffffff;
  --grey-25: #fafafa;
  --grey-50: #f6f6f7;
  --grey-100: #eeeeef;
  --grey-200: #e2e2e5;
  --grey-300: #c9c9ce;
  --grey-500: #666a71;
  --grey-700: #3a3f45;
  --grey-800: #24272b;
  --grey-900: #141618;

  /* One restrained accent */
  --blue-50: #eef4ff;
  --blue-600: #1f5eff;
  --blue-700: #174bcc;

  /* Red accent for Sale/Certified */
  --red-700: #b42318;
  --red-50: #fdecea;

  --green-700: #157347;

  /* Layout and components */
  --radius-sm: 4px;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 6%);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 8%);
  --container: 1240px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--grey-900);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* Layout */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 200;
  padding: 0.7rem 1rem;
  color: var(--white);
  background: var(--grey-900);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

/* Announcement bar */
.announcement-bar {
  font-size: 0.875rem;
  color: var(--grey-800);
  background: var(--grey-100);
  border-bottom: 1px solid var(--grey-200);
}

.announcement-inner {
  padding-block: 0.55rem;
  text-align: center;
}

/* =========================================================
   NOTE: All header / navbar styles are owned by
   includes/navbar.php. Do not add .site-header,
   .header-inner, .menu-toggle, .search-form,
   .header-actions, .primary-nav, or .nav-inner rules here.
   ========================================================= */

/* Search result rows (used inside the navbar's dropdown, still fine here) */
.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--grey-100);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover,
.search-result:focus-visible {
  background: var(--grey-50);
}

.search-result-title {
  font-size: 0.9rem;
}

.search-result-price {
  color: var(--grey-500);
  white-space: nowrap;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.65rem 1.1rem;
  font-size: 0.925rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.button.primary {
  color: var(--white);
  background: var(--grey-900);
}

.button.primary:hover {
  background: #000;
}

.button.secondary {
  color: var(--grey-900);
  background: var(--white);
  border-color: var(--grey-200);
}

.button.secondary:hover {
  background: var(--grey-50);
}

.button.full-width {
  width: 100%;
}

.text-link {
  color: var(--blue-700);
  font-size: 0.9rem;
  font-weight: 600;
}

.text-link:hover {
  text-decoration: underline;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  gap: 1.5rem;
  padding-block: 2.5rem;
}

.hero-content {
  padding: 2.25rem;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
}

.eyebrow {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey-500);
}

.hero h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  line-height: 1.15;
}

.hero p {
  max-width: 56ch;
  color: var(--grey-500);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hero-panel {
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
}

.hero-panel h2 {
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.hero-panel p {
  margin-bottom: 1rem;
  color: var(--grey-500);
}

/* Product sections */
.product-section {
  padding-block: 2rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-header h2 {
  font-size: 1.35rem;
}

.carousel {
  position: relative;
}

.product-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 1rem;
  padding-bottom: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.product-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  scroll-snap-align: start;
  position: relative;
}

.product-link {
  display: block;
  flex: 1;
}

.product-image {
  aspect-ratio: 1 / 1;
  padding: 1rem;
  background: var(--grey-50);
  border-bottom: 1px solid var(--grey-100);
  position: relative;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-info {
  padding: 0.9rem;
}

.product-badge {
  display: inline-block;
  margin-bottom: 0.45rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--grey-800);
  background: var(--grey-100);
  border-radius: var(--radius-sm);
}

.product-badge.sale {
  color: var(--red-700);
  background: var(--red-50);
}

.product-title {
  display: -webkit-box;
  margin-bottom: 0.35rem;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  transition: color 0.2s;
}

.product-meta {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--grey-500);
}

.price {
  font-weight: 700;
}

.price-compare {
  margin-left: 0.4rem;
  font-weight: 400;
  color: var(--grey-500);
  text-decoration: line-through;
}

.add-to-cart {
  width: 100%;
  min-height: 42px;
  font-weight: 600;
  color: var(--grey-900);
  background: var(--grey-50);
  border-top: 1px solid var(--grey-100);
}

.add-to-cart:hover {
  background: var(--grey-100);
}

.carousel-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.carousel-controls button {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
}

.carousel-controls button:hover {
  background: var(--grey-50);
}

/* Info bands */
.info-band {
  margin-bottom: 1.5rem;
  padding: 2rem;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
}

.info-band h2 {
  margin-bottom: 0.5rem;
}

.info-band p {
  max-width: 62ch;
  margin-bottom: 1.25rem;
  color: var(--grey-500);
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-block: 1rem;
  font-size: 0.85rem;
  color: var(--grey-500);
}

.breadcrumb a:hover {
  color: var(--grey-900);
  text-decoration: underline;
}

/* Product detail page */
.product-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 2rem;
  padding-block: 1.5rem 2.5rem;
}

.product-gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 1.5rem;
  object-fit: contain;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
}

.thumbnail-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  overflow-x: auto;
}

.thumbnail {
  width: 72px;
  height: 72px;
  padding: 0.35rem;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
}

.thumbnail.active {
  border-color: var(--grey-900);
}

.product-summary h1 {
  margin: 0.5rem 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
}

.product-price {
  margin: 0.75rem 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.stock {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.stock.in-stock {
  color: var(--green-700);
}

.stock.out-of-stock {
  color: var(--red-700);
}

.product-description {
  max-width: 62ch;
  margin-bottom: 1.5rem;
  color: var(--grey-500);
}

.purchase-row {
  display: flex;
  gap: 0.75rem;
  max-width: 360px;
}

.purchase-row input {
  width: 82px;
  padding: 0.65rem;
  text-align: center;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
}

.purchase-feedback {
  min-height: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--green-700);
}

/* Product video */
.video-review {
  padding-block: 1.5rem;
}

.video-wrapper {
  position: relative;
  aspect-ratio: 16 / 9;
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
}

.video-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Related products */
.related {
  padding-block: 2rem;
}

/* Footer */
.site-footer {
  margin-top: 2rem;
  background: var(--grey-50);
  border-top: 1px solid var(--grey-200);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  padding-block: 2.5rem;
}

.site-footer h3 {
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
}

.site-footer ul {
  display: grid;
  gap: 0.45rem;
}

.site-footer a:hover {
  text-decoration: underline;
}

address {
  font-style: normal;
  color: var(--grey-500);
}

.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.newsletter-form input {
  flex: 1;
  min-width: 200px;
  min-height: 42px;
  padding: 0.65rem;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
}

.form-message {
  width: 100%;
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.form-message.success {
  color: var(--green-700);
}

.form-message.error {
  color: var(--red-700);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
  font-size: 0.85rem;
  color: var(--grey-500);
  border-top: 1px solid var(--grey-200);
}

.payment-methods {
  display: flex;
  gap: 0.5rem;
}

.payment-methods span {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
}

/* Cart drawer */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.cart-drawer.open {
  pointer-events: auto;
}

.cart-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 45%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cart-drawer.open .cart-backdrop {
  opacity: 1;
}

.cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(420px, 100%);
  height: 100%;
  background: var(--white);
  border-left: 1px solid var(--grey-200);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.cart-drawer.open .cart-panel {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--grey-200);
}

.cart-header h2 {
  font-size: 1.1rem;
}

.cart-items {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.75rem;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--grey-100);
}

.cart-item-image {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--grey-50);
  border: 1px solid var(--grey-100);
  border-radius: var(--radius-sm);
}

.cart-item-title {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.cart-item-price {
  font-size: 0.85rem;
  color: var(--grey-500);
}

.remove-item {
  align-self: start;
  font-size: 0.8rem;
  color: var(--red-700);
  text-decoration: underline;
}

.cart-empty {
  padding-block: 2rem;
  color: var(--grey-500);
  text-align: center;
}

.cart-footer {
  padding: 1rem;
  border-top: 1px solid var(--grey-200);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

/* =========================================================
   New Catalog Layout & Filters
   ========================================================= */

.catalog-header {
  padding-block: 2.5rem 1.5rem;
}

.catalog-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}

/* Shop Layout Grid */
.shop-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.5rem;
  align-items: start;
  padding-bottom: 4rem;
}

/* Sidebar Filters */
.filter-sidebar {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--white);
  position: sticky;
  top: 100px;
}

.filter-header {
  background: var(--grey-900);
  color: var(--white);
  padding: 1rem;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  border-bottom: 4px solid var(--red-700);
}

.filter-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.05em;
}

.filter-content {
  padding: 1.5rem 1.25rem;
}

.filter-group {
  border-bottom: 1px solid var(--grey-200);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

.filter-group:last-of-type {
  border-bottom: none;
  margin-bottom: 1rem;
  padding-bottom: 0;
}

.filter-title, .filter-toggle {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--grey-800);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.05em;
}

.price-inputs {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  padding-left: 0.5rem;
  width: 100%;
}

.input-wrapper span {
  color: var(--grey-500);
  font-size: 0.9rem;
}

.input-wrapper input {
  border: none;
  padding: 0.5rem;
  width: 100%;
  font-size: 0.9rem;
  outline: none;
}

.range-slider {
  width: 100%;
  margin-top: 1.5rem;
  accent-color: var(--grey-900);
}

.filter-options {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.filter-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--grey-700);
}

/* Toolbar & Sorting */
.product-main {
  display: flex;
  flex-direction: column;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--grey-200);
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  color: var(--grey-500);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.sort-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort-wrapper select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--grey-800);
  cursor: pointer;
  outline: none;
}

/* Main Product Grid */
#main-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  overflow: visible;
  scroll-snap-type: none;
  padding-bottom: 0;
}

#main-product-grid .product-card {
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

#main-product-grid .product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

#main-product-grid .product-badge {
  background: var(--grey-900) !important;
  color: var(--white) !important;
  border-radius: 999px !important;
  padding: 0.25rem 0.75rem !important;
  font-size: 0.65rem !important;
  letter-spacing: 0.5px;
  position: absolute;
  top: 1rem;
  right: 1rem;
  margin: 0;
}

#main-product-grid .product-image {
  padding: 2rem !important;
}

#main-product-grid .product-card:hover .product-title {
  color: var(--red-700);
}

/* Wishlist Floating Button */
.wishlist-fab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 1.25rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  z-index: 40;
  box-shadow: -2px 2px 10px rgba(0,0,0,0.05);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
}

.wishlist-fab:hover {
  background: var(--grey-50);
}

.wishlist-fab span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 1px;
}

/* =========================================================
   Skeleton Loading Placeholders & Empty States
   ========================================================= */

.product-card.skeleton {
  pointer-events: none;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.skeleton-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--grey-50);
  border-bottom: 1px solid var(--grey-100);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text {
  height: 16px;
  margin: 0.9rem 0.9rem 0.35rem;
  background-color: var(--grey-100);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text.short {
  width: 60%;
  margin-bottom: 2rem;
}

@keyframes skeleton-pulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  background: var(--grey-50);
  border: 1px dashed var(--grey-300);
  border-radius: var(--radius);
  color: var(--grey-500);
  width: 100%;
}

.empty-state h3 {
  color: var(--grey-800);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

/* =========================================================
   Responsive
   ========================================================= */

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

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .product-layout {
    grid-template-columns: 1fr;
  }

  .shop-layout {
    grid-template-columns: 1fr;
  }

  .filter-sidebar {
    position: static;
    margin-bottom: 2rem;
  }

  .wishlist-fab {
    display: none;
  }
}

@media (max-width: 760px) {
  .product-grid {
    grid-auto-columns: minmax(220px, 78vw);
  }
}

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

  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}