/* ==========================================================================
   ARIA — Components

   Callout boxes, tier cards, badges, trace audit, key findings,
   toggle buttons, and experiment results tables.
   All on white/parchment backgrounds — no dark variants.
   Distill-inspired academic styling with Apple design tokens.
   ========================================================================== */

/* ── Callout Boxes ── */
/* Morandi-JHU frosted callouts: full glass border, no top accent bar. */
.callout {
  position: relative;
  border-radius: 20px;
  padding: 28px;
  margin: 32px 0;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.6));
  font-size: var(--text-body);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 24px rgba(0, 45, 114, 0.06);
}

.callout p {
  margin: 0.4em 0 0;
}

.callout-label {
  font-weight: var(--weight-semibold);
  font-size: var(--text-caption-strong);
  line-height: var(--leading-caption-strong);
  letter-spacing: var(--tracking-caption);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* Insight — Heritage Blue accent */
.callout.insight {
  background: rgba(0, 45, 114, 0.05);
}

.callout.insight .callout-label {
  color: var(--apple-primary);
}

/* Definition — Heritage Blue lighter */
.callout.definition {
  background: rgba(0, 45, 114, 0.03);
}

.callout.definition .callout-label {
  color: var(--tier-1);
}

/* Success — Apple green */
.callout.success {
  background: var(--aria-success-bg);
}

.callout.success .callout-label {
  color: var(--aria-success);
}

/* Warning — Apple red */
.callout.warning {
  background: var(--aria-danger-bg);
}

.callout.warning .callout-label {
  color: var(--aria-danger);
}

/* ── Tier Overview Cards ── */
.tier-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin: 32px 0;
}

.tier-card {
  position: relative;
  border-radius: 20px;
  padding: 28px;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.6));
  background: var(--pearl-glass, rgba(255, 255, 255, 0.55));
  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 8px 28px 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;
}

/* Tier-colored bottom-bar reveal on hover. The bar starts at 0
   width and grows to 100% on hover — a refined Morandi blue/gold
   accent that signals which tier the card represents without
   fighting the rest of the design. */
.tier-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--tier-1, #002D72) 30%,
    var(--tier-2, #A99400) 70%,
    transparent 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 420ms cubic-bezier(.16, 1, .3, 1);
  opacity: 0.55;
  pointer-events: none;
}

.tier-card:hover {
  transform: translateY(-4px);
  border-color: rgba(104, 172, 229, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 18px 44px rgba(0, 45, 114, 0.14),
    0 0 0 1px rgba(104, 172, 229, 0.06);
}

.tier-card:hover::after { transform: scaleX(1); }

.tier-card:active {
  transform: scale(0.985) translateY(-1px);
}

.tier-card h3 {
  margin: 0.3em 0;
  font-size: var(--text-body-strong);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-body-strong);
  color: var(--apple-ink);
}

.tier-card p {
  margin: 0.4em 0;
  font-size: var(--text-caption);
  color: var(--apple-ink-muted-80);
  line-height: var(--leading-caption);
}

.tier-confidence {
  font-size: var(--text-caption);
  margin-top: 12px;
  color: var(--apple-ink-muted-48);
}

/* ── Tier Badge (small) ── */
.tier-badge {
  display: inline-block;
  color: var(--apple-on-primary);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  padding: 2px 10px;
  border-radius: var(--radius-xs);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Tier Badge (large — deep dive) ── */
.tier-badge-large {
  display: inline-block;
  color: var(--apple-on-primary);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── Tier Detail Sections ──
   Quiet frosted glass container — full rounded border, no top accent bar.
   The *examples* inside still pop as opaque cards. */
.tier-detail {
  margin: 48px 0;
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.6));
  background: var(--pearl-glass, rgba(255, 255, 255, 0.45));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 28px rgba(0, 45, 114, 0.06);
}

.tier-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
  flex-wrap: wrap;
}

/* ── Tier Example (sub-block) ──
   Each Example 1/2/3 no longer carries its own full-block frosted
   glass panel (it already sits inside a .detail-toggle glass card,
   so a second layer of blur was redundant and visually heavy). It
   keeps only a light surface tint, a corner badge "EXAMPLE 01/02/03",
   and the SAME calm hover-lift recipe used elsewhere on the site
   (translateY + border/shadow highlight, no bounce) so the
   interaction feels unified across the page. */
