/* SHRDLU — terminal.
   SHRDLU is Winograd's 1970 blocks-world program as much as it is the second
   line of a Linotype keyboard. This takes the first reading: monospace on a
   strict grid, dark by default, chrome that reads like output.

   Two exceptions to the monospace rule, both deliberate. Persian is set in
   Vazirmatn: no monospace face covers Arabic-script joining or ZWNJ, and the
   transcripts are several hundred words of prose meant to be read slowly.
   Fonts are self-hosted, so a page contacts nothing but this origin. */

@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap; unicode-range: U+0600-06FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFF; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-SemiBold.woff2") format("woff2");
  font-weight: 600; font-display: swap; unicode-range: U+0600-06FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFF; }

:root {
  color-scheme: dark light;
  --paper: #0d1117; --ink: #d3d7de; --muted: #7d8590; --rule: #22272e;
  --raised: #161b22; --accent: #58c8b0; --slang: #e3a04a;
  --hl-comment: #6e7781; --hl-keyword: #e3a04a; --hl-string: #9ece6a;
  --hl-type: #58c8b0; --hl-number: #7fb2f0; --hl-pre: #c99bf0;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: var(--mono);
  --fa: "Vazirmatn", Tahoma, sans-serif;
  --measure: 40rem;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --paper: #fbfbf9; --ink: #1c2128; --muted: #6a737d; --rule: #e1e4e8;
    --raised: #f2f2ef; --accent: #16786a; --slang: #a35d12;
    --hl-comment: #8b949e; --hl-keyword: #a35d12; --hl-string: #3f7a25;
    --hl-type: #16786a; --hl-number: #1c5fb0; --hl-pre: #7a3fae;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #fbfbf9; --ink: #1c2128; --muted: #6a737d; --rule: #e1e4e8;
  --raised: #f2f2ef; --accent: #16786a; --slang: #a35d12;
  --hl-comment: #8b949e; --hl-keyword: #a35d12; --hl-string: #3f7a25;
  --hl-type: #16786a; --hl-number: #1c5fb0; --hl-pre: #7a3fae;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; padding: 0 20px; background: var(--paper); color: var(--ink);
  font: 400 0.9375rem/1.75 var(--mono);
}
main { max-width: var(--measure); margin: 0 auto; }
a { color: var(--accent); text-underline-offset: 3px; }
.muted, .meta { color: var(--muted); }
.meta { font-size: 0.8125rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--raised); padding: 8px; }

/* masthead ---------------------------------------------------------------- */
.masthead {
  max-width: var(--measure); margin: 0 auto; padding: 26px 0 14px;
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-weight: 600; font-size: 0.9375rem; letter-spacing: 0.2em;
  color: var(--accent); text-decoration: none;
}
.wordmark::before { content: "$ "; color: var(--muted); }
.masthead nav { display: flex; gap: 16px; font-size: 0.8125rem; }
.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a::before { content: "/"; color: var(--rule); margin-right: 2px; }
.masthead nav a:hover { color: var(--accent); }

