/* ===========================================================================
 *  Fonts – self-hosted so the site runs in regions where Google Fonts is blocked.
 *  Ubuntu  → big display titles only
 *  Nunito Sans → everything else (body, UI, numbers)
 * ======================================================================== */
hr{display:none !important}

@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ubuntu/ubuntu-400.ttf') format('truetype');
}

@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/ubuntu/ubuntu-700.ttf') format('truetype');
}

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nunito-sans/nunito-sans-400.ttf') format('truetype');
}

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/nunito-sans/nunito-sans-600.ttf') format('truetype');
}

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/nunito-sans/nunito-sans-700.ttf') format('truetype');
}

/* Explorer font — contains only the characters "数据集浏览" for Chinese dataset explorer title */
@font-face {
  font-family: 'Explorer';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/explorer.woff2') format('woff2');
}

:root {
  --mdx-bg: #000000;
  --mdx-border: rgba(255, 255, 255, 0.14);
  --mdx-border-soft: rgba(255, 255, 255, 0.08);
  --mdx-text: #f4f1f7;
  --mdx-muted: #8a8490;
  --mdx-muted-2: #6b6570;
  --mdx-accent: #c4b5fd;
  --mdx-accent-strong: #a78bfa;

  --mdx-radius-pill: 999px;
  --mdx-radius-card: 20px;
  --mdx-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);

  --mdx-font-display: 'Ubuntu', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --mdx-font-body: 'Nunito Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;

  --mdx-grid-cols: minmax(320px, 2.2fr) 0.95fr 0.7fr 0.65fr 0.55fr 0.8fr;
  --mdx-grid-gap: 14px;
  --mdx-grid-padding-x: 28px;
}

/* ==========================================================================
 *  Full-bleed reset for pages hosting the Magic Data UI.
 *
 *  The Twenty Twenty-Five block theme wraps all post content inside
 *  `.wp-site-blocks` with root-level left/right padding, and further
 *  constrains the post content area to `contentSize` (~645px). Those
 *  defaults produce white gutters on both sides of our dark UI.
 *
 *  We only neutralize them on the pages that actually load this stylesheet
 *  (Dataset Explorer today), so other editorial pages on the same site keep
 *  the default theme behavior.
 * ======================================================================== */
/* Every layer the block theme may wrap us in — flatten to 0 padding,
 * 0 margin, no max-width. Even 1–2px of html/body default margin leaks
 * through as a white hairline at the viewport edge. */
html:has(body.page-template-page-dataset-explorer-php),
html:has(body.page-template-page-dataset-explorer),
body.page-template-page-dataset-explorer-php,
body.page-template-page-dataset-explorer {
  background: var(--mdx-bg) !important;
  margin: 0 !important;
}

