@font-face {
  font-family: "Idun 387";
  src: url("fonts/Idun387.ttf") format("truetype");
}
@font-face {
  font-family: "APL387";
  src: url("fonts/APL387.ttf") format("truetype");
}

:root {
  --bg: #fdfcf8;
  --fg: #1f1d1a;
  --muted: #6a645c;
  --line: #ddd8cf;
  --code-bg: #f1eee6;
  --link: #8a3b12;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b;
    --fg: #e6e3dc;
    --muted: #a19b91;
    --line: #34363b;
    --code-bg: #222428;
    --link: #f0a46c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
header, main, footer { max-width: 52rem; margin: 0 auto; padding: 0 1rem; }
header {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding-top: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line);
}
nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; flex: 1; }
nav a { color: var(--fg); text-decoration: none; }
nav a[aria-current="page"] { font-weight: 600; border-bottom: 2px solid var(--link); }
a { color: var(--link); }
footer { margin-top: 3rem; padding-bottom: 2rem; color: var(--muted); font-size: .9rem; }

#script-toggle {
  font: inherit; font-size: .9rem; padding: .3rem .8rem; cursor: pointer;
  color: var(--fg); background: var(--code-bg);
  border: 1px solid var(--line); border-radius: 4px;
}

h1 { font-size: 2rem; line-height: 1.2; margin: 1.5rem 0 1rem; }
h2 { margin-top: 2rem; }

pre, code { font-family: "Idun 387", ui-monospace, monospace; }
pre {
  background: var(--code-bg); padding: .75rem 1rem; border-radius: 4px;
  overflow-x: auto; font-size: 1.25rem; line-height: 1.4;
}
/* Inline code quotes glyphs literally (`⍝`), so it uses APL387, which draws
   them as themselves; Idun 387 would draw the rune. */
:not(pre) > code {
  font-family: "APL387", ui-monospace, monospace;
  background: var(--code-bg); padding: 0 .2em; border-radius: 3px;
}

/* APL blocks hold both texts; runes show unless .show-apl is set. */
pre.apl .glyphs { display: none; font-family: "APL387", ui-monospace, monospace; }
.show-apl pre.apl .idun { display: none; }
.show-apl pre.apl .glyphs { display: inline; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; font-size: .9rem; }
th, td { border-bottom: 1px solid var(--line); padding: .3rem .5rem; text-align: left; vertical-align: top; }
td.glyph { font-family: "APL387", ui-monospace, monospace; font-size: 1.3rem; }
td.rune { font-family: "Idun 387", ui-monospace, monospace; font-size: 1.3rem; }

figure { margin: 1.5rem 0; }
figure img { max-width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
figcaption { color: var(--muted); font-size: .9rem; }
