/* static/products.css */

body {
  background-color: var(--gallery-bg);
}

:root {
  --shop-nav-height: 50px;
  --shop-page-gap: 12px;
  --shop-row-reserve: 320px;
  --hero-side-mask: clamp(88px, 17vw, 360px);
}

#shop-page {
  padding: calc(var(--shop-nav-height) + var(--shop-page-gap)) 20px 28px;
}

#shop-hero {
  position: relative;
  height: calc(100svh - var(--shop-nav-height) - var(--shop-page-gap) - var(--shop-row-reserve));
  min-height: 300px;
  max-height: 720px;
  margin-bottom: 22px;
  overflow: hidden;
  border-radius: 32px;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--btn-bg) 22%, transparent 78%), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--product-card-bg) 88%, var(--gallery-bg) 12%), color-mix(in srgb, var(--gallery-bg) 92%, var(--nav-bg) 8%));
  box-shadow: 0 24px 60px color-mix(in srgb, var(--category-header-color) 14%, transparent 86%);
  touch-action: pan-y;
}

#shop-hero.is-hidden {
  display: none;
}

#shop-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, color-mix(in srgb, var(--nav-bg) 30%, transparent 70%) 0%, transparent 28%),
    linear-gradient(to bottom, color-mix(in srgb, var(--gallery-bg) 20%, transparent 80%) 0%, transparent 20%);
  pointer-events: none;
}

#shop-hero-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.shop-hero-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  --hero-slide-offset: 0px;
  --hero-slide-scale: 1.04;
  opacity: 0;
  transform: translate3d(var(--hero-slide-offset), 0, 0) scale(var(--hero-slide-scale));
  clip-path: inset(0 0 0 0);
  transition:
    opacity 220ms ease,
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1),
    clip-path 520ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, clip-path, opacity;
}

.shop-hero-slide.is-active,
.shop-hero-slide.is-visible {
  opacity: 1;
}

.shop-hero-slide.is-active {
  --hero-slide-scale: 1;
  z-index: 2;
}

.shop-hero-slide.is-visible {
  z-index: 1;
}

.shop-hero-slide.is-dragging {
  transition: none;
}

.shop-hero-slide.has-link {
  cursor: pointer;
}

.shop-hero-slide.has-link:focus-visible {
  outline: 2px solid var(--btn-bg);
  outline-offset: -6px;
}

.shop-hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#shop-hero-indicators {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
}

.shop-hero-nav {
  position: absolute;
  bottom: 18px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gallery-bg) 76%, transparent 24%);
  color: var(--category-header-color);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--nav-bg) 16%, transparent 84%);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 0.22s ease, background-color 0.22s ease, color 0.22s ease, opacity 0.22s ease;
}

.shop-hero-nav:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--product-card-bg) 88%, transparent 12%);
}

.shop-hero-nav:focus-visible {
  outline: 2px solid var(--btn-bg);
  outline-offset: 3px;
}

.shop-hero-nav[hidden] {
  display: none;
}

.shop-hero-nav span {
  font-size: 1.15rem;
  line-height: 1;
}

.shop-hero-nav-prev {
  left: 18px;
}

.shop-hero-nav-next {
  right: 18px;
}

.shop-hero-indicator {
  position: relative;
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--category-header-color) 34%, transparent 66%);
  opacity: 0.88;
  overflow: hidden;
  cursor: pointer;
  transition: width 0.32s ease, background-color 0.32s ease, opacity 0.32s ease;
}

.shop-hero-indicator:hover {
  opacity: 1;
}

.shop-hero-indicator.is-active {
  width: 34px;
  background: color-mix(in srgb, var(--nav-icon) 28%, transparent 72%);
}

.shop-hero-indicator-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--btn-bg);
  transform: scaleX(0);
  transform-origin: left center;
  animation-name: hero-indicator-fill;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes hero-indicator-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

#product-list {
  padding: 0;
}

.category-section {
  position: relative;
  margin-top: 18px;
  margin-bottom: 18px;
  --category-info-accent: color-mix(in srgb, var(--nav-icon) 62%, var(--btn-bg) 38%);
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.category-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.category-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--category-header-color);
}

.category-info {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.category-info-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--category-info-accent) 56%, transparent 44%);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 28%, color-mix(in srgb, white 72%, var(--category-info-accent) 28%), transparent 58%),
    color-mix(in srgb, var(--product-card-bg) 74%, var(--category-info-accent) 26%);
  color: color-mix(in srgb, var(--category-header-color) 82%, var(--category-info-accent) 18%);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--category-info-accent) 16%, transparent 84%);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.category-info-trigger span {
  transform: translateY(-0.5px);
}

.category-info:hover .category-info-trigger,
.category-info:focus-within .category-info-trigger {
  transform: translateY(-1px) rotate(-8deg);
  box-shadow: 0 10px 18px color-mix(in srgb, var(--category-info-accent) 24%, transparent 76%);
}

