/* ==========================================================================
   UUtah VDL & Atmospheric Sciences Design System (web/style.css)
   Implements STYLE_GUIDE.md tokens, typography, and modern-web-guidance rules.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Montserrat:wght@600;700&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
  /* Official University of Utah Palette — Light & Night-Obs Dark Pairs */
  --utah-red-light: #BE0000;
  --utah-red-dark: #E11D2E;
  --red-rocks-light: #890000;
  --red-rocks-dark: #FF4D5E;
  --granite-peak-light: #526B75;
  --granite-peak-dark: #8FAAB5;
  --zion-cinder-light: #6E6760;
  --zion-cinder-dark: #A39B93;

  --bg-canvas-light: #F4F5F6;
  --bg-canvas-dark: #0D1117;
  --bg-panel-light: #FFFFFF;
  --bg-panel-dark: #151B23;
  --bg-subtle-light: #E2E6E6;
  --bg-subtle-dark: #1E2631;

  --text-primary-light: #11151A;
  --text-primary-dark: #E8EEF4;
  --border-hairline-light: #CFD6D9;
  --border-hairline-dark: #2B3645;

  /* Data encoding tokens (Great Salt Lake, Wasatch Sunrise, Mountain Green) */
  --data-teal: #3ABFC0;
  --data-gold: #FFB81D;
  --data-green: #6CC24A;
  --data-crimson: #D92632;

  /* Default (Light) assignments */
  --brand: var(--utah-red-light);
  --brand-hover: var(--red-rocks-light);
  --muted: var(--granite-peak-light);
  --meta: var(--zion-cinder-light);
  --bg: var(--bg-canvas-light);
  --panel: var(--bg-panel-light);
  --subtle: var(--bg-subtle-light);
  --text: var(--text-primary-light);
  --border: var(--border-hairline-light);

  --font-display: 'Montserrat', system-ui, -apple-system, sans-serif;
  --font-sans: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
  accent-color: var(--brand);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  border-top: 3px solid var(--brand);
}

header.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-eyebrow {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.meta-line {
  font-size: 0.8rem;
  color: var(--muted);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.nav-links {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  background: var(--subtle);
  border: 1px solid var(--border);
}

.nav-links a.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

main.workspace {
  max-width: 1520px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 960px) {
  main.workspace {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.95rem;
}

.section-label,
label.field-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

select,
input[type="number"],
input[type="search"] {
  width: 100%;
  padding: 0.48rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
}

.geocode-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.btn-find {
  padding: 0.48rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--subtle);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.btn-find:hover {
  border-color: var(--brand);
}

.geo-results {
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 155px;
  overflow-y: auto;
}

.geo-results button {
  width: 100%;
  text-align: left;
  padding: 0.38rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
}

.geo-results button:hover {
  border-color: var(--brand);
  background: var(--subtle);
}

input[type="number"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  margin: 0.2rem 0 0.65rem;
}

table.telemetry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.35rem;
}

table.telemetry-table th,
table.telemetry-table td {
  padding: 0.42rem 0.35rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

table.telemetry-table th {
  font-family: var(--font-display);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

table.telemetry-table td.num,
table.telemetry-table th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}

.tab-btn {
  padding: 0.42rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--subtle);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
}

.tab-btn.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.plot-frame {
  width: 100%;
  text-align: center;
  background: var(--bg);
  border-radius: 4px;
  padding: 0.5rem;
  border: 1px solid var(--border);
}

.plot-frame img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
  display: block;
  margin: 0 auto;
}

.badge-truth {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  font-size: 0.78rem;
  background: var(--subtle);
  border-left: 3px solid var(--data-green);
  margin: 0.5rem 0 0.85rem;
}

button.primary {
  width: 100%;
  padding: 0.58rem;
  border-radius: 4px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

button.primary:hover {
  background: var(--brand-hover);
}

.model-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  margin: 0.35rem 0 0.85rem;
  font-size: 0.84rem;
}

.model-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

/* Fallback for older browsers without accent-color support */
@supports not (accent-color: var(--brand)) {
  input[type="checkbox"].visually-hidden {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
  }
  .model-checks label {
    position: relative;
    padding-left: 1.45rem;
  }
  input[type="checkbox"] + span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0.95rem;
    height: 0.95rem;
    border: 2px solid var(--border);
    background: var(--bg);
    border-radius: 2px;
  }
  input[type="checkbox"]:checked + span::before {
    background-color: var(--brand);
    border-color: var(--brand);
  }
  input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(to right, var(--brand) var(--progress, 50%), var(--border) var(--progress, 50%));
    border-radius: 3px;
  }
}

/* High-contrast Plotly unified hover tooltip overrides (WCAG AAA contrast in light & dark mode) */
.js-plotly-plot .plotly .hoverlayer .hovertext rect {
  fill: var(--panel) !important;
  fill-opacity: 0.97 !important;
  stroke: var(--brand) !important;
  stroke-width: 1.5px !important;
}

.js-plotly-plot .plotly .hoverlayer .hovertext text {
  fill: var(--text) !important;
  font-family: var(--font-mono) !important;
  font-weight: 600 !important;
}

/* Science & Methodology page layout */
main.doc-workspace {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  main.doc-workspace {
    grid-template-columns: 1fr;
  }
}

.toc-nav {
  position: sticky;
  top: 1rem;
}

.toc-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.toc-nav a {
  display: block;
  text-decoration: none;
  font-size: 0.82rem;
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  border-left: 2px solid transparent;
}

.toc-nav a:hover {
  background: var(--subtle);
  border-left-color: var(--brand);
}

.doc-section {
  margin-bottom: 1.25rem;
}

.doc-section h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.doc-section h3 {
  font-family: var(--font-display);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
  margin: 1rem 0 0.4rem;
}

.doc-section p,
.doc-section li {
  font-size: 0.92rem;
  line-height: 1.55;
}

.equation-box {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  padding: 0.7rem 0.9rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0.65rem 0;
  white-space: pre-wrap;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.65rem;
  margin: 0.75rem 0;
}

.pipeline-step {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--data-teal);
  border-radius: 4px;
  padding: 0.7rem;
}

.pipeline-step .step-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
}

.pipeline-step .step-title {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  margin: 0.2rem 0 0.35rem;
}

.pipeline-step p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

