/* Copyright (c) Sercan Külcü. All rights reserved. */
/* Publication presentations: charts, explorers and paper-specific widgets on top of deck.css */
.ds-deck {
  --pv-s1: #2a78d6;
  --pv-s2: #eb6834;
  --pv-base: #7a7974;
  --pv-hi: #2a78d6;
  --pv-dim: color-mix(in srgb, var(--ds-text) 22%, var(--ds-bg));
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .ds-deck { --pv-s1: #3987e5; --pv-s2: #d95926; --pv-base: #a3a29b; --pv-hi: #3987e5; }
}
html[data-theme="dark"] .ds-deck { --pv-s1: #3987e5; --pv-s2: #d95926; --pv-base: #a3a29b; --pv-hi: #3987e5; }

/* ---------- title slide meta ---------- */
.pv-venue {
  margin: 0 0 14px;
  color: var(--ds-muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ds-deck__slide--title h1.pv-title { max-width: 700px; font-size: 34px; line-height: 1.18; }
.ds-deck__slide--title .pv-authors { margin-top: 4px; font-size: 18px; font-weight: 700; }
.ds-deck__slide--title .pv-affil { color: var(--ds-muted); font-size: 15px; }

/* ---------- segmented controls ---------- */
.pv-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 8px; font-size: 14px; }
.pv-ctrl > span { color: var(--ds-muted); font-weight: 700; }
.pv-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pv-seg button {
  height: 28px;
  padding: 0 10px;
  border: 1.5px solid var(--ds-border);
  border-radius: 999px;
  background: var(--ds-bg);
  color: var(--ds-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.pv-seg button:hover { border-color: var(--ds-link); }
.pv-seg button.is-on { border-color: var(--ds-link); background: var(--ds-link); color: #fff; }
.pv-seg button:focus-visible { outline: 2px solid var(--ds-link); outline-offset: 2px; }
.pv-range { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.pv-range input[type="range"] { flex: 1; accent-color: var(--ds-link); }
.pv-range output { min-width: 70px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- charts ---------- */
.pv-chart { position: relative; }
.pv-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.pv-chart .ax { stroke: var(--ds-muted); stroke-width: 1; fill: none; }
.pv-chart .gl { stroke: var(--ds-border-base); stroke-width: .7; fill: none; }
.pv-chart .tk { fill: var(--ds-muted); font: 12px system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.pv-chart .tt { fill: var(--ds-text); font: 600 12.5px system-ui, sans-serif; }
.pv-chart .vl { fill: var(--ds-text); font: 12px system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.pv-chart .eb { stroke: var(--ds-text); stroke-width: 1.2; fill: none; }
.pv-chart .hit { fill: transparent; cursor: pointer; }
.pv-chart .mk { transition: opacity .15s ease; }
.pv-chart .is-dim { opacity: .28; }
.pv-tip {
  position: absolute;
  z-index: 3;
  max-width: 240px;
  padding: 6px 9px;
  border: 1px solid var(--ds-border);
  border-radius: 8px;
  background: var(--ds-bg);
  box-shadow: var(--ds-shadow);
  color: var(--ds-text);
  font-size: 12.5px;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s ease;
}
.pv-tip.is-on { opacity: 1; }
.pv-tip b { font-weight: 700; }
.pv-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 4px; color: var(--ds-muted); font-size: 13px; }
.pv-legend i { display: inline-block; width: 14px; height: 4px; margin-right: 5px; border-radius: 2px; vertical-align: middle; }
.pv-legend i.dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- KPI tiles ---------- */
.pv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pv-kpi { padding: 10px 12px; border: 1.5px solid var(--ds-border); border-radius: 12px; background: var(--ds-bg); }
.pv-kpi span { display: block; color: var(--ds-muted); font-size: 12.5px; font-weight: 700; }
.pv-kpi b { display: block; font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pv-kpi small { color: var(--ds-muted); font-size: 12px; }
.pv-kpi.is-best { border-color: var(--ds-good); }

/* ---------- sortable table ---------- */
.pv-sort th { cursor: pointer; user-select: none; white-space: nowrap; }
.pv-sort th::after { content: " ↕"; color: var(--ds-muted); font-size: 11px; }
.pv-sort th.is-asc::after { content: " ↑"; color: var(--ds-link); }
.pv-sort th.is-desc::after { content: " ↓"; color: var(--ds-link); }
.pv-sort tr.is-ours td { background: color-mix(in srgb, var(--ds-good) 12%, var(--ds-bg)); font-weight: 700; }
.ds-deck__table.pv-tight { font-size: 13px; }
.ds-deck__table.pv-tight th, .ds-deck__table.pv-tight td { padding: 3px 7px; }

/* ---------- image viewer ---------- */
.pv-view { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pv-view figure { margin: 0; }
.pv-view img { display: block; width: 100%; height: auto; border-radius: 8px; background: #000; }
.pv-view figcaption { margin-top: 3px; color: var(--ds-muted); font-size: 13px; text-align: center; }
.pv-note { min-height: 40px; color: var(--ds-text); font-size: 14.5px; line-height: 1.4; }
.pv-badge { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #fff; }
.pv-badge--ok { background: var(--ds-good); }
.pv-badge--miss { background: var(--ds-bad); }
.pv-badge--extra { background: #b7791f; }

/* ---------- pipeline ---------- */
.pv-flow { display: flex; align-items: stretch; gap: 6px; }
.pv-flow > div {
  flex: 1;
  padding: 8px 8px;
  border: 1.5px solid var(--ds-border);
  border-radius: 10px;
  background: var(--ds-bg);
  font-size: 13.5px;
  line-height: 1.3;
  text-align: center;
}
.pv-flow > div b { display: block; margin-bottom: 2px; color: var(--ds-link); font-size: 14px; }
.pv-flow > i { align-self: center; color: var(--ds-link); font-style: normal; font-weight: 800; }

/* ---------- before / after wipe: drag the divider (or use the hidden range input) ---------- */
.ds-deck .pv-wipe { position: relative; width: 300px; aspect-ratio: 1; margin: 0 auto; overflow: hidden; border-radius: 10px; background: #000; cursor: ew-resize; touch-action: none; user-select: none; }
.ds-deck .pv-wipe img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ds-deck .pv-wipe__bar { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4); pointer-events: none; }
.ds-deck .pv-wipe__bar::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #111; font-size: 15px; font-weight: 700; }
.ds-deck .pv-wipe input { position: absolute; inset: auto 0 0 0; width: 100%; opacity: 0; }
.ds-deck .pv-wipe__lab { position: absolute; top: 6px; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; pointer-events: none; }
.ds-deck .pv-wipe__lab--l { left: 6px; }
.ds-deck .pv-wipe__lab--r { right: 6px; }

.ds-deck.is-fluid .pv-view,
.ds-deck.is-fluid .pv-kpis { grid-template-columns: 1fr 1fr; }
.ds-deck.is-fluid .pv-flow { flex-direction: column; }
.ds-deck.is-fluid .pv-flow > i { transform: rotate(90deg); }