.tier-example {
  position: relative;
  margin: 28px 0;
  padding: 28px 26px 24px;
  border-radius: var(--radius-lg, 18px);
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid var(--apple-divider-soft, rgba(0, 45, 114, 0.08));
  transition:
    transform 280ms cubic-bezier(.16, 1, .3, 1),
    box-shadow 280ms ease,
    border-color 280ms ease;
}

.tier-example:hover {
  transform: translateY(-3px);
  border-color: rgba(104, 172, 229, 0.30);
  box-shadow: 0 12px 32px rgba(0, 45, 114, 0.10);
}

/* "EXAMPLE 0X" corner badge — gives each block its own identity */
.tier-example::after {
  content: "EXAMPLE " counter(aria-example, decimal-leading-zero);
  position: absolute;
  top: -10px;
  left: 22px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--apple-primary);
  color: var(--apple-on-primary);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.10em;
  box-shadow: 0 2px 8px rgba(0, 45, 114, 0.22);
}

.tier-1-detail .tier-example::after { background: var(--tier-1); }
.tier-2-detail .tier-example::after { background: var(--tier-2); }
.tier-3-detail .tier-example::after { background: var(--tier-3); }

/* Counter for "EXAMPLE 01/02/03" badges. Reset ONCE at the top-level
   #tier-deep-dive container so the three examples number globally
   (01 → 02 → 03) rather than each tier restarting at 01. */
#tier-deep-dive { counter-reset: aria-example; }
.tier-example { counter-increment: aria-example; }

.tier-example h4 {
  margin: 4px 0 16px;
  font-size: var(--text-body-strong);
  font-weight: var(--weight-semibold);
  color: var(--apple-ink);
  line-height: var(--leading-body-strong);
  letter-spacing: var(--tracking-body);
}

/* Constraint checks, analogical transfer, confidence comparison —
   all live as inner blocks within .tier-example. They get a calmer
   surface treatment so the eye doesn't get exhausted by 4 layers of
   blur in a row, but they still respond to hover. */
.constraint-checks,
.analogical-transfer,
.confidence-comparison {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--apple-divider-soft);
  border-radius: var(--radius-md, 11px);
  padding: 16px 18px;
  transition:
    border-color 240ms ease,
    box-shadow 240ms ease,
    transform 240ms cubic-bezier(.16, 1, .3, 1);
}

/* .uncertainty-flag shares this family's radius/motion recipe but keeps
   its own danger-tinted surface (color rules untouched — see below) */
.uncertainty-flag {
  border-radius: var(--radius-md, 11px);
}

.analogical-transfer:hover,
.confidence-comparison:hover {
  border-color: rgba(104, 172, 229, 0.30);
  box-shadow: 0 6px 20px rgba(0, 45, 114, 0.08);
  transform: translateY(-2px);
}

/* ── Causal Trace Visualization ── */
.tier-trace {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 17px 0;
  flex-wrap: nowrap;
  justify-content: center;
}

.trace-node {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
  flex: 1 1 0;
  min-width: 0;
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  cursor: default;
  transition:
    transform 240ms cubic-bezier(.16, 1, .3, 1),
    box-shadow 240ms ease;
}

.trace-node:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 24px rgba(0, 45, 114, 0.18);
  z-index: 1;
}

.trace-label {
  font-weight: var(--weight-semibold);
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trace-content {
  font-weight: var(--weight-semibold);
  margin: 2px 0;
}

.trace-confidence {
  font-size: var(--text-caption);
  color: var(--apple-ink-muted-48);
}

.trace-arrow {
  flex: 0 0 auto;
  color: var(--apple-ink-muted-48);
  font-weight: var(--weight-semibold);
  font-size: var(--text-caption);
  white-space: nowrap;
}

.trace-mechanism {
  font-size: var(--text-caption);
  background: rgba(255, 255, 255, 0.85);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  line-height: var(--leading-body);
  border: 1px solid var(--apple-divider-soft);
  cursor: default;
  transition: border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.trace-mechanism:hover {
  border-color: rgba(104, 172, 229, 0.30);
  transform: translateX(3px);
  box-shadow: 0 6px 18px rgba(0, 45, 114, 0.08);
}

/* ── Constraint Checks ── */
.constraint-checks {
  margin: 17px 0;
}

.constraint-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  border-radius: var(--radius-sm, 8px);
  cursor: default;
  transition: background 200ms ease, transform 200ms cubic-bezier(.16, 1, .3, 1);
}

.constraint-check:hover {
  background: rgba(104, 172, 229, 0.06);
  transform: translateX(3px);
}

.constraint-check.passed .check-icon {
  color: var(--aria-success);
  font-weight: var(--weight-semibold);
}

/* ── Analogical Transfer ── */
.analogical-transfer {
  display: flex;
  align-items: center;
  gap: 17px;
  margin: 17px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.transfer-source,
.transfer-target {
  padding: 12px 17px;
  border-radius: var(--radius-sm);
  text-align: center;
  min-width: 150px;
  cursor: default;
  transition: transform 240ms cubic-bezier(.16, 1, .3, 1), box-shadow 240ms ease;
}

.analogical-transfer:hover .transfer-source,
.analogical-transfer:hover .transfer-target {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 45, 114, 0.12);
}

.analogical-transfer:hover .transfer-source { transform: translateX(-4px); }
.analogical-transfer:hover .transfer-target { transform: translateX(4px); }

.transfer-source {
  background: rgba(0, 45, 114, 0.05);
}

.transfer-target {
  background: var(--aria-success-bg);
}

.transfer-label {
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--apple-ink-muted-48);
}

