/* ==========================================================================
   Charm Media — Base layer
   Tokens, reset, typography, grid, header, footer, buttons, forms.
   Design system: "Discovery Instrument"
   - Ground is a cool screen-grey, cards are result-white.
   - Colour is never decorative: each hue names a discovery channel.
       Search = blue · Maps = purple · AI = orange · Social = pink · Site = ink
   - The waveform from the Charm logo is re-read as a measuring instrument.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */
:root {
  /* Ground & surfaces */
  --field: #e9ecef;
  --field-2: #dfe4e9;
  --card: #ffffff;
  --ink: #0b0c0e;
  --ink-80: #2b3138;
  --ink-60: #545b63;
  --ink-40: #7c848c;
  --on-ink: #eef1f3;
  --on-ink-60: #a3abb3;

  /* Channel palette — taken from the Charm Media wordmark bars */
  --c-search: #2c6e9e;
  --c-maps: #7a3a8b;
  --c-ai: #f0561f;
  --c-social: #e4879c;
  --c-site: #4c545c;

  --accent: var(--c-ai);
  --accent-ink: #ffffff;

  /* Lines */
  --line: rgba(11, 12, 14, 0.16);
  --line-soft: rgba(11, 12, 14, 0.085);
  --line-strong: rgba(11, 12, 14, 0.42);
  --line-on-ink: rgba(238, 241, 243, 0.16);
  --line-on-ink-soft: rgba(238, 241, 243, 0.09);

  /* Type */
  --f-display: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-ui: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Rhythm — the density scale. The site reads as an app, not a brochure:
     small type, tight bands, roughly twice the content per screen. */
  --gutter: 22px;
  --maxw: 1180px;
  --maxw-text: 66ch;
  --sec-y: 52px;
  --radius: 3px;
  --radius-lg: 6px;
  --card-pad: 16px;

  /* Shell */
  --rail-w: 216px;
  --topbar-h: 46px;
  --tabbar-h: 54px;

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

@media (max-width: 860px) {
  :root {
    --gutter: 14px;
    --sec-y: 30px;
    --card-pad: 14px;
  }
}

/* --- Reset ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 12px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg,
video { max-width: 100%; display: block; }

/* Class-level `display` beats the UA rule for [hidden], so say it once here.
   The multi-step form and the conditional fields depend on this. */
[hidden] { display: none !important; }

img { height: auto; }

a { color: inherit; text-decoration: none; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--c-ai);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--ink);
  color: var(--field);
}

