/* ==========================================================================
   cogradio.org — theme
   Layered on vendored Bootstrap 5.3.8. Loaded after it; overrides only.

   Amber (--cr-accent) is rationed: band labels, rules, counts, links, section
   markers. It is never used for body text. That single rule is what keeps the
   dark register reading as an instrument panel rather than as costume.
   ========================================================================== */

:root {
  --cr-bg:        #0d1117;   /* page ground */
  --cr-recessed:  #010409;   /* sunk panel — mastheads, diagram bands */
  --cr-raised:    #161b22;   /* lifted panel — cards */
  --cr-rule:      #21262d;
  --cr-rule-hi:   #30363d;
  --cr-accent:    #d99a2b;
  --cr-accent-dim:#8a6218;
  --cr-head:      #f0f6fc;
  --cr-body:      #c9d1d9;
  --cr-muted:     #8b949e;
  --cr-faint:     #6e7681;

  --cr-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
  --cr-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
             "Liberation Mono", monospace;

  --cr-gut: clamp(1rem, 4vw, 2.5rem);
}

/* --- base ---------------------------------------------------------------- */

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--cr-bg);
  color: var(--cr-body);
  font-family: var(--cr-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { color: var(--cr-head); font-weight: 650; letter-spacing: -0.011em; }
h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.12; }
h2 { font-size: clamp(1.35rem, 2.8vw, 1.85rem); line-height: 1.2; }
h3 { font-size: 1.08rem; }

a { color: var(--cr-accent); text-decoration: none; }
a:hover, a:focus-visible { color: #f0b44b; text-decoration: underline; text-underline-offset: 3px; }

/* Keyboard focus must stay visible against the dark ground. */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--cr-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.cr-shell { max-width: 1080px; margin-inline: auto; padding-inline: var(--cr-gut); }

/* Bootstrap ships <code> in pink (#d63384). Inline code here is ontology terms
   and URIs — part of the prose, not an alert. */
code {
  font-family: var(--cr-mono);
  font-size: .92em;
  color: var(--cr-body);
  background: var(--cr-raised);
  border: 1px solid var(--cr-rule);
  border-radius: 2px;
  padding: .08em .34em;
}

/* Small uppercase label. Used for every section marker on the site. */
.cr-eyebrow {
  font-family: var(--cr-mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--cr-accent);
  margin: 0 0 .85rem;
}

.cr-lede { font-size: 1.075rem; color: var(--cr-muted); max-width: 62ch; }

/* --- masthead ------------------------------------------------------------ */

.cr-masthead {
  background: var(--cr-recessed);
  border-bottom: 1px solid var(--cr-rule);
  position: sticky; top: 0; z-index: 20;
}
.cr-masthead .cr-shell {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 58px; flex-wrap: wrap;
}
.cr-brand {
  font-family: var(--cr-mono);
  font-size: .95rem; font-weight: 700; letter-spacing: .22em;
  color: var(--cr-accent); margin-right: auto; text-transform: uppercase;
}
.cr-brand:hover { color: var(--cr-accent); text-decoration: none; }
.cr-brand span { color: var(--cr-faint); letter-spacing: .12em; font-weight: 400; }

.cr-nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.cr-nav a {
  font-family: var(--cr-mono);
  font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--cr-muted); padding: .35rem 0;
  border-bottom: 2px solid transparent;
}
.cr-nav a:hover { color: var(--cr-head); text-decoration: none; }
.cr-nav a[aria-current="page"] { color: var(--cr-head); border-bottom-color: var(--cr-accent); }

/* --- hero ---------------------------------------------------------------- */

.cr-hero { padding: clamp(2.75rem, 7vw, 5rem) 0 clamp(2rem, 4vw, 3rem); }
.cr-hero h1 { margin: 0 0 1.1rem; max-width: 20ch; }
.cr-hero .cr-lede { margin: 0 0 1.9rem; }

.cr-btn {
  display: inline-block;
  font-family: var(--cr-mono);
  font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: .78rem 1.5rem;
  background: var(--cr-accent); color: #0d1117 !important;
  border: 1px solid var(--cr-accent); border-radius: 2px;
}
.cr-btn:hover { background: #f0b44b; border-color: #f0b44b; text-decoration: none; }
.cr-btn--ghost {
  background: transparent; color: var(--cr-accent) !important;
  border-color: var(--cr-rule-hi);
}
.cr-btn--ghost:hover { background: transparent; border-color: var(--cr-accent); color: #f0b44b !important; }

.cr-btnrow { display: flex; gap: .8rem; flex-wrap: wrap; }

/* --- stat strip ---------------------------------------------------------- */

.cr-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--cr-rule);
  border-block: 1px solid var(--cr-rule);
}
.cr-stat { background: var(--cr-bg); padding: 1.15rem var(--cr-gut); }
.cr-stat b {
  display: block; font-family: var(--cr-mono); font-size: 1.6rem;
  font-weight: 700; color: var(--cr-accent); line-height: 1.1;
}
.cr-stat span {
  font-family: var(--cr-mono); font-size: .69rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--cr-faint);
}

