/* css/slider-products.css */

/* ====================== */
/* Global custom variables */
/* ====================== */
:root{
  /* Tweak to taste */
  --detail-w: 760px;          /* detail panel max width (match grid width) */
  --detail-aspect: 4 / 3;     /* canvas look for the frame */
  --detail-max-h: 573px;      /* image area max-height inside 600px panel */
}

/* ------- Root container ------- */
#prod-scroller{
  /* Tunables */
  --scale: 1;
  --cols: 4;
  --filter: clamp;                  /* category key or 'all' */
  --speed: 10s;                     /* animation speed (JS may override) */

  /* Derived */
  --gap: calc(12px * var(--scale));
  --radius: 0px;
  --caption-h: calc(44px * var(--scale));
  --font: calc(16px * var(--scale));

  /* Theme (from site.css with sensible fallbacks) */
  --surface: #fff;
  --border: #e6e6e6;
  --border-2: #ddd;
  --text: var(--color-text, #4B4B4B);

  position: relative;
  width: min(var(--site-max-width, 1000px), 100%);
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 14px rgba(0,0,0,.06);
  background: var(--surface);
  overflow: hidden;
}

#prod-header {
  background: var(--color-nonact,#153b8e);
  color:#ffffff;
  font-size:19px;
  line-height: 32px;    /* sets vertical height and centers text */
  text-align: center;
  z-index: 2;
}

#prod-header a:hover,
#prod-header a:focus-visible{
  color:#fff;
  text-decoration:none;
  background-color: var(--color-act, #0f2e6d);
  outline: none;
}

/* ------- Track = viewport that clips scrolling content ------- */
#prod-scroller .track{
  position: relative;                         /* not absolute */
  overflow: hidden;                           /* clip children */
  height: calc(100% - var(--header-h, 0px));  /* space for header set by JS */
  z-index: 1;
}

/* ------- Moving inner wrapper (JS starts/stops animation) ------- */
#prod-scroller .loop{
  position: absolute;
  left: 0;
  right: 0;
  top: 0;                 /* no bottom -> natural content height */
  will-change: transform;
  /* animation applied via JS: hjmScrollUp var(--speed) linear infinite */
}

/* Pause on hover */
#prod-scroller:hover .loop{ animation-play-state: paused; }

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce){
  #prod-scroller .loop{ animation: none !important; }
}

/* Travel distance controlled by --loop */
@keyframes hjmScrollUp{
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, calc(var(--loop, 50%) * -1), 0); }
}

/* ------- Grid & cards ------- */
#prod-scroller .grid{
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: var(--gap);
  padding: var(--gap);
}

#prod-scroller .card{
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  display: grid;
  grid-template-rows: auto var(--caption-h);  /* image area + caption */
}

/* Keep 4:3 with no cropping */
#prod-scroller .card > img{
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  display: block;
  background: var(--surface);
}

/* smaller caption text inside cards */
#prod-scroller .card .meta{
  font-size: 0.9rem;   /* down from default ~1rem/16px */
  font-weight: 500;
  line-height: 1.3;
}

#prod-scroller .meta{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  text-align: center;
  font-size: var(--font);
  line-height: 1.2;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--surface);
}

/* ----- Detail view layout ----- */
#prod-detail{
  text-align: center;
  height: 600px;          /* fixed viewport for detail */
  overflow: auto;         /* scroll inside if content is taller */
  padding: 16px;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--detail-w);   /* match grid column width */
  margin: 0 auto;
}

#prod-detail .hero-frame{
  width: min(var(--detail-w), 100%);                 /* never exceed panel */
  aspect-ratio: var(--detail-aspect);
  max-height: min(var(--detail-max-h), calc(100vh - 220px));
  margin: 12px auto 16px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  overflow: hidden; /* no scrollbars if an image is odd-shaped */
}

#prod-detail .hero{
  display: block;
  max-width: 100%;
  max-height: var(--detail-max-h);   /* use the shared knob */
  width: auto;
  height: auto;
  object-fit: contain;               /* scale without cropping */
  margin: 0 auto 16px;
}

/* Copy tweaks */
#prod-detail .desc{
  font-size: 1.2rem;
  line-height: 1.45;
  max-width: 800px;
  margin: 0 auto;
  white-space: normal;
  word-break: break-word;
}

#prod-detail .back{
  display: inline-block;
  margin-top: 14px;
  background: var(--color-nonact, #153b8e);
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
}

#prod-header.panel-header{
  margin-top: 0;      /* in case it has a default margin */
  padding-top: 4px;   /* tighten vertical spacing */
}