/* --- Typography ----------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: -0.021em;
  line-height: 1.06;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: 38px; }
h2 { font-size: 26px; }
h3 { font-size: 16.5px; font-stretch: 105%; letter-spacing: -0.008em; line-height: 1.24; }
h4 { font-size: 14.5px; font-stretch: 105%; letter-spacing: -0.005em; line-height: 1.3; }

p { margin: 0; text-wrap: pretty; }

strong { font-weight: 600; }

.t-xl { font-size: 32px; font-family: var(--f-display); font-weight: 700; font-stretch: 112%; letter-spacing: -0.02em; line-height: 1.08; }
.t-lead { font-size: 16.5px; line-height: 1.5; color: var(--ink-80); }
.t-body { font-size: 15px; line-height: 1.55; color: var(--ink-80); }
.t-sm { font-size: 13px; line-height: 1.5; color: var(--ink-60); }

.label {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-40);
  display: inline-block;
}

.label--ink { color: var(--ink); }
.label--accent { color: var(--c-ai); }

.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: -0.01em; }

.measure { max-width: var(--maxw-text); }
.measure-sm { max-width: 54ch; }

@media (max-width: 860px) {
  body { font-size: 14px; line-height: 1.52; }
  h1 { font-size: 26px; line-height: 1.1; letter-spacing: -0.016em; }
  h2 { font-size: 20px; line-height: 1.14; }
  h3 { font-size: 15px; }
  h4 { font-size: 13.5px; }
  .t-xl { font-size: 23px; }
  .t-lead { font-size: 15px; line-height: 1.48; }
  .t-body { font-size: 14px; }
  .t-sm { font-size: 12.5px; }
  .label { font-size: 10px; letter-spacing: 0.11em; }
  .mono { font-size: 11.5px; }
}

/* --- Layout --------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow { max-width: 820px; }

.section {
  padding-block: var(--sec-y);
  position: relative;
}

.section--tight { padding-block: calc(var(--sec-y) * 0.6); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

.section--ink {
  background: var(--ink);
  color: var(--on-ink);
}
.section--ink .t-lead,
.section--ink .t-body { color: var(--on-ink-60); }
.section--ink .t-sm { color: var(--on-ink-60); }
.section--ink .label { color: var(--on-ink-60); }
.section--ink .label--ink { color: var(--on-ink); }

.section--deep { background: var(--field-2); }

.stack > * + * { margin-top: var(--gap, 12px); }
.stack-sm { --gap: 7px; }
.stack-lg { --gap: 20px; }

.grid { display: grid; gap: 1px; }

.sec-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 16px 40px;
  align-items: end;
  margin-bottom: 22px;
}

.sec-head__title { margin-top: 7px; }

@media (max-width: 860px) {
  .sec-head {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 16px;
  }
  .sec-head__title { margin-top: 5px; }
}

/* --- Rule: the spectrum divider ------------------------------------------- */
/* A hairline that carries the logo's bar rhythm. Marks a real change of topic. */
.spectrum-rule {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}
.spectrum-rule i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.9;
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--field);
  --btn-bd: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius);
  font-family: var(--f-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.1;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform 0.18s var(--ease);
  text-align: left;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--accent {
  --btn-bg: var(--c-ai);
  --btn-fg: #fff;
  --btn-bd: var(--c-ai);
}
.btn--accent:hover { --btn-bg: #d64712; --btn-bd: #d64712; }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
}
.btn--ghost:hover { --btn-bg: var(--ink); --btn-fg: var(--field); --btn-bd: var(--ink); }

.section--ink .btn--ghost {
  --btn-fg: var(--on-ink);
  --btn-bd: var(--line-on-ink);
}
.section--ink .btn--ghost:hover { --btn-bg: var(--on-ink); --btn-fg: var(--ink); --btn-bd: var(--on-ink); }

.btn--light {
  --btn-bg: var(--field);
  --btn-fg: var(--ink);
  --btn-bd: var(--field);
}

.btn--sm { padding: 7px 11px; font-size: 12.5px; }

.btn__arrow {
  width: 14px;
  height: 14px;
  flex: none;
  transition: transform var(--dur) var(--ease);
}
.btn:hover .btn__arrow { transform: translateX(3px); }

/* Inline icons that sit directly inside a component, with no wrapper of
   their own, still need an explicit box or they render at full size. */
.btn > svg { width: 16px; height: 16px; flex: none; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Text link with a rule that draws in on hover */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13.5px;
  padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--dur) var(--ease);
}
.tlink:hover { background-size: 100% 1px; }
.tlink svg { width: 13px; height: 13px; flex: none; }

/* --- Skip link ------------------------------------------------------------ */
.skip {
  position: absolute;
  left: 10px;
  top: -60px;
  z-index: 200;
  background: var(--ink);
  color: var(--field);
  padding: 10px 16px;
  border-radius: var(--radius);
  transition: top 0.2s var(--ease);
}
.skip:focus { top: 10px; }

/* --- App shell ------------------------------------------------------------ */
/* Wide: a fixed rail carries the whole navigation, content scrolls beside it.
   Narrow: a thin top bar for identity, a bottom tab bar for the thumb. */

.app { display: flex; align-items: flex-start; }

.app__main {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: var(--rail-w);
}

.logo { display: inline-flex; align-items: center; flex: none; }
.logo img { height: 34px; width: auto; }
.logo--sm img { height: 26px; }

/* --- Rail (wide screens) -------------------------------------------------- */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  z-index: 50;
  background: var(--field-2);
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rail__in {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 12px 14px;
}

.rail__nav { display: grid; gap: 12px; flex: 1 1 auto; }

.rail__group { display: grid; gap: 1px; }

.rail__link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-80);
  letter-spacing: -0.005em;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.rail__link:hover { background: rgba(11, 12, 14, 0.055); color: var(--ink); }
.rail__link.is-current { background: var(--ink); color: var(--field); }

