/* ============================================
   SHOP PAGE STYLES
   Grid, product cards, product modal,
   cart panel, and empty states
   ============================================ */

/* ---- SHOP HEADER ---- */
.shop-header {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xl);
}

/* Title and description on the same row, both starting at the same top line */
.shop-header-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
}

.shop-header-title {
  flex-shrink: 0;
  line-height: 1;
}

/* Subtle left border sections the description off from the title */
.shop-header-desc {
  flex: 1;
  max-width: 380px;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--color-text-muted);
  padding-left: var(--space-lg);
  border-left: 1px solid var(--color-border);
  padding-top: 0.35rem;   /* nudges text down slightly to clear the cap-height of the h1 */
}

/* Third column: category filter buttons */
.shop-header-filters {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-left: var(--space-lg);
  border-left: 1px solid var(--color-border);
  padding-top: 0.35rem;
  flex-shrink: 0;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: none;
  border: none;
  padding: 0.15rem 0;
  cursor: pointer;
  text-align: left;
  transition: color var(--transition);
}

.filter-btn:hover {
  color: var(--color-text);
}

.filter-btn--active {
  color: var(--color-navy);
  font-weight: 600;
}

@media (max-width: 767px) {
  .shop-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .shop-header-desc {
    border-left: none;
    padding-left: 0;
    max-width: none;
  }

  .shop-header-filters {
    flex-direction: row;
    gap: 1rem;
    border-left: none;
    padding-left: 0;
    padding-top: 0;
  }
}

/* ---- PRODUCT GRID ---- */
.shop-grid-section {
  padding-top: 0;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg) var(--space-md);
  padding-bottom: var(--space-xxl);
}

@media (max-width: 1023px) {
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* ---- PRODUCT CARD ---- */
.product-card {
  cursor: pointer;
  outline: none;   /* we'll style focus below instead */
}

.product-card:focus-visible .product-card__image-wrap {
  outline: 2px solid var(--color-navy);
  outline-offset: 3px;
}

/* Image wrapper controls overflow so zoom stays inside the card */
.product-card__image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;    /* all prints are landscape format */
  background: var(--color-bg-soft);
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.55s ease;
}

/* Zoom the image slightly on hover */
.product-card:hover .product-card__image {
  transform: scale(1.04);
}

/* Dark overlay with "VIEW PRINT" — fades in on hover */
.product-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 35, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.product-card:hover .product-card__overlay {
  opacity: 1;
}

.product-card__cta {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.65);
  padding: 0.6rem 1.75rem;
  transition: background var(--transition);
}

.product-card:hover .product-card__cta {
  background: rgba(255, 255, 255, 0.12);
}

/* Text below the image */
.product-card__info {
  padding-top: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.product-card__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  letter-spacing: 0.04em;
  color: var(--color-text);
  font-weight: 400;
  line-height: 1;
}

.product-card__location {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  max-width: none;
  line-height: 1.4;
  margin-top: 0.15rem;
}

.product-card__price {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  max-width: none;
  line-height: 1.4;
  margin-top: 0.3rem;
}

/* ---- EMPTY STATE ---- */
/* Shown when the products array is empty */
.shop-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-xxl) var(--space-lg);
}

.shop-empty p {
  margin-inline: auto;
}

.shop-empty .btn {
  margin-top: var(--space-md);
}


/* ============================================
   PRODUCT MODAL
   Full-width image on top, 2-column controls below
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  z-index: 200;
  display: flex;
  align-items: stretch;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  overflow-y: auto;
}

.modal-overlay--open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transition: opacity 0.25s ease; /* visibility becomes visible immediately on open */
}

.modal-close {
  position: fixed;
  top: 1.5rem;
  right: 1.75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: color var(--transition);
  z-index: 201;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-inner {
  display: block;
  width: 100%;
}

/* Stacked wrapper: image above, controls below */
.modal-print-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Full-width grey area — image sits on it like a print on a wall */
.modal-image-full {
  position: relative;
  width: 100%;
  background: #f0f0ee;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 3.5rem 1.25rem;
}

/* Tight wrapper around the image — anchors the drag shield and nav arrows */
.modal-image-wrap {
  position: relative;
  width: 100%;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.11), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* Aspect-ratio container: reserves space before the image loads and shows the grey placeholder */
.modal-image-aspect {
  line-height: 0;
  background: #e8e8e6;
  width: 100%;
  max-height: 75vh;
  overflow: hidden;
}

.modal-image-aspect--horizontal { aspect-ratio: 4 / 3; }
.modal-image-aspect--vertical   { aspect-ratio: 2 / 3; }

/* Image fills the reserved container — no layout shift on load */
.modal-image-aspect img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Prev / Next arrows — overlay the left/right edges of the image */
.modal-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(10, 20, 35, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  z-index: 10;
}

.modal-nav-btn:hover {
  background: rgba(10, 20, 35, 0.5);
  border-color: rgba(255, 255, 255, 0.4);
}

.modal-nav-btn--prev { left: 0; }
.modal-nav-btn--next { right: 0; }

/* Two-column controls bar */
.modal-controls-bar {
  display: flex;
  gap: 4rem;
  padding: 2rem 3.5rem;
  background: var(--color-bg);
  flex: 1;
}

/* Left: title, location, description */
.modal-controls-info {
  flex: 1;
  max-width: 440px;
}

/* Right: size, type, qty, add to cart */
.modal-controls-options {
  flex: 0 0 360px;
  display: flex;
  flex-direction: column;
}

.modal-label {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  letter-spacing: 0.04em;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.modal-location {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  max-width: none;
  margin-bottom: var(--space-md);
}

.modal-description {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--color-text-muted);
  max-width: none;
}

/* Option group: label row + selector buttons */
.modal-option-group {
  margin-bottom: var(--space-md);
}

.modal-option-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: 0.625rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.modal-price {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: 0;
}

.option-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.option-btn {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--color-border);
  background: none;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  color: var(--color-text);
}

