/* ========= SUPPORT SECTION — COMPLETE STYLES ========= */

/* Layout grid */
.support-section {
  --gap: clamp(2rem, 4vw, 4rem);
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 2fr;
  gap: var(--gap);
  max-width: 1100px;
  margin-inline: auto;
  padding-block: 6rem;
}

/* LEFT: sticky, always vertically centered while the section is in view */
.support-visual {
  position: sticky;
  top: 0;                 /* stick to viewport top */
  height: 100vh;          /* occupy full viewport height */
  display: grid;
  place-items: center;    /* centers the image vertically and horizontally */
  background: transparent; /* no background, only the image */
}

.support-image-layer {
  max-height: 77vh;       /* respectful sizing */
  width: auto;
  height: auto;
  border-radius: 24px;
  grid-area: 1 / 1;       /* stack both images in same grid cell */
  transition: opacity var(--xfade-ms, 300ms) ease;
  will-change: opacity;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .support-image-layer { transition: none !important; }
}

#support-image-back {
  opacity: calc(var(--back-opacity, 1) * var(--img-end, 1));
}

#support-image-front {
  opacity: calc(var(--front-opacity, 0) * var(--img-end, 1));
}

/* RIGHT: scrollable column, cards fade by distance to center band */
.support-scroll { 
  padding-right: 1rem;
  margin-top: 300px;
  margin-bottom: 300px;
}

.support-item {
  background: var(--white-coral, #fff5f5);
  border: 1px solid rgba(255, 127, 127, 0.12);
  border-radius: 24px;
  padding: 2rem;
  /* Cheaper shadows on non-active; richer only when active */
  box-shadow: 0 8px 20px rgba(255, 127, 127, 0.07);
  margin-top: 150px;
  margin-bottom: 150px;
  margin-left: 50px;

  /* Driven by JS */
  opacity: var(--card-opacity, 0.35);
  transform: scale(var(--card-scale, 0.98));
  transition: opacity .18s ease, transform .28s cubic-bezier(.4,1.6,.6,1), box-shadow .28s;
  will-change: opacity, transform;
}

.support-item[data-active="true"] {
  box-shadow: 0 18px 44px rgba(255, 127, 127, 0.14);
}

/* Skip painting far-off items when supported */
@supports (content-visibility: auto) {
  .support-item {
    content-visibility: auto;
    contain-intrinsic-size: 360px auto;
  }
}

/* 1px markers used only for IntersectionObserver on mobile */
.support-sentinel {
  position: relative;
  height: 1px;
  width: 100%;
  pointer-events: none;
  visibility: hidden;
}

/* Optional: scrollbar cosmetics for the text column */
.support-scroll::-webkit-scrollbar { width: 8px; }
.support-scroll::-webkit-scrollbar-track { background: transparent; }
.support-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,127,127,0.35);
  border-radius: 4px;
}

/* Mobile stack */
@media (max-width: 768px) {
  .support-section {
    --nav-offset: var(--support-mobile-nav-offset, 5.25rem);
    --mobile-gap: 1rem;
    --text-height: clamp(180px, 30vh, 250px);
    --mobile-image-height: calc(100vh - var(--nav-offset) - var(--text-height) - var(--mobile-gap) * 2);
    --text-offset: calc(var(--nav-offset) + var(--mobile-image-height) + var(--mobile-gap));
    grid-template-columns: 1fr;
    grid-template-rows: var(--mobile-image-height) 1fr;
    padding: var(--nav-offset) 1.5rem 4rem;
    gap: var(--mobile-gap);
    min-height: 100vh;
  }

  .support-visual {
    position: sticky;
    top: var(--nav-offset);
    height: var(--mobile-image-height);
    display: grid;
    place-items: center;
    margin: 0 auto;
    width: 100%;
    max-width: min(400px, 90vw);
    z-index: 10;
  }

  .support-image-layer {
    grid-area: 1 / 1; /* Stack both images in same cell */
    width: 100%;
    height: 100%;
    max-height: var(--mobile-image-height);
    object-fit: contain;
    border-radius: 20px;
  }

  .support-scroll {
    display: block;
    position: relative;
    margin: 0;
    padding: 0;
    /* Dynamic min-height based on actual card count (set by JS) */
    min-height: calc(var(--text-height) * var(--card-count, 9) * 1.5);
  }

  .support-item {
    margin: 0;
    padding: clamp(1rem, 3vh, 1.25rem);
    border-radius: 20px;
    /* All cards stack at the same position */
    position: sticky;
    top: var(--text-offset);
    height: var(--text-height);
    max-height: var(--text-height);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Hidden by default - only visible when active */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: opacity .3s ease, transform .5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
  }

  .support-item[data-active="true"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    z-index: 5;
  }

  /* Single-pass scaling controlled by JS */
  .support-item h3 {
    font-size: calc(1.10rem * var(--text-scale, 1));
    line-height: 1.3;
    margin: 0;
    flex-shrink: 0;
  }

  .support-item p {
    font-size: calc(0.85rem * var(--text-scale, 1));
    line-height: 1.45;
    margin: 0;
    flex: 1;
    overflow-y: auto;
  }
}
