/* ===== BASE ===== */
body {
  font-family: 'Noto Sans', sans-serif;
  color: #222;
  background: #fff;
  overflow-x: hidden;
}
a { color: #6B4FD6; }
a:hover { text-decoration: underline; }

/* ===== NAVBAR ===== */
.navbar {
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
}
.navbar-item { font-size: 0.93rem; font-weight: 500; color: #333; }
.navbar-item:hover { color: #6B4FD6 !important; background: transparent !important; }

/* ===== HERO ===== */
.publication-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 2rem;
  line-height: 1.28;
  color: #111;
  max-width: 100%;
}
.publication-authors {
  font-family: 'Google Sans', sans-serif;
  margin-top: 0.5rem;
}
.publication-authors a { color: #6B4FD6 !important; }
.publication-authors a:hover { text-decoration: underline; }
.author-block { display: inline-block; }

/* ===== BUTTONS ===== */
.publication-links .icon img { max-height: 1.25em; width: auto; }
.publication-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}
.publication-links .link-block { display: inline-flex; }
.link-block a { margin: 4px; }
.button[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ===== VIDEO ===== */
.publication-video-block {
  max-width: 900px;
  width: 100%;
  margin: 1.8rem auto 0;
}
.publication-video-block video {
  display: block;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #ddd;
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
}

/* ===== SECTION BACKGROUNDS ===== */
.sec-white { background: #ffffff; }
.sec-gray  { background: #f5f6f8; }

/* ===== SECTION HEADINGS ===== */
.sec-heading {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.72rem;
  font-weight: 700;
  color: #111;
  display: inline-block;
  padding-bottom: 0.35rem;
  border-bottom: 3px solid #6B4FD6;
  margin-bottom: 1.4rem;
}
.subsec-heading {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #222;
  margin-top: 2.2rem;
  margin-bottom: 0.65rem;
}

/* ===== HIGHLIGHTS + METHOD STORY ===== */
.fmp-highlight-shell {
  margin: 2.2rem auto 0;
  padding: 1.45rem;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(107,79,214,0.10), rgba(40,114,181,0.06)),
    #fff;
  border: 1px solid #e5e8ef;
  box-shadow: 0 10px 30px rgba(24, 35, 56, 0.08);
}
.highlight-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6B4FD6;
  margin-bottom: 0.45rem;
}
.fmp-highlight-shell h3,
.method-copy h3 {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.45rem;
  line-height: 1.22;
  font-weight: 800;
  color: #111;
  margin: 0 0 0.55rem;
}
.highlight-lead {
  max-width: 760px;
  color: #4b5563;
  line-height: 1.65;
  margin: 0 0 1.2rem;
  font-size: 0.96rem;
}
.highlight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}
.highlight-card {
  min-height: 150px;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(214,220,232,0.9);
  box-shadow: 0 4px 14px rgba(20,30,50,0.055);
}
.highlight-card.primary {
  color: #fff;
  background: linear-gradient(135deg, #3d2a8f, #6B4FD6);
  border-color: transparent;
}
.highlight-card.primary p,
.highlight-card.primary .highlight-icon { color: rgba(255,255,255,0.86); }
.highlight-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(107,79,214,0.10);
  color: #6B4FD6;
  margin-bottom: 0.7rem;
}
.highlight-card strong {
  display: block;
  font-family: 'Google Sans', sans-serif;
  font-size: 1.35rem;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}
.highlight-card p {
  margin: 0;
  color: #596273;
  font-size: 0.8rem;
  line-height: 1.45;
}
.method-story {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1.4rem;
}
.method-copy,
.method-step,
.method-visual-card {
  background: #fff;
  border: 1px solid #e2e6ee;
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(24,35,56,0.065);
}
.method-copy {
  padding: 1.35rem;
}
.method-copy p {
  color: #4b5563;
  line-height: 1.65;
  font-size: 0.94rem;
  margin-bottom: 1rem;
}
.formula-pill {
  display: inline-block;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  background: #f7f8fb;
  border: 1px solid #e1e5ef;
  color: #222;
  font-style: italic;
  font-size: 0.9rem;
}
.method-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.method-step {
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.method-step::after {
  content: "";
  position: absolute;
  inset: auto -25% -45% 35%;
  height: 90px;
  background: radial-gradient(circle, rgba(107,79,214,0.10), transparent 65%);
}
.method-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #6B4FD6;
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}
.method-step h4 {
  font-family: 'Google Sans', sans-serif;
  font-size: 0.96rem;
  font-weight: 800;
  margin: 0 0 0.4rem;
  color: #111;
}
.method-step p {
  font-size: 0.8rem;
  line-height: 1.48;
  color: #596273;
  margin: 0;
}
.method-visual-card {
  padding: 0.85rem;
  text-align: center;
  margin-top: 0.5rem;
}
.method-visual-card img {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #fff;
}
.method-visual-card p {
  max-width: 760px;
  margin: 0.75rem auto 0.2rem;
  font-size: 0.84rem;
  color: #5f6673;
  line-height: 1.55;
}
@media (max-width: 760px) {
  .highlight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-story { grid-template-columns: 1fr; }
  .method-steps { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .highlight-grid { grid-template-columns: 1fr; }
}

/* ===== KEY CONTRIBUTIONS CARDS ===== */
.contrib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1.1rem;
  margin-top: 1.2rem;
}
.contrib-card {
  background: #fff;
  border: 1px solid #dde3ee;
  border-radius: 10px;
  padding: 1.2rem 1.1rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.055);
  transition: box-shadow 0.18s, transform 0.18s;
}
.contrib-card:hover {
  box-shadow: 0 4px 18px rgba(107,79,214,0.16);
  transform: translateY(-2px);
}
.contrib-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #efeafc;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.7rem;
  color: #6B4FD6;
  font-size: 1.05rem;
}
.contrib-card h4 {
  font-family: 'Google Sans', sans-serif;
  font-weight: 700;
  font-size: 0.94rem;
  color: #111;
  margin-bottom: 0.35rem;
}
.contrib-card p {
  font-size: 0.84rem;
  color: #555;
  line-height: 1.55;
  margin: 0;
}

