/*
 * Campbell Scientific styling for the Furo theme.
 *
 * Colors live in conf.py (html_theme_options light_css_variables /
 * dark_css_variables). This file only holds the structural accents that
 * cannot be expressed as a Furo color variable: the gold rules, the
 * charcoal table header type, the sidebar current-page marker, and the
 * logo sizing.
 */

:root {
  --csi-gold: #ffc425;
  --csi-gold-soft: rgba(255, 196, 37, 0.45);
  --csi-charcoal: #4a4b4d;
}

/* ---- Sidebar brand block -------------------------------------------------
 * Furo stacks the logo above the site title; lay them out as one row
 * instead -- shield on the left, white lightly letterspaced type beside it,
 * both over a gold rule -- so the header reads like the logo itself.
 * ------------------------------------------------------------------------ */
.sidebar-brand {
  align-items: center;
  border-bottom: 2px solid var(--csi-gold);
  flex-direction: row;
  gap: 0.6rem;
  padding-bottom: 0.7rem;
}

.sidebar-brand-text {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0;
}

.sidebar-logo-container {
  flex-shrink: 0;
  margin: 0;
}

.sidebar-logo {
  height: 2.4rem;
  margin: 0;
  max-width: none;
  width: auto;
}

/* The mobile top bar shows the title but not the logo; mark it with the
 * shield so the brand survives on narrow screens. Furo puts the title in a
 * block-level div, so the anchor has to become a row for the two to sit
 * side by side. */
.mobile-header .header-center a {
  align-items: center;
  display: flex;
  gap: 0.4em;
  justify-content: center;
}

.mobile-header .header-center a::before {
  background: center / contain no-repeat url("cs_shield.svg");
  content: "";
  flex-shrink: 0;
  height: 1.3em;
  width: 1.45em;
}

/* Section captions in the nav, set like the "SCIENTIFIC" line of the logo. */
.sidebar-tree .caption {
  font-size: var(--font-size--small--2);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Gold marker on the page you are currently reading. */
.sidebar-tree .current-page > .reference {
  border-left: 3px solid var(--csi-gold);
  font-weight: 600;
  padding-left: calc(var(--sidebar-item-spacing-horizontal) - 3px);
}

/* ---- Headings ----------------------------------------------------------- */
.content h1 {
  border-bottom: 2px solid var(--csi-gold);
  padding-bottom: 0.3em;
}

.content h2 {
  border-bottom: 1px solid var(--color-background-border);
  padding-bottom: 0.2em;
}

/* Rubrics read as gold sub-labels rather than plain small caps. */
.content p.rubric {
  color: var(--color-foreground-secondary);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.content p.rubric::before {
  background: var(--csi-gold);
  content: "";
  display: inline-block;
  height: 0.9em;
  margin-right: 0.5em;
  vertical-align: -0.1em;
  width: 3px;
}

/* ---- Tables ------------------------------------------------------------- */
/* The header row is charcoal (--color-table-header-background in conf.py),
 * so its type has to be white. Stub-column cells in the body are also <th>,
 * but a full column of charcoal is too heavy, so they get a light panel. */
table.docutils thead th,
table.docutils thead th p {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

table.docutils tbody th {
  background: var(--color-background-secondary);
  color: var(--color-foreground-primary);
}

table.docutils tbody tr:nth-child(2n) td {
  background: var(--color-background-secondary);
}

/* ---- Code blocks -------------------------------------------------------- */
.content div.highlight,
.content div.literal-block-wrapper {
  border: 1px solid var(--color-background-border);
  border-left: 3px solid var(--csi-gold-soft);
  border-radius: 0.2rem;
}

.content div.literal-block-wrapper div.highlight {
  border: none;
}

.content div.code-block-caption {
  background: var(--color-background-secondary);
  font-size: var(--font-size--small);
  font-weight: 600;
}

/* ---- Admonitions -------------------------------------------------------- */
/* Colors come from conf.py: generic `.. admonition::` blocks are neutral
 * charcoal, `note` is gold, and caution/warning/danger keep their own hues. */
.content .admonition {
  border-radius: 0.2rem;
}

.content .admonition > .admonition-title {
  letter-spacing: 0.01em;
}

/* ---- Links -------------------------------------------------------------- */
a:hover {
  text-decoration-thickness: 2px;
}

/* ---- Page footer -------------------------------------------------------
 * The build-date / sha line comes from _templates/page.html, which replaces
 * Furo's own credit. Give it the same gold rule the headings use.
 * ------------------------------------------------------------------------ */
.bottom-of-page {
  border-top: 2px solid var(--csi-gold);
}

/* Transitions (`----`) in page content. */
.content hr.docutils {
  background: linear-gradient(90deg, var(--csi-gold), var(--color-background-border));
  border: none;
  height: 2px;
  margin-top: 2.5rem;
}

/* ---- Selection ---------------------------------------------------------- */
::selection {
  background: var(--csi-gold);
  color: #26272a;
}
