/* ==========================================================================
   ARIA — Interactive Figure Styles

   Shared styles for D3 visualization containers, filter controls,
   and SVG elements. All sections use light backgrounds.
   Distill-style figure layout with centered captions.
   ========================================================================== */

/* ── Interactive Figure Container ──
   Plain, flat container — no glass/frosted treatment, no hover lift on
   the outer box. Hover interactions live entirely inside the D3-rendered
   SVG (node highlight, tooltips, etc.), independent of this wrapper.
   Structural role only: sizing, clipping, positioning for the SVG. */
.interactive-figure {
  min-height: 300px;
  border: 1px solid var(--apple-divider-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
  position: relative;
}

/* ── SVG Text ── */
.interactive-figure text {
  font-family: var(--font-body);
  fill: var(--apple-ink);
}

/* ── KG Filter Bar ── */
.kg-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
  padding: 12px 17px;
  background: var(--apple-parchment);
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-weight: var(--weight-semibold);
}

.filter-group select {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--apple-hairline);
  background: var(--apple-canvas);
  font-family: var(--font-body);
  font-size: var(--text-caption);
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.filter-group input[type="range"] {
  accent-color: var(--apple-primary);
}

/* ── KG Stats Row ── */
.kg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 17px;
  margin: 24px 0;
  text-align: center;
}

.stat {
  position: relative;
  background: var(--pearl-glass, rgba(255, 255, 255, 0.55));
  padding: 22px 17px;
  border-radius: 20px;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.6));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 6px 22px rgba(0, 45, 114, 0.08);
  transition: transform 320ms cubic-bezier(.16, 1, .3, 1), box-shadow 320ms ease, border-color 320ms ease;
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--apple-primary, #002D72) 50%, transparent 100%);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 380ms cubic-bezier(.16, 1, .3, 1);
  opacity: 0.7;
  pointer-events: none;
}

.stat:hover {
  transform: translateY(-4px);
  border-color: rgba(104, 172, 229, 0.30);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 16px 36px rgba(0, 45, 114, 0.14);
}

.stat:hover::after { transform: scaleX(1); }

.stat-number {
  display: block;
  font-size: var(--text-display-md);               /* 34px */
  font-weight: var(--weight-semibold);
  color: var(--apple-primary);
  line-height: 1.2;
  transition: color 240ms ease, transform 280ms cubic-bezier(.16, 1, .3, 1);
}

.stat:hover .stat-number {
  color: var(--tier-1, #002D72);
  transform: scale(1.04);
}

.stat-label {
  font-size: var(--text-caption);
  color: var(--apple-ink-muted-48);
  line-height: var(--leading-caption);
  margin-top: 4px;
  display: block;
}

/* ── Tier Activation Container ── */
.tier-activation-container {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  margin: 24px 0;
}

/* ── Figcaption (Distill-style figure caption) ── */
figcaption, .figure-caption {
  font-size: var(--text-caption);
  font-weight: var(--weight-regular);
  line-height: var(--leading-caption);
  letter-spacing: var(--tracking-caption);
  color: var(--apple-ink-muted-48);
  margin-top: 8px;
  text-align: center;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Animation ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

section.tile {
  animation: fadeInUp 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    animation: none;
    opacity: 1;
  }
  section.tile {
    animation: none;
  }
}

/* ── KG Explorer (built dynamically by kg-explorer.js) ── */
.kg-viz {
  position: relative;
  min-height: 540px;
  background: var(--apple-canvas);
}

.kg-controls {
  padding: 12px 16px;
  background: var(--apple-parchment);
  border-radius: var(--radius-sm);
  border: 1px solid var(--apple-divider-soft);
  margin-bottom: 8px;
  color: var(--apple-ink);
}

.kg-controls select {
  background: var(--apple-canvas);
  color: var(--apple-ink);
  border: 1px solid var(--apple-hairline);
}

.kg-svg {
  background: var(--apple-canvas) !important;
  border: 1px solid var(--apple-divider-soft) !important;
}

.kg-tooltip {
  background: rgba(29, 29, 31, 0.94) !important;
  color: #fff !important;
  font-family: var(--font-body);
}

.kg-legend {
  padding: 8px 12px;
  background: var(--apple-parchment);
  border-radius: var(--radius-sm);
  border: 1px solid var(--apple-divider-soft);
  color: var(--apple-ink-muted-80);
}

.kg-detail-panel {
  background: var(--apple-canvas) !important;
  color: var(--apple-ink) !important;
  border: 1px solid var(--apple-hairline) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12) !important;
}
