/* Deliberately single-theme: the brand is an instrument panel read in the dark.
     Every color is painted explicitly so the page holds on any host ground. */
  :root {
    color-scheme: dark;
    --ground: #0C0B09;
    --surface: #15130F;
    --raised: #1C1914;
    --line: #2B271F;
    --line-soft: #211E18;
    --ink: #EEE7D6;
    --ink-2: #BDB3A0;
    --muted: #8C8473;
    --faint: #5B5446;
    --gold: #D9A424;
    --gold-soft: rgba(217, 164, 36, 0.13);
    --gold-line: rgba(217, 164, 36, 0.45);
    --bar: #4A4438;

    --f-display: "Chakra Petch", "Bahnschrift", "Arial Narrow", sans-serif;
    --f-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
    --f-mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;

    --s-1: 0.75rem;
    --s-2: 0.875rem;
    --s-3: 1rem;
    --s-4: 1.25rem;
    --s-5: 1.75rem;
    --s-6: clamp(2.1rem, 4.4vw, 3.4rem);
  }

  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--f-body);
    font-size: var(--s-3);
    line-height: 1.55;
    padding-inline: clamp(16px, 4vw, 48px);
    -webkit-font-smoothing: antialiased;
  }

  .wrap { max-width: 1180px; margin-inline: auto; }

  a { color: inherit; }
  :focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

  .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
  .label {
    font-family: var(--f-mono);
    font-size: var(--s-1);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
  }

  /* ---------- header ---------- */
  .top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-block: 22px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
  }
  .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
  .brand svg { width: 64px; height: 28px; flex: none; }
  .wordmark {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.04em;
  }
  .nav { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
  .nav a {
    text-decoration: none;
    font-size: var(--s-2);
    color: var(--ink-2);
  }
  .nav a:hover { color: var(--ink); }
  /* The language chooser: a disclosure, not a row of codes, because the row
     stopped fitting at the fourth language. Closed it names the language being
     read; open it lists them all, each a link to this same page. */
  .lang { position: relative; font-family: var(--f-mono); font-size: var(--s-1); }
  .lang > summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-2);
    cursor: pointer;
    list-style: none;
  }
  .lang > summary::-webkit-details-marker { display: none; }
  .lang > summary::after { content: "\25BE"; color: var(--faint); }
  .lang > summary:hover { color: var(--ink); }
  .lang[open] > summary { color: var(--ink); border-color: var(--gold); }
  .lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    min-width: 148px;
    padding: 4px;
    background: var(--ground);
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .nav .lang-menu a {
    padding: 6px 10px;
    border-radius: 7px;
    color: var(--faint);
    font-size: var(--s-1);
    text-decoration: none;
  }
  .nav .lang-menu a:hover { color: var(--ink); background: var(--line); }
  .nav .lang-menu a[aria-current="page"] { background: var(--gold); color: var(--ground); font-weight: 500; }
  /* On a phone the menu wraps to its own row at the left, where a list hung
     from the right edge of the button would run off the screen. */
  @media (max-width: 767px) {
    .lang-menu { right: auto; left: 0; }
  }

  /* Wide screens keep the header in view as a slim strip, so the sections and
     the other language are one click away from anywhere on a long page. Not on
     phones: there the menu wraps to two rows and would hold a fifth of the
     screen for good. Jumps to a section stop below the strip, not under it. */
  @media (min-width: 768px) {
    .top {
      position: sticky;
      top: 0;
      z-index: 5;
      padding-block: 14px;
      background: rgba(12, 11, 9, 0.92);
      -webkit-backdrop-filter: blur(8px);
      backdrop-filter: blur(8px);
    }
    [id] { scroll-margin-top: 84px; }
  }

  .preview-note {
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
    padding-block: 10px;
    border-bottom: 1px solid var(--line-soft);
    font-size: var(--s-1);
    color: var(--muted);
  }

  /* ---------- hero ---------- */
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    gap: clamp(28px, 5vw, 72px);
    align-items: center;
    padding-block: clamp(40px, 7vw, 88px);
  }
  .eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
  .rec {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 4px var(--gold-soft);
  }
  @media (prefers-reduced-motion: no-preference) {
    .rec { animation: rec 2.4s ease-in-out infinite; }
    @keyframes rec { 50% { box-shadow: 0 0 0 7px rgba(217,164,36,0.04); } }
  }
  h1 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: var(--s-6);
    line-height: 1.04;
    letter-spacing: -0.01em;
    margin: 0 0 22px;
    text-wrap: balance;
  }
  h1 em { font-style: normal; color: var(--gold); }
  .lede {
    max-width: 52ch;
    color: var(--ink-2);
    font-size: 1.07rem;
    margin: 0 0 30px;
  }
  .hero-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
  .btn {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--f-mono);
    font-size: var(--s-2);
    text-decoration: none;
    padding: 11px 18px;
    border: 1px solid var(--gold-line);
    border-radius: 3px;
    color: var(--ink);
    background: var(--gold-soft);
  }
  .btn:hover { border-color: var(--gold); }
  .btn-quiet { border-color: var(--line); background: transparent; color: var(--ink-2); }
  .btn-quiet:hover { border-color: var(--muted); color: var(--ink); }

  /* the one lifted object on the page */
  .instrument {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 22px 22px 18px;
  }
  .inst-head {
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    align-items: baseline;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--line);
    margin-bottom: 16px;
  }
  .inst-sym { font-family: var(--f-display); font-weight: 600; font-size: var(--s-4); }
  .inst-reading {
    display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
    margin-bottom: 6px;
  }
  .reading-num {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 3.2rem);
    line-height: 1;
    color: var(--gold);
  }
  .reading-txt { color: var(--ink-2); font-size: var(--s-2); max-width: 32ch; }
  .chart-wrap { position: relative; }
  .chart-wrap svg { display: block; width: 100%; height: auto; }
  .inst-foot {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 20px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
    font-size: var(--s-1);
    color: var(--muted);
  }
  .inst-foot b { display: block; font-family: var(--f-mono); font-weight: 500; color: var(--ink); font-size: var(--s-2); }

  /* ---------- sections ---------- */
  section { padding-block: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line); }
  .sec-head {
    display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap;
    margin-bottom: 28px;
  }
  h2 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: var(--s-5);
    line-height: 1.15;
    margin: 6px 0 0;
    text-wrap: balance;
  }
  .sec-note { max-width: 46ch; color: var(--muted); font-size: var(--s-2); margin: 0; }

  /* ---------- event log ---------- */
  .log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
  .event {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) 250px 150px;
    gap: 24px;
    padding-block: 22px;
    border-bottom: 1px solid var(--line);
    align-items: start;
  }
  .ev-time { font-family: var(--f-mono); font-size: var(--s-2); color: var(--ink-2); line-height: 1.45; }
  .ev-time span { display: block; color: var(--muted); font-size: var(--s-1); }
  .ev-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
  .ev-sym { font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; }
  a.ev-sym, .inst-sym a { color: inherit; text-decoration: none; }
  a.ev-sym:hover, .inst-sym a:hover { text-decoration: underline; text-decoration-color: var(--gold-line); }

  /* An event's own page. */
  .crumb { font-size: var(--s-1); color: var(--muted); margin: 28px 0 10px; }
  .crumb a { color: var(--ink-2); text-decoration: none; }
  .crumb a:hover { color: var(--ink); }
  .facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: var(--s-2); }
  .facts dt { color: var(--muted); }
  .facts dd { margin: 0; color: var(--ink); }
  .back { display: inline-block; margin-top: 8px; color: var(--ink-2); text-decoration: none; font-size: var(--s-2); }
  .back:hover { color: var(--ink); }

  /* The link from the home page's newest events to all of them, and the archive's pages. */
  .more { margin: 18px 0 0; font-size: var(--s-2); }
  .more a, .pager a { color: var(--ink-2); text-decoration: none; }
  .more a:hover, .pager a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold-line); }
  .sec-head h1 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: var(--s-5);
    line-height: 1.15;
    margin: 6px 0 0;
    text-wrap: balance;
  }
  .pager {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    margin-top: 22px;
    font-size: var(--s-2);
    color: var(--muted);
  }
  .pager a[rel="next"] { justify-self: end; }

  /* The operator's traffic page; plain rows, no chrome. */
  .stats { border-collapse: collapse; width: 100%; max-width: 640px; font-size: var(--s-2); }
  .stats th, .stats td { border-bottom: 1px solid var(--line); padding: 7px 0; text-align: left; }
  .stats th { font-weight: 400; color: var(--ink-2); word-break: break-all; }
  .stats td { font-family: var(--f-mono); text-align: right; color: var(--ink); width: 6em; }
  .chip {
    font-family: var(--f-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 2px 7px;
    color: var(--ink-2);
  }
  .venue { font-size: var(--s-1); color: var(--muted); font-family: var(--f-mono); }
  .ev-desc { margin: 0; color: var(--ink-2); font-size: 0.95rem; max-width: 60ch; }
  .ev-desc strong { color: var(--ink); font-weight: 600; }
  .venues { display: block; margin: 4px 0 0; font-size: var(--s-1); color: var(--muted); }
  .ev-chart svg { display: block; width: 100%; height: auto; }
  .ev-chart .cap { font-size: 0.7rem; color: var(--muted); font-family: var(--f-mono); margin-top: 4px; }
  .follow { font-size: var(--s-1); color: var(--muted); display: grid; gap: 6px; }
  .state {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--f-mono); font-size: 0.72rem;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--ink-2);
  }
  .state i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--muted); display: inline-block; }
  .state.done i { background: var(--ink-2); border-color: var(--ink-2); }
  .follow .both { font-family: var(--f-mono); color: var(--ink-2); font-size: var(--s-1); line-height: 1.6; }

  /* ---------- what we measure ---------- */
  .types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
  .type { padding: 26px 28px 26px 0; display: flex; flex-direction: column; gap: 14px; }
  .type + .type { padding-left: 28px; border-left: 1px solid var(--line); }
  h3 { font-family: var(--f-display); font-weight: 600; font-size: var(--s-4); margin: 0; }
  .def { margin: 0; color: var(--ink-2); font-size: 0.95rem; }
  .formula {
    font-family: var(--f-mono); font-size: var(--s-1); color: var(--ink);
    background: var(--surface); border: 1px solid var(--line-soft);
    padding: 10px 12px; border-radius: 3px; line-height: 1.6;
  }
  .two {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    margin-top: auto;
  }
  .two div { border-top: 1px solid var(--line); padding-top: 10px; }
  .two .k { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
  .two .v { font-family: var(--f-display); font-weight: 600; font-size: 1.35rem; color: var(--ink); line-height: 1.2; }
  .two .s { font-size: 0.78rem; color: var(--muted); }
  .base { font-size: 0.8rem; color: var(--muted); }

  /* Four small adjustments that used to be style attributes on the elements
     themselves. They are here so the site can promise a content policy with no
     'unsafe-inline' in it: a page that allows inline style allows injected
     style, and the promise would be worth less than the sentence saying it. */
  .flush { margin: 0; }
  .sec-first { border-top: 0; padding-top: 0; }
  .sec-loose { padding-top: 28px; }
  .note-small { font-size: 0.8rem; color: var(--muted); }
  .label-strong { color: var(--ink-2); }

  .base b { color: var(--ink-2); font-weight: 500; font-family: var(--f-mono); }

  /* Where a card's numbers were measured, and what is actually watched. Kept
     visible rather than in a footnote: the two differ, and a reader should not
     have to hunt for that. */
  .source {
    display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px;
    margin: 0; padding-top: 10px; border-top: 1px dashed var(--line);
    font-size: 0.78rem;
  }
  .source dt { font-family: var(--f-mono); color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.68rem; padding-top: 2px; }
  .source dd { margin: 0; color: var(--ink-2); }

  /* ---------- method ---------- */
  .method { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px 40px; }
  .method div { border-left: 2px solid var(--line); padding-left: 16px; }
  .method h4 { font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; margin: 0 0 6px; }
  .method p { margin: 0; color: var(--ink-2); font-size: 0.93rem; }

  /* ---------- disclaimer ---------- */
  .disclaimer {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 26px 28px;
  }
  .disclaimer p { margin: 0; max-width: 72ch; color: var(--ink-2); font-size: 0.95rem; }
  .disclaimer p + p { margin-top: 10px; }

  .foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
  .foot-links a { color: var(--muted); text-decoration: none; }
  .foot-links a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold-line); }

  /* A standing page: one column of text, at a width that reads. */
  .doc { max-width: 72ch; padding-block: 8px 24px; }
  .doc h1 { font-family: var(--f-display); font-weight: 600; font-size: var(--s-5); margin: 0 0 18px; }
  .doc h2 { font-size: var(--s-4); margin: 28px 0 8px; }
  .doc p { color: var(--ink-2); margin: 0 0 12px; }
  .doc a { color: var(--ink); text-decoration-color: var(--gold-line); }
  .doc code { font-family: var(--f-mono); font-size: 0.9em; color: var(--ink); }
  .doc-date { color: var(--muted); font-size: var(--s-1); font-family: var(--f-mono); }
  .doc .facts { margin-bottom: 20px; }

  footer {
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding-block: 28px 40px;
    font-size: var(--s-1); color: var(--muted); font-family: var(--f-mono);
  }

  /* ---------- tooltip ---------- */
  .tip {
    position: fixed; z-index: 10; pointer-events: none;
    background: var(--raised); border: 1px solid var(--line);
    color: var(--ink); font-family: var(--f-mono); font-size: 0.75rem;
    padding: 7px 10px; border-radius: 3px; line-height: 1.45;
    max-width: 240px;
  }
  .tip b { color: var(--ink); font-weight: 500; }
  .tip span { color: var(--muted); display: block; }

  svg text { font-family: var(--f-mono); }

  /* ---------- responsive ---------- */
  @media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; }
    .event { grid-template-columns: 130px minmax(0, 1fr); }
    .ev-chart { grid-column: 2; }
    .follow { grid-column: 2; }
    .types { grid-template-columns: 1fr; }
    .type, .type + .type { padding: 24px 0; border-left: 0; }
    .type + .type { border-top: 1px solid var(--line); }
  }
  @media (max-width: 600px) {
    .event { grid-template-columns: 1fr; gap: 12px; }
    .ev-chart, .follow { grid-column: 1; }
    .disclaimer { grid-template-columns: 1fr; gap: 10px; }
    .nav { gap: 16px; }
    .inst-foot { grid-template-columns: 1fr; }
  }
