/*
 * bsos-tokens.css — shared design tokens for bsos-data.umd.edu
 *
 * Loaded site-wide via header.html <link>. Purely additive:
 * defines CSS custom properties + a small set of utility classes
 * (ambient background layer, scroll-reveal affordances). Does NOT
 * override any CKAN or page-specific selectors.
 *
 * Local :root blocks on individual pages may still redefine any of
 * these tokens; the cascade leaves per-page intent intact.
 */

:root {
  /* Surface */
  --bsos-bg-warm: #f7f6f3;
  --bsos-bg-cool: #eff3f8;
  --bsos-surface: #ffffff;
  --bsos-surface-soft: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(243,247,252,0.96) 100%);
  --bsos-surface-strong: linear-gradient(158deg, rgba(255,255,255,0.98) 0%, rgba(237,244,255,0.93) 52%, rgba(239,250,255,0.90) 100%);

  /* Ink */
  --bsos-text: #18202c;
  --bsos-muted: #3f5168;
  --bsos-subtle: #667890;
  --bsos-border: rgba(201, 212, 229, 0.92);
  --bsos-border-strong: #cdd6e4;

  /* Brand */
  --bsos-terp-red: #d22630;
  --bsos-terp-gold: #ffd34d;
  --bsos-accent: #0a84ff;
  --bsos-accent-strong: #0066cc;

  /* Shared page backdrop */
  --bsos-page-background:
    radial-gradient(circle at 50% -10%, rgba(255, 211, 77, 0.16) 0%, rgba(255, 211, 77, 0) 34%),
    radial-gradient(circle at 14% 18%, rgba(210, 38, 48, 0.07) 0%, rgba(210, 38, 48, 0) 28%),
    radial-gradient(circle at 86% 22%, rgba(255, 211, 77, 0.08) 0%, rgba(255, 211, 77, 0) 26%),
    linear-gradient(180deg, var(--bsos-bg-warm) 0%, var(--bsos-bg-cool) 100%);

  /* Derived accent-bar gradient used on hero cards and list items */
  --bsos-accent-bar: linear-gradient(90deg, rgba(210, 38, 48, 0.82), rgba(255, 211, 77, 0.82));

  /* Tint washes (for section backgrounds) */
  --bsos-tint-blue:  #eaf2ff;
  --bsos-tint-cyan:  #ebf8ff;
  --bsos-tint-peach: #fff3e8;
  --bsos-tint-mint:  #eafcf5;

  /* Elevation */
  --bsos-shadow-sm: 0 10px 24px rgba(12, 33, 66, 0.05);
  --bsos-shadow-md: 0 14px 32px rgba(12, 33, 66, 0.07);
  --bsos-shadow-lg: 0 16px 40px rgba(10, 28, 56, 0.10);

  /* Radius */
  --bsos-radius-xl: 32px;
  --bsos-radius-lg: 22px;
  --bsos-radius-md: 18px;
  --bsos-radius-sm: 14px;
  --bsos-radius-pill: 999px;

  /* 8px spacing scale */
  --bsos-s-1:  8px;
  --bsos-s-2: 16px;
  --bsos-s-3: 24px;
  --bsos-s-4: 32px;
  --bsos-s-5: 40px;
  --bsos-s-6: 48px;
  --bsos-s-7: 64px;
  --bsos-s-8: 80px;

  /* Typography */
  --bsos-font: "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Theme controls */
  --bsos-theme-control-bg: rgba(255, 255, 255, 0.82);
  --bsos-theme-control-border: rgba(12, 33, 66, 0.12);
  --bsos-theme-control-shadow: 0 18px 34px rgba(12, 33, 66, 0.14);

  /* Analytics chart theme */
  --bsos-chart-text: #55697f;
  --bsos-chart-grid: rgba(12, 33, 66, 0.08);
  --bsos-chart-tooltip-bg: rgba(10, 18, 31, 0.94);
  --bsos-chart-tooltip-text: #f8fafc;

  /* Motion */
  --bsos-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html {
  color-scheme: light;
}

/* ──────────────────────────────────────────────────────────────
 * Ambient background layer
 * Add class="bsos-ambient" to any wrapper that should get the
 * warm→cool gradient with terp-red/terp-gold radial hotspots.
 * The layer is painted behind content via z-index: -1 so it never
 * intercepts pointer events or raises stacking-context surprises.
 * ────────────────────────────────────────────────────────────── */
