/* Course sites: shared stylesheet. See design_style_guide.md.
   The per-course accent color arrives as --accent from the page <head>. */

@font-face {
  font-family: "PT Sans Narrow";
  font-weight: 700;
  font-display: swap;
  src: url(fonts/pt-sans-narrow-latin-700.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "PT Sans Narrow";
  font-weight: 700;
  font-display: swap;
  src: url(fonts/pt-sans-narrow-latin-ext-700.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "PT Sans Narrow";
  font-weight: 700;
  font-display: swap;
  src: url(fonts/pt-sans-narrow-cyrillic-700.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --bg: #f1eee6;          /* limestone */
  --surface: #faf8f2;
  --ink: #26221e;         /* peat */
  --muted: #655c52;
  --rule: #d6cebf;
  --loam: #3a2e26;        /* dark band */
  --loam-ink: #f1eee6;
  --ochre: #e6c96f;       /* highlight */
  --ochre-wash: #f6e8bd;  /* behind inline bold */
  --umber: #7b4a1f;       /* course terms */
  --accent: #7a4a2b;      /* overridden per course */
  --link: var(--accent);
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "PT Sans Narrow", "Arial Narrow", system-ui, sans-serif;
  --measure: 47rem;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root { --link: color-mix(in srgb, var(--accent) 86%, black); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--body);
  overflow-wrap: break-word;
}
@media (min-width: 60rem) { body { font-size: 1.125rem; } }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--surface); padding: .5rem .75rem; }

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

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.12; letter-spacing: .005em; text-wrap: balance; }
h1 { font-size: 2.7rem; margin: 2.4rem 0 1.4rem; }
h2 { font-size: 1.85rem; margin: 2.6rem 0 .8rem; }
h3 { font-size: 1.4rem; margin: 2rem 0 .5rem; }
h4, h5, h6 { font-size: 1.02em; line-height: 1.3; margin: 1.6rem 0 .4rem; }
p, ul, ol, dl, blockquote, pre, figure, .table-wrap, .embed { margin: 0 0 1.05rem; }
ul, ol { padding-left: 1.4rem; }
li { margin: .3rem 0; }
li > ul, li > ol { margin: .3rem 0 .3rem; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4rem 0; }

/* ---- emphasis (design guide, section 6) ---- */
strong { font-weight: 680; color: var(--loam); }
strong:not(.lead) {
  background: var(--ochre-wash);
  padding: .08em .26em;
  margin: 0 -.1em;
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
em.term { color: var(--umber); font-weight: 620; }
del { color: var(--muted); }
.tbd { background: var(--ochre); padding: 0 .3em; font-weight: 650; }

/* ---- top bar (content pages) ---- */
.topbar { background: var(--loam); color: var(--loam-ink); border-bottom: 5px solid var(--accent); }
.topbar .wrap { max-width: 64rem; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.6rem; padding-top: .7rem; padding-bottom: .7rem; }
.topbar a { color: inherit; text-decoration: none; }
.topbar .home { display: inline-flex; align-items: center; gap: .55rem; font: 700 1.45rem/1 var(--display); margin-right: auto; }
.topbar .home img { width: 1.7rem; height: 1.7rem; flex: none; border-radius: 4px; }
.topbar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .1rem 1.15rem; font-size: .9rem; }
.topbar li { margin: 0; }
.topbar nav a { display: inline-block; padding: .28rem 0; border-bottom: 2px solid transparent; opacity: .88; }
.topbar nav a:hover { opacity: 1; border-bottom-color: currentColor; }
.topbar nav a[aria-current] { opacity: 1; border-bottom-color: var(--ochre); }

