/* ---------- Reset & base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0F1B2D;
  --ink-soft: #4A5A70;
  --card-bg: rgba(255, 255, 255, 0.55);
  --card-border: rgba(255, 255, 255, 0.8);
  --shadow-color: 220, 60%, 40%;
  --font-display: 'Manrope', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Section shell ---------- */
.modules-section {
  position: relative;
  overflow: hidden;
  padding: 80px 24px 160px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F3F8FF 45%, #E9F2FF 100%);
  isolation: isolate;
}

.section-inner {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  z-index: 2;
}

/* ---------- Background: grid, waves, blobs ---------- */
.bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(70, 110, 180, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(70, 110, 180, 0.055) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 65% at 50% 30%, black 40%, transparent 90%);
}

.bg-waves {
  position: absolute;
  bottom: -40px;
  left: 0;
  width: 100%;
  height: 60%;
  opacity: 0.6;
}
.wave { fill: none; }
.wave-1 { fill: rgba(110, 140, 255, 0.10); animation: waveDrift 22s ease-in-out infinite; }
.wave-2 { fill: rgba(56, 198, 224, 0.10); animation: waveDrift 26s ease-in-out infinite reverse; }
.wave-3 { fill: rgba(143, 107, 255, 0.08); animation: waveDrift 30s ease-in-out infinite; }

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

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: blobFloat 18s ease-in-out infinite;
}
.blob-a {
  width: 420px; height: 420px;
  top: -120px; left: -100px;
  background: radial-gradient(circle at 30% 30%, #A9C1FF, transparent 70%);
  animation-duration: 20s;
}
.blob-b {
  width: 380px; height: 380px;
  top: 120px; right: -140px;
  background: radial-gradient(circle at 60% 40%, #9EE6F0, transparent 70%);
  animation-duration: 24s;
  animation-delay: -6s;
}
.blob-c {
  width: 340px; height: 340px;
  bottom: -140px; left: 40%;
  background: radial-gradient(circle at 50% 50%, #D3BFFF, transparent 70%);
  animation-duration: 26s;
  animation-delay: -12s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -24px) scale(1.06); }
}

/* ---------- Header ---------- */
.modules-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 88px;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4E6BFF;
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(78, 107, 255, 0.08);
  border: 1px solid rgba(78, 107, 255, 0.16);
  margin-bottom: 20px;
}

.headline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 4.2vw, 46px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 18px;
}

.subhead {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---------- Pyramid grid (desktop) ---------- */
.modules-viewport {
  overflow: visible;
}

.modules-track {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
}

.module-card {
  position: relative;
  width: 350px;
  flex: 0 0 350px;
  padding: 40px 34px 38px;
  border-radius: 40px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow:
    0 1px 1px rgba(255,255,255,0.6) inset,
    0 20px 40px -20px hsla(var(--shadow-color), 0.25);
  overflow: hidden;
  transition: transform 0.45s cubic-bezier(.2,.8,.2,1), box-shadow 0.45s cubic-bezier(.2,.8,.2,1);
}

.module-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0) 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.module-card:hover {
  transform: translateY(-10px);
  box-shadow:
    0 1px 1px rgba(255,255,255,0.7) inset,
    0 30px 60px -20px hsla(var(--shadow-color), 0.35),
    0 0 0 1px rgba(255,255,255,0.6),
    0 0 60px -10px var(--accent-1);
}

.card-number {
  position: absolute;
  top: 8px;
  right: 22px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 84px;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(15, 27, 45, 0.10);
  background: linear-gradient(180deg, rgba(15,27,45,0.06), rgba(15,27,45,0));
  -webkit-background-clip: text;
  background-clip: text;
  user-select: none;
  pointer-events: none;
}

.card-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 26px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-1) 18%, white), color-mix(in srgb, var(--accent-2) 18%, white));
  box-shadow: 0 8px 20px -8px var(--accent-1);
}
.card-icon svg { width: 30px; height: 30px; }

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  position: relative;
}

.card-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  position: relative;
  max-width: 32ch;
}

/* Pyramid row targeting: row1 = cards 1-3, row2 = cards 4-5, row3 = card 6.
   Achieved naturally via flex-wrap + centered justify-content since 3 cards fill a row
   at this width, and remaining cards wrap onto centered new lines. */

/* ---------- Slider controls (hidden on desktop) ---------- */
.module-slider-controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 40px;
}

.module-slider-arrow {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(15,27,45,0.10);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  box-shadow: 0 8px 20px -10px rgba(20,40,90,0.25);
}
.module-slider-arrow svg { width: 20px; height: 20px; }
.module-slider-arrow:hover { transform: translateY(-2px); background: rgba(255,255,255,0.95); }
.module-slider-arrow:active { transform: translateY(0); }
.module-slider-arrow:disabled { opacity: 0.35; cursor: default; transform: none; }

.module-slider-dots {
  display: flex;
  gap: 9px;
}
.module-slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(15,27,45,0.18);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(.2,.8,.2,1);
}
.module-slider-dot.active {
  width: 24px;
  border-radius: 5px;
  background: linear-gradient(90deg, #6E8CFF, #4E9BFF);
}

/* ---------- Tablet & mobile: slider mode ---------- */
@media (max-width: 980px) {
  .modules-section { padding: 100px 20px 120px; }
  .modules-header { margin-bottom: 56px; }

  .modules-viewport {
    overflow: hidden;
    padding-bottom: 4px;
  }

  .modules-track {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0;
    touch-action: pan-y;
    will-change: transform;
    transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
  }

  .module-card {
    flex: 0 0 100%;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }

  .module-slider-controls { display: flex; }
}

@media (max-width: 520px) {
  .module-card { padding: 34px 26px 32px; border-radius: 32px; }
  .card-number { font-size: 68px; }
  .headline { font-size: 28px; }
  .subhead { font-size: 15.5px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .wave, .blob { animation: none; }
  .module-card, .modules-track, .module-slider-arrow, .module-slider-dot { transition: none; }
}

/* ---------- Focus states ---------- */
.module-slider-arrow:focus-visible,
.module-slider-dot:focus-visible {
  outline: 2px solid #4E6BFF;
  outline-offset: 2px;
}