.transfer-content {
  font-weight: var(--weight-semibold);
  margin-top: 2px;
}

.transfer-arrow {
  font-weight: var(--weight-semibold);
  color: var(--aria-warning);
}

.disclaimer {
  font-size: var(--text-caption);
  background: var(--aria-warning-bg);
  padding: 10px 17px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  border: 1px solid transparent;
  cursor: default;
  transition: border-color 220ms ease, transform 220ms ease;
}

.disclaimer:hover {
  border-color: var(--aria-warning);
  transform: translateX(3px);
}

/* ── Uncertainty Flag ── */
.uncertainty-flag {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--aria-danger-bg);
  padding: 16px 18px;
  border: 1px solid rgba(184, 80, 74, 0.22);
  margin: 17px 0;
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  cursor: default;
  transition:
    border-color 240ms ease,
    box-shadow 240ms ease,
    transform 240ms cubic-bezier(.16, 1, .3, 1);
}

.uncertainty-flag:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 45, 114, 0.10);
}

.flag-icon {
  display: flex;
  flex: 0 0 auto;
  color: var(--aria-danger);
  transition: transform 320ms cubic-bezier(.16, 1, .3, 1);
}

.uncertainty-flag:hover .flag-icon {
  transform: rotate(-8deg) scale(1.15);
}

/* ── Confidence Comparison Bars ── */
.confidence-comparison {
  margin: 17px 0;
}

.comparison-bar {
  margin: 8px 0;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 8px);
  cursor: default;
  transition: background 220ms ease, transform 220ms cubic-bezier(.16, 1, .3, 1);
}

.comparison-bar:hover {
  background: rgba(104, 172, 229, 0.06);
  transform: translateX(3px);
}

.comparison-label {
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  display: block;
  margin-bottom: 4px;
}

/* Tinted fill + left accent border rather than a solid saturated block
   with reversed white text — reads as "progress" without the harsh
   billboard-color-block look. Default (unthemed) case keeps a soft
   blue tint; .aria-fill / .naive-fill override background/border/color
   below to carry the pass/fail semantics. */
.comparison-fill {
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  padding-left: 12px;
  font-weight: var(--weight-semibold);
  font-size: var(--text-caption);
  color: var(--apple-primary);
  transition: width 0.5s ease, transform 220ms ease, box-shadow 220ms ease, background 220ms ease;
  background: rgba(0, 45, 114, 0.08);
  border-left: 3px solid var(--apple-primary);
  box-shadow: none;
}

.comparison-bar:hover .comparison-fill {
  transform: translateX(4px);
  box-shadow: 0 4px 14px rgba(0, 45, 114, 0.10);
}

/* ── Trace Audit Demo ── */
.trace-audit-demo {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.6));
  border-radius: 20px;
  padding: 24px;
  margin: 24px 0;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 10px 32px rgba(0, 45, 114, 0.08);
}