.option-btn:hover {
  border-color: var(--color-text);
}

.option-btn--selected {
  background: var(--color-navy);
  border-color: var(--color-navy);
  color: white;
}

/* Frame colour swatches */
.frame-colour-swatches {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.frame-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.frame-swatch__colour {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.12);
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.15s ease;
}

.frame-swatch--selected .frame-swatch__colour {
  outline-color: var(--color-navy);
}

.frame-swatch__label {
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: color var(--transition);
}

.frame-swatch--selected .frame-swatch__label {
  color: var(--color-text);
}

.frame-swatch--white     .frame-swatch__colour { background: #f0ede8; }
.frame-swatch--wood      .frame-swatch__colour { background: #c4965a; border-color: transparent; }
.frame-swatch--dark-wood .frame-swatch__colour { background: #3d2b1f; border-color: transparent; }
.frame-swatch--black     .frame-swatch__colour { background: #1a1a1a; border-color: transparent; }

/* Quantity row */
.modal-qty {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: var(--space-md);
}

.modal-qty-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text);
  flex: 1;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  background: none;
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  transition: border-color var(--transition);
  flex-shrink: 0;
}

.qty-btn:hover {
  border-color: var(--color-text);
}

.qty-value {
  font-size: 0.9375rem;
  font-weight: 500;
  min-width: 24px;
  text-align: center;
}

.modal-add-btn {
  width: 100%;
  padding: 1rem;
}

.modal-print-details {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}

.modal-print-detail-item {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  max-width: none;
  line-height: 1.6;
}

/* Tablet: tighten padding */
@media (min-width: 768px) and (max-width: 1023px) {
  .modal-image-full {
    padding: 1.25rem 2rem 1rem;
  }
  .modal-controls-bar {
    padding: 1.75rem 2rem;
    gap: 2.5rem;
  }
  .modal-controls-options {
    flex: 0 0 300px;
  }
}

/* Desktop: equal-width two-column layout with dividing line */
@media (min-width: 1024px) {
  .modal-controls-bar {
    gap: 0;
    align-items: flex-start;
  }

  .modal-controls-info {
    max-width: none;
    padding-right: 2.5rem;
  }

  .modal-controls-options {
    flex: 1;
    border-left: 1px solid var(--color-border);
    padding-left: 2.5rem;
  }
}

/* Mobile: stack to single column, full image visible */
@media (max-width: 767px) {
  .modal-image-full {
    padding: 1.5rem;
  }

  .modal-image-wrap img {
    max-height: none;
  }

  .modal-controls-bar {
    flex-direction: column;
    gap: var(--space-md);
    padding: 1.5rem;
  }

  .modal-controls-info {
    max-width: none;
  }

  .modal-controls-options {
    flex: none;
  }
}


/* ============================================
   MOBILE — 767px and below
   Touch targets, sticky CTA
   ============================================ */
@media (max-width: 767px) {

  /* Product card overlay — always visible on touch (no hover on mobile) */
  .product-card__overlay {
    opacity: 1;
  }

  /* Filter buttons — 44px minimum tap height */
  .filter-btn {
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Option buttons (size/finish) — 44px minimum tap height */
  .option-btn {
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Modal quantity buttons — 44px */
  .qty-btn {
    width: 44px;
    height: 44px;
  }

  /* Sticky Add to Cart: hidden when modal is closed */
  .modal-overlay:not(.modal-overlay--open) .modal-add-btn {
    display: none;
  }

  /* When modal is open, pin CTA to bottom of viewport */
  .modal-overlay--open .modal-add-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 202;
    margin-top: 0;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--color-border);
    text-align: center;
  }

  /* Extra bottom padding in options column so sticky button doesn't cover content */
  .modal-controls-options {
    padding-bottom: 5rem;
  }

  /* Modal title — smaller on mobile to prevent overflow */
  .modal-title {
    font-size: 2rem;
  }

  /* Modal close button — easier to tap */
  .modal-close {
    top: 1rem;
    right: 1rem;
    padding: 0.75rem;
  }
}