/* home -------------------------------------------------------------------- */
.intro { padding: 44px 0 6px; }
.intro h1 { font-weight: 600; font-size: 1.75rem; letter-spacing: 0.22em; margin: 0 0 14px; }
.intro h1::after { content: "_"; color: var(--accent); }
.lede { color: var(--muted); margin: 0 0 22px; }
.lede::before { content: "// "; color: var(--rule); }
.collection { padding: 30px 0 8px; border-top: 1px solid var(--rule); }
.collection h2 {
  font-size: 0.875rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 6px;
}
.collection h2::before { content: "## "; color: var(--rule); }
.collection h2 a { color: inherit; text-decoration: none; }
.blurb { color: var(--muted); font-size: 0.8125rem; margin: 0 0 16px; }
ul.index { list-style: none; padding: 0; margin: 0; }
ul.index li {
  display: flex; gap: 16px; align-items: baseline; justify-content: space-between;
  padding: 5px 8px; margin: 0 -8px; border-radius: 2px;
}
ul.index li:hover { background: var(--raised); }
ul.index li a { text-decoration: none; }
ul.index li a::before { content: "› "; color: var(--muted); }
ul.index .meta { flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* entries ----------------------------------------------------------------- */
.entry-head { padding: 44px 0 18px; }
.entry-head h1 { font-size: 1.375rem; font-weight: 600; line-height: 1.45; margin: 0 0 10px; }
.eyebrow {
  font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.eyebrow a { color: var(--muted); }
.prose, .episode { padding-bottom: 60px; }
.prose h2, .episode h2 { font-size: 1.0625rem; font-weight: 600; margin: 32px 0 10px; }
.prose h2::before, .episode h2::before { content: "## "; color: var(--rule); }
.prose p, .episode p { margin: 0 0 18px; }
.prose img, .episode img, .show-intro img {
  max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 2px;
}
/* Alignment carried over from WordPress via attr_list. The width attribute
   caps the natural size; max-width keeps it responsive on narrow screens. */
img.alignright { float: right; margin: 4px 0 16px 22px; }
img.alignleft  { float: left;  margin: 4px 22px 16px 0; }
img.aligncenter { display: block; margin: 20px auto; }
img.alignnone { display: block; margin: 20px 0; }
.prose, .episode, .show-intro { overflow: auto; }   /* contain the floats */
@media (max-width: 30rem) {
  /* a 200px float in a 320px column leaves an unreadable ribbon of text */
  img.alignright, img.alignleft { float: none; display: block; margin: 20px 0; }
}
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 6px; }
blockquote { margin: 0 0 18px; padding-left: 16px; border-left: 2px solid var(--rule); color: var(--muted); }

/* code -------------------------------------------------------------------- */
pre, .codehilite {
  background: var(--raised); border: 1px solid var(--rule);
  border-left: 2px solid var(--accent); border-radius: 2px;
  overflow-x: auto;
}
.codehilite pre { border: 0; border-radius: 0; margin: 0; background: none; }
pre { padding: 14px 16px; font: 400 0.8125rem/1.65 var(--mono); }
.codehilite { margin: 0 0 18px; }
pre code { background: none; padding: 0; font-size: inherit; }
code { font: 400 0.9em/1.4 var(--mono); background: var(--raised); padding: 1px 5px; border-radius: 2px; }

/* Pygments tokens, coloured through the theme's own variables so light and
   dark stay in step. Highlighting is baked in at build time. */
.codehilite .c, .codehilite .c1, .codehilite .cm, .codehilite .cs { color: var(--hl-comment); font-style: italic; }
.codehilite .cp, .codehilite .cpf { color: var(--hl-pre); }
.codehilite .k, .codehilite .kd, .codehilite .kn, .codehilite .kr,
.codehilite .kc, .codehilite .kt { color: var(--hl-keyword); }
.codehilite .s, .codehilite .s1, .codehilite .s2, .codehilite .sd,
.codehilite .sc, .codehilite .se { color: var(--hl-string); }
.codehilite .m, .codehilite .mi, .codehilite .mf, .codehilite .mh { color: var(--hl-number); }
.codehilite .nc, .codehilite .nf, .codehilite .nb, .codehilite .bp { color: var(--hl-type); }
.codehilite .nl, .codehilite .na { color: var(--ink); }
.codehilite .o, .codehilite .p { color: var(--muted); }
.codehilite .err { color: var(--ink); background: none; }

.downloads { margin-top: 36px; border-top: 1px solid var(--rule); padding-top: 16px; }
.downloads h2 { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.downloads ul { list-style: none; padding: 0; margin: 0; }
.downloads li { padding: 4px 0; }
.downloads li a::before { content: "› "; color: var(--muted); }

/* podcast ----------------------------------------------------------------- */
.show-head { display: flex; gap: 26px; flex-wrap: wrap; align-items: center; padding: 44px 0 22px; }
/* min-width:0 stops a wide image inside the text column from setting the
   column's min-content width and forcing the cover onto its own line */
.show-head > div { flex: 1 1 17rem; min-width: 0; }
.show-head h1 { font-size: 1.625rem; font-weight: 600; letter-spacing: 0.06em; margin: 0 0 8px; }
.cover { flex: none; border: 1px solid var(--rule); border-radius: 2px; }
.show-intro { padding-bottom: 30px; }
.show-intro p { margin: 0 0 14px; }
.subscribe { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.button {
  display: inline-block; text-decoration: none; padding: 8px 14px;
  border: 1px solid var(--accent); color: var(--accent);
  font-size: 0.8125rem; border-radius: 2px;
}
.button::before { content: "[ "; } .button::after { content: " ]"; }
.button:hover { background: var(--accent); color: var(--paper); }
ol.episodes { list-style: none; padding: 0; margin: 0; }
ol.episodes li { padding: 24px 0; border-top: 1px solid var(--rule); }
ol.episodes h2 { font-size: 1.125rem; font-weight: 600; margin: 0 0 6px; }
ol.episodes h2 a { color: var(--ink); text-decoration: none; }
ol.episodes h2 a:hover { color: var(--accent); }
audio { width: 100%; margin-top: 12px; }
.player { margin: 8px 0 30px; }
.player .meta { display: flex; gap: 10px; margin-top: 8px; }
.note { padding: 18px 0; }

/* Persian transcript ------------------------------------------------------
   Not monospace: no mono face joins Arabic script correctly, and this is the
   longest-form reading on the site. */
.transcript {
  font-family: var(--fa); font-size: 1.1875rem; line-height: 2.05;
  text-align: right; padding: 16px 0;
  border-top: 1px dashed var(--rule); border-bottom: 1px dashed var(--rule);
}
.transcript p { margin: 0 0 20px; }
.transcript p:last-child { margin-bottom: 0; }
.transcript a[href^="#vocab_"], .transcript a[href^="#slang_"] {
  text-decoration: none; border-bottom: 1px dotted currentColor; padding-bottom: 1px;
}
.transcript a[href^="#vocab_"] { color: var(--accent); }
.transcript a[href^="#slang_"] { color: var(--slang); }

/* glossaries --------------------------------------------------------------
   LTR rows with the Persian isolated in <bdi>; setting dir on the cells made
   mixed-direction rows align unpredictably. */
.glossary { margin-top: 38px; }
.glossary h2 {
  font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 0 0 4px;
}
.glossary h2::before { content: "── "; color: var(--rule); }
.glossary .blurb { margin-bottom: 12px; }
.glossary dl { margin: 0; }
.glossary .entry {
  display: grid; grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 2px 16px; align-items: baseline;
  padding: 6px 8px; margin: 0 -8px; border-bottom: 1px solid var(--rule);
  border-radius: 2px; scroll-margin-top: 25vh;
}
.glossary dt { font-family: var(--fa); font-size: 1.0625rem; font-weight: 600; line-height: 1.7; }
.glossary dd { margin: 0; color: var(--muted); font-size: 0.8125rem; }
.glossary .asused { display: block; opacity: 0.85; }
.glossary dd bdi, .glossary .asused bdi { font-family: var(--fa); font-size: 0.9375rem; }
.glossary .entry:target, .glossary .entry.lit { background: var(--raised); }
.glossary.slangs dt { color: var(--slang); }
@media (min-width: 52rem) {
  .glossary dl { columns: 2; column-gap: 30px; }
  .glossary .entry { break-inside: avoid; }
}

.gloss-pop {
  display: inline-block; margin: 0 6px; padding: 2px 8px; border-radius: 2px;
  background: var(--accent); color: var(--paper);
  font: 400 0.8125rem/1.5 var(--mono); direction: ltr;
}
.gloss-pop[data-kind="slang"] { background: var(--slang); direction: rtl; font-family: var(--fa); }

.episode-nav { margin-top: 40px; font-size: 0.8125rem; }
footer {
  max-width: var(--measure); margin: 0 auto;
  border-top: 1px solid var(--rule); padding: 22px 0 48px;
  color: var(--muted); font-size: 0.8125rem;
}
footer p { margin: 0 0 4px; }
footer p:first-child::before { content: "// "; color: var(--rule); }
footer a { color: var(--muted); }

@media (max-width: 34rem) {
  .intro h1 { font-size: 1.25rem; letter-spacing: 0.16em; }
  .cover { width: 130px; height: 130px; }
  .show-head { gap: 18px; }
}
