/* ==========================================================================
   VITALYS — HYDRATION FOR EVERY MOMENT (LIFESTYLE SHOWCASE)
   Sections: Variables, Section, Header, Grid, Moment Cards, Image + Overlay,
   Content, Icon, Typography, Hover Effects, Animations, Responsive
   Breakpoints.
   Shares brand tokens (--font-nav, --color-accent, --color-navy,
   --color-description, --ease-out-quart, etc.) already defined in
   navbar.css / features.css; only section-specific tokens live here.
   ========================================================================== */

/* ==========================================================================
   1. VARIABLES
   ========================================================================== */
:root {
  --moments-padding-desktop: 100px;
  --moments-padding-tablet: 80px;
  --moments-padding-mobile: 60px;

  --moments-description-max-width: 640px;

  --moments-heading-desktop: 52px;
  --moments-heading-tablet: 42px;
  --moments-heading-mobile: 32px;

  --moment-card-radius: 24px;
  --moment-image-height-desktop: 440px;
  --moment-image-height-tablet: 380px;
  --moment-image-height-mobile: 320px;
}

/* ==========================================================================
   2. SECTION
   ========================================================================== */
.moments {
  background: #f7fafc;
  padding-top: var(--moments-padding-desktop);
  padding-bottom: var(--moments-padding-desktop);
  text-align: center;
}

/* ==========================================================================
   3. HEADER
   ========================================================================== */
.moments-subtitle {
  margin: 0 0 15px;
  font-family: var(--font-nav);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--color-accent);
}

.moments-heading {
  margin: 0 0 20px;
  font-family: var(--font-nav);
  font-weight: 700;
  font-size: var(--moments-heading-desktop);
  line-height: 1.15;
  color: var(--color-navy);
  text-wrap: balance;
}

.moments-description {
  margin: 0 auto 60px;
  max-width: var(--moments-description-max-width);
  font-family: var(--font-nav);
  font-size: 18px;
  line-height: 1.8;
  color: var(--color-description);
  text-wrap: pretty;
}

/* ==========================================================================
   4. GRID
   ========================================================================== */
.moments-grid > .col {
  display: flex;
}

/* ==========================================================================
   5. MOMENT CARDS
   ========================================================================== */
.moment-card {
  position: relative;
  display: block;
  width: 100%;
  height: var(--moment-image-height-desktop);
  border-radius: var(--moment-card-radius);
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 12px 32px rgba(12, 44, 81, 0.12);
  transition: transform 0.4s var(--ease-out-quart), box-shadow 0.4s var(--ease-out-quart);
}

.moment-card:hover,
.moment-card:focus-within {
  transform: translateY(-8px);
  box-shadow: 0 28px 56px rgba(12, 44, 81, 0.24);
}

/* ==========================================================================
   6. IMAGE + OVERLAY
   ========================================================================== */
.moment-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.moment-card:hover .moment-image,
.moment-card:focus-within .moment-image {
  transform: scale(1.08);
}

/* Navy scrim (brand color, not a neutral black) so every card reads as
   part of the same palette as the rest of the site, fading from solid at
   the caption up to fully transparent so the top of each photo stays
   clear. */
.moment-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(12, 44, 81, 0.92) 0%,
    rgba(12, 44, 81, 0.55) 42%,
    rgba(12, 44, 81, 0) 72%
  );
  pointer-events: none;
}

/* ==========================================================================
   7. CONTENT
   ========================================================================== */
.moment-content {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 32px 28px;
  text-align: left;
}

/* ==========================================================================
   8. ICON
   ========================================================================== */
.moment-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #ffffff;
  font-size: 22px;
  transition: transform 0.35s var(--ease-out-quart), background-color 0.35s ease;
}

.moment-card:hover .moment-icon,
.moment-card:focus-within .moment-icon {
  transform: scale(1.08);
  background: var(--color-accent-deep);
}

/* ==========================================================================
   9. TYPOGRAPHY
   ========================================================================== */
.moment-title {
  margin: 0 0 8px;
  font-family: var(--font-nav);
  font-weight: 600;
  font-size: 24px;
  color: #ffffff;
}

.moment-text {
  margin: 0;
  max-width: 320px;
  font-family: var(--font-nav);
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.88);
}

/* ==========================================================================
   10. ANIMATIONS
   ========================================================================== */
@keyframes momentFadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cards are fully visible by default. moments.js opts individual cards
   into the hidden pre-animation state (.will-animate) only after
   confirming IntersectionObserver support and no reduced-motion
   preference — so a JS failure or a headless/no-scroll render never
   ships a blank section. */
.moment-card.will-animate {
  opacity: 0;
  transform: translateY(30px);
}

.moment-card.will-animate.is-visible {
  animation: momentFadeUp 0.7s var(--ease-out-quart) both;
}

.moments-grid > .col:nth-child(1) .moment-card.is-visible {
  animation-delay: 0ms;
}

.moments-grid > .col:nth-child(2) .moment-card.is-visible {
  animation-delay: 150ms;
}

.moments-grid > .col:nth-child(3) .moment-card.is-visible {
  animation-delay: 300ms;
}

@media (prefers-reduced-motion: reduce) {
  .moment-card.will-animate,
  .moment-card.will-animate.is-visible {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .moment-card:hover,
  .moment-card:focus-within {
    transform: none;
  }

  .moment-card:hover .moment-image,
  .moment-card:focus-within .moment-image {
    transform: none;
  }
}

/* ==========================================================================
   11. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet: 768px–991px */
@media (min-width: 768px) and (max-width: 991.98px) {
  .moments {
    padding-top: var(--moments-padding-tablet);
    padding-bottom: var(--moments-padding-tablet);
  }

  .moments-heading {
    font-size: var(--moments-heading-tablet);
  }

  .moment-card {
    height: var(--moment-image-height-tablet);
  }
}

/* Mobile: below 768px */
@media (max-width: 767.98px) {
  .moments {
    padding-top: var(--moments-padding-mobile);
    padding-bottom: var(--moments-padding-mobile);
  }

  .moments-heading {
    font-size: var(--moments-heading-mobile);
  }

  .moments-description {
    margin-bottom: 40px;
  }

  .moment-card {
    height: var(--moment-image-height-mobile);
  }

  .moment-title {
    font-size: 21px;
  }
}
