/* frhsml.org. No JavaScript and no third-party requests: the CSP allows 'self'
   only, so the fonts live in /assets. The figure is inline SVG coloured
   entirely from the tokens below. */

@font-face {
  font-family: "Plex Sans";
  src: url("/assets/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("/assets/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/assets/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

/* --- Tokens -------------------------------------------------------------- */

:root {
  --bg:       #ffffff;
  --bg-soft:  #f6f7f9;
  --text:     #1b1f24;
  --text-2:   #444b53;
  --muted:    #626a73;
  --border:   #dfe3e8;
  --link:     #1d5fc2;
  --link-hov: #123f85;

  --code-bg:  #f6f7f9;
  --tok-k:    #a22a6b;   /* keywords */
  --tok-f:    #1d5fc2;   /* function names */
  --tok-m:    #0f6b58;   /* numbers */
  --tok-s:    #5b6570;   /* docstrings */
  --tok-c:    #6b7580;   /* comments */

  --plot:     #1b1f24;
  --path:     #1d5fc2;

  --sans: "Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:       #111418;
    --bg-soft:  #181c21;
    --text:     #e3e6ea;
    --text-2:   #bcc3cb;
    --muted:    #8d959e;
    --border:   #2a3038;
    --link:     #7fb0ff;
    --link-hov: #b5d0ff;
    --code-bg:  #181c21;
    --tok-k:    #f08fc0;
    --tok-f:    #7fb0ff;
    --tok-m:    #6fd3b8;
    --tok-s:    #9aa3ad;
    --tok-c:    #87909a;
    --plot:     #e3e6ea;
    --path:     #7fb0ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:       #111418;
  --bg-soft:  #181c21;
  --text:     #e3e6ea;
  --text-2:   #bcc3cb;
  --muted:    #8d959e;
  --border:   #2a3038;
  --link:     #7fb0ff;
  --link-hov: #b5d0ff;
  --code-bg:  #181c21;
  --tok-k:    #f08fc0;
  --tok-f:    #7fb0ff;
  --tok-m:    #6fd3b8;
  --tok-s:    #9aa3ad;
  --tok-c:    #87909a;
  --plot:     #e3e6ea;
  --path:     #7fb0ff;
  color-scheme: dark;
}

/* --- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-weight: 600; line-height: 1.25; margin: 0; }
p { margin: 0; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hov); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }

.wrap { width: 100%; max-width: 64rem; margin: 0 auto; padding-inline: 1.5rem; }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--text); color: var(--bg); padding: .4rem .8rem; border-radius: 4px;
}
.skip:focus { top: .75rem; }

/* --- Header -------------------------------------------------------------- */

.site-header { border-bottom: 1px solid var(--border); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1.5rem;
  min-height: 3.75rem; padding-block: .6rem;
}
.site-name {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--text); font-weight: 600; text-decoration: none;
}
.site-name:hover { color: var(--text); }
.logo { width: 1.6rem; height: 1.6rem; flex: none; }
.logo ellipse { fill: none; stroke: currentColor; stroke-width: 3.2; }
.logo ellipse:nth-child(1) { opacity: .45; }
.logo ellipse:nth-child(2) { opacity: .6; }
.logo-dot { fill: var(--path); }

.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.4rem; font-size: .9375rem; }
.site-nav a { color: var(--text-2); text-decoration: none; }
.site-nav a:hover { color: var(--text); text-decoration: underline; }
.site-nav a[aria-current] { color: var(--text); font-weight: 600; }
.site-nav .login {
  color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: .3rem .75rem;
}
.site-nav .login:hover { border-color: var(--muted); text-decoration: none; }

/* --- Page: sidebar + content --------------------------------------------- */

.doc {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 3rem;
  padding-block: 3rem 5rem;
}