body.page-template-page-dataset-explorer-php .wp-site-blocks,
body.page-template-page-dataset-explorer .wp-site-blocks,
body.page-template-page-dataset-explorer-php main,
body.page-template-page-dataset-explorer main,
body.page-template-page-dataset-explorer-php main .wp-block-group,
body.page-template-page-dataset-explorer main .wp-block-group,
body.page-template-page-dataset-explorer-php .wp-block-post-content,
body.page-template-page-dataset-explorer .wp-block-post-content,
body.page-template-page-dataset-explorer-php .wp-block-post-content > .mdx-page,
body.page-template-page-dataset-explorer .wp-block-post-content > .mdx-page {
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.mdx-page {
  background: var(--mdx-bg);
  color: var(--mdx-text);
  min-height: 100vh;
  padding: 24px 32px 40px;
  font-family: var(--mdx-font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mdx-page button,
.mdx-page input,
.mdx-page select,
.mdx-page textarea {
  font-family: inherit;
}

.mdx-shell {
  max-width: 1280px;
  margin: 0 auto;
}

/* ============================  Header / nav  ============================
 *
 *  Header / brand / primary nav / CTA styles now live in
 *  template-parts/md-chrome-header.php (as an inline <style> guarded by
 *  a $GLOBALS flag), so every template that calls
 *  get_template_part( 'template-parts/md-chrome-header' ) gets them
 *  once per request. That partial uses the `.mdx-chrome__*` prefix
 *  (.mdx-chrome, .mdx-chrome__inner, .mdx-chrome__brand,
 *  .mdx-chrome__nav, .mdx-chrome__cta, .mdx-chrome__langs) to avoid
 *  colliding with any legacy `.mdx-header`-style selectors.
 *
 *  We intentionally DO NOT redefine those rules here: the sticky
 *  chrome needs consistent styling on `single-dataset.php` which
 *  does NOT load this stylesheet, so keeping the rules self-contained
 *  in the partial guarantees parity across every page that uses it.
 * ======================================================================== */

/* .mdx-page no longer needs extra top padding — the sticky chrome
 * already provides the visual gutter above .mdx-hero. Override to
 * tighten the space between the header's gradient fade and the
 * hero's heatmap/title. */
.mdx-page { padding-top: 8px; }

/* ================================  Hero  =============================== */

.mdx-hero {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 28px;
}

.mdx-hero-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

/* One-line gradient title; entire phrase uses the gradient (no white half). */
.mdx-hero-title {
  font-family: var(--mdx-font-display);
  font-size: clamp(30px, 3vw, 41px);
  line-height: 1.05;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Chinese title — Explorer subset font + same VF axes as home hero (阿里妈妈方圆体). */
.mdx-hero-title--zh {
  font-family: 'Explorer', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-weight: 700;
  font-variation-settings: "BEVL" 57.85, "wght" 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.mdx-title-accent {
  background: linear-gradient(-90deg, #ff8fc5 0%, #da2f5b 60%, #da2f5b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/*
 * Search bar — subtle minimalist glass pill.
 * Low-opacity white fill + slight inner highlight + outer border at ~10% opacity.
 * Uses backdrop-filter so it picks up a faint desaturation of anything behind it.
 */
.mdx-search {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--mdx-radius-pill);
  padding: 14px 22px 14px 22px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  /*box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 0 0 1px rgba(255, 255, 255, 0.015),
    0 20px 60px rgba(0, 0, 0, 0.45);*/
  width: 100%;
  max-width: 281px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.mdx-search:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}

.mdx-search:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.035);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.55);
}

.mdx-search-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--mdx-accent);
  opacity: 0.85;
}

.mdx-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--mdx-text);
  outline: none;
  font-size: 16px;
  letter-spacing: 0.005em;
  font-weight: 400;
}

.mdx-search input::placeholder {
  color: var(--mdx-muted);
  opacity: 0.85;
}

/* ==============  Pill selects (both hero filters and toolbar)  ========== */

