/* CSH design system (csh-neu.why.dev/design-system, v1), dark variant: black page, white type, square corners.
   Tailwind's stone/accent colours and radii are remapped onto these tokens in base.html. */
:root {
  color-scheme: dark;

  --color-black: #000000;
  --color-white: #ffffff;
  --color-grey: #dde1e6;
  --color-grey-dark: #5a5f66;
  --color-blue: #4589ff;
  --color-magenta: #d02670;
  --color-surface-dark: #111214;     /* cards and panels on the black page */
  --color-line-dark: #25282c;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-fast: 160ms;
  --dur: 280ms;
  --control-h: 36px;

  /* Chart tokens, read by the ECharts setup. Categorical slots 1-6 in fixed order: CSH blue, orange, lilac,
     green, magenta, ochre, with the light accents stepped into the dark-mode lightness band (validated on
     --surface-1: adjacent CVD ΔE ≥ 9.1, normal ΔE ≥ 24, all ≥ 3:1). */
  --surface-1: #111214;
  --text-primary: #ffffff;
  --text-secondary: #9aa1a9;
  --grid: #25282c;
  --series-1: #4589ff;
  --series-2: #e16c06;
  --series-3: #9f80d0;
  --series-4: #3aab5e;
  --series-5: #d02670;
  --series-6: #af8f04;
  --meter-track: #1b2a44;
}

.tabular { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--color-white); outline-offset: 3px; }

/* Buttons: square, one height, hover swaps fill and outline. White on black is the primary (CSH .btn--white). */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--control-h); padding: 6px 14px; border: 1px solid var(--color-white);
  background: var(--color-white); color: var(--color-black); font-size: .875rem; font-weight: 700; line-height: 1.2;
  white-space: nowrap; transition: background-color var(--dur-fast), color var(--dur-fast);
}
.btn:hover { background: transparent; color: var(--color-white); }
.btn::before { content: ""; position: absolute; inset: -4px 0; }   /* 44px hit area */
.btn--outline { background: transparent; color: var(--color-white); }
.btn--outline:hover { background: var(--color-white); color: var(--color-black); }
.btn--block { display: flex; width: 100%; }

/* The CSH arrow, the only directional glyph; moves right on hover of its link or card. */
.csh-arrow { display: inline-block; width: .62em; height: .62em; flex: none; transition: transform var(--dur) var(--ease); }
a:hover > .csh-arrow, .group:hover .csh-arrow, .btn:hover .csh-arrow { transform: translateX(4px); }

/* Animated underline for text links */
.link { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size var(--dur) var(--ease); padding-bottom: 1px; }
.link:hover, .link:focus-visible { background-size: 100% 1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* <details> chevrons */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary .chev { transition: transform .15s ease; }
details[open] > summary .chev { transform: rotate(90deg); }

/* Meter: same-hue track + fill */
.meter { height: 6px; background: var(--meter-track); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--series-1); }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }

/* Code viewer: line numbers as anchors, the linked line highlighted below the sticky header */
.code-line { display: block; padding-right: 1rem; scroll-margin-top: 6rem; }
.code-line:target { background: var(--meter-track); }
.code-no { display: inline-block; width: 3.5rem; padding-right: 1rem; text-align: right; color: var(--text-secondary); opacity: .6; user-select: none; }
.code-no:hover { opacity: 1; text-decoration: underline; }
