/* ==========================================================================
   KSM – static site additions
   Loaded after style.css (the original theme stylesheet). Contains:
   1. Overrides that replace WordPress-only markup/inline styles
   2. The product catalog page (products.html) and its photo gallery
   ========================================================================== */

:root {
  --surface: #ffffff;
  --surface-low: #f5f5f4;
  --surface-high: #ececea;
  --line: #e5e5e5;
  --muted: #5d6468;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-soft: 0 20px 40px rgba(24, 28, 32, 0.08);
  --focus: 0 0 0 3px rgba(212, 149, 43, 0.55);
}

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 5000;
  background: var(--primary-bg);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--btn-radius);
  font-weight: 700;
}
.skip-link:focus { top: 12px; color: #fff; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 4px;
}

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

/* ---------- Header ---------- */
.site-logo,
.footer-info__logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
}
.site-logo img { height: 50px; width: auto; }
.site-logo__slogan { height: 50px; width: auto; }
.footer-info__logo { margin-bottom: 16px; }
.footer-info__logo img { height: 60px; width: auto; }

.site-header { transition: box-shadow 0.2s; }
.site-header.is-scrolled { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }

.primary-nav__list {
  display: flex;
  align-items: center;
}
.primary-nav__link[aria-current="page"] {
  color: var(--primary-bg);
  box-shadow: inset 0 -3px 0 var(--accent-bg);
}

@media (min-width: 992px) {
  /* Theme clipped the header row; the mega menu needs to overflow it. */
  .site-header__inner { overflow: visible; }

  .primary-nav__item--mega:hover .mega-menu,
  .primary-nav__item--mega:focus-within .mega-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
  }
  .mega-menu { min-width: 640px; }
  /* invisible bridge so the menu doesn't close while moving the pointer down */
  .primary-nav__item--mega::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 12px;
  }
}

/* Mobile menu: the theme hid the toggle until a WP menu existed. */
@media (max-width: 991px) {
  .mobile-menu-toggle { display: inline-flex !important; }
}
.mobile-nav__list a[aria-current="page"] { color: var(--primary-bg); }
.mobile-nav__sub { padding: 0 0 10px 16px; }
.mobile-nav__list .mobile-nav__sub li { border-bottom: 0; }
.mobile-nav__list .mobile-nav__sub a {
  padding: 8px 0;
  font-size: 1rem;
  font-weight: 400;
}

@media (max-width: 480px) {
  .site-logo__slogan-link { display: none; }
}

/* ---------- Search suggestions ---------- */
.search-suggestions:empty { display: none; }
.search-suggestions__item {
  color: var(--text-color);
  border-radius: 8px;
  padding: 8px;
}
.search-suggestions__item:hover { background: var(--surface-low); }
.search-suggestions__item span { display: flex; flex-direction: column; line-height: 1.3; }
.search-suggestions__item small { color: var(--muted); font-size: 0.8rem; }
.search-suggestions__item img { width: 64px; height: 48px; }
.search-suggestions__all {
  display: block;
  margin-top: 12px;
  font-weight: 700;
  color: var(--primary-bg);
}

/* ---------- Forms ---------- */
.footer-newsletter__msg,
.contact-form__msg {
  margin-top: 12px;
  font-size: 0.9rem;
}
.contact-form__msg {
  background: var(--surface-low);
  border-left: 3px solid var(--accent-bg);
  padding: 12px 16px;
  border-radius: 6px;
}

/* ---------- Homepage: featured products ---------- */
.products-section__header--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.product-card--photo .product-card__image { aspect-ratio: 4 / 3; }
.product-card__variant {
  font-size: 0.85rem;
  color: var(--muted) !important;
  opacity: 1 !important;
  margin: 0;
}
.product-card__specs {
  font-size: 0.8rem;
  color: var(--primary-bg) !important;
  opacity: 1 !important;
  font-weight: 700;
  margin: 6px 0 0;
}
.products-section--blue .product-card__info { padding: 14px 16px 16px; }

/* ==========================================================================
   Catalog page
   ========================================================================== */
.catalog-header { padding: 56px 0 48px; }
.catalog-header__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-bg);
  margin-bottom: 8px;
}
.catalog-header h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  letter-spacing: -0.02em;
}
.catalog-header__lead {
  max-width: 680px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.catalog { padding-top: 32px; }

/* Toolbar */
.catalog-toolbar {
  background: var(--surface-low);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}
@media (min-width: 768px) {
  .catalog-toolbar { padding: 20px 24px; }
}
.catalog-toolbar__top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}

.catalog-tabs {
  display: inline-flex;
  background: var(--surface-high);
  border-radius: 999px;
  padding: 4px;
  max-width: 100%;
  overflow-x: auto;
}
.catalog-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-color);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.catalog-tab:hover { background: rgba(255, 255, 255, 0.6); }
.catalog-tab[aria-selected="true"] {
  background: var(--primary-bg);
  color: #fff;
  box-shadow: 0 4px 12px rgba(31, 61, 79, 0.25);
}
.catalog-tab__count {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
  text-align: center;
}
.catalog-tab[aria-selected="true"] .catalog-tab__count { background: rgba(255, 255, 255, 0.2); }
@media (max-width: 599px) {
  .catalog-tabs { display: flex; width: 100%; }
  .catalog-tab {
    flex: 1 1 auto;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.85rem;
  }
  .catalog-tab__count { display: none; }
}