.mdx-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mdx-pill-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--mdx-muted) 50%),
    linear-gradient(135deg, var(--mdx-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: 1px solid var(--mdx-border);
  border-radius: var(--mdx-radius-pill);
  color: var(--mdx-text);
  padding: 7px 30px 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
  /*
   * Even with truncated option labels (see truncateOptionLabel), the pill
   * should hard-cap its width so a long "selected" text can't push the
   * neighboring toolbar columns around.
   */
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.mdx-pill-select:hover,
.mdx-pill-select:focus {
  border-color: rgba(255, 255, 255, 0.3);
  outline: none;
}

/*  De-emphasized variant for hero Industry / Application pills (reference style) */
.mdx-pill-select--muted {
  border-color: var(--mdx-border-soft);
  color: var(--mdx-muted);
  font-size: 12px;
  padding: 5px 26px 5px 12px;
  min-width: 0;
}

.mdx-pill-select--muted:hover,
.mdx-pill-select--muted:focus {
  border-color: var(--mdx-border);
  color: var(--mdx-text);
}

/* ==============================  Heatmap  =============================== */

.mdx-hero-right { min-width: 0; }

.mdx-heatmap-wrap {
  position: relative;
  min-height: 140px;
  padding-top: 4px;
  /* Breathing room at the hero’s inner left edge (~20px beyond prior flush layout). */
  padding-left: 22px;
  /*
   * Fixed label gutter so every modality row aligns to the same column start (EN labels
   * like LEXICON vary in width vs TEXT; separate per-row grids were shifting the tiles).
   */
  --mdx-heatmap-label-col: 104px;
}

.mdx-heatmap {
  display: grid;
  gap: 10px;
}

.mdx-heatmap-row {
  display: grid;
  grid-template-columns: var(--mdx-heatmap-label-col) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.mdx-heatmap-label {
  align-self: center;
  color: var(--mdx-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  padding-top: 0;
  text-align: right;
  justify-self: stretch;
  min-width: 0;
  white-space: nowrap;
}

.mdx-heatmap-blocks {
  position: relative;
  width: 100%;
  min-height: 14px;
  /* No height transition: animating the row box made tiles look like they squash;
     only .mdx-block transforms move (translate3d). */
}

.mdx-block {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  border-radius: 0;
  border: 0;
  /* Inset edge only — keeps true 14×14 layout tiles; avoids border inflating the
   * box under content-box and doubling seams between neighbors. */
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  cursor: pointer;
  opacity: 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Only animate translation — opacity/box-shadow interpolation looked like “shrink”
   * when many tiles crossed (same key asc ↔ desc). Slot z-index is set in JS. */
  transition: transform 0.585s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.mdx-block:hover {
  z-index: 999 !important;
  filter: brightness(1.08);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.mdx-block--inactive {
  opacity: 0.08;
  pointer-events: none;
}

.mdx-block--tier-hi {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.mdx-block--tier-zero { opacity: 0.78; }
.mdx-block--tier-zero.mdx-block--inactive { opacity: 0.05; }

/* Legend toggle – deemphasized (no heavy button look, just ghost pill). */

.mdx-legend-toggle {
  position: absolute;
  right: 0;
  bottom: -6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--mdx-muted);
  border: 1px solid var(--mdx-border-soft);
  border-radius: var(--mdx-radius-pill);
  padding: 5px 12px;
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.mdx-legend-toggle:hover,
.mdx-legend-toggle[aria-expanded="true"] {
  color: var(--mdx-text);
  border-color: var(--mdx-border);
}

.mdx-legend-toggle-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.mdx-legend-toggle-caret { font-size: 9px; opacity: 0.8; }

.mdx-legend {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: 320px;
  background: #0a0a0a;
  border: 1px solid var(--mdx-border);
  border-radius: 14px;
  box-shadow: var(--mdx-shadow);
  padding: 16px;
  z-index: 20;
  font-size: 13px;
}

.mdx-legend-section + .mdx-legend-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--mdx-border-soft);
}

.mdx-legend-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
}

.mdx-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.mdx-legend-scale-label {
  color: var(--mdx-muted);
  font-size: 12px;
  margin-bottom: 8px;
}

/*
 * "Brightness = views" mini-diagram.
 * The gradient is drawn per family (neutral pink/magenta) so it reads as
 * "same hue, more light" without tying to any one family color.
 */
.mdx-legend-scale-bar {
  height: 10px;
  border-radius: 3px;
  /*
   * Stops mirror the JS saturation power curve (t^2.2) and L range 18–50%.
   */
  background: linear-gradient(
    90deg,
    hsl(305 38% 18%) 0%,
    hsl(305 42% 26%) 35%,
    hsl(305 50% 34%) 60%,
    hsl(305 62% 42%) 82%,
    hsl(305 78% 50%) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mdx-legend-scale-ends {
  display: flex;
  justify-content: space-between;
  color: var(--mdx-muted);
  font-size: 11px;
  margin-top: 6px;
  letter-spacing: 0.03em;
}

/* ============================  Results shell  =========================== */

.mdx-results-shell {
  background: var(--mdx-bg);
  border: 1px solid var(--mdx-border);
  border-radius: var(--mdx-radius-card);
  overflow: hidden;
  margin-top: 18px;
}

.mdx-toolbar {
  display: grid;
  grid-template-columns: var(--mdx-grid-cols);
  gap: var(--mdx-grid-gap);
  padding: 22px var(--mdx-grid-padding-x) 18px;
  align-items: center;
  border-bottom: 1px solid var(--mdx-border-soft);
}

.mdx-toolbar-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 6px;
}

/* Dataset column heading stays left-aligned with its art banner below. */
.mdx-toolbar-cell--title {
  justify-content: flex-start;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.mdx-toolbar-cell--size .mdx-col-label {
  color: var(--mdx-text);
  font-size: 14px;
  opacity: 0.82;
}

.mdx-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--mdx-text);
  border: 0;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  opacity: 0.82;
}

.mdx-sort-btn:hover { opacity: 1; }
.mdx-sort-btn.is-active { opacity: 1; font-weight: 700; }
.mdx-sort-btn[hidden] { display: none !important; }

/* Stacked up/down triangle sort caret. Active direction goes full opacity. */
.mdx-sort-caret {
  display: inline-flex;
  width: 8px;
  height: 12px;
  color: var(--mdx-muted);
}

.mdx-sort-caret svg { display: block; }

.mdx-sort-caret-up,
.mdx-sort-caret-down { opacity: 0.45; transition: opacity 0.15s ease; }

.mdx-sort-btn:hover .mdx-sort-caret-up,
.mdx-sort-btn:hover .mdx-sort-caret-down { opacity: 0.65; }

.mdx-sort-btn.is-active[data-dir="asc"] .mdx-sort-caret-up,
.mdx-sort-btn.is-active:not([data-dir="asc"]) .mdx-sort-caret-down {
  opacity: 1;
  color: var(--mdx-text);
}

.mdx-active-state {
  padding: 10px var(--mdx-grid-padding-x) 0;
  color: var(--mdx-muted);
}

.mdx-active-state:empty { padding: 0; }

.mdx-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--mdx-radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--mdx-border-soft);
  margin-right: 8px;
  margin-top: 10px;
  font-size: 12px;
}

.mdx-chip button {
  border: 0;
  background: transparent;
  color: var(--mdx-text);
  cursor: pointer;
  line-height: 1;
}

/* =============================  Result rows  ============================ */

.mdx-results { display: flex; flex-direction: column; }

.mdx-row {
  display: grid;
  grid-template-columns: var(--mdx-grid-cols);
  gap: var(--mdx-grid-gap);
  align-items: center;
  padding: 0px var(--mdx-grid-padding-x);
  border-top: 1px solid var(--mdx-border-soft);
  transition: background 0.18s ease;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

.mdx-row:first-child { border-top: 1px solid var(--mdx-border-soft); }

/*
 * Whole-row hover: brighten only the raster art layer (.mdx-thumb-art). Vignette
 * (.mdx-thumb-vignette) stays unfiltered so left/bottom bars keep the same
 * depth; the list still reads as one continuous strip (no row-wide wash).
 * @see PRESETS.EXPLORER_ROW in magicdata-art.js — vignette must stay in sync.
 */
.mdx-row:hover,
.mdx-row:focus-visible {
  background: transparent;
}
.mdx-row:hover .mdx-thumb,
.mdx-row:focus-visible .mdx-thumb {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 14px 38px rgba(0, 0, 0, 0.52),
    0 0 36px rgba(255, 220, 200, 0.09);
}
.mdx-row:hover .mdx-thumb-art .mdx-thumb-canvas,
.mdx-row:focus-visible .mdx-thumb-art .mdx-thumb-canvas,
.mdx-row:hover .mdx-thumb-art .mdx-thumb-cover,
.mdx-row:focus-visible .mdx-thumb-art .mdx-thumb-cover {
  filter: brightness(1.48) saturate(1.4) contrast(1.06);
}

.mdx-card {
  min-width: 0;
}

/*
 * Art banner — the Dataset column IS the image. 5:1 aspect so the canvas
 * painted by MDArt (nebula + firepeople, EXPLORER_ROW preset) keeps its
 * natural person proportions. Title sits on the vignette strip (CSS mirror
 * of the left/bottom canvas gradients when skipGradients is used).
 */
.mdx-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 1;
  min-height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background: #050505;
  border: 0px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: box-shadow 0.22s ease;
}

/* Bitmap only — receives hover filter; sibling vignette stays untouched. */
.mdx-thumb-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  z-index: 0;
}

/*
 * Mirrors MDArt PRESETS.EXPLORER_ROW left + bottom gradients (skipGradients).
 * Keep alphas/stops/widths aligned with magicdata-art.js.
 */
.mdx-thumb-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
  background:
  linear-gradient(
    to right,
    rgba(0, 0, 0, 0.96) 0%,
    rgba(0, 0, 0, 0.528) 55%,
    rgba(0, 0, 0, 0) 100%
  )
    0 0 / 38% 100% no-repeat,
  linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0) 100%
  )
    bottom / 100% 58% no-repeat
}

