/* Products section on the home page. Scoped to #products.opx-products; loaded only by templates/index.html. */

#products.opx-products {
  --opx-maroon: #9d2f2f;
  --opx-maroon-dark: #802626;
  --opx-ink: #1b232b;
  --opx-body: #5b6570;
  --opx-line: #e3ddd7;
  --opx-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

#products.opx-products .opx-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 6px 15px 0;
}

#products.opx-products .opx-card {
  position: relative;
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--opx-line);
  border-radius: 12px;
  background: #fff;
  transition: transform 0.35s var(--opx-ease), box-shadow 0.35s ease, border-color 0.35s ease;
}

#products.opx-products .opx-card:hover,
#products.opx-products .opx-card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(157, 47, 47, 0.35);
  box-shadow: 0 22px 40px -28px rgba(27, 35, 43, 0.5);
}

/* The whole card is one link. */
#products.opx-products .opx-card > .opx-inner {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  padding: 34px 32px 32px;
  color: inherit !important;
  text-decoration: none !important;
  outline: none;
}

#products.opx-products .opx-cta:focus-visible {
  outline: 3px solid var(--opx-maroon, #9d2f2f);
  outline-offset: 3px;
}

/* Logo stands on the card itself, at full size, with no panel behind it. */
/* The logo files carry a lot of empty margin, so the box crops to the artwork. */
#products.opx-products .opx-logo {
  display: block;
  margin-bottom: 28px;
  overflow: hidden;
}

#products.opx-products .opx-logo img {
  display: block;
  width: 100%;
  max-width: 340px;
  height: 84px;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s var(--opx-ease);
}

#products.opx-products .opx-card:hover .opx-logo img { transform: translateY(-2px) scale(1.02); }

/* Text column fills the card so every Read More lines up at the bottom. */
#products.opx-products .opx-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

#products.opx-products .opx-card h4 {
  margin: 0 0 12px !important;
  color: var(--opx-ink) !important;
  font-size: 28px !important;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-transform: none;
  transition: color 0.3s ease;
}

#products.opx-products .opx-card:hover h4 { color: var(--opx-maroon) !important; }

#products.opx-products .opx-card p {
  flex: 1 1 auto;
  margin: 0 0 28px !important;
  color: var(--opx-body) !important;
  font-size: 15.5px !important;
  line-height: 1.7;
  text-align: left;
}

/* Read More: quiet outlined link so the logo and product name lead the card.
   It fills in only on hover, matching the other sections. */
#products.opx-products .opx-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  min-height: 40px;
  margin-top: auto !important;
  padding: 9px 18px;
  border: 1px solid rgba(157, 47, 47, 0.35);
  border-radius: 999px;
  background: transparent;
  color: var(--opx-maroon) !important;
  font-size: 13px !important;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

#products.opx-products .opx-cta i {
  font-size: 12px;
  transition: transform 0.3s var(--opx-ease);
}

#products.opx-products .opx-card:hover .opx-cta,
#products.opx-products .opx-card:focus-within .opx-cta {
  background: var(--opx-maroon);
  border-color: var(--opx-maroon);
  color: #fff !important;
  box-shadow: 0 12px 22px -14px rgba(157, 47, 47, 0.95);
}

#products.opx-products .opx-card:hover .opx-cta i { transform: translateX(4px); }
/* Reveal on scroll (only when the page's script adds the class). */
#products.opx-products.opx-ready .opx-card {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--opx-ease), transform 0.7s var(--opx-ease), box-shadow 0.35s ease, border-color 0.35s ease;
  transition-delay: calc(var(--i, 0) * 110ms);
}

#products.opx-products.opx-ready .opx-card.is-in { opacity: 1; transform: none; }

@media (max-width: 991px) {
  #products.opx-products .opx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  #products.opx-products .opx-card > .opx-inner { padding: 28px 26px 26px; }
  #products.opx-products .opx-card h4 { font-size: 24px !important; }
}

@media (max-width: 640px) {
  #products.opx-products .opx-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #products.opx-products .opx-logo { margin-bottom: 20px; }
  #products.opx-products .opx-logo img { height: 54px; }
  #products.opx-products .opx-card h4 { font-size: 22px !important; }
  #products.opx-products .opx-card p { margin-bottom: 22px !important; }
}

@media (prefers-reduced-motion: reduce) {
  #products.opx-products *,
  #products.opx-products *::before {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  #products.opx-products.opx-ready .opx-card { opacity: 1; transform: none; }
}

/* ---------- Phones: swipeable card rail ----------
   Stacking every card makes the page very long, so on small screens the grid
   becomes a horizontal rail: swipe, each card snaps, and the next one peeks.
   Native scrolling only - no JavaScript, and all cards stay in the markup. */
@media (max-width: 640px) {
  #products.opx-products .opx-grid {
    display: flex;
    grid-template-columns: none;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 16px;
    padding: 4px 16px 10px;
    margin: 0 -15px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  #products.opx-products .opx-grid::-webkit-scrollbar { display: none; }

  #products.opx-products .opx-card {
    flex: 0 0 78%;
    scroll-snap-align: start;
  }
}
/* The card body is not clickable - only this button navigates. */
#products.opx-products .opx-cta { text-decoration: none !important; cursor: pointer; }
#products.opx-products .opx-card { cursor: default; }