.trace-query {
  background: linear-gradient(135deg, var(--tier-1, #002D72) 0%, var(--apple-primary-focus, #1a3d8f) 100%);
  color: var(--apple-on-primary);
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: var(--weight-semibold);
  box-shadow: 0 4px 14px rgba(0, 45, 114, 0.18);
}

.trace-query-label {
  font-size: var(--text-caption);
  opacity: 0.8;
}

.trace-query-text {
  font-style: italic;
  margin-top: 4px;
}

.trace-steps {
  padding: 17px 0;
}

/* Each individual step in the trace gets its own glass treatment
   so the user can focus on one step at a time. */
.trace-step {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  opacity: 1;
  transition: transform 280ms cubic-bezier(.16, 1, .3, 1), box-shadow 280ms ease;
  padding: 4px;
  border-radius: 16px;
}

.trace-step:hover {
  transform: translateX(2px);
}

.trace-step-marker {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-full);
  background: var(--apple-primary);
  color: var(--apple-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-semibold);
  font-size: var(--text-caption);
  box-shadow: 0 2px 8px rgba(0, 45, 114, 0.22);
}

.tier-1-marker {
  background: var(--tier-1);
}

.result-marker {
  background: var(--aria-success);
}

.trace-step-content {
  flex: 1;
  background: rgba(255, 255, 255, 0.7);
  padding: 14px 17px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: border-color 240ms ease, box-shadow 240ms ease, transform 240ms ease;
}

.trace-step:hover .trace-step-content {
  border-color: rgba(104, 172, 229, 0.30);
  box-shadow: 0 6px 20px rgba(0, 45, 114, 0.08);
  transform: translateY(-1px);
}

.trace-step-content h4 {
  margin: 0 0 4px;
  font-size: var(--text-body-strong);
  font-weight: var(--weight-semibold);
}

/* Evidence items */
.trace-evidence {
  background: var(--apple-parchment);
  padding: 12px 17px;
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  margin-top: 8px;
}

.evidence-item {
  margin: 8px 0;
}

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

.evidence-doi {
  font-size: var(--text-caption);
  color: var(--apple-primary);
}

/* Trace result — a soft success-tinted glass card instead of a left rule */
.trace-result .trace-step-content {
  background: var(--aria-success-bg);
  border-color: rgba(42, 138, 110, 0.28);
}

.result-meta {
  display: flex;
  gap: 17px;
  margin-top: 8px;
  font-size: var(--text-caption);
  flex-wrap: wrap;
}

.result-confidence {
  font-weight: var(--weight-semibold);
}

.result-tier {
  background: var(--tier-1);
  color: var(--apple-on-primary);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: var(--text-caption);
}

.result-sources {
  color: var(--apple-ink-muted-48);
}

/* ── Key Findings ──
   REMOVED: Hard-coded stats. Data comes from interactive visualizations.
   See .results-toggle for the paper reference toggle. */

/* Outbound link from a body section to the matching paper figure
   (which lives at the bottom of the page, before References). Low
   emphasis, single-line, with a small Fig-N badge. */
.paper-fig-link {
  margin-top: var(--sp-lg);
  font-size: var(--text-caption, 15px);
  text-align: right;
}

.paper-fig-link a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--apple-ink-muted-80, #333);
  text-decoration: none;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-pill, 9999px);
  background: var(--apple-surface-pearl, #fafafc);
  border: 1px solid var(--apple-hairline, #e0e0e0);
  transition: color 200ms ease, border-color 200ms ease, background-color 200ms ease;
}

.paper-fig-link a:hover,
.paper-fig-link a:focus-visible {
  color: var(--apple-primary, #002D72);
  border-color: var(--mint, #68ACE5);
  background: var(--mint-soft, rgba(104, 172, 229, 0.10));
  text-decoration: none;
}

.paper-fig-link__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: var(--weight-semibold, 600);
  letter-spacing: 0.02em;
  color: var(--apple-on-primary, #fff);
  background: var(--apple-primary, #002D72);
  border-radius: var(--radius-pill, 9999px);
}

.toggle-btn {
  padding: 5px 14px;
  border: 2px solid var(--apple-hairline);
  border-radius: var(--radius-pill);
  background: var(--apple-canvas);
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--apple-ink-muted-80);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn:hover {
  border-color: var(--spirit-blue, #68ACE5);
  color: var(--tier-1, #002D72);
  background: rgba(104, 172, 229, 0.10);
}

.toggle-btn:active {
  transform: scale(0.95);
}

.toggle-btn:focus-visible {
  outline: 2px solid var(--apple-primary-focus);
  outline-offset: 2px;
}

/* ── Tour CTA — cloud-like idle drift, iridescent shimmer on hover ──
   Idle: a 6.5s five-keyframe "tide" — non-sinusoidal vertical drift
   with a paired breathing shadow, so the button reads as floating in
   water rather than ticking on a metronome. Pairs .tour-cta with
   the .glass-pill row so the surface language matches its siblings
   (translucent white, backdrop blur, inset top highlight).

   Hover: rather than pausing the idle animation (which used to make
   the lift pop in abruptly) the idle is *replaced* by a slower
   breath; the shimmer sweep, edge ring, and lift are all driven by
   the same ease so the transition into hover is continuous. Kept
   subtle — academic paper site, not a marketing page. */
@keyframes tour-cta-tide {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 4px 10px rgba(0, 45, 114, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.55);
  }
  22% {
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 7px 14px rgba(0, 45, 114, 0.10),
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
  }
  46% {
    transform: translateY(-3.5px) scale(1.008);
    box-shadow: 0 9px 18px rgba(0, 45, 114, 0.11),
                inset 0 1px 0 rgba(255, 255, 255, 0.65);
  }
  68% {
    transform: translateY(-1.5px) scale(1.003);
    box-shadow: 0 6px 12px rgba(0, 45, 114, 0.09),
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 4px 10px rgba(0, 45, 114, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.55);
  }
}

@keyframes tour-cta-hover-breath {
  0% {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 14px 26px rgba(0, 45, 114, 0.16),
                inset 0 1px 0 rgba(255, 255, 255, 0.75);
  }
  50% {
    transform: translateY(-5.5px) scale(1.05);
    box-shadow: 0 18px 32px rgba(0, 45, 114, 0.18),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
  }
  100% {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 14px 26px rgba(0, 45, 114, 0.16),
                inset 0 1px 0 rgba(255, 255, 255, 0.75);
  }
}

@keyframes tour-cta-shimmer {
  0%   { background-position: -160% 0; }
  100% { background-position: 260% 0; }
}

.tour-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(0, 45, 114, 0.18);
  color: var(--apple-primary, #002D72);
  animation: tour-cta-tide 6.5s ease-in-out infinite;
  transition: color 0.4s ease,
              border-color 0.4s ease,
              background 0.4s ease;
}

/* Light-sweep shimmer, off-screen until hover */
.tour-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 32%,
    rgba(255, 255, 255, 0.7) 46%,
    var(--mint-bright, #8fc1ea) 50%,
    rgba(255, 255, 255, 0.7) 54%,
    transparent 68%
  );
  background-size: 260% 100%;
  background-position: -160% 0;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  transition: opacity 0.4s ease;
}

/* Edge ring — a soft mint halo that fades in on hover, so the
   "this is the primary action" signal isn't carried by colour
   shift alone. Pairs with the lift to give a continuous feel. */
.tour-cta::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg,
    rgba(104, 172, 229, 0.0) 0%,
    rgba(104, 172, 229, 0.55) 50%,
    rgba(104, 172, 229, 0.0) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
  z-index: -1;
}

.tour-cta:hover,
.tour-cta:focus-visible {
  animation: tour-cta-hover-breath 2.6s ease-in-out infinite;
  border-color: var(--spirit-blue, #68ACE5);
  color: var(--tier-1, #002D72);
  background: rgba(104, 172, 229, 0.12);
}

.tour-cta:hover::before,
.tour-cta:focus-visible::before {
  opacity: 1;
  animation: tour-cta-shimmer 1.6s ease-in-out;
}

.tour-cta:hover::after,
.tour-cta:focus-visible::after {
  opacity: 1;
}

.tour-cta:active {
  animation: none;
  transform: translateY(-1px) scale(1.01);
  transition-duration: 150ms;
}

@media (prefers-reduced-motion: reduce) {
  .tour-cta {
    animation: none;
  }

  .tour-cta:hover,
  .tour-cta:focus-visible,
  .tour-cta:active {
    animation: none;
    transform: none;
  }

  .tour-cta:hover::before,
  .tour-cta:focus-visible::before {
    animation: none;
    opacity: 0;
  }
}

/* ── Results Toggle (expand/collapse for paper tables) ── */
.results-toggle {
  margin: 32px 0;
}

.results-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--apple-hairline);
  border-radius: var(--radius-pill);
  padding: 8px 20px;
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--apple-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.results-toggle-btn:hover {
  background: rgba(104, 172, 229, 0.10);
  border-color: var(--apple-primary);
}

.results-toggle-btn:active {
  transform: scale(0.95);
}

.results-toggle-btn .toggle-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 12px;
}

.results-toggle-btn.open .toggle-arrow {
  transform: rotate(90deg);
}

.results-table-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.results-table-container.open {
  max-height: 2000px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  margin-top: 17px;
}

.results-table th {
  background: var(--apple-parchment);
  font-weight: var(--weight-semibold);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--apple-hairline);
}

.results-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--apple-divider-soft);
}