/* ===== FIGURES ===== */
.fig-wrap {
  margin: 1.8rem auto 0.2rem;
  text-align: center;
}
.fig-wrap img {
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.09);
  background: #fff;
}
.fig-sm   img { max-width: 58%; }
.fig-md   img { max-width: 78%; }
.fig-lg   img { max-width: 92%; }
.fig-full img { max-width: 100%; }
.fig-half img { max-width: 50%; min-width: 360px; }

.fig-cap {
  font-size: 0.83rem;
  color: #666;
  margin-top: 0.65rem;
  max-width: 86%;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.52;
  text-align: center;
}
.fig-cap strong { color: #333; }

/* ===== FOOTER ===== */
.footer { background: #f5f6f8; }
.footer .icon-link {
  font-size: 22px;
  color: #666;
  margin: 0 6px;
  transition: color 0.18s;
}
.footer .icon-link:hover { color: #6B4FD6; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .publication-title { font-size: 1.4rem; }
  .fig-sm img, .fig-md img { max-width: 100%; }
  .contrib-grid { grid-template-columns: 1fr; }
}

/* ===== SECTION-LEVEL TABS (Ablations & Comparisons) ===== */
.sec-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e8eaed;
  padding-bottom: 0.6rem;
}
.sec-tab {
  font-family: 'Google Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: #777;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
  position: relative;
}
.sec-tab::after {
  content: "";
  position: absolute;
  bottom: -0.65rem;
  left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.18s;
}
.sec-tab:hover { color: #6B4FD6; background: #f2effc; }
.sec-tab.active { color: #6B4FD6; background: #f2effc; }
.sec-tab.active::after { background: #6B4FD6; }

/* Panels */
.sec-panel { display: block; }
.sec-panel-hidden { display: none; }

.sec-panel-desc {
  font-size: 0.95rem;
  line-height: 1.72;
  color: #444;
  margin-bottom: 1.5rem;
  padding: 0.9rem 1.1rem;
  background: #fff;
  border-left: 3px solid #6B4FD6;
  border-radius: 0 8px 8px 0;
}

/* ===== ANIMATED BAR CHARTS ===== */
.fmp-bar-chart { margin: 1rem 0 0.5rem; }

.fmp-metric-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.fmp-metric-tab {
  font-family: 'Google Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.7rem;
  border: 1.5px solid #dde0e6;
  border-radius: 20px;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.fmp-metric-tab:hover { border-color: #6B4FD6; color: #6B4FD6; }
.fmp-metric-tab.active {
  background: #6B4FD6;
  border-color: #6B4FD6;
  color: #fff;
}

.fmp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.76rem;
  color: #444;
}
.fmp-legend-group { display: inline-flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.fmp-legend-group-label { font-weight: 700; color: #888; margin-right: 0.1rem; }
.fmp-legend-item { display: inline-flex; align-items: center; gap: 0.25rem; }
.fmp-legend-swatch {
  width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex-shrink: 0;
}

.fmp-chart-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  overflow-x: auto;
}

.fmp-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 1.6rem;
  flex-shrink: 0;
}
.fmp-y-tick {
  font-size: 0.68rem;
  color: #999;
  white-space: nowrap;
}

.fmp-chart-plot {
  flex: 1 1 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 0.5rem;
  height: 200px;
  padding: 0 0.25rem 0;
  border-bottom: 2px solid #d9d9d9;
  border-left: 1.5px solid #d9d9d9;
  min-width: 480px;
}
.fmp-chart-plot-single { min-width: 220px; }

.fmp-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  height: 100%;
  justify-content: flex-end;
}
.fmp-bar-group-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
}
.fmp-bar-spacer { width: 5px; flex-shrink: 0; }
.fmp-bar-group-label {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: #333;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}

.fmp-bar {
  position: relative;
  flex: 1 1 0;
  max-width: 26px;
  min-width: 8px;
  height: 0;
  border-radius: 3px 3px 0 0;
  transition: height 1.1s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: default;
}
.fmp-bar-chart.in-view .fmp-bar { height: var(--target); }
.fmp-bar.fmp-bar-ours { box-shadow: 0 0 0 1.5px rgba(107,79,214,0.55); }

.fmp-bar-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.35rem;
  background: #1b1b1b;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.3rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}
.fmp-bar-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1b1b1b;
}
.fmp-bar:hover .fmp-bar-tooltip { opacity: 1; transform: translateX(-50%) translateY(-3px); }

.realworld-chart-card {
  max-width: 680px;
  margin: 1.5rem auto 0;
  padding: 1rem 1.1rem 0.8rem;
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.realworld-chart .fmp-chart-plot { min-width: 360px; height: 190px; }
.realworld-chart .fmp-bar { max-width: 34px; min-width: 14px; }
.realworld-chart .fmp-legend { justify-content: center; }

/* ===== UNIFIED PAIRED-COMPARISON PANEL ===== */
/* One row per metric, each independently scaled — for small paired
   comparisons (2 conditions) where a full bar chart per metric would
   be too sparse. All metrics visible at once, no tab-switching. */
.compare-panel-card {
  margin: 1.4rem auto 0;
  padding: 1.2rem 1.35rem 1.1rem;
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 12px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.05);
}
.compare-legend { margin-bottom: 0.9rem; }
.compare-rows { display: flex; flex-direction: column; }
.compare-row {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr 78px;
  align-items: center;
  gap: 1.1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #eef0f3;
}
.compare-row:last-child { border-bottom: none; }
.compare-label {
  font-family: 'Google Sans', sans-serif;
  font-weight: 700;
  font-size: 0.84rem;
  color: #222;
  line-height: 1.35;
}
.compare-arrow {
  display: inline-block;
  margin-left: 0.4rem;
  font-family: 'Noto Sans', sans-serif;
  font-weight: 600;
  font-size: 0.63rem;
  letter-spacing: 0.01em;
  padding: 0.06rem 0.4rem;
  border-radius: 10px;
  vertical-align: middle;
  white-space: nowrap;
}
.compare-arrow-down { color: #1f8a5a; background: #e7f6ee; }
.compare-arrow-up   { color: #1f8a5a; background: #e7f6ee; }
.compare-arrow-neutral { color: #8a6d1f; background: #f8f1de; }
.compare-note {
  display: block;
  margin-top: 0.2rem;
  font-weight: 400;
  font-size: 0.74rem;
  color: #8a8f99;
  line-height: 1.4;
}
.compare-bars { display: flex; flex-direction: column; gap: 0.32rem; }
.compare-bar-line { display: flex; align-items: center; gap: 0.55rem; }
.compare-bar-track {
  flex: 1 1 0;
  height: 13px;
  background: #f1f2f5;
  border-radius: 4px;
  overflow: hidden;
}
.compare-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.compare-panel.in-view .compare-bar-fill { width: var(--target); }
.compare-bar-value {
  flex-shrink: 0;
  width: 46px;
  text-align: right;
  font-size: 0.76rem;
  font-weight: 600;
  color: #444;
  font-variant-numeric: tabular-nums;
}
.compare-delta {
  text-align: right;
  font-family: 'Google Sans', sans-serif;
  font-weight: 800;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.compare-delta-good { color: #1f8a5a; }
.compare-delta-bad { color: #c0392b; }
.compare-delta-neutral { color: #8a8f99; }
@media (max-width: 640px) {
  .compare-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .compare-delta { text-align: left; }
}

/* ===== METRIC DESCRIPTION BOX ===== */
.fmp-chart-desc {
  margin-top: 1rem;
  padding: 0.85rem 1.1rem;
  background: #fafbfc;
  border-left: 3px solid #6B4FD6;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #444;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.fmp-chart-desc.desc-visible { opacity: 1; transform: none; }

/* ===== SCROLL REVEAL ===== */
.reveal-block {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal-block.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal-block { opacity: 1; transform: none; transition: none; }
}

/* ===== TASK GALLERY (real-world figure tabs) ===== */
.task-gallery-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin: 1.6rem 0 0.4rem;
}
.task-gallery-nav button {
  font-family: 'Google Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.42rem 1rem;
  border: 1.5px solid #dde0e6;
  border-radius: 20px;
  background: #fff;
  color: #444;
  cursor: pointer;
  transition: all 0.18s;
}
.task-gallery-nav button:hover { border-color: #6B4FD6; color: #6B4FD6; }
.task-gallery-nav button.active { background: #6B4FD6; border-color: #6B4FD6; color: #fff; }
.task-gallery-panel { display: none; }
.task-gallery-panel.active { display: block; }

/* ===== KEY-VALUE STAT STRIP (contrib highlights row) ===== */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0 0;
}
.stat-card {
  background: #fff;
  border: 1px solid #e0e4ea;
  border-top: 3px solid #6B4FD6;
  border-radius: 8px;
  padding: 1.1rem 0.9rem 1rem;
  text-align: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.055);
}
.stat-num {
  font-family: 'Google Sans', sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  color: #6B4FD6;
  line-height: 1.1;
}
.stat-label {
  font-size: 0.78rem;
  color: #666;
  margin-top: 0.35rem;
  line-height: 1.4;
}
@media (max-width: 640px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .container,
  .columns,
  .column {
    min-width: 0;
    max-width: 100%;
  }
  .hero-body { padding-left: 1rem; padding-right: 1rem; }
  .publication-title {
    font-size: 1.24rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
    margin-left: auto;
    margin-right: auto;
  }
  .publication-links {
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
    margin-left: auto;
    margin-right: auto;
  }
  .publication-links .button { max-width: calc(100vw - 2rem); }
  .publication-video-block video,
  .fig-wrap img { max-width: 100%; height: auto; }
  .publication-video-block,
  .fig-wrap {
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
  }
  .fig-wrap { padding-left: 0.65rem; padding-right: 0.65rem; }
  .fig-half img { max-width: 100%; min-width: 0; }
  .fmp-chart-plot,
  .realworld-chart .fmp-chart-plot {
    height: 180px;
    min-width: 0;
  }
  .fmp-bar-group-label { font-size: 0.65rem; }
}