.category-info-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 6;
  width: min(320px, 50vw);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--category-info-accent) 34%, transparent 66%);
  background: color-mix(in srgb, var(--product-card-bg) 94%, var(--gallery-bg) 6%);
  color: var(--category-header-color);
  box-shadow: 0 18px 42px color-mix(in srgb, var(--nav-bg) 16%, transparent 84%);
  text-transform: none;
  letter-spacing: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.category-info-tooltip::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 18px;
  width: 14px;
  height: 14px;
  border-top: 1px solid color-mix(in srgb, var(--category-info-accent) 34%, transparent 66%);
  border-left: 1px solid color-mix(in srgb, var(--category-info-accent) 34%, transparent 66%);
  background: color-mix(in srgb, var(--product-card-bg) 94%, var(--gallery-bg) 6%);
  transform: rotate(45deg);
}

.category-info-body {
  display: block;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.45;
}

.category-info:hover .category-info-tooltip,
.category-info:focus-within .category-info-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.category-info-panel {
  display: none;
}

.scroll-container {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 15px;
  padding-bottom: 10px;
}

.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: black;
  color: white;
  border: none;
  border-radius: 20%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.scroll-btn.left { left: 3px; }
.scroll-btn.right { right: 5px; }

.product-card {
  background: var(--product-card-bg);
  border-radius: 8px;
  min-width: 180px;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.product-card:hover {
  transform: translateY(-2px);
}

.product-card img {
  width: 150px;
  height: 150px;
  border-radius: 4px;
  object-fit: contain;
}

.product-name {
  font-weight: 600;
  margin-top: 8px;
  color: var(--product-name-color);
  line-height: 1.2;
  min-height: 2.4em; /* reserve two lines for compact phone-case labels */
  overflow-wrap: anywhere;
}

.product-price {
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--product-name-color) 72%, var(--category-header-color) 28%);
}

@media (min-width: 769px) {
  #shop-page {
    padding: calc(var(--shop-nav-height) + var(--shop-page-gap)) 12px 24px;
  }

  #shop-hero {
    height: calc(100svh - var(--shop-nav-height) - var(--shop-page-gap) - var(--shop-row-reserve));
    min-height: 300px;
    max-height: 720px;
    margin-bottom: 22px;
    border-radius: 32px;
    box-shadow: 0 24px 60px color-mix(in srgb, var(--category-header-color) 14%, transparent 86%);
  }

  #shop-hero::after {
    z-index: 3;
    background:
      linear-gradient(to top, color-mix(in srgb, var(--nav-bg) 34%, transparent 66%) 0%, transparent 24%),
      linear-gradient(to bottom, color-mix(in srgb, var(--gallery-bg) 16%, transparent 84%) 0%, transparent 16%);
  }

  #shop-hero-track {
    z-index: 1;
  }

  .shop-hero-slide img {
    width: 100%;
    object-position: center center;
  }

  #shop-hero-indicators {
    z-index: 4;
  }

  .shop-hero-nav {
    z-index: 4;
  }

  #product-list {
    padding: 0;
  }
}

@media (max-width: 768px) {
  :root {
    --shop-nav-height: 60px;
    --shop-page-gap: 14px;
    --shop-row-reserve: 248px;
  }

  #shop-page {
    padding: calc(var(--shop-nav-height) + var(--shop-page-gap)) 14px 24px;
  }

  #shop-hero {
    min-height: 240px;
    margin-bottom: 18px;
    border-radius: 24px;
    background: #000;
    box-shadow: 0 24px 60px color-mix(in srgb, var(--category-header-color) 14%, transparent 86%);
  }

  #shop-hero-track {
    z-index: 1;
  }

  .shop-hero-slide {
    background: #000;
  }

  .shop-hero-slide img {
    width: 100%;
    object-position: center center;
  }

  #product-list {
    padding: 0;
  }

  #shop-hero-indicators {
    bottom: 16px;
    gap: 6px;
  }

  .shop-hero-nav {
    display: none;
  }

  .category-heading {
    gap: 6px;
  }

  .category-info {
    display: inline-flex;
  }

  .category-info-trigger {
    width: 16px;
    height: 16px;
    font-size: 0.68rem;
  }

  .category-info-tooltip {
    display: none;
  }

  .category-info-panel.is-open {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--category-info-accent) 32%, transparent 68%);
    background: color-mix(in srgb, var(--product-card-bg) 94%, var(--gallery-bg) 6%);
    color: var(--category-header-color);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--category-info-accent) 10%, transparent 90%);
  }

  .category-info-panel-copy {
    flex: 1;
  }

  .category-info-panel .category-info-body {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.45;
  }

  .category-info-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: color-mix(in srgb, var(--category-info-accent) 14%, transparent 86%);
    color: var(--category-header-color);
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
  }

  .shop-hero-indicator.is-active {
    width: 28px;
  }

  .scroll-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    overflow: visible;
    padding-bottom: 0;
  }

  .product-card {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    padding: 7px;
  }

  .product-card img {
    width: 105px;   /* ~30% smaller than 150px */
    height: 105px;
  }

  .product-name {
    margin-top: 6px;
    font-size: 0.92rem;
  }

  .product-price {
    margin-top: 4px;
    font-size: 0.78rem;
  }
}