/* ---- content ---- */
article { padding-bottom: 3rem; }
body.collapsible > main.wrap { max-width: 58rem; }   /* the syllabus is structured lists, not running prose */
blockquote {
  margin-left: 0; margin-right: 0;
  padding: 1.1rem 1.25rem .2rem;
  background: var(--surface);
  border-left: 5px solid var(--accent);
}
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
pre { background: var(--surface); border: 1px solid var(--rule); padding: 1rem; overflow-x: auto; line-height: 1.5; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95em; }
th, td { text-align: left; padding: .5rem .8rem .5rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { border-bottom: 2px solid var(--ink); }
img { max-width: 100%; height: auto; }
figure { margin-left: 0; margin-right: 0; text-align: center; }
figure img { display: block; margin: 0 auto; }
figcaption { color: var(--muted); font-size: .9em; margin-top: .5rem; }
.embed { aspect-ratio: 16 / 9; }
.embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.construction { background: var(--surface); border-left: 5px solid var(--ochre); padding: 1rem 1.25rem; }
.fine { color: var(--muted); font-size: .88rem; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.24em; }
.icon-out { width: .8em; height: .8em; vertical-align: baseline; }

/* ---- syllabus: toolbar and collapsible sections ---- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin: -.4rem 0 1.6rem; }
.pdf { display: inline-flex; align-items: center; gap: .4rem; }
.toggles { display: inline-flex; gap: .5rem; }
.toggles[hidden] { display: none; }
button {
  font: inherit; font-size: .88rem; color: var(--ink);
  background: transparent; border: 1px solid var(--muted); border-radius: 3px;
  padding: .3rem .7rem; cursor: pointer;
}
button:hover { background: var(--surface); border-color: var(--ink); }

summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary h2, summary h3 { margin: 0; }
summary::before {
  content: ""; flex: none;
  width: .5rem; height: .5rem; margin-top: .55em;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .15s;
}
details[open] > summary::before { transform: rotate(45deg) translate(-.1rem, -.1rem); }
@media (prefers-reduced-motion: reduce) { summary::before { transition: none; } }

details.part { border-top: 4px solid var(--ink); margin-top: 2.2rem; }
details.part > summary { display: flex; gap: .7rem; padding: .8rem 0 .7rem; }
details.part > summary::before { margin-top: .7rem; }
details.part > p { margin-left: 1.2rem; }

details.session { border-top: 1px solid var(--rule); padding: 0 0 0 1.2rem; }
details.session > summary { display: flex; gap: .7rem; padding: .7rem 0; margin-left: -1.2rem; }
details.session > summary > h3 { flex: 1; min-width: 0; display: grid; grid-template-columns: 11.5rem 1fr; gap: .1rem 1rem; align-items: baseline; font-size: 1.3rem; }
details.session > summary > h3:not(:has(.s-when)) { display: block; }
.s-when { font: 400 .88rem/1.4 var(--body); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.s-date { color: var(--ink); font-weight: 600; }
.s-num { white-space: nowrap; }
.s-num::before { content: "/ "; opacity: .6; }
details.session[open] { padding-bottom: .6rem; }
details.session[data-next] { background: var(--surface); box-shadow: -5px 0 0 var(--accent); }
.next-badge {
  font: 600 .74rem/1 var(--body); color: #fff; background: var(--accent);
  padding: .25rem .45rem; border-radius: 2px; align-self: center; white-space: nowrap;
}
h2.marker, h3.marker {
  font: 600 .95rem/1.4 var(--body); color: var(--muted); text-align: center;
  border-top: 4px solid var(--ink); margin: 2.2rem 0 0; padding: 1rem 0 0;
}
h3.marker { border-top: 1px solid var(--rule); margin: 0; padding: .7rem 0; }

/* ---- splash page ---- */
.masthead { background: var(--loam); color: var(--loam-ink); border-bottom: 6px solid var(--accent); overflow: hidden; }
.masthead .wrap { max-width: 62rem; position: relative; padding-top: 3.2rem; padding-bottom: 2.6rem; }
.masthead .course-meta { margin: 0 0 .5rem; font-size: 1rem; opacity: .85; }
.masthead h1 { font-size: clamp(3.2rem, 12vw, 6.8rem); line-height: .95; margin: 0 0 1.1rem; max-width: 11ch; position: relative; z-index: 1; }
.masthead .tagline { margin: 0; max-width: 30rem; font-size: 1.15rem; line-height: 1.45; position: relative; z-index: 1; }
.emblem { position: absolute; right: -1.5rem; bottom: -3.2rem; width: clamp(9rem, 30vw, 19rem); transform: rotate(8deg); opacity: .95; }
.emblem img { display: block; width: 100%; height: auto; border-radius: 12%; }
@media (max-width: 40rem) {
  .emblem { width: 6.5rem; right: -1.2rem; top: 1.4rem; bottom: auto; }
  .masthead h1, .masthead .tagline { max-width: calc(100% - 4.5rem); }
}

.splash-grid { max-width: 62rem; display: grid; gap: 2.5rem; padding-top: 2.6rem; padding-bottom: 3.5rem; }
@media (min-width: 52rem) { .splash-grid { grid-template-columns: 19rem 1fr; gap: 4rem; } }
.info dl { margin: 0 0 1.4rem; }
.info dl > div { padding: .55rem 0; border-top: 1px solid var(--rule); }
.info dl > div:first-child { border-top: 4px solid var(--ink); }
.info dt { font-size: .85rem; color: var(--muted); }
.info dd { margin: 0; }
.canvas { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; text-decoration: none; color: var(--ink); border: 1px solid var(--muted); border-radius: 3px; padding: .5rem .9rem; }
.canvas:hover { background: var(--surface); border-color: var(--ink); }

.toc ul { list-style: none; margin: 0; padding: 0; border-top: 4px solid var(--ink); }
.toc li { margin: 0; border-bottom: 1px solid var(--rule); }
.toc a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 1.05rem .2rem 1rem;
  font: 700 clamp(1.7rem, 5.2vw, 2.35rem)/1.1 var(--display);
  color: var(--ink); text-decoration: none;
}
/* The syllabus is the page students come back to: a quiet accent rule in the gutter. */
.toc li.key { position: relative; }
.toc li.key > a::before {
  content: ""; position: absolute; left: -.8rem; top: .95rem; bottom: .9rem; width: 5px;
  background: var(--ochre);
}
.toc a:hover, .toc a:focus-visible { color: var(--link); background: var(--surface); box-shadow: -1rem 0 0 var(--surface), 1rem 0 0 var(--surface); }
.toc .external a { font: 600 1.05rem/1.3 var(--body); padding-bottom: .3rem; justify-content: flex-start; gap: .4rem; }
.toc .external .fine { margin: 0 .2rem .9rem; }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--rule); background: var(--surface); padding: 1.8rem 0 2.2rem; font-size: .95rem; }
.site-footer .wrap { max-width: 64rem; }
.site-footer ul { list-style: none; margin: 0 0 .9rem; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem 1.5rem; }
.site-footer li { margin: 0; }
.site-footer .extras a { display: inline-flex; align-items: center; gap: .35rem; }
.site-footer .fine { margin: 1.2rem 0 0; }

