/* WS-41: Interests section — 4 stacked card carousels (scroll-snap + JS enhancement) */

/* ---- Interests section wrapper ---- */
.interests {
  margin: 3rem 0 4rem;
}

.interests-heading {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

/* ---- Interest group (one per topic) ---- */
.interest-group {
  margin-bottom: 2.5rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

.interest-group:last-child {
  margin-bottom: 0;
}

.interest-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.interest-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.card-counter {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.interest-subheading {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

/* ---- Card carousel ---- */
.card-carousel {
  position: relative;
}

/* ---- Card track: native scroll-snap base layer ---- */
.card-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  /* Full-bleed: break out of .container-wide's 1.5rem padding so
     88vw cards + 6vw peek work as designed (track spans the viewport) */
  margin-inline: calc(-1 * 1.5rem);
  padding: 0 6vw;
  scroll-padding-inline: 6vw;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-radius: 12px;
  touch-action: pan-y;
}

.card-track::-webkit-scrollbar {
  display: none;
}

/* Reduced motion: collapse scroll animation to instant */
@media (prefers-reduced-motion: reduce) {
  .card-track {
    scroll-behavior: auto;
  }
}

/* ---- Card ---- */
.card {
  flex: 0 0 88vw;
  scroll-snap-align: center;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  box-sizing: border-box;
}

/* Desktop: single full card, no peek */
@media (min-width: 768px) {
  .card-track {
    margin-inline: auto;
    max-width: 640px;
    padding: 0;
    scroll-padding-inline: 0;
  }
  .card {
    flex-basis: 100%;
    max-width: none;
    margin-inline: 0;
  }
}

/* Card 1 (chart card): let intrinsic height drive — no fixed aspect */
.card[data-card-type="chart"] {
  align-items: stretch;
}

/* ---- Placeholder cards ---- */
.card.placeholder {
  border: 1px dashed var(--accent);
  border-radius: 12px;
  opacity: 0.5;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card.placeholder .placeholder-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
}

/* ---- Chart card content: graph-section fills the card ---- */
.card[data-card-type="chart"] .graph-section {
  margin: 0;
  width: 100%;
  max-width: none;
}

/* Neutralize the graph-section border-top (cards are in carousel, not stacked) */
.card[data-card-type="chart"] .graph-section + .graph-section {
  border-top: none;
  padding-top: 0;
}

/* The source div at the bottom of each section stays with its card */
.card[data-card-type="chart"] .inflation-source {
  padding-bottom: 0.5rem;
}

/* ---- Dots (below the card) ---- */
.card-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.card-dot {
  display: block;
  width: 28px;
  height: 2px;
  border: none;
  border-radius: 1px;
  background: var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: width 0.25s var(--ease-out, ease), background 0.25s;
}

.card-dot[aria-current="true"] {
  width: 40px;
  background: var(--accent);
}

.card-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Arrows (pointer-capable devices only) ---- */
/* Arrows flank the carousel at mid-height (left/right sides) */
.card-arrows {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
  padding: 0 0.5rem;
  box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
  .card-arrows {
    display: flex;
  }
}

.card-arrow {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  padding: 0;
  pointer-events: auto;
}

.card-arrow:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.card-arrow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ---- Visually hidden (for aria-live region) ---- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---- Chart interactive zone marker ---- */
[data-chart-interactive] {
  touch-action: none;
}

/* ---- Narrow viewport tweaks ---- */
@media (max-width: 640px) {
  .interests {
    margin: 2rem 0 3rem;
  }
  .interests-heading {
    font-size: 1.25rem;
  }
  .interest-subheading {
    font-size: 1.1rem;
  }
  .card-arrow {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }
}