/* =============================================================
   At a Glance — Module 31
   Prefix: .aag-
   ============================================================= */

/* ── Section wrapper — padding follows design system ────────── */
.aag-section {
  width: 100%;
  box-sizing: border-box;
}

.aag-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 112px 96px;
  box-sizing: border-box;
}

/* ── Heading ────────────────────────────────────────────────── */
.aag-heading {
  font-family: var(--ads-font, 'Nunito Sans', sans-serif);
  font-size: 32px;
  font-weight: 700;
  color: #000;
  margin: 0 0 48px;
  line-height: 1.2;
}

/* ── Pager container ────────────────────────────────────────── */
.aag-pager {
  position: relative;
  overflow: hidden;
}

/* ── Track (flex row of items) ──────────────────────────────── */
.aag-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  align-items: stretch; /* equal height rows so rules all align */
}

/* When pager is active, track becomes a flex slider */
.aag-pager[data-pager-active] .aag-track {
  display: flex;
  gap: 0;
  transition: transform 360ms cubic-bezier(0.2, 0.9, 0.2, 1);
  will-change: transform;
}

.aag-pager[data-pager-active] .aag-track[data-no-transition] {
  transition: none;
}

/* Each item in pager mode becomes fixed-width */
.aag-pager[data-pager-active] .aag-item {
  flex: 0 0 25%; /* 4 per view desktop */
  box-sizing: border-box;
  padding-right: 32px;
}

/* ── Individual stat item ───────────────────────────────────── */
.aag-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.aag-item--link {
  cursor: pointer;
}

.aag-item--link:hover .aag-stat__number {
  color: var(--ds-strong-red, #C1000F);
  transition: color 200ms ease;
}

/* ── Big number ─────────────────────────────────────────────── */
.aag-stat {
  display: block;
}

.aag-stat__number {
  display: block;
  font-family: var(--ads-font, 'Nunito Sans', sans-serif);
  font-size: 32px;
  font-style: normal;
  font-weight: 600;
  line-height: 40px;
  letter-spacing: -0.02em;
  color: #000;
}

/* ── Label + rule ───────────────────────────────────────────── */
/* Label wrap grows to fill available space so the rule always
   sits at the same baseline across all columns regardless of
   how many lines the label wraps to.                           */
.aag-item {
  /* Override: make item a column with the rule pinned at bottom */
  justify-content: flex-start;
}

.aag-label-wrap {
  display: flex;
  flex-direction: column;
  flex: 1; /* stretch to fill item height */
  gap: 0;

  /* Hidden until count-up finishes */
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 400ms ease 100ms, transform 400ms ease 100ms;
}

.aag-label-wrap.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.aag-label {
  font-family: var(--ads-font, 'Nunito Sans', sans-serif);
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 28px;
  letter-spacing: -0.01em;
  color: #000;
  margin: 0 0 12px;
  /* Constrain width so short labels don't run edge-to-edge */
  max-width: 200px;
}

/* Rule pushed to bottom of label-wrap so all rules align */
.aag-rule {
  display: block;
  width: 170px;
  height: 1px;
  background: #000;
  flex-shrink: 0;
  margin-top: auto; /* pushes rule to bottom of the flex column */
}

.aag-note {
  font-family: var(--ads-font, 'Nunito Sans', sans-serif);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: -0.01em;
  color: rgba(0, 0, 0, 0.6);
  margin: 8px 0 0;
}

/* ── Dots pagination ────────────────────────────────────────── */
.aag-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  min-height: 20px;
}

.aag-dots:empty {
  display: none;
}

.aag-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1.5px solid #B0BFC2;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
  flex-shrink: 0;
}

.aag-dot[aria-current="true"] {
  background: #B0BFC2;
  border-color: #B0BFC2;
  transform: scale(1.3);
}

.aag-dot:hover {
  border-color: #000;
}

.aag-dot:focus-visible {
  outline: 2px solid rgba(193, 0, 15, 0.35);
  outline-offset: 3px;
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .aag-label-wrap {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .aag-pager[data-pager-active] .aag-track {
    transition: none;
  }
  .aag-dot {
    transition: none;
  }
}

/* ── Tablet — vertical list, no pager ──────────────────────── */
@media (max-width: 1024px) {
  .aag-inner {
    padding: 0 64px 72px;
  }

  /* Force single-column regardless of pager state */
  .aag-track,
  .aag-pager[data-pager-active] .aag-track {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    transform: none !important;
    transition: none !important;
    height: auto !important;
  }

  /* Each item: full width, padding top/bottom, no flex stretch */
  .aag-item,
  .aag-pager[data-pager-active] .aag-item {
    flex: 1 1 auto !important;
    width: 100% !important;
    padding: 24px 0 !important;
    gap: 8px;
  }

  /* Label wrap: natural height, no stretch */
  .aag-label-wrap {
    flex: 0 0 auto;
  }

  /* Rule: full width, tight under label */
  .aag-rule {
    width: 100%;
    margin-top: 16px;
    background: rgba(0, 0, 0, 0.15);
  }

  /* Label: no width cap on tablet — more room */
  .aag-label {
    max-width: none;
  }

  /* Hide dots — no pager on tablet */
  .aag-dots {
    display: none !important;
  }
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .aag-inner {
    padding: 0 24px 48px;
  }

  .aag-heading {
    font-size: 24px;
    margin-bottom: 24px;
  }

  .aag-stat__number {
    font-size: 28px;
    line-height: 34px;
  }

  /* Label: no width cap on mobile */
  .aag-label {
    max-width: none;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: -0.01em;
  }
}