.results-table tr:hover td {
  background: rgba(104, 172, 229, 0.06);
}

.results-table .best-score {
  font-weight: var(--weight-semibold);
  color: var(--aria-success);
}

/* ── BibTeX Block ── */
.bibtex-wrap {
  position: relative;
}
#bibtex-content {
  background: var(--apple-parchment);
  padding: 17px;
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  overflow-x: auto;
  white-space: pre;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  line-height: 1.5;
  /* Leave room at the top-right so the floating copy button never
     covers the first line of BibTeX content on small screens. */
  padding-top: 44px;
}
.bibtex-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 45, 114, 0.18);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  color: var(--apple-primary, #002D72);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 2px 8px -3px rgba(4, 8, 18, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: background 0.15s ease,
              transform 0.15s ease,
              box-shadow 0.2s ease,
              color 0.2s ease,
              border-color 0.2s ease;
}
.bibtex-copy-btn:hover {
  background: rgba(104, 172, 229, 0.18);
  transform: translateY(-1px);
  border-color: rgba(0, 45, 114, 0.3);
}
.bibtex-copy-btn:active {
  transform: translateY(0);
}
.bibtex-copy-btn:focus-visible {
  outline: 2px solid var(--apple-primary-focus, #1a3d8f);
  outline-offset: 2px;
}

/* ── Glass pill — section-level action button ──
   Same glass language as .bibtex-copy-btn (and the broader
   .glass-card family): translucent white surface, backdrop blur,
   inset top highlight, soft shadow, JHU primary text. Sized for
   use as a row of buttons in a section header (e.g. References &
   Resources) rather than an inline icon button.

   Use on <a> or <button>. Pair with an inline SVG icon for a
   paper-style link button; works without one too. */
.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 45, 114, 0.18);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  color: var(--apple-primary, #002D72);
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: var(--text-caption, 13px);
  font-weight: var(--weight-semibold, 600);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 8px -3px rgba(4, 8, 18, 0.18),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: background 0.18s ease,
              transform 0.15s ease,
              box-shadow 0.2s ease,
              color 0.2s ease,
              border-color 0.2s ease;
}

