/* ================================================================
   PRODUCTS SECTION — dark flagship showcase
   Inherits the old iFourLabs atmosphere (purple 60px grid, blob glows,
   canvas particles) on a deep purple→dark gradient. Panels are glass
   surfaces with 1px gradient borders; logos sit on a light radial glow
   plate so dark wordmarks stay legible on the dark section.

   Tokens only (tokens.css); alpha colors reuse the exact rgba(163,82,166,x)
   purple / rgba(5,125,235,x) blue conventions already used by main.css.
   The .bg-grid-dark pattern and blobFloat1/2 keyframes come from main.css.
   ================================================================ */

#products {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface-purple-deep) 0%, var(--surface-darker) 100%);
  padding: 130px 0;
}

/* ── Decorative layers (particles canvas is injected as first child
      by particles.js at z-index:1) ─────────────────────────────────*/
.products-grid-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* brighten the main.css purple grid slightly for the dark surface */
  background-image:
    linear-gradient(rgba(163, 82, 166, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(163, 82, 166, 0.12) 1px, transparent 1px);
  background-size: 60px 60px;
}

.products-blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(163, 82, 166, 0.35) 0%, transparent 70%);
  top: -120px;
  left: -120px;
  animation: blobFloat1 10s ease-in-out infinite;
}

.products-blob-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(5, 125, 235, 0.18) 0%, transparent 70%);
  bottom: -80px;
  right: -60px;
  animation: blobFloat2 12s ease-in-out infinite;
}

.products-inner {
  position: relative;
  z-index: 2;
}

/* ── Header — dark-surface overrides of the shared type utilities ──*/
#products .eyebrow {
  color: var(--primary-200);
}

#products .h2 {
  color: var(--surface-white);
}

.products-subheading {
  color: rgba(255, 255, 255, 0.65);
  max-width: 700px;
}

/* ── Alternating feature panels ────────────────────────────────────*/
.products-flow {
  display: grid;
  gap: var(--space-7);
  margin-top: var(--space-10);
}

.product-panel {
  position: relative;
  display: grid;
  grid-template-columns: 5fr 6fr;
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  padding: clamp(32px, 4.5vw, 56px);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-2xl);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.4s var(--ease-out-quart);
}

/* 1px gradient border (mask-composite ring — paints only the border) */
.product-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(163, 82, 166, 0.45) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(5, 125, 235, 0.30) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.product-panel:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Alternation — even panels flip logo/content sides */
.product-panel--flip {
  grid-template-columns: 6fr 5fr;
}

.product-panel--flip .product-panel-visual {
  order: 2;
}

.product-panel--flip .product-panel-content {
  order: 1;
}

/* ── Visual side: logo on a light radial glow plate ────────────────*/
.product-panel-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-logo-plate {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 360px);
  min-height: 200px;
  padding: 40px 36px;
  border-radius: var(--radius-xl);
  /* light plate: guarantees contrast for dark wordmarks (iFourLabs #1d252d) */
  background: radial-gradient(
    ellipse at 50% 35%,
    var(--surface-white) 0%,
    var(--neutral-50) 55%,
    var(--neutral-100) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 80px rgba(163, 82, 166, 0.28),
    0 24px 60px rgba(0, 0, 0, 0.35);
  animation: productFloat 7s ease-in-out infinite;
  will-change: transform;
}

.product-logo-plate img {
  height: 56px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

/* logo_dark variant — light/white logo rendered directly on the dark
   surface, no light plate needed */
.product-logo-plate--dark {
  background: rgba(255, 255, 255, 0.03);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 80px rgba(163, 82, 166, 0.22);
}

/* No-logo fallback: elegant wordmark on the plate */
.product-logo-wordmark {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--smoky-800);
}

.product-logo-plate--dark .product-logo-wordmark {
  color: var(--surface-white);
}

@keyframes productFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* ── Content side ──────────────────────────────────────────────────*/
.product-name {
  font-family: var(--font-heading);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--surface-white);
  margin: 0 0 16px;
}

.product-desc {
  font-size: 16px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.68);
  margin: 0 0 24px;
}

/* Highlight chips — mono labels, matching the site's eyebrow voice */
.product-highlights {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0 0 28px;
}

.product-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-200);
  padding: 7px 14px;
  border: 1px solid rgba(163, 82, 166, 0.35);
  border-radius: var(--radius-full);
  background: rgba(163, 82, 166, 0.10);
  white-space: nowrap;
}

/* CTA — bright link with the site's arrow-slide hover */
.product-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-200);
  text-decoration: none;
  padding: 12px 24px;
  border: 1px solid rgba(163, 82, 166, 0.4);
  border-radius: var(--radius-full);
  background: rgba(163, 82, 166, 0.12);
  transition: all 0.3s var(--ease-out-quart);
}

.product-cta:hover {
  color: var(--surface-white);
  background: var(--primary-500);
  border-color: var(--primary-500);
  box-shadow: var(--shadow-purple);
  transform: translateY(-2px);
}

.product-cta-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.3s;
}

.product-cta:hover .product-cta-icon {
  transform: translateX(3px);
}

/* ── Responsive — matches the theme's 1100/900/640 ladder ──────────*/
@media (max-width: 1100px) {
  .product-panel,
  .product-panel--flip {
    gap: 40px;
  }
}

@media (max-width: 900px) {
  .product-panel,
  .product-panel--flip {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  /* stacked: visual always on top, content below */
  .product-panel--flip .product-panel-visual { order: 1; }
  .product-panel--flip .product-panel-content { order: 2; }
  .product-logo-plate {
    min-height: 160px;
    width: min(100%, 320px);
    margin: 0 auto;
  }
  .product-panel-content {
    text-align: center;
  }
  .product-highlights {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  #products {
    padding: 88px 0;
  }
  .product-panel {
    padding: 28px 22px;
  }
  .product-logo-plate {
    min-height: 140px;
    padding: 32px 24px;
  }
  .product-logo-plate img {
    height: 44px;
  }
}

/* ── Reduced motion — kill the float/blob drift explicitly ─────────*/
@media (prefers-reduced-motion: reduce) {
  .product-logo-plate,
  .products-blob-1,
  .products-blob-2 {
    animation: none !important;
  }
}
