/* pandoralytics.com: no scripts, nothing from other servers. */

/* paper gets its own small sheet, so the screen rules below stay the whole truth */
@import url("/assets/print.css") print;

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* The screen */
  --screen: #0b0c0e;
  --panel: #15161a;
  --row: #1e2025;
  --rule: #2c2e35;

  /* What is written on it */
  --bright: #f5f5f2;
  --text: #c7c9cf;
  --dim: #8a8d96;

  /* The cursor, and only the cursor */
  --amber: #ffb224;

  --font: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: clamp(3rem, 8vw, 6.25rem);
  --num: clamp(0.75rem, 2.4vw, 1.875rem);
  --measure: 70ch;

  color-scheme: dark;
  scrollbar-color: var(--rule) var(--screen);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 2rem;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--screen);
  color: var(--text);
  /* one face at one size: brightness and weight carry the hierarchy */
  font: 400 clamp(0.9375rem, 0.86rem + 0.35vw, 1.125rem) / 1.7 var(--font);
  font-variant-ligatures: none;
  caret-color: var(--amber);
}

::selection {
  background: var(--amber);
  color: var(--screen);
}

a {
  color: var(--bright);
  text-decoration-line: underline;
  text-decoration-color: var(--dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

a:hover {
  color: var(--amber);
  text-decoration-color: currentColor;
}

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

h1,
h2,
p,
dl,
dd,
ul,
address {
  margin: 0;
  font-size: 1em;
  font-style: normal;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -6rem;
  z-index: 1;
  padding: 0.5em 1em;
  background: var(--amber);
  color: var(--screen);
}

.skip:hover,
.skip:focus {
  color: var(--screen);
}

.skip:focus {
  top: 0;
  outline-color: var(--bright);
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}

.tabs a {
  margin-bottom: -1px;
  padding: 0.8em 0.35em;
  color: var(--dim);
  font-size: 0.875em;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}

.tabs a:hover {
  color: var(--bright);
}

/* the open tab runs into the screen below it */
.tabs a[aria-current="page"] {
  background: var(--screen);
  color: var(--bright);
  border-bottom-color: var(--screen);
  font-weight: 700;
}

.tabs .tab--end {
  margin-left: auto;
  border-right: 0;
}

/* the ring stays inside the tab, clear of the screen edge and the bar's rule */
.tabs a:focus-visible {
  outline-offset: -2px;
}

.tab--wide {
  display: none;
}

/* ---------- The screen: numbered lines ---------- */

.term {
  flex: 1;
  padding-block: clamp(1.5rem, 8vh, 5.5rem) clamp(1.5rem, 6vh, 6rem);
  counter-reset: line;
}

/* one numbered line; long ones wrap under the same number */
.l {
  position: relative;
  max-width: calc(var(--gutter) + var(--measure) + 1rem);
  padding: 0.3em 1rem 0.3em var(--gutter);
  counter-increment: line;
  overflow-wrap: break-word;
  hyphens: auto;
  hyphenate-limit-chars: 12 5 5;
  -webkit-hyphenate-limit-before: 5;
  -webkit-hyphenate-limit-after: 5;
  scroll-margin-top: 2rem;
}

.l::before {
  content: counter(line);
  content: counter(line) / "";
  position: absolute;
  top: 0.3em;
  left: var(--num);
  color: var(--dim);
  font-weight: 400;
  text-indent: 0;
}

.l:empty::after {
  content: "\a0";
}

h1.l,
h2.l {
  color: var(--bright);
  font-weight: 700;
  hyphens: manual;
}

/* the # of a heading, the - of a list item */
.mk {
  color: var(--dim);
  font-weight: 400;
}

.lead {
  color: var(--bright);
}

.note {
  color: var(--dim);
}

.nb {
  white-space: nowrap;
}

address,
.kv dd {
  hyphens: manual;
}

/* the current line: where the cursor rests */
.l--active {
  background: var(--row);
  box-shadow: inset 2px 0 0 var(--amber);
}

/* it moves to the line whose link you point at or tab to */
.l:has(a:hover),
.l:has(a:focus-visible) {
  background: var(--row);
  box-shadow: inset 2px 0 0 var(--amber);
}

/* a block you jumped to from a tab is selected as a whole */
.block:target .l {
  background: var(--row);
  box-shadow: inset 2px 0 0 var(--amber);
}

.term:has(.l a:hover) .l--active:not(:has(a:hover)),
.term:has(.l a:focus-visible) .l--active:not(:has(a:focus-visible)) {
  background: none;
  box-shadow: none;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.2em;
  margin-left: 0.6em;
  background: var(--amber);
  vertical-align: -0.22em;
}

@media (prefers-reduced-motion: no-preference) {
  .cursor {
    animation: blink 1.2s steps(1, end) infinite;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* key and value, as a config file prints them */
.kv dt {
  color: var(--dim);
}

.kv dd {
  color: var(--text);
}

.list {
  padding: 0;
  list-style: none;
}

.list .l {
  padding-left: calc(var(--gutter) + 2ch);
  text-indent: -2ch;
}

/* ---------- Status bar ---------- */

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 2rem;
  padding: 0.5em 1rem 0.5em var(--num);
  background: var(--panel);
  color: var(--dim);
  border-top: 1px solid var(--rule);
  /* phones only: one step down so the bar fits, as the tabs do */
  font-size: 0.875em;
}

.status ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5em;
  padding: 0;
  list-style: none;
}

.status a {
  display: inline-block;
  padding-block: 0.45em;
  color: var(--text);
}

.status a:hover {
  color: var(--amber);
}

/* ---------- Wider screens ---------- */

@media (min-width: 22.5rem) {
  .tabs a {
    padding-inline: 0.6em;
  }
}

@media (min-width: 30rem) {
  .tabs a {
    padding: 0.7em 0.9em;
    font-size: 1em;
  }

  .tabs .tab--end {
    border-left: 1px solid var(--rule);
  }

  .status {
    font-size: 1em;
  }
}

@media (min-width: 46rem) {
  .tabs a {
    padding-inline: 1.5em;
  }

  .tab--wide {
    display: block;
  }

  .kv .l {
    display: grid;
    grid-template-columns: 20ch minmax(0, 1fr);
    gap: 0 2ch;
  }
}

/* ---------- Other media ---------- */

@media (forced-colors: active) {
  .cursor {
    background: Highlight;
  }

  .l--active,
  .block:target .l {
    outline: 1px solid Highlight;
  }

  .l:has(a:hover),
  .l:has(a:focus-visible) {
    outline: 1px solid Highlight;
  }
}