.glass-pill:hover {
  background: rgba(104, 172, 229, 0.18);
  border-color: rgba(0, 45, 114, 0.3);
  color: var(--apple-primary, #002D72);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(4, 8, 18, 0.22),
              inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.glass-pill:active {
  transform: translateY(0);
}

.glass-pill:focus-visible {
  outline: 2px solid var(--apple-primary-focus, #1a3d8f);
  outline-offset: 2px;
}

.glass-pill svg {
  flex: 0 0 auto;
}

/* Row container — gives the pills a small consistent gap and
   lets them wrap gracefully on narrow viewports. */
.glass-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0.5rem 0 1.5rem;
}
.bibtex-copy-btn svg {
  flex: 0 0 auto;
}
.bibtex-copy-btn.copied,
.bibtex-copy-btn.is-copied {
  background: rgba(52, 199, 89, 0.18);
  border-color: rgba(52, 199, 89, 0.45);
  color: #1f7a3a;
}
@media (prefers-color-scheme: dark) {
  .bibtex-copy-btn {
    background: rgba(20, 26, 40, 0.7);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--apple-primary-on-dark, #68ACE5);
  }
  .bibtex-copy-btn:hover {
    background: rgba(104, 172, 229, 0.22);
    border-color: rgba(104, 172, 229, 0.45);
  }
  .bibtex-copy-btn.copied,
  .bibtex-copy-btn.is-copied {
    background: rgba(52, 199, 89, 0.22);
    border-color: rgba(52, 199, 89, 0.5);
    color: #6ee7a3;
  }
}
/* ── Tier 1/3 badge tokens (Apple-tier color binding) ── */
.tier-badge--tier1 { background: var(--tier-1); }
.tier-badge--tier3 { background: var(--tier-3); }
.tier-badge-large--tier1 { background: var(--tier-1); }
.tier-badge-large--tier3 { background: var(--tier-3); }

/* ==========================================================================
   Global Press States (Personal Accent Layer)

   Adds a consistent tactile feel across all interactive elements.
   Spring easing makes the press feel like a physical key.
   Component-level :active rules are preserved; this is a safety net.
   ========================================================================== */

.btn,
button,
a[class*="cta"],
a[class*="btn"] {
  transition: transform 180ms var(--ease-spring),
              box-shadow 180ms ease,
              background 180ms ease;
}

.btn:active,
button:active,
a[class*="cta"]:active,
a[class*="btn"]:active {
  transform: scale(0.95);
}