.catalog-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 360px;
  color: var(--muted);
}
.catalog-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.catalog-search input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 14px 10px 40px;
  color: var(--text-color);
  transition: border-color 0.15s;
}
.catalog-search input:focus {
  outline: none;
  border-bottom-color: var(--primary-bg);
  box-shadow: none;
}
@media (max-width: 599px) {
  .catalog-search { max-width: none; }
}

.catalog-filters:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-top: 16px;
}
.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.filter-group__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.filter-group__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-color);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--primary-bg); }
.chip[aria-pressed="true"] {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: #fff;
}

.catalog-status {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  min-height: 28px;
}
#catalog-count {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
}
.catalog-clear,
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primary-bg);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* Grid + cards */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 700px) {
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
}
@media (min-width: 1100px) {
  .catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
}

.catalog-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.25s, transform 0.25s;
}
.catalog-card:hover {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), var(--shadow-soft);
  transform: translateY(-2px);
}
.catalog-card[hidden] { display: none; }

.catalog-card__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface-high);
  overflow: hidden;
}
.catalog-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.catalog-card:hover .catalog-card__media img { transform: scale(1.06); }

.catalog-card__count {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: rgba(22, 45, 59, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.catalog-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 14px 16px;
}
@media (min-width: 700px) {
  .catalog-card__body { padding: 16px 18px 18px; }
}
.catalog-card__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-bg);
  margin-bottom: 4px;
}
.catalog-card__title {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.catalog-card__title a::after {
  /* make the whole card body clickable without nesting links */
  content: "";
  position: absolute;
  inset: 0;
}
.catalog-card__body { position: relative; }
.catalog-card__variant {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 2px;
}
.catalog-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}
.catalog-card__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.catalog-card__specs li {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-low);
  color: var(--primary-bg);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Colour swatches */
.swatches {
  display: inline-flex;
  flex-shrink: 0;
}
.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.swatches .swatch + .swatch { margin-left: -6px; }
.swatch--clear {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0 45%, rgba(170, 205, 225, 0.9) 45% 55%, rgba(255, 255, 255, 0.95) 55%);
}

.catalog-empty {
  text-align: center;
  padding: 48px 16px;
  background: var(--surface-low);
  border-radius: var(--radius-lg);
}
.catalog-empty h3 { margin-bottom: 8px; }
.catalog-empty p { color: var(--muted); max-width: 520px; margin: 0 auto; }
.catalog-empty a { color: var(--primary-bg); font-weight: 700; text-decoration: underline; }

.catalog-cta { background: var(--surface-low); }
.catalog-cta p { max-width: 560px; margin-left: auto; margin-right: auto; }
.catalog-cta .btn { margin: 4px; }

/* ==========================================================================
   Product dialog (gallery)
   ========================================================================== */
.product-dialog {
  border: 0;
  padding: 0;
  margin: auto;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-color);
  box-shadow: 0 30px 80px rgba(10, 25, 35, 0.35);
  overflow: hidden;
}
.product-dialog::backdrop {
  background: rgba(22, 45, 59, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.product-dialog[open] { animation: pd-in 0.2s ease-out; }
@keyframes pd-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .product-dialog[open] { animation: none; }
  .catalog-card, .catalog-card__media img { transition: none; }
}

.product-dialog__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
@media (min-width: 900px) {
  .product-dialog__inner {
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
    overflow: hidden;
  }
}

.product-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-color);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.product-dialog__close:hover { background: #fff; }

.product-dialog__gallery {
  background: #1d2a32;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pd-stage {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #1d2a32;
  overflow: hidden;
  touch-action: pan-y;
}
.pd-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pd-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.15s;
}
.pd-nav:hover { background: #fff; }
.pd-nav--prev { left: 12px; }
.pd-nav--next { right: 12px; }
.pd-counter {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 3px 10px;
  border-radius: 999px;
}
@media (min-width: 900px) {
  /* let the photo fill the dark column next to the info panel */
  .pd-stage {
    flex: 1 1 auto;
    aspect-ratio: auto;
    min-height: 420px;
  }
}
.pd-thumbs {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.pd-thumb {
  flex: 0 0 auto;
  width: 84px;
  aspect-ratio: 3 / 2;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  opacity: 0.6;
  background: #000;
  transition: opacity 0.15s, border-color 0.15s;
}
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumb:hover { opacity: 0.9; }
.pd-thumb[aria-current="true"] { opacity: 1; border-color: var(--accent-bg); }

.product-dialog__info {
  padding: 24px 20px 24px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
@media (min-width: 900px) {
  .product-dialog__info {
    padding: 40px 32px 32px;
    overflow-y: auto;
    max-height: calc(100dvh - 32px);
  }
}
.product-dialog__info h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.02em;
}
.pd-variant {
  color: var(--muted);
  font-size: 1.05rem;
  margin-top: 4px;
}
.pd-specs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin: 24px 0 20px;
  padding: 18px 20px;
  background: var(--surface-low);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
}
.pd-specs dt {
  font-weight: 700;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  align-self: center;
}
.pd-specs dd { margin: 0; }
.pd-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.pd-colors > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pd-related {
  font-weight: 700;
  color: var(--primary-bg);
  margin-bottom: 20px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pd-related[hidden] { display: none; }
.pd-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
}
.pd-note {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 599px) {
  .product-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
  .product-dialog__inner { max-height: 100dvh; height: 100%; }
  .pd-nav { width: 38px; height: 38px; }
  .pd-thumb { width: 68px; }
}
