@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&family=IBM+Plex+Sans+Condensed:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg-deep: #f3f3ee;
  --bg-primary: #f8f8f3;
  --bg-panel: #f2f2eb;
  --bg-panel-soft: #e5e5dd;
  --bg-strong: #101012;
  --bg-strong-soft: #2f2f35;

  --text-primary: #101012;
  --text-secondary: #2f2f35;
  --text-muted: #575760;
  --text-dark: #fafaf7;

  --border-strong: #101012;
  --border-muted: #6b6b73;
  --shadow-offset: 6px 6px 0 rgba(16, 16, 18, 0.86);
  --shadow-soft: 4px 4px 0 rgba(16, 16, 18, 0.72);

  --panel-hover: #e9e9e1;
  --table-rule: #9ca3af;
  --table-stripe-bg: #e8e8df;
  --table-hover-bg: #ddddd3;
  --form-bg: #f8f8f3;
  --form-optgroup-bg: #ecece4;
  --table-header-bg: #ecece4;
  --table-header-text: #101012;
  --table-cell-bg: rgba(248, 248, 243, 0.92);
  --table-cell-text: #101012;
  --table-border-color: rgba(16, 16, 18, 0.18);
  --table-selected-bg: rgba(16, 16, 18, 0.1);
  --table-selected-border: rgba(16, 16, 18, 0.28);
  --plot-font-color: #101012;
  --plot-title-color: #101012;
  --plot-grid-color: rgba(16, 16, 18, 0.12);
  --plot-line-color: rgba(16, 16, 18, 0.24);
  --plot-hover-bg: #f8f8f3;
  --plot-hover-border: #101012;
  --plot-hover-font: #101012;

  --radius-sm: 0;
  --radius-md: 2px;

  --font-display: "Archivo Black", sans-serif;
  --font-body: "IBM Plex Sans Condensed", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

html[data-theme="dark"] {
  --bg-deep: #0b0b0c;
  --bg-primary: #121214;
  --bg-panel: #1a1a1d;
  --bg-panel-soft: #202024;
  --bg-strong: #f4f4f5;
  --bg-strong-soft: #d4d4d8;

  --text-primary: #f8fafc;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --text-dark: #101012;

  --border-strong: #f4f4f5;
  --border-muted: #71717a;
  --shadow-offset: 6px 6px 0 #f4f4f5;
  --shadow-soft: 4px 4px 0 #d4d4d8;

  --panel-hover: #2a2a30;
  --table-rule: #4b5563;
  --table-stripe-bg: #212126;
  --table-hover-bg: #2d2d35;
  --form-bg: #111113;
  --form-optgroup-bg: #1f1f23;
  --table-header-bg: rgba(15, 20, 31, 0.96);
  --table-header-text: #f5f7fb;
  --table-cell-bg: rgba(8, 12, 18, 0.72);
  --table-cell-text: #f5f7fb;
  --table-border-color: rgba(255, 255, 255, 0.08);
  --table-selected-bg: rgba(249, 115, 22, 0.16);
  --table-selected-border: rgba(249, 115, 22, 0.25);
  --plot-font-color: #f5f5f5;
  --plot-title-color: #fafafa;
  --plot-grid-color: rgba(255, 255, 255, 0.12);
  --plot-line-color: rgba(255, 255, 255, 0.24);
  --plot-hover-bg: #111111;
  --plot-hover-border: #f5f5f5;
  --plot-hover-font: #fafafa;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
}

a {
  color: var(--text-primary);
  text-decoration: none;
}

a:hover {
  color: var(--text-secondary);
}

.shell-root {
  min-height: 100vh;
}

.shell-noise,
.shell-orb,
.shell-badge,
.shell-stat {
  display: none;
}

.shell-header {
  padding: 1rem 0 0.5rem;
}

.shell-hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.shell-hero-copy,
.shell-nav-panel,
.shell-main,
.card {
  background: var(--bg-panel);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-offset);
}

.shell-hero-copy {
  padding: 1rem 1.1rem;
}