.bsos-ambient {
  position: relative;
  isolation: isolate;
}
.bsos-ambient > * {
  position: relative;
  z-index: 1;
}
.bsos-ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bsos-page-background);
}
.bsos-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(210, 38, 48, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 211, 77, 0.03) 1px, transparent 1px);
  background-size: 160px 160px;
  -webkit-mask-image: radial-gradient(circle at 50% 32%, #000 0%, rgba(0,0,0,0.55) 42%, transparent 80%);
          mask-image: radial-gradient(circle at 50% 32%, #000 0%, rgba(0,0,0,0.55) 42%, transparent 80%);
  opacity: 0.6;
}

/* Corner motif slot — page can supply a faint SVG via custom property.
 * Usage: set --bsos-motif: url('/base/images/motif-network-nodes.svg') on
 * a .bsos-motif-corner element; the SVG renders at 5% opacity, blurred. */
.bsos-motif-corner {
  position: absolute;
  pointer-events: none;
  width: min(36vw, 420px);
  height: 260px;
  opacity: 0.05;
  filter: blur(0.4px);
  background-image: var(--bsos-motif, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.bsos-motif-corner.top-right    { top: -20px; right: -20px; }
.bsos-motif-corner.bottom-left  { bottom: -20px; left: -20px; }
.bsos-motif-corner.bottom-right { bottom: -20px; right: -20px; }

/* ──────────────────────────────────────────────────────────────
 * Scroll reveal — pair with bsosScrollAnimations.js.
 * Add data-bsos-reveal to any element to fade+slide in once on enter.
 * Fully skipped when the user prefers reduced motion.
 * ────────────────────────────────────────────────────────────── */
[data-bsos-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s var(--bsos-ease), transform 0.55s var(--bsos-ease);
  will-change: opacity, transform;
}
[data-bsos-reveal].is-in {
  opacity: 1;
  transform: none;
}
[data-bsos-reveal][data-bsos-reveal-delay="1"].is-in { transition-delay: 0.08s; }
[data-bsos-reveal][data-bsos-reveal-delay="2"].is-in { transition-delay: 0.16s; }
[data-bsos-reveal][data-bsos-reveal-delay="3"].is-in { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  [data-bsos-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* Focus ring utility — used by interactive polish layers */
.bsos-focus-ring:focus-visible {
  outline: 3px solid rgba(0, 102, 204, 0.35);
  outline-offset: 2px;
}

.bsos-theme-control-slot {
  position: relative;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
}

.masthead .bsos-theme-control-slot {
  flex: 0 0 auto;
  align-self: center;
  margin-left: 12px;
}

.guide-shell > .bsos-theme-control-slot,
.analytics-shell > .bsos-theme-control-slot {
  margin: 0 0 16px;
}

.bsos-theme-control-slot--floating {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1300;
}

body.bsos-theme-has-masthead .bsos-theme-control-slot--floating {
  top: 84px;
}

.bsos-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: min(100%, 338px);
  padding: 10px 12px;
  border: 1px solid var(--bsos-theme-control-border);
  border-radius: 22px;
  background: var(--bsos-theme-control-bg);
  box-shadow: var(--bsos-theme-control-shadow);
  -webkit-backdrop-filter: blur(14px);
          backdrop-filter: blur(14px);
}

.bsos-theme-toggle__meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bsos-theme-toggle__label {
  color: var(--bsos-subtle);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bsos-theme-toggle__headline {
  color: var(--bsos-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.bsos-theme-toggle__hint {
  color: var(--bsos-muted);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bsos-theme-toggle__options {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(12, 33, 66, 0.06);
}

.bsos-theme-toggle__button {
  min-width: 58px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--bsos-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s var(--bsos-ease), color 0.18s var(--bsos-ease), transform 0.18s var(--bsos-ease), box-shadow 0.18s var(--bsos-ease);
}

.bsos-theme-toggle__button:hover,
.bsos-theme-toggle__button:focus-visible {
  outline: none;
  color: var(--bsos-text);
  background: rgba(255, 255, 255, 0.72);
}

.bsos-theme-toggle__button.is-active {
  color: #ffffff;
  background: linear-gradient(180deg, #2696ff 0%, var(--bsos-accent-strong) 100%);
  box-shadow: 0 10px 18px rgba(0, 102, 204, 0.22);
}

.masthead .bsos-theme-toggle {
  max-width: 100%;
  padding: 8px 10px;
}

.masthead .bsos-theme-toggle__hint {
  display: none;
}

@media (max-width: 991px) {
  .masthead .bsos-theme-control-slot {
    order: 2;
    margin-left: auto;
    margin-right: 12px;
  }

  .masthead .main-navbar {
    order: 4;
    width: 100%;
  }

  .bsos-theme-toggle {
    max-width: min(100vw - 36px, 100%);
  }

  .bsos-theme-toggle__hint {
    display: none;
  }
}

@media (max-width: 640px) {
  .bsos-theme-toggle {
    gap: 8px;
    padding: 8px 10px;
  }

  .bsos-theme-toggle__meta {
    display: none;
  }

  .bsos-theme-toggle__button {
    min-width: 54px;
    padding: 8px 10px;
  }
}

/* Stock CKAN footer polish — keeps the existing links and language selector,
 * but recasts the footer using the same surface, accent-bar, and motif system
 * used across the refined CKAN pages. */
.site-footer {
  position: relative;
  margin-top: clamp(48px, 8vw, 88px);
  padding: 40px 0 34px;
  border-top: 1px solid var(--bsos-border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(236,244,253,0.94)),
    radial-gradient(circle at top left, rgba(210, 38, 48, 0.08), transparent 38%),
    radial-gradient(circle at top right, rgba(255, 211, 77, 0.14), transparent 34%);
  color: var(--bsos-muted);
  overflow: hidden;
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--bsos-accent-bar);
}

.site-footer::after {
  content: "";
  position: absolute;
  top: 18px;
  right: -28px;
  width: min(28vw, 300px);
  height: 180px;
  background: url('/base/images/motif-network-nodes.svg') center / contain no-repeat;
  opacity: 0.05;
  pointer-events: none;
}

.site-footer > .container {
  position: relative;
  z-index: 1;
}

.site-footer .row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 24px;
  margin: 0;
}

.site-footer [class*="col-md-"] {
  float: none;
  width: auto;
  max-width: none;
  padding: 0;
}

.site-footer .footer-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

.site-footer .footer-links > ul {
  position: relative;
  margin: 0;
  padding: 28px 0 0;
  list-style: none;
}

.site-footer .footer-links > ul::before {
  content: "Resources";
  position: absolute;
  top: 0;
  left: 0;
  color: var(--bsos-subtle);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer .footer-links > ul:first-child::before {
  content: "Repository";
}

.site-footer .footer-links > ul + ul::before {
  content: "Open Data";
}

.site-footer .footer-links li {
  margin: 0 0 10px;
}

.site-footer a {
  color: var(--bsos-accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus {
  color: var(--bsos-text);
  text-decoration: none;
}

.site-footer .footer-links img[alt="Open Data"] {
  display: inline-block;
  padding: 7px 12px;
  border: 1px solid rgba(12, 33, 66, 0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 8px 18px rgba(12, 33, 66, 0.08);
}

.site-footer .attribution {
  position: relative;
  padding: 28px 22px 22px;
  border: 1px solid rgba(12, 33, 66, 0.10);
  border-radius: 22px;
  background: rgba(255,255,255,0.76);
  box-shadow: var(--bsos-shadow-sm);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}

.site-footer .attribution::before {
  content: "Platform";
  position: absolute;
  top: 18px;
  left: 22px;
  color: var(--bsos-subtle);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer .attribution p {
  margin: 0 0 18px;
  color: var(--bsos-text);
  font-size: 14px;
  line-height: 1.6;
}

.site-footer .attribution p strong {
  font-weight: 800;
}

.site-footer .ckan-footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  height: auto;
  overflow: visible;
  text-indent: 0;
  white-space: normal;
  background: none !important;
  color: var(--bsos-accent-strong);
  font-size: inherit;
  font-weight: 800;
  line-height: inherit;
  vertical-align: baseline;
}

.site-footer .ckan-footer-logo::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bsos-terp-red), var(--bsos-terp-gold));
  box-shadow: 0 0 0 4px rgba(255, 211, 77, 0.16);
}

.site-footer .lang-select {
  display: block;
  margin: 0;
}

.site-footer .lang-select .form-group {
  display: grid;
  gap: 8px;
  margin: 0;
}

.site-footer .lang-select label {
  margin: 0;
  color: var(--bsos-subtle);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer .lang-select select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(12, 33, 66, 0.12);
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  color: var(--bsos-text);
}

.site-footer .lang-select select:focus-visible {
  outline: 3px solid rgba(0, 102, 204, 0.25);
  outline-offset: 2px;
}

@media (max-width: 991px) {
  .site-footer .row {
    grid-template-columns: 1fr;
  }

  .site-footer .footer-links {
    grid-template-columns: 1fr;
  }
}

html[data-bsos-theme="dark"] {
  color-scheme: dark;
  --bsos-bg-warm: #08101c;
  --bsos-bg-cool: #0f1828;
  --bsos-surface: rgba(11, 20, 33, 0.92);
  --bsos-surface-soft: linear-gradient(180deg, rgba(15, 25, 41, 0.98) 0%, rgba(10, 18, 30, 0.96) 100%);
  --bsos-surface-strong: linear-gradient(160deg, rgba(20, 31, 48, 0.98) 0%, rgba(10, 19, 33, 0.95) 56%, rgba(8, 16, 28, 0.94) 100%);
  --bsos-text: #e8f0fd;
  --bsos-muted: #b8c5da;
  --bsos-subtle: #8ea2bf;
  --bsos-border: rgba(109, 129, 161, 0.42);
  --bsos-border-strong: rgba(142, 166, 203, 0.56);
  --bsos-accent: #79bcff;
  --bsos-accent-strong: #abd4ff;
  --bsos-page-background:
    radial-gradient(circle at 50% -12%, rgba(255, 211, 77, 0.12) 0%, rgba(255, 211, 77, 0) 32%),
    radial-gradient(circle at 16% 20%, rgba(210, 38, 48, 0.12) 0%, rgba(210, 38, 48, 0) 28%),
    radial-gradient(circle at 84% 18%, rgba(121, 188, 255, 0.12) 0%, rgba(121, 188, 255, 0) 26%),
    linear-gradient(180deg, #07101b 0%, #0d1726 50%, #111c2d 100%);
  --bsos-tint-blue: rgba(16, 43, 78, 0.78);
  --bsos-tint-cyan: rgba(13, 60, 68, 0.74);
  --bsos-tint-peach: rgba(78, 36, 16, 0.72);
  --bsos-tint-mint: rgba(11, 66, 53, 0.72);
  --bsos-shadow-sm: 0 14px 28px rgba(0, 0, 0, 0.28);
  --bsos-shadow-md: 0 18px 36px rgba(0, 0, 0, 0.34);
  --bsos-shadow-lg: 0 22px 48px rgba(0, 0, 0, 0.4);
  --bsos-theme-control-bg: rgba(8, 15, 27, 0.84);
  --bsos-theme-control-border: rgba(145, 169, 204, 0.2);
  --bsos-theme-control-shadow: 0 20px 40px rgba(0, 0, 0, 0.34);
  --bsos-chart-text: #c0d0e6;
  --bsos-chart-grid: rgba(143, 160, 186, 0.18);
  --bsos-chart-tooltip-bg: rgba(3, 8, 15, 0.96);
  --bsos-chart-tooltip-text: #ecf4ff;
}

html[data-bsos-theme="dark"] body,
html[data-bsos-theme="dark"] .bsos-home-shell,
html[data-bsos-theme="dark"] .guide-shell,
html[data-bsos-theme="dark"] .analytics-shell,
html[data-bsos-theme="dark"] .wrapper,
html[data-bsos-theme="dark"] #content.container {
  background: var(--bsos-page-background);
  color: var(--bsos-text);
}

html[data-bsos-theme="dark"] a {
  color: var(--bsos-accent);
}

html[data-bsos-theme="dark"] a:hover,
html[data-bsos-theme="dark"] a:focus {
  color: #d7ecff;
}

html[data-bsos-theme="dark"] .bsos-ambient::after,
html[data-bsos-theme="dark"] .bsos-home-shell .main.hero::after,
html[data-bsos-theme="dark"] .bsos-hero::after,
html[data-bsos-theme="dark"] .guide-hero::after,
html[data-bsos-theme="dark"] .analytics-hero::after {
  opacity: 0.28;
}

html[data-bsos-theme="dark"] .bsos-hero::before,
html[data-bsos-theme="dark"] .guide-hero::before,
html[data-bsos-theme="dark"] .analytics-hero::before {
  opacity: 0.34;
}

html[data-bsos-theme="dark"] .guide-shell::before,
html[data-bsos-theme="dark"] .guide-shell::after,
html[data-bsos-theme="dark"] #content.container::before,
html[data-bsos-theme="dark"] #content.container::after,
html[data-bsos-theme="dark"] .site-footer::after {
  opacity: 0.08;
}

html[data-bsos-theme="dark"] .bsos-hero,
html[data-bsos-theme="dark"] .bsos-search-wrap form,
html[data-bsos-theme="dark"] .bsos-link-card,
html[data-bsos-theme="dark"] .bsos-howto,
html[data-bsos-theme="dark"] .bsos-howto-side,
html[data-bsos-theme="dark"] .bsos-min-stats,
html[data-bsos-theme="dark"] .bsos-min-kpi,
html[data-bsos-theme="dark"] .bsos-min-group,
html[data-bsos-theme="dark"] .bsos-dataset-shell,
html[data-bsos-theme="dark"] .bsos-method-filter,
html[data-bsos-theme="dark"] .bsos-group-filter,
html[data-bsos-theme="dark"] .secondary .module-narrow,
html[data-bsos-theme="dark"] .primary .search-form,
html[data-bsos-theme="dark"] .primary .well,
html[data-bsos-theme="dark"] .primary .alert,
html[data-bsos-theme="dark"] .primary .empty,
html[data-bsos-theme="dark"] .bsos-dataset-card,
html[data-bsos-theme="dark"] .secondary .module,
html[data-bsos-theme="dark"] .additional-info,
html[data-bsos-theme="dark"] .bsos-preview-section,
html[data-bsos-theme="dark"] .primary .module > .module-content.page-header,
html[data-bsos-theme="dark"] .primary .notes,
html[data-bsos-theme="dark"] .primary .prose-notes,
html[data-bsos-theme="dark"] .primary [property="rdfs:label"],
html[data-bsos-theme="dark"] .dataset-notes,
html[data-bsos-theme="dark"] .bsos-notes-shell,
html[data-bsos-theme="dark"] .primary .resource-item,
html[data-bsos-theme="dark"] .primary .resource-list li,
html[data-bsos-theme="dark"] .bsos-snapshot-section,
html[data-bsos-theme="dark"] .bsos-snapshot-item,
html[data-bsos-theme="dark"] .guide-hero,
html[data-bsos-theme="dark"] .hero-panel,
html[data-bsos-theme="dark"] .guide-panel,
html[data-bsos-theme="dark"] .detail-panel,
html[data-bsos-theme="dark"] .surface-panel,
html[data-bsos-theme="dark"] .pathway-card,
html[data-bsos-theme="dark"] .flow-panel,
html[data-bsos-theme="dark"] .metadata-panel,
html[data-bsos-theme="dark"] .method-panel,
html[data-bsos-theme="dark"] .hero-stat,
html[data-bsos-theme="dark"] .analytics-hero,
html[data-bsos-theme="dark"] .hero-summary,
html[data-bsos-theme="dark"] .hero-mini-stat,
html[data-bsos-theme="dark"] .toolbar,
html[data-bsos-theme="dark"] .tab-strip,
html[data-bsos-theme="dark"] .results-panel,
html[data-bsos-theme="dark"] .guide-card,
html[data-bsos-theme="dark"] .summary-card,
html[data-bsos-theme="dark"] .chart-card,
html[data-bsos-theme="dark"] .wrangling-table,
html[data-bsos-theme="dark"] .code-card,
html[data-bsos-theme="dark"] .resource-card,
html[data-bsos-theme="dark"] .dataset-card,
html[data-bsos-theme="dark"] .bsos-org-panel,
html[data-bsos-theme="dark"] .site-footer .attribution {
  background: var(--bsos-surface-soft);
  border-color: var(--bsos-border);
  box-shadow: var(--bsos-shadow-md);
  color: var(--bsos-text);
}

html[data-bsos-theme="dark"] .hero-panel,
html[data-bsos-theme="dark"] .hero-summary,
html[data-bsos-theme="dark"] .hero-stat,
html[data-bsos-theme="dark"] .hero-mini-stat,
html[data-bsos-theme="dark"] .bsos-snapshot-item {
  background: rgba(7, 15, 27, 0.78);
}

html[data-bsos-theme="dark"] .bsos-link-card:nth-child(1) {
  background: linear-gradient(165deg, rgba(14, 24, 39, 0.98) 0%, rgba(18, 43, 74, 0.9) 100%);
}

html[data-bsos-theme="dark"] .bsos-link-card:nth-child(2) {
  background: linear-gradient(165deg, rgba(14, 24, 39, 0.98) 0%, rgba(15, 58, 73, 0.88) 100%);
}

html[data-bsos-theme="dark"] .bsos-link-card:nth-child(3) {
  background: linear-gradient(165deg, rgba(14, 24, 39, 0.98) 0%, rgba(14, 61, 49, 0.88) 100%);
}

html[data-bsos-theme="dark"] .bsos-link-card:nth-child(4) {
  background: linear-gradient(165deg, rgba(14, 24, 39, 0.98) 0%, rgba(43, 34, 78, 0.88) 100%);
}

html[data-bsos-theme="dark"] .bsos-dataset-card.theme-health-wellbeing .bsos-card-body,
html[data-bsos-theme="dark"] .bsos-dataset-card.theme-covid-19-pandemic .bsos-card-body {
  background-image: linear-gradient(150deg, rgba(10, 19, 31, 0.98) 0%, rgba(9, 25, 34, 0.95) 100%), url('/base/images/motif-health-wave.svg');
}

html[data-bsos-theme="dark"] .bsos-dataset-card.theme-elections-governance .bsos-card-body {
  background-image: linear-gradient(150deg, rgba(10, 19, 31, 0.98) 0%, rgba(11, 24, 39, 0.95) 100%), url('/base/images/motif-governance-columns.svg');
}

html[data-bsos-theme="dark"] .bsos-dataset-card.theme-crime-public-safety .bsos-card-body,
html[data-bsos-theme="dark"] .bsos-dataset-card.theme-global-comparative .bsos-card-body {
  background-image: linear-gradient(150deg, rgba(10, 19, 31, 0.98) 0%, rgba(10, 21, 37, 0.95) 100%), url('/base/images/motif-network-nodes.svg');
}

html[data-bsos-theme="dark"] .bsos-dataset-card.theme-economics-employment .bsos-card-body,
html[data-bsos-theme="dark"] .bsos-dataset-card.theme-default .bsos-card-body {
  background-image: linear-gradient(150deg, rgba(10, 19, 31, 0.98) 0%, rgba(13, 23, 38, 0.95) 100%), url('/base/images/motif-data-grid.svg');
}

html[data-bsos-theme="dark"] .hero-kicker,
html[data-bsos-theme="dark"] .section-kicker,
html[data-bsos-theme="dark"] .panel-kicker,
html[data-bsos-theme="dark"] .hero-chip,
html[data-bsos-theme="dark"] .theme-chip,
html[data-bsos-theme="dark"] .bsos-howto-kicker,
html[data-bsos-theme="dark"] .bsos-dataset-shell .bsos-dataset-link,
html[data-bsos-theme="dark"] .bsos-filter-btn,
html[data-bsos-theme="dark"] .primary .module > .module-content.page-header .nav-tabs li a,
html[data-bsos-theme="dark"] .primary .tag,
html[data-bsos-theme="dark"] .primary .tag-list li a,
html[data-bsos-theme="dark"] .primary .dataset-tags a,
html[data-bsos-theme="dark"] .bsos-signal-pill,
html[data-bsos-theme="dark"] .bsos-min-chip,
html[data-bsos-theme="dark"] .bsos-min-group .g-prompt,
html[data-bsos-theme="dark"] .pill,
html[data-bsos-theme="dark"] .tag,
html[data-bsos-theme="dark"] .button-secondary,
html[data-bsos-theme="dark"] .hero-button.secondary,
html[data-bsos-theme="dark"] .primary .pagination > li > a,
html[data-bsos-theme="dark"] .primary .pagination > li > span {
  background: linear-gradient(180deg, rgba(18, 31, 49, 0.96) 0%, rgba(9, 17, 30, 0.98) 100%);
  border-color: rgba(122, 147, 184, 0.32);
  color: var(--bsos-text);
  box-shadow: none;
}

html[data-bsos-theme="dark"] .button-local {
  background: linear-gradient(180deg, rgba(88, 46, 18, 0.92) 0%, rgba(60, 29, 10, 0.98) 100%);
  border-color: rgba(214, 128, 65, 0.32);
  color: #ffd8bc;
}

html[data-bsos-theme="dark"] .bsos-filter-btn:hover,
html[data-bsos-theme="dark"] .bsos-filter-btn.active,
html[data-bsos-theme="dark"] .button-secondary:hover,
html[data-bsos-theme="dark"] .button-secondary:focus-visible,
html[data-bsos-theme="dark"] .hero-button.secondary:hover,
html[data-bsos-theme="dark"] .hero-button.secondary:focus-visible,
html[data-bsos-theme="dark"] .primary .module > .module-content.page-header .nav-tabs li.active a,
html[data-bsos-theme="dark"] .primary .module > .module-content.page-header .nav-tabs li a:hover,
html[data-bsos-theme="dark"] .primary .module > .module-content.page-header .nav-tabs li a:focus,
html[data-bsos-theme="dark"] .primary .pagination > .active > a,
html[data-bsos-theme="dark"] .primary .pagination > .active > span,
html[data-bsos-theme="dark"] .primary .pagination > .active > a:hover,
html[data-bsos-theme="dark"] .primary .pagination > .active > span:hover {
  background: linear-gradient(180deg, #329dff 0%, #0c72de 100%);
  border-color: #329dff;
  color: #ffffff;
}

html[data-bsos-theme="dark"] .button-local:hover,
html[data-bsos-theme="dark"] .button-local:focus-visible {
  background: linear-gradient(180deg, rgba(108, 59, 24, 0.96) 0%, rgba(72, 34, 12, 0.98) 100%);
  color: #ffffff;
}

html[data-bsos-theme="dark"] .pill-group {
  background: rgba(20, 56, 92, 0.82);
  border-color: rgba(92, 137, 190, 0.42);
  color: #dbe9ff;
}

html[data-bsos-theme="dark"] .pill-access {
  background: rgba(18, 68, 54, 0.82);
  border-color: rgba(76, 170, 142, 0.4);
  color: #d7fff1;
}

html[data-bsos-theme="dark"] .pill-status-imported {
  background: rgba(17, 55, 95, 0.82);
  border-color: rgba(93, 146, 201, 0.42);
  color: #eaf4ff;
}

html[data-bsos-theme="dark"] .pill-flag {
  background: rgba(91, 47, 18, 0.84);
  border-color: rgba(214, 128, 65, 0.4);
  color: #ffddc2;
}

html[data-bsos-theme="dark"] .local-pill {
  background: rgba(68, 39, 103, 0.84);
  border-color: rgba(153, 112, 214, 0.4);
  color: #efe3ff;
}

html[data-bsos-theme="dark"] .bsos-link-card i,
html[data-bsos-theme="dark"] .bsos-min-group .g-title i,
html[data-bsos-theme="dark"] .bsos-min-group .g-title .g-figure,
html[data-bsos-theme="dark"] .bsos-min-group .g-bg-icon {
  background: linear-gradient(180deg, rgba(18, 31, 49, 0.96) 0%, rgba(9, 17, 30, 0.98) 100%);
  border-color: rgba(122, 147, 184, 0.32);
  color: var(--bsos-muted);
  box-shadow: none;
}

html[data-bsos-theme="dark"] .bsos-hero h1,
html[data-bsos-theme="dark"] .bsos-link-card strong,
html[data-bsos-theme="dark"] .bsos-min-stats h2,
html[data-bsos-theme="dark"] .bsos-min-kpi .val,
html[data-bsos-theme="dark"] .bsos-min-group strong,
html[data-bsos-theme="dark"] .bsos-dataset-shell h1,
html[data-bsos-theme="dark"] .bsos-card-title,
html[data-bsos-theme="dark"] .bsos-card-title a,
html[data-bsos-theme="dark"] .primary .heading,
html[data-bsos-theme="dark"] .primary h1.heading,
html[data-bsos-theme="dark"] .bsos-snapshot-head h3,
html[data-bsos-theme="dark"] .hero-copy h1,
html[data-bsos-theme="dark"] .hero-panel h2,
html[data-bsos-theme="dark"] .hero-stat strong,
html[data-bsos-theme="dark"] .hero-summary h2,
html[data-bsos-theme="dark"] .toolbar-head h2,
html[data-bsos-theme="dark"] .hero-mini-stat strong,
html[data-bsos-theme="dark"] .dataset-card h4,
html[data-bsos-theme="dark"] .detail-title,
html[data-bsos-theme="dark"] .site-footer .attribution p,
html[data-bsos-theme="dark"] .site-footer .ckan-footer-logo {
  color: var(--bsos-text);
}

html[data-bsos-theme="dark"] .bsos-link-card span,
html[data-bsos-theme="dark"] .hero-copy p,
html[data-bsos-theme="dark"] .hero-panel p,
html[data-bsos-theme="dark"] .hero-list li,
html[data-bsos-theme="dark"] .toolbar-head p,
html[data-bsos-theme="dark"] .field label,
html[data-bsos-theme="dark"] .hero-summary p,
html[data-bsos-theme="dark"] .guide-panel p,
html[data-bsos-theme="dark"] .detail-panel p,
html[data-bsos-theme="dark"] .surface-panel p,
html[data-bsos-theme="dark"] .pathway-card p,
html[data-bsos-theme="dark"] .bsos-min-subtitle,
html[data-bsos-theme="dark"] .bsos-min-kpi .lbl,
html[data-bsos-theme="dark"] .bsos-min-kpi small,
html[data-bsos-theme="dark"] .bsos-min-group .g-copy,
html[data-bsos-theme="dark"] .bsos-resource-count,
html[data-bsos-theme="dark"] .primary .search-results,
html[data-bsos-theme="dark"] .primary .dataset-heading,
html[data-bsos-theme="dark"] .primary .search-results-count,
html[data-bsos-theme="dark"] .primary .search-form .control-order-by,
html[data-bsos-theme="dark"] .primary .search-form .form-inline,
html[data-bsos-theme="dark"] .primary .search-form .search-input + *,
html[data-bsos-theme="dark"] .primary .dataset-resources,
html[data-bsos-theme="dark"] .primary .search-facets,
html[data-bsos-theme="dark"] .primary .facets,
html[data-bsos-theme="dark"] .primary .facet-list,
html[data-bsos-theme="dark"] .hero-stat span,
html[data-bsos-theme="dark"] .muted-table-name,
html[data-bsos-theme="dark"] .empty-state,
html[data-bsos-theme="dark"] .site-footer,
html[data-bsos-theme="dark"] .site-footer .footer-links > ul::before,
html[data-bsos-theme="dark"] .site-footer .attribution::before,
html[data-bsos-theme="dark"] .site-footer .lang-select label {
  color: var(--bsos-muted);
}

html[data-bsos-theme="dark"] input,
html[data-bsos-theme="dark"] select,
html[data-bsos-theme="dark"] textarea,
html[data-bsos-theme="dark"] .form-control,
html[data-bsos-theme="dark"] .primary .search-form .search-giant input,
html[data-bsos-theme="dark"] .primary .search-form input[type="text"],
html[data-bsos-theme="dark"] .primary .search-form .form-control,
html[data-bsos-theme="dark"] .masthead .site-search input,
html[data-bsos-theme="dark"] .site-footer .lang-select select {
  background: rgba(8, 15, 27, 0.82);
  border-color: rgba(122, 147, 184, 0.32);
  color: var(--bsos-text);
  box-shadow: none;
}

html[data-bsos-theme="dark"] input::placeholder,
html[data-bsos-theme="dark"] textarea::placeholder,
html[data-bsos-theme="dark"] .masthead .site-search input::placeholder {
  color: var(--bsos-subtle);
}

html[data-bsos-theme="dark"] select option {
  background: #0b1421;
  color: var(--bsos-text);
}

html[data-bsos-theme="dark"] .table,
html[data-bsos-theme="dark"] .preview-table,
html[data-bsos-theme="dark"] .wrangling-table table {
  border-color: var(--bsos-border);
}

html[data-bsos-theme="dark"] .table th,
html[data-bsos-theme="dark"] .preview-table th,
html[data-bsos-theme="dark"] .wrangling-table th,
html[data-bsos-theme="dark"] .additional-info .table th {
  background: rgba(14, 24, 39, 0.95);
  border-color: var(--bsos-border);
  color: var(--bsos-text);
}

html[data-bsos-theme="dark"] .table td,
html[data-bsos-theme="dark"] .preview-table td,
html[data-bsos-theme="dark"] .wrangling-table td,
html[data-bsos-theme="dark"] .additional-info .table td {
  background: rgba(8, 15, 27, 0.68);
  border-color: var(--bsos-border);
  color: var(--bsos-muted);
}

html[data-bsos-theme="dark"] .preview-table tbody tr:nth-child(even) td,
html[data-bsos-theme="dark"] .wrangling-table tbody tr:nth-child(even) td {
  background: rgba(10, 18, 30, 0.82);
}

html[data-bsos-theme="dark"] pre,
html[data-bsos-theme="dark"] code,
html[data-bsos-theme="dark"] .code-card pre,
html[data-bsos-theme="dark"] .code-card code {
  background: rgba(4, 10, 18, 0.9);
  color: #e8f0fd;
}

html[data-bsos-theme="dark"] .site-footer {
  border-top-color: var(--bsos-border);
  background:
    linear-gradient(180deg, rgba(9, 16, 28, 0.98), rgba(13, 22, 38, 0.96)),
    radial-gradient(circle at top left, rgba(210, 38, 48, 0.18), transparent 38%),
    radial-gradient(circle at top right, rgba(255, 211, 77, 0.16), transparent 34%);
}

html[data-bsos-theme="dark"] .site-footer a {
  color: var(--bsos-accent-strong);
}

html[data-bsos-theme="dark"] .site-footer a:hover,
html[data-bsos-theme="dark"] .site-footer a:focus {
  color: #ffffff;
}

html[data-bsos-theme="dark"] .site-footer .footer-links img[alt="Open Data"] {
  background: rgba(8, 15, 27, 0.82);
  border-color: rgba(122, 147, 184, 0.32);
  box-shadow: none;
}

html[data-bsos-theme="dark"] .site-footer .ckan-footer-logo::before {
  box-shadow: 0 0 0 4px rgba(255, 211, 77, 0.1);
}