.rail__icon { width: 15px; height: 15px; flex: none; opacity: 0.75; }
.rail__icon svg { width: 100%; height: 100%; }
.rail__link.is-current .rail__icon { opacity: 1; }

.rail__sub {
  display: grid;
  gap: 1px;
  margin: 2px 0 0 10px;
  padding-left: 12px;
  border-left: 1px solid var(--line-soft);
}

.rail__sublink {
  padding: 5px 8px;
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-60);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.rail__sublink:hover { background: rgba(11, 12, 14, 0.05); color: var(--ink); }
.rail__sublink[aria-current="page"] { color: var(--ink); font-weight: 600; }

.rail__foot {
  display: grid;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.rail__foot .btn { justify-content: center; }

/* --- Language switch ------------------------------------------------------ */
.langsw {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.langsw a {
  padding: 3px 8px;
  border-radius: 2px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-40);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.langsw a[aria-current="true"] { background: var(--ink); color: var(--field); }
.langsw a:not([aria-current="true"]):hover { background: rgba(11, 12, 14, 0.06); color: var(--ink); }

/* --- Top bar (narrow screens) --------------------------------------------- */
.topbar { display: none; }

/* --- Tab bar (narrow screens) --------------------------------------------- */
.tabbar { display: none; }

/* --- Narrow layout -------------------------------------------------------- */
@media (max-width: 1080px) {
  .rail { display: none; }
  .app__main { margin-left: 0; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-inline: var(--gutter);
    background: rgba(233, 236, 239, 0.94);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line-soft);
  }

  .tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 60;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: rgba(233, 236, 239, 0.96);
    backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: var(--tabbar-h);
    color: var(--ink-40);
    transition: color 0.18s var(--ease);
  }

  .tab__icon { width: 19px; height: 19px; }
  .tab__icon svg { width: 100%; height: 100%; }

  .tab__label {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-inline: 2px;
  }

  .tab.is-current { color: var(--ink); }
  .tab.is-current .tab__icon { transform: translateY(-1px); }

  /* Keep the last section clear of the tab bar. */
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

/* --- Language banner ------------------------------------------------------ */
.langbar {
  background: var(--ink);
  color: var(--on-ink);
  font-size: 12.5px;
}
.langbar[data-show="false"] { display: none; }

.langbar__in {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px var(--gutter);
}
.langbar__in a { text-decoration: underline; text-underline-offset: 2px; }
.langbar__close {
  margin-left: auto;
  background: none;
  border: 0;
  color: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

/* --- Tags ----------------------------------------------------------------- */
.tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 2px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  vertical-align: middle;
}

.tag--core { background: var(--c-ai); color: #fff; }
.tag--selected { background: transparent; color: var(--ink-40); border: 1px solid var(--line); }
.tag--soon { background: rgba(11, 12, 14, 0.07); color: var(--ink-60); }

/* --- Footer --------------------------------------------------------------- */
.ftr {
  background: var(--ink);
  color: var(--on-ink);
  padding-block: 64px 28px;
}
.ftr__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--line-on-ink-soft);
}
/* Footer sits on ink; the logo's own outline carries it, no white card needed. */
.logo--footer img { height: 44px; }
@media (max-width: 860px) { .logo--footer img { height: 36px; } }
.ftr__head {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-ink-60);
  margin-bottom: 14px;
}
.ftr__list { display: grid; gap: 9px; }
.ftr__list a {
  font-size: 14.5px;
  color: var(--on-ink-60);
  transition: color 0.2s var(--ease);
  width: fit-content;
}
.ftr__list a:hover { color: var(--on-ink); }
.ftr__bottom {
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  align-items: center;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--on-ink-60);
  letter-spacing: 0.01em;
}
.ftr__bottom a:hover { color: var(--on-ink); }
.ftr__legal { display: flex; flex-wrap: wrap; gap: 18px; }