/* ---- small screens ---- */
@media (max-width: 34rem) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.6rem; }
  details.session > summary > h3 { grid-template-columns: 1fr; }
  .topbar .home { width: 100%; }
}

/* ---- print (for students who print a web page; the PDF is the real print version) ---- */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .topbar nav, .skip, .toolbar, .site-footer nav, .site-footer .extras, .emblem, .next-badge, summary::before { display: none !important; }
  .topbar, .masthead { background: none; color: #000; border-bottom: 2px solid #000; }
  a { color: #000; }
  strong:not(.lead) { background: none; padding: 0; margin: 0; }
  em.term, strong.lead { color: #000; }
  details.session > summary > h3 { grid-template-columns: 11.5rem 1fr; }
  details.session[data-next] { background: none; box-shadow: none; }
  details::details-content { content-visibility: visible; display: block; }
  figure, blockquote, details.session > summary { break-inside: avoid; }
  h1, h2, h3, h4 { break-after: avoid; }
}

/* ======================================================================
   Theme: anachronism (Digital Methods, dh.bactriana.org).
   Set by design.theme in the course config, which adds .theme-anachronism to <body>.
   The page is the manuscript (vellum, lapis, vermilion, gold, a blackletter initial);
   the machine is modern (system sans, terminal-style code). A deliberate exception to
   the design guide's "no decorative typeface" rule: see design_style_guide.md, section 12.
   ====================================================================== */
@font-face {
  font-family: "UnifrakturMaguntia";   /* SIL Open Font License; subset to letters and digits */
  font-display: swap;
  src: url(fonts/unifraktur-maguntia-subset.woff2) format("woff2");
}
.theme-anachronism {
  --bg: #f4ecd8;          /* vellum */
  --surface: #fbf6ea;
  --ink: #241b12;         /* iron-gall ink */
  --muted: #66563f;
  --rule: #dccdab;
  --loam: #172b66;        /* the dark band becomes lapis */
  --loam-ink: #f4ecd8;
  --ochre: #d9a93f;       /* gold leaf */
  --ochre-wash: #f3e3b6;
  --umber: #a83220;
  --vermilion: #a83220;
  --gold: #b8862b;
  --lapis: #1f3a8a;
  --code-bg: #0f1620;     /* the machine */
  --code-ink: #7fe6ee;
  --blackletter: "UnifrakturMaguntia", "Old English Text MT", serif;
  /* Ground pigment: irregular mottling and a fine dust, as in hand-ground ultramarine.
     Two tiles of SVG fractal noise, laid on in soft-light so the lapis keeps its hue. */
  --pigment:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1400' height='500'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='1400' height='500' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
}
.theme-anachronism ::selection { background: var(--code-ink); color: var(--code-bg); }

/* bands: a starry lapis sky, edged in gold and vermilion */
.theme-anachronism .topbar,
.theme-anachronism .masthead {
  background-color: var(--loam);
  position: relative;
  isolation: isolate;          /* keep the blend inside the band */
  border-bottom: 4px solid var(--gold);
  box-shadow: 0 3px 0 var(--vermilion);
}
.theme-anachronism .topbar::before,
.theme-anachronism .masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--pigment);
  mix-blend-mode: soft-light;
  opacity: .6;
}
.theme-anachronism .topbar nav a[aria-current] { border-bottom-color: var(--ochre); }

