/* ══════════════════════════════════════════════════════════════════════════
   DATA-PAGE KIT (dp-*)

   Shared components for the data pages that follow the diaspora page. The
   dsp-* components already in style.css (hero, sourced stat cards, comparison
   bars, data table, era timeline, world map) are reused as-is; everything here
   is what those pages need and the diaspora page never did.

   Loaded only by the data pages, alongside style.css. Colour rules are always
   rooted in a class so they can't leak - see scripts/audit-theme.mjs.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── toolbar: filter box + live result count ── */
.dp-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 16px; }
.dp-search {
  flex: 1 1 240px; min-width: 0;
  font-family: 'DM Sans', sans-serif; font-size: 15px; color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 11px 18px;
  box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.dp-search::placeholder { color: var(--text-muted); }
.dp-search:focus { outline: none; border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(188,75,0,0.13); }
.dp-count { font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.dp-count b { color: var(--saffron); font-family: 'Lora', serif; font-size: 15px; }

/* ── filter chips ── */
.dp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.dp-chip {
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600;
  color: var(--navy); background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 15px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.dp-chip:hover { border-color: var(--saffron); transform: translateY(-2px); }
.dp-chip.active { color: #fff; background: var(--saffron); border-color: var(--saffron); box-shadow: var(--shadow); }

/* ── sortable table headers (applied to the shared .dsp-table) ── */
.dsp-table thead th.is-sortable { cursor: pointer; user-select: none; padding-right: 26px; position: relative; }
.dsp-table thead th.is-sortable::after {
  content: '\2195'; position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%); font-size: 11px; opacity: 0.38;
}
.dsp-table thead th.is-sortable:hover { color: var(--saffron); }
.dsp-table thead th.is-sortable:hover::after { opacity: 0.75; }
.dsp-table thead th[data-dir="asc"]::after { content: '\2191'; opacity: 1; color: var(--saffron); }
.dsp-table thead th[data-dir="desc"]::after { content: '\2193'; opacity: 1; color: var(--saffron); }
.dsp-table thead th.is-sortable:focus-visible { outline: 2px solid var(--saffron); outline-offset: -2px; }
.dp-empty { display: none; padding: 26px; text-align: center; color: var(--text-muted); font-size: 14px; }
[data-empty="1"] + .dp-empty { display: block; }

/* ── status pills for the legal matrix ── */
.dp-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em;
  border-radius: 999px; padding: 4px 11px 4px 9px;
  border: 1px solid transparent; white-space: nowrap;
}
.dp-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.dp-status-yes { color: #14532D; background: #E6F4EA; border-color: #BBE0C6; }
.dp-status-yes::before { background: #1B7F3B; }
.dp-status-part { color: #7A4A00; background: var(--saffron-pale); border-color: #F3D6B4; }
.dp-status-part::before { background: var(--saffron); }
.dp-status-no { color: #7A1B1B; background: #FCEAEA; border-color: #F0C4C4; }
.dp-status-no::before { background: #B32626; }
.dp-status-none { color: var(--text-muted); background: var(--warm-white); border-color: var(--border); }
.dp-status-none::before { background: var(--border-strong); }
.dp-key { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }

/* ── versus: two territories, one row of comparisons ── */
.dp-versus {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden; margin-top: 8px;
}
.dp-versus-head, .dp-versus-row { display: grid; grid-template-columns: 1fr 190px 1fr; align-items: center; }
.dp-versus-head { background: var(--navy); padding: 18px 20px; }
.dp-versus-side { display: flex; align-items: center; gap: 11px; min-width: 0; }
.dp-versus-side:last-child { justify-content: flex-end; text-align: right; }
.dp-versus-side img { width: 34px; height: auto; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,0.25); flex: 0 0 auto; }
.dp-versus-head .dp-versus-name { font-family: 'Lora', serif; font-weight: 700; font-size: 17px; line-height: 1.2; color: #fff; }
.dp-versus-sub { font-size: 11.5px; color: rgba(255,255,255,0.62); letter-spacing: 0.02em; }
.dp-versus-vs {
  text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--gold-light);
}
.dp-versus-row { padding: 15px 20px; border-top: 1px solid var(--border); }
.dp-versus-row:nth-child(even) { background: var(--warm-white); }
.dp-versus-metric { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-muted); line-height: 1.35; padding: 0 10px; }
.dp-versus-val { font-family: 'Lora', serif; font-weight: 700; font-size: 21px; color: var(--navy); line-height: 1.15; }
.dp-versus-row .dp-versus-side:last-child .dp-versus-val { color: var(--saffron); }
.dp-versus-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.dp-versus-foot { padding: 14px 20px; background: var(--warm-white); border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
@media (max-width: 700px) {
  .dp-versus-head, .dp-versus-row { grid-template-columns: 1fr; gap: 4px; }
  .dp-versus-side, .dp-versus-side:last-child { justify-content: flex-start; text-align: left; }
  .dp-versus-metric {
    text-align: left; padding: 6px 0 2px; order: -1;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--saffron);
  }
  .dp-versus-vs { text-align: left; padding: 8px 0 0; }
}

/* ── share bars: one figure as a proportion of a whole ── */
.dp-shares { display: flex; flex-direction: column; gap: 15px; margin-top: 8px; }
.dp-share-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dp-share-label { font-size: 14px; font-weight: 600; color: var(--navy); }
.dp-share-label small { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); margin-top: 1px; }
.dp-share-val { font-family: 'Lora', serif; font-weight: 700; font-size: 17px; color: var(--saffron); white-space: nowrap; }
.dp-share-track { background: var(--saffron-pale); border: 1px solid var(--border); border-radius: 999px; height: 15px; overflow: hidden; }
.dp-share-fill {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--saffron));
  transition: width 1.1s cubic-bezier(0.22,0.61,0.36,1);
}
.dp-share-fill.is-muted { background: linear-gradient(90deg, var(--border-strong), var(--navy-light)); }

/* ── scale: a contested figure shown as a range of named estimates ── */
.dp-scale { margin: 30px 0 8px; }
.dp-scale-track {
  position: relative; height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--saffron-pale), var(--saffron-light));
  border: 1px solid var(--border);
}
.dp-scale-mark { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.dp-scale-dot {
  display: block; width: 13px; height: 13px; border-radius: 50%;
  background: var(--navy); border: 2.5px solid var(--cream); box-shadow: 0 0 0 1.5px var(--navy);
}
.dp-scale-axis { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.dp-estimates { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 20px; }
.dp-estimate {
  background: var(--card-bg); border: 1px solid var(--border);
  border-left: 3px solid var(--saffron); border-radius: var(--radius-sm);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.dp-estimate-num { font-family: 'Lora', serif; font-weight: 700; font-size: 20px; color: var(--navy); }
.dp-estimate-who { font-size: 13px; font-weight: 600; color: var(--saffron); margin-top: 2px; }
.dp-estimate-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin-top: 5px; }

/* ── flow: a directed movement of people ── */
.dp-flows { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 8px; }
.dp-flow {
  position: relative; overflow: hidden;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
}
.dp-flow::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--saffron));
}
.dp-flow-route {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px;
}
.dp-flow-arrow { color: var(--saffron); font-size: 15px; }
.dp-flow-num { font-family: 'Lora', serif; font-weight: 700; font-size: 34px; color: var(--saffron); line-height: 1; }
.dp-flow-who { font-size: 14px; font-weight: 600; color: var(--navy); margin-top: 7px; line-height: 1.4; }
.dp-flow-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin-top: 7px; }