/* --- generic section ----------------------------------------------------- */

.cr-section { padding: clamp(2.5rem, 6vw, 4.25rem) 0; }
.cr-section + .cr-section { border-top: 1px solid var(--cr-rule); }

/* --- diagram ------------------------------------------------------------- */

.cr-figure {
  background: var(--cr-recessed);
  border: 1px solid var(--cr-rule);
  border-radius: 3px;
  padding: 1.5rem 1.25rem 1rem;
}
.cr-figure svg { width: 100%; height: auto; display: block; }
.cr-figcaption {
  font-size: .9rem; color: var(--cr-muted);
  margin: 1.1rem .25rem 0; max-width: 78ch;
}
.cr-figcaption strong { color: var(--cr-body); font-weight: 600; }

/* --- cards --------------------------------------------------------------- */

.cr-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1rem; }
.cr-card {
  background: var(--cr-raised);
  border: 1px solid var(--cr-rule);
  border-radius: 3px;
  padding: 1.35rem 1.4rem;
}
.cr-card h3 { margin: 0 0 .5rem; }
.cr-card p { margin: 0; color: var(--cr-muted); font-size: .93rem; }

/* --- download list (ontology page) --------------------------------------- */

.cr-dl { list-style: none; margin: 0; padding: 0; }
.cr-dl li {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  padding: 1.05rem 0; border-top: 1px solid var(--cr-rule);
}
.cr-dl li:last-child { border-bottom: 1px solid var(--cr-rule); }
.cr-dl a.cr-file {
  font-family: var(--cr-mono); font-size: .97rem; font-weight: 600;
  min-width: 15ch;
}
.cr-dl .cr-desc { color: var(--cr-muted); font-size: .93rem; flex: 1 1 18ch; }
.cr-tag {
  font-family: var(--cr-mono); font-size: .66rem; letter-spacing: .13em;
  text-transform: uppercase; padding: .2rem .5rem; border-radius: 2px;
  border: 1px solid var(--cr-rule-hi); color: var(--cr-faint);
}
.cr-tag--warn { color: var(--cr-accent); border-color: var(--cr-accent-dim); }

/* --- publications -------------------------------------------------------- */

.cr-tier { margin-bottom: clamp(2.25rem, 5vw, 3.5rem); }
.cr-tier:last-child { margin-bottom: 0; }
.cr-tier-head {
  display: flex; align-items: baseline; gap: 1rem;
  border-bottom: 1px solid var(--cr-accent-dim);
  padding-bottom: .6rem; margin-bottom: .35rem;
}
.cr-tier-head h2 {
  font-family: var(--cr-mono); font-size: .82rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--cr-accent); margin: 0; margin-right: auto;
}
.cr-tier-count { font-family: var(--cr-mono); font-size: .78rem; color: var(--cr-faint); }
.cr-tier-note { font-size: .9rem; color: var(--cr-muted); margin: .7rem 0 1.1rem; max-width: 74ch; }

.cr-pub {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--cr-rule);
}
.cr-pub-year {
  font-family: var(--cr-mono); font-size: .84rem; color: var(--cr-faint);
  padding-top: .18rem;
}
.cr-pub-title { color: var(--cr-head); font-weight: 600; font-size: 1rem; line-height: 1.4; }
.cr-pub-authors { color: var(--cr-body); font-size: .9rem; }
.cr-pub-venue { font-family: var(--cr-mono); font-size: .8rem; color: var(--cr-muted); }
.cr-pub-xref { font-size: .84rem; color: var(--cr-faint); font-style: italic; }
.cr-pub-links { margin-top: .3rem; display: flex; gap: .55rem; flex-wrap: wrap; }
.cr-pub-links a {
  font-family: var(--cr-mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; padding: .22rem .55rem;
  border: 1px solid var(--cr-rule-hi); border-radius: 2px;
}
.cr-pub-links a:hover { border-color: var(--cr-accent); text-decoration: none; }

@media (max-width: 34rem) {
  .cr-pub { grid-template-columns: 1fr; gap: .15rem; }
  .cr-pub-year { padding-top: 0; }
}

/* --- prose --------------------------------------------------------------- */

.cr-prose { max-width: 68ch; }
.cr-prose p { margin: 0 0 1.05rem; }
.cr-prose p:last-child { margin-bottom: 0; }

/* --- footer -------------------------------------------------------------- */

.cr-footer {
  background: var(--cr-recessed);
  border-top: 1px solid var(--cr-rule);
  padding: 2.25rem 0;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}
.cr-footer .cr-shell {
  display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: baseline;
  font-size: .85rem; color: var(--cr-faint);
}
.cr-footer p { margin: 0; }
.cr-footer .cr-footer-end { margin-left: auto; font-family: var(--cr-mono); font-size: .72rem;
  letter-spacing: .12em; text-transform: uppercase; }

/* --- print --------------------------------------------------------------- */

@media print {
  body { background: #fff; color: #000; }
  .cr-masthead, .cr-footer, .cr-btnrow { display: none; }
  a { color: #000; }
  .cr-pub-links { display: none; }
}