@media (max-width: 980px) {
  .ftr__top { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 860px) {
  .ftr { padding-block: 44px 84px; }
  .ftr__top { grid-template-columns: 1fr 1fr; gap: 26px; padding-bottom: 30px; }
  .ftr__brand { grid-column: 1 / -1; }
  .ftr__bottom { font-size: 10.5px; gap: 8px 18px; }
}

/* --- Forms ---------------------------------------------------------------- */
.field { display: grid; gap: 7px; }

.field__label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.input,
.textarea,
.select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  font-size: 15.5px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.textarea { min-height: 118px; resize: vertical; line-height: 1.5; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%230b0c0e' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 11px;
  padding-right: 34px;
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11, 12, 14, 0.08);
}
.input::placeholder,
.textarea::placeholder { color: var(--ink-40); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Choice chips — used by the form and the audit */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }

.choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.2;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
  user-select: none;
}
.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.choice:hover { border-color: var(--line-strong); }
.choice:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--field);
}
.choice:has(input:focus-visible) {
  outline: 2px solid var(--c-ai);
  outline-offset: 2px;
}
.choice .tag--core { background: var(--c-ai); }
.choice:has(input:checked) .tag--selected { border-color: rgba(238, 241, 243, 0.3); color: var(--on-ink-60); }

.form-note {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-40);
}
.form-note a { text-decoration: underline; text-underline-offset: 2px; }

.form-status {
  border: 1px solid var(--line);
  border-left: 3px solid var(--c-ai);
  background: var(--card);
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14.5px;
}
.form-status[data-state="ok"] { border-left-color: #2f8f5b; }
.form-status[data-state="err"] { border-left-color: #c0392b; }
.form-status[hidden] { display: none; }

/* --- Utilities ------------------------------------------------------------ */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.only-desktop { display: initial; }
.only-mobile { display: none; }
@media (max-width: 860px) {
  .only-desktop { display: none; }
  .only-mobile { display: initial; }
}

/* Scroll reveal — short, transform+opacity only */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
}

/* --- Sibling strip (narrow screens only) ---------------------------------- */
/* The rail's sub-links have nowhere to go below 1080px, so on section pages
   they become a horizontally scrollable row pinned under the top bar. */
.subnav { display: none; }

@media (max-width: 1080px) {
  .subnav {
    display: block;
    position: sticky;
    top: var(--topbar-h);
    z-index: 55;
    background: rgba(233, 236, 239, 0.94);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line-soft);
  }

  .subnav__row {
    display: flex;
    gap: 6px;
    padding: 7px var(--gutter);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .subnav__row::-webkit-scrollbar { display: none; }

  .subnav__chip {
    flex: none;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--ink-60);
    white-space: nowrap;
    scroll-margin-inline: var(--gutter);
  }

  .subnav__chip.is-current {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--field);
  }

  /* Anchor jumps must clear the top bar and the strip. */
  html { scroll-padding-top: calc(var(--topbar-h) + 46px); }
}

/* --- Where am I ------------------------------------------------------------ */
/* Pages that name a discovery channel carry its colour into the shell.
   Everything else falls back to ink, so the tint always means something. */
:root { --page-ch: var(--ink); }

/* Rail: the page you are on is solid; the section it belongs to is marked
   with a rule, never the same treatment. */
.rail__link.is-section {
  color: var(--ink);
  font-weight: 600;
  background: rgba(11, 12, 14, 0.04);
}
.rail__link.is-section .rail__icon { opacity: 1; color: var(--page-ch); }

.rail__group.is-open .rail__sub { border-left-color: var(--page-ch); }

.rail__sublink.is-current,
.rail__sublink[aria-current="page"] {
  background: var(--ink);
  color: var(--field);
  font-weight: 600;
}

@media (max-width: 1080px) {
  /* Top: a colour rule under the bar. */
  .topbar { border-bottom: 2px solid var(--page-ch); }

  /* Bottom: the active tab takes the page colour and gets a marker above it. */
  .tab.is-current { color: var(--page-ch); }
  .tab.is-current::before {
    content: "";
    position: absolute;
    top: 0;
    left: 22%;
    right: 22%;
    height: 2px;
    background: var(--page-ch);
    border-radius: 0 0 2px 2px;
  }
  .tab { position: relative; }

  /* The sibling strip agrees with both. */
  .subnav { border-bottom-color: var(--line); }
  .subnav__chip.is-current {
    background: var(--page-ch);
    border-color: var(--page-ch);
    color: #fff;
  }
}