.shell-kicker,
.shell-panel-label,
.shell-page-label {
  display: inline-block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.shell-kicker::before,
.shell-panel-label::before,
.shell-page-label::before {
  content: none;
}

.shell-title,
.shell-page-title,
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.shell-title {
  margin: 0.35rem 0 0.55rem;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  line-height: 1;
}

.shell-subtitle {
  margin: 0;
  max-width: 52rem;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.shell-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.9rem;
}

.btn,
.shell-cta-primary,
.shell-cta-secondary,
.shell-theme-toggle {
  border-radius: var(--radius-sm) !important;
  border: 2px solid var(--border-strong) !important;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.55rem 0.8rem;
  box-shadow: var(--shadow-soft);
}

.btn-primary,
.shell-cta-primary {
  background: var(--bg-strong) !important;
  color: var(--text-dark) !important;
}

.btn-primary:hover,
.shell-cta-primary:hover {
  background: var(--bg-strong-soft) !important;
  color: var(--text-dark) !important;
}

.btn-secondary,
.btn-outline-secondary,
.shell-cta-secondary,
.shell-theme-toggle {
  background: transparent !important;
  color: var(--text-primary) !important;
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.shell-cta-secondary:hover,
.shell-theme-toggle:hover {
  background: var(--panel-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text-primary) !important;
}

.shell-theme-toggle {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-left: auto;
  background: var(--bg-panel-soft) !important;
  color: var(--text-secondary) !important;
  cursor: pointer;
}

.shell-theme-toggle .sun-icon,
.shell-theme-toggle .moon-icon {
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 180ms ease;
}

.shell-theme-toggle:hover .sun-icon,
.shell-theme-toggle:hover .moon-icon {
  transform: rotate(15deg);
}

.shell-theme-toggle .sun-icon {
  display: none;
}

.shell-theme-toggle .moon-icon {
  display: block;
}

html[data-theme="dark"] .shell-theme-toggle .sun-icon {
  display: block;
}

html[data-theme="dark"] .shell-theme-toggle .moon-icon {
  display: none;
}

.shell-body {
  padding-bottom: 2rem;
}

.shell-nav-panel {
  padding: 0.35rem;
}

.shell-nav {
  display: flex;
}

.shell-nav .nav-link,
.shell-nav-link {
  border-radius: var(--radius-sm) !important;
  border: 2px solid transparent !important;
  padding: 0.5rem 0.75rem !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
}

.shell-nav .nav-link:hover {
  background: var(--panel-hover) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-strong) !important;
}

.shell-nav .nav-link.active {
  background: var(--bg-strong) !important;
  color: var(--text-dark) !important;
  border-color: var(--border-strong) !important;
  box-shadow: var(--shadow-soft);
}

.shell-main {
  padding: 1rem;
  min-width: 0;
}

.shell-page-head {
  margin-bottom: 1rem;
}

.shell-page-title {
  margin: 0.25rem 0 0;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.1;
}

.card {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.card-body {
  padding: 0.9rem;
  min-width: 0;
}

.card-title {
  margin-bottom: 0.7rem;
  font-size: 1rem;
}

.card-text,
p,
small,
.text-muted,
.form-text,
label,
.form-label,
th,
td {
  color: var(--text-secondary) !important;
}

.explorer-metric-value,
.overview-page .card-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
}

.form-select,
.form-control {
  min-height: 2.6rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: var(--form-bg);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
}

.form-select:focus,
.form-control:focus {
  background: var(--form-bg);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
}

.form-select option {
  color: var(--text-primary);
  background: var(--form-bg);
}

.form-select optgroup {
  color: var(--text-primary);
  background: var(--form-optgroup-bg);
}

.table {
  color: var(--text-primary);
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  background: transparent !important;
  color: inherit;
  border-bottom: 1px solid var(--table-rule);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: var(--table-stripe-bg) !important;
}

.table-hover > tbody > tr:hover > * {
  background: var(--table-hover-bg) !important;
}

.dash-graph,
.js-plotly-plot,
.plot-container,
.plot-container .svg-container {
  background: transparent !important;
  max-width: 100% !important;
}

.shell-main .row > *,
.page-container,
.overview-page,
.taxonomy-page,
.environment-page,
.annotations-page,
.clusters-page {
  min-width: 0;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner table {
  border-collapse: separate;
}

.shell-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.2rem 0 0.25rem;
}

.shell-footer-copy,
.shell-footer-link {
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 991px) {
  .shell-main {
    padding: 0.85rem;
  }

  .shell-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 767px) {
  .shell-hero-copy {
    padding: 0.85rem 0.9rem;
  }

  .shell-title {
    font-size: 1.75rem;
  }

  .shell-subtitle {
    font-size: 0.92rem;
  }

  .shell-nav .nav-link,
  .shell-nav-link {
    width: 100%;
    text-align: center;
    font-size: 0.72rem;
    padding: 0.45rem 0.55rem !important;
  }

  .shell-nav {
    gap: 0.35rem;
  }

  .card-body {
    padding: 0.8rem;
  }

  .shell-theme-toggle {
    margin-left: 0;
  }

  .js-plotly-plot,
  .plot-container,
  .plot-container .svg-container {
    width: 100% !important;
  }
}

@media (max-width: 575px) {
  .shell-main {
    padding: 0.75rem;
  }

  .card-body {
    padding: 0.75rem;
  }

  #overview-taxonomy-treemap .js-plotly-plot,
  #overview-taxonomy-treemap .plot-container,
  #overview-taxonomy-treemap .svg-container,
  #overview-environment-treemap .js-plotly-plot,
  #overview-environment-treemap .plot-container,
  #overview-environment-treemap .svg-container,
  #overview-scatter .js-plotly-plot,
  #overview-scatter .plot-container,
  #overview-scatter .svg-container,
  #taxonomy-distribution-graph .js-plotly-plot,
  #taxonomy-distribution-graph .plot-container,
  #taxonomy-distribution-graph .svg-container,
  #taxonomy-sankey-graph .js-plotly-plot,
  #taxonomy-sankey-graph .plot-container,
  #taxonomy-sankey-graph .svg-container,
  #environment-bar-chart .js-plotly-plot,
  #environment-bar-chart .plot-container,
  #environment-bar-chart .svg-container,
  #environment-pie-chart .js-plotly-plot,
  #environment-pie-chart .plot-container,
  #environment-pie-chart .svg-container,
  #clusters-bar-chart .js-plotly-plot,
  #clusters-bar-chart .plot-container,
  #clusters-bar-chart .svg-container,
  #annotation-heatmap .js-plotly-plot,
  #annotation-heatmap .plot-container,
  #annotation-heatmap .svg-container {
    max-height: 24rem !important;
  }
}