/* ── callout: the one finding a page wants quoted ── */
.dp-callout {
  display: flex; gap: 18px; align-items: flex-start;
  background: linear-gradient(135deg, #0F1B33 0%, var(--navy) 60%, var(--navy-light) 100%);
  border-radius: var(--radius-lg); padding: 26px 30px;
  box-shadow: var(--shadow-xl); margin-top: 8px;
}
.dp-callout-mark { font-family: 'Lora', serif; font-size: 46px; line-height: 0.8; color: var(--gold-light); flex: 0 0 auto; }
.dp-callout-body { font-size: 16.5px; line-height: 1.65; color: rgba(255,255,255,0.9); }
.dp-callout-body strong { color: var(--gold-light); font-weight: 700; }
.dp-callout-src { display: block; margin-top: 10px; font-size: 12px; color: rgba(255,255,255,0.55); letter-spacing: 0.02em; }
@media (max-width: 560px) {
  .dp-callout { padding: 22px; gap: 12px; }
  .dp-callout-body { font-size: 15px; }
  .dp-callout-mark { font-size: 34px; }
}

/* ── explorer cards (surnames, dialects, anything enumerable) ── */
.dp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 13px; }
.dp-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px 18px;
  box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.dp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: transparent; }
.dp-card-name { font-family: 'Lora', serif; font-weight: 700; font-size: 19px; color: var(--navy); line-height: 1.2; }
.dp-card-pa { font-family: 'Noto Sans Gurmukhi', sans-serif; font-size: 15px; color: var(--saffron); margin-top: 3px; }
.dp-card-tag {
  display: inline-block; margin-top: 9px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--saffron);
  background: var(--saffron-pale); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px;
}
.dp-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.55; margin: 9px 0 0; }
.dp-card-desc strong { color: var(--navy); font-weight: 600; }

/* ── inline source note under any figure ── */
.dp-src { font-size: 11.5px; color: var(--text-muted); letter-spacing: 0.02em; margin-top: 10px; }
.dp-src a { color: var(--saffron); }

/* ── cluster nav: the data pages point at each other ── */
.dp-cluster { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 13px; margin-top: 8px; }
.dp-cluster-card {
  display: block; text-decoration: none;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.dp-cluster-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: transparent; }
.dp-cluster-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--saffron); }
.dp-cluster-title { font-family: 'Lora', serif; font-weight: 700; font-size: 17px; color: var(--navy); margin-top: 5px; line-height: 1.25; }
.dp-cluster-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 6px 0 0; }

/* ── inline SVG figures (gurdwaras page: the chronology chart) ──
   The chart is the argument, so it has to survive a narrow screen. Below the
   breakpoint it scrolls inside its own box rather than shrinking the labels
   into illegibility - the page itself never scrolls sideways. */
.gw-fig {
  margin: 4px 0 22px; padding: 20px 18px 14px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.gw-fig-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gw-chart { display: block; width: 100%; height: auto; font-family: 'DM Sans', system-ui, sans-serif; }
.gw-figcap { margin-top: 12px; font-size: 13px; line-height: 1.55; color: var(--text-muted); }
@media (max-width: 700px) {
  .gw-fig { padding: 16px 12px 12px; }
  .gw-chart { min-width: 640px; }
  .gw-figcap::after {
    content: ' (scroll the chart sideways to see the full span)';
    color: var(--saffron);
  }
}