.mdx-thumb-art .mdx-thumb-canvas,
.mdx-thumb-art .mdx-thumb-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition: filter 0.22s ease;
}

.mdx-thumb-cover {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.mdx-thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  pointer-events: none;
  z-index: 2;
}

.mdx-card-title-link {
  pointer-events: auto;
  color: #ffffff;
  text-decoration: none;
  max-width: 62%;
  font-family: var(--mdx-font-display);
  font-weight: 700;
  font-size: clamp(14px, 1vw, 18px);
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mdx-card-title-link:hover,
.mdx-card-title-link:focus { color: #ffffff; text-decoration: none; outline: none; }

.mdx-card-title-main {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mdx-card-code {
  font-family: var(--mdx-font-display);
  font-weight: 700;
  font-size: 0.7em;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.62);
}

.mdx-card-os {
  font-family: var(--mdx-font-display);
  font-weight: 700;
  font-size: 1em;
  letter-spacing: 0.02em;
}

.mdx-tooltip-os {
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.mdx-col {
  color: var(--mdx-text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Center tabular data under their centered toolbar headings. */
  text-align: center;
  justify-self: center;
  max-width: 100%;
  white-space: nowrap;
}

.mdx-empty {
  padding: 24px var(--mdx-grid-padding-x) 32px;
  color: var(--mdx-muted);
}

/* ============================  Pagination  ============================= */

.mdx-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px var(--mdx-grid-padding-x) 26px;
}

.mdx-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--mdx-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background 0.2s ease, transform 0.2s ease;
}

.mdx-page-btn:hover:not(:disabled) { color: var(--mdx-text); }
.mdx-page-btn:disabled { cursor: default; opacity: 0.35; }

.mdx-page-btn--active {
  color: #fff;
  background: radial-gradient(circle at 30% 30%, #9b5cff 0%, #5b21b6 80%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 4px 14px rgba(124, 58, 237, 0.35);
}

.mdx-page-ellipsis {
  color: var(--mdx-muted);
  padding: 0 4px;
  user-select: none;
}

/* =============================  Tooltip  =============================== */

.mdx-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  max-width: 360px;
  background: rgba(12, 12, 12, 0.97);
  border: 1px solid var(--mdx-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--mdx-shadow);
  z-index: 9999;
  pointer-events: none;
  font-size: 13px;
}

.mdx-tooltip h4 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.mdx-tooltip p { margin: 4px 0; color: var(--mdx-muted); }
.mdx-tooltip .mdx-tooltip-tags { margin-top: 10px; color: var(--mdx-muted-2); font-size: 11px; }

/* ============================  Responsive  ============================= */

@media (max-width: 1100px) {
  :root {
    --mdx-grid-cols: minmax(260px, 2fr) 0.95fr 0.7fr 0.65fr 0.55fr 0.8fr;
  }
  .mdx-hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 640px) {

  /* ---- Page-level spacing: match nav's 20px side padding ---- */
  .mdx-page { padding: 0 16px 32px; }

  /* ---- Hero ---- */
  .mdx-hero {
    gap: 14px;
    margin-bottom: 10px;
  }

  .mdx-hero-left { gap: 10px; }

  .mdx-hero-title {
    white-space: normal;
    font-size: clamp(24px, 7vw, 32px);
    padding-left: 29px;
  }

  .mdx-search {
    max-width: 100%;
    padding: 10px 16px;
  }

  /* ---- Heatmap: tighter label column for narrow viewports ---- */
  .mdx-heatmap-wrap {
    padding-left: 0;
    --mdx-heatmap-label-col: 27px;
  }

  .mdx-heatmap-label {
    font-size: 8px;
    letter-spacing: 0.04em;
  }

  /* ---- Results shell ---- */
  .mdx-results-shell {
    border-radius: 14px;
    margin-top: 8px;
  }

  /* ---- Toolbar: 2-row grid matching 3-col card layout ----
   * Row 1: Language (col 1) | Modality (cols 2–3)
   * Row 2: Size (col 1) | Newest (col 2) | Views (col 3)
   * Explicit grid-row fixes auto-placement: DOM order is size → views → newest,
   * but visual order must be size | newest | views; without row 2 all three sort
   * controls can end up mis-placed (e.g. newest on its own row).
   * minmax(0,1fr) lets columns shrink so sort labels stay on one line.
   */
  .mdx-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 6px;
    padding: 14px 16px 10px;
  }

  .mdx-toolbar-cell--title  { display: none; }
  .mdx-toolbar-cell          { justify-content: center; }

  .mdx-toolbar-cell--language { grid-column: 1 / 2; grid-row: 1; justify-content: flex-start; }
  .mdx-toolbar-cell--modality { grid-column: 2 / 4; grid-row: 1; justify-content: flex-start; }
  .mdx-toolbar-cell--size     { grid-column: 1; grid-row: 2; justify-content: center; }
  .mdx-toolbar-cell--newest   { grid-column: 2; grid-row: 2; justify-content: center; }
  .mdx-toolbar-cell--views    { grid-column: 3; grid-row: 2; justify-content: center; }

  .mdx-toolbar-cell--size .mdx-sort-btn,
  .mdx-toolbar-cell--newest .mdx-sort-btn,
  .mdx-toolbar-cell--views .mdx-sort-btn {
    max-width: 100%;
    white-space: nowrap;
    padding-left: 2px;
    padding-right: 2px;
    font-size: 13px;
  }

  /* ---- Card rows: 3-column layout matching toolbar headers ----
   * Row 1: full-width art banner
   * Row 2: size | newest | views  — 3 equal cols, centered
   * Row 3: language | modality    — 2 equal cols, centered
   */
  .mdx-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 0;
    padding: 10px 16px 14px;
  }

  .mdx-row > .mdx-card {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  /* Row 2: size | newest | views — DOM order is size, views, newest; explicit
   * columns match visual order (same issue as toolbar auto-placement). */
  .mdx-row > :nth-child(4) {            /* size */
    grid-column: 1; grid-row: 2;
    text-align: center; justify-self: stretch;
  }
  .mdx-row > :nth-child(6) {            /* newest */
    grid-column: 2; grid-row: 2;
    text-align: center; justify-self: stretch;
  }
  .mdx-row > :nth-child(5) {            /* views */
    grid-column: 3; grid-row: 2;
    text-align: center; justify-self: stretch;
  }

  /* Row 3: language | modality — equal halves, centered */
  .mdx-row > :nth-child(2) {            /* language */
    grid-column: 1 / 2; grid-row: 3;
    text-align: center; justify-self: stretch;
    font-size: 12px; color: var(--mdx-muted);
  }
  .mdx-row > :nth-child(3) {            /* modality */
    grid-column: 2 / 3; grid-row: 3;
    text-align: center; justify-self: stretch;
    font-size: 12px; color: var(--mdx-muted);
  }

  /* Mobile labels below each value */
  .mdx-row .mdx-col[data-label]::after {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    color: var(--mdx-muted-2);
    margin-top: 2px;
    line-height: 1;
  }

  .mdx-col { font-size: 13px; }

  .mdx-pagination { padding: 16px; }

  .mdx-legend {
    width: auto;
    left: 16px;
    right: 16px;
  }

  /* Active-state chips */
  .mdx-active-state { padding: 8px 16px 0; }
}