/* the illuminated initial: first letter of each page's opening paragraph */
/* pandoc wraps each page in section.level1 (--section-divs); the syllabus is lists, so it gets no initial */
.theme-anachronism:not(.collapsible) article > section.level1 > p:first-of-type::first-letter {
  float: left;
  font-family: var(--blackletter);
  font-weight: 400;
  font-size: 3.5em;
  line-height: .8;
  padding: .14em .16em .06em;
  margin: .08em .16em 0 0;
  color: #f3d98a;
  background: var(--lapis);
  border: 3px double var(--gold);
}

/* rubrication instead of highlighter */
.theme-anachronism strong.lead { color: var(--lapis); }
.theme-anachronism strong:not(.lead) { background: none; padding: 0; margin: 0; color: var(--vermilion); }
.theme-anachronism:not(.collapsible) article h2::before { content: "\00B6"; color: var(--vermilion); margin-right: .3em; font-weight: 400; }
.theme-anachronism hr { height: 1px; border: 0; background: linear-gradient(to right, transparent, var(--gold), transparent); }
.theme-anachronism blockquote { border-left-color: var(--vermilion); }
.theme-anachronism figure img { border: 3px solid var(--gold); }

/* the machine: terminal-style code on the vellum */
.theme-anachronism code { background: var(--code-bg); color: var(--code-ink); padding: .08em .35em; border-radius: 3px; }
.theme-anachronism pre {
  background: var(--code-bg); color: var(--code-ink);
  border: 0; border-left: 4px solid var(--vermilion); border-radius: 3px;
  box-shadow: 0 6px 18px rgba(15, 22, 32, .25);
}
.theme-anachronism pre code { background: none; padding: 0; }
.theme-anachronism code span.kw, .theme-anachronism code span.cf { color: #ff8bd8; }
.theme-anachronism code span.st, .theme-anachronism code span.ss { color: #ffd479; }
.theme-anachronism code span.co { color: #8d9aa8; font-style: italic; }
.theme-anachronism code span.fu, .theme-anachronism code span.bu { color: #a6f59a; }
.theme-anachronism code span.dv, .theme-anachronism code span.fl, .theme-anachronism code span.dt { color: #ffa45c; }
.theme-anachronism code span.at, .theme-anachronism code span.va { color: #b7c8ff; }

/* syllabus */
.theme-anachronism details.part { border-top-color: var(--vermilion); }
.theme-anachronism h2.marker { border-top-color: var(--vermilion); }
.theme-anachronism .s-date { color: var(--lapis); }

/* splash page */
.theme-anachronism .masthead h1::first-letter { font-family: var(--blackletter); font-weight: 400; color: var(--ochre); }
.theme-anachronism .emblem {
  right: 1.25rem; top: 50%; bottom: auto;
  width: clamp(11rem, 30vw, 19rem);
  transform: translateY(-50%) rotate(-2deg);
}
.theme-anachronism .emblem img {
  border-radius: 3px;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 3px var(--vermilion), 0 14px 30px rgba(0, 0, 0, .4);
}
@media (min-width: 40.01rem) {
  .theme-anachronism .masthead .wrap { padding-right: clamp(14rem, 34vw, 23rem); min-height: 22rem; }
}
@media (max-width: 40rem) {
  .theme-anachronism .emblem { position: static; transform: none; width: 100%; margin-top: 1.6rem; }
  .theme-anachronism .emblem img { aspect-ratio: 4 / 3; object-fit: cover; object-position: center 40%; }
  .theme-anachronism .masthead h1, .theme-anachronism .masthead .tagline { max-width: none; }
}
.theme-anachronism .info dl > div:first-child { border-top-color: var(--lapis); }
.theme-anachronism .toc ul { border-top-color: var(--vermilion); }
.theme-anachronism .toc a:hover, .theme-anachronism .toc a:focus-visible { color: var(--vermilion); }

@media print {
  .theme-anachronism .topbar, .theme-anachronism .masthead { background: none; box-shadow: none; }
  .theme-anachronism .topbar::before, .theme-anachronism .masthead::before { display: none; }
  .theme-anachronism code, .theme-anachronism pre { background: none; color: #000; box-shadow: none; }
  .theme-anachronism article > section.level1 > p:first-of-type::first-letter { color: #000; background: none; border: 0; }
  .theme-anachronism strong:not(.lead), .theme-anachronism strong.lead { color: #000; }
}