.toc { position: sticky; top: 2rem; align-self: start; font-size: .875rem; }
.toc-title { font-weight: 600; color: var(--text); margin-bottom: .5rem; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li a {
  display: block; padding: .25rem 0 .25rem .9rem; margin-left: -1px;
  color: var(--muted); text-decoration: none; border-left: 1px solid transparent;
}
.toc li a:hover { color: var(--text); border-left-color: var(--muted); }

.content { max-width: 46rem; }
.content-solo { grid-column: 1 / -1; padding-block: 3rem; }
.content h1 { font-size: 2.25rem; letter-spacing: -0.015em; }
.content .intro { margin-top: 1rem; font-size: 1.1875rem; line-height: 1.6; color: var(--text-2); }
.content h2 {
  font-size: 1.4rem; letter-spacing: -0.01em;
  margin-top: 3rem; padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 1.5rem;
}
.content h2 + * { margin-top: 1rem; }
.content p + p { margin-top: 1rem; }
.content p + table, .content table + p { margin-top: 1.25rem; }

/* --- Tables -------------------------------------------------------------- */

table { border-collapse: collapse; width: 100%; font-size: 1rem; }
th, td { text-align: left; vertical-align: top; padding: .6rem .9rem; border: 1px solid var(--border); }

.info th { width: 8rem; font-weight: 600; color: var(--text-2); background: var(--bg-soft); }
.info td { overflow-wrap: anywhere; }

.grid-table thead th { font-weight: 600; font-size: .875rem; color: var(--text-2); background: var(--bg-soft); }
.grid-table td:first-child { white-space: nowrap; }
.officers { max-width: 30rem; }
.officers .sub td:first-child { padding-left: 2.1rem; color: var(--text-2); }

/* --- Figure and code listing --------------------------------------------- */

.figure { margin: 2rem 0 0; border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem 1.5rem 1.1rem; }
.figure .fig { display: block; width: 100%; max-width: 30rem; height: auto; margin: 0 auto; }
.figure figcaption { margin-top: 1rem; font-size: .9375rem; color: var(--muted); }

.fig { overflow: visible; }
.fig-frame, .fig-tick { fill: none; stroke: var(--plot); stroke-width: 1; opacity: .8; }
.fig-contour { fill: none; stroke: var(--plot); stroke-width: .8; opacity: .28; }
.fig-contour.major { stroke-width: 1.1; opacity: .6; }
.fig-axis { font-family: var(--sans); font-size: 17px; fill: var(--text-2); }
.fig-sub { font-size: 11px; }
.fig-note {
  font-family: var(--sans); font-size: 14px; fill: var(--path);
  stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; paint-order: stroke;
}
.fig-path { fill: none; stroke: var(--path); stroke-width: 1.8; stroke-linejoin: round; }
.fig-step { fill: var(--path); }
.fig-start { fill: var(--bg); stroke: var(--path); stroke-width: 1.8; }
.fig-end { fill: var(--path); }

.listing { margin-top: 1rem; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.listing-name {
  padding: .45rem 1rem; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: .8125rem; color: var(--muted);
  background: var(--bg);
}
.listing pre {
  margin: 0; padding: 1rem 1.1rem; overflow-x: auto;
  background: var(--code-bg);
  font-family: var(--mono); font-size: .875rem; line-height: 1.6;
  tab-size: 4;
}
.listing .k { color: var(--tok-k); }
.listing .f { color: var(--tok-f); }
.listing .m { color: var(--tok-m); }
.listing .s { color: var(--tok-s); }
.listing .c { color: var(--tok-c); }

/* --- Footer -------------------------------------------------------------- */

.site-footer { border-top: 1px solid var(--border); font-size: .875rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; padding-block: 1.75rem 2.5rem; }
.footer-fine { flex-basis: 100%; }

/* --- Small screens ------------------------------------------------------- */

@media (max-width: 860px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 2rem; }
  .toc { display: none; }
}
@media (max-width: 520px) {
  .wrap { padding-inline: 1rem; }
  .content h1 { font-size: 1.9rem; }
  .figure { padding: 1rem .75rem .9rem; }
  th, td { padding: .5rem .65rem; }
  .info th { width: 5.5rem; }
  .grid-table td:first-child { white-space: normal; }
}
