/* site.css — house style for the PhD project site.
 *
 * Newspaper front-page aesthetic, extracted from "Inspection/PhD Newspaper.dc.html"
 * (Option A · Broadsheet). Clean, minimal, print-inspired; no highlights.
 *
 * MODULAR BY DESIGN: everything below the :root block reads from the tokens.
 * To restyle the whole site, edit ONLY the custom properties in :root.
 */

/* Web fonts load here so the whole style — type included — lives in this one
   file. Newsreader + Libre Franklin, matching the design source. */
@import url("https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=Libre+Franklin:wght@400;500;600;700;800&display=swap");

:root {
  /* Type families — Newsreader (serif) for reading, Libre Franklin (sans) for
     labels/nav/metadata, monospace for code. Web fonts are loaded per-page by
     the converter; the fallbacks keep the page readable offline. */
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Libre Franklin", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Ink — headline black down to faint captions. */
  --ink: #161614;        /* headlines, hard rules */
  --ink-2: #1a1a18;      /* secondary headings */
  --body: #33332f;       /* running text */
  --deck: #46453f;       /* standfirst / lead-in */
  --muted: #6b6b66;      /* metadata, subtitles */
  --faint: #9b9b95;      /* kicker labels, captions */

  /* Accent — the masthead navy. Links and kickers only; used sparingly. */
  --accent: #1a3a6b;
  --accent-soft: #aab8d8;
  --accent-line: #3a558a;

  /* Paper + rules. */
  --paper: #fcfcfb;      /* page background */
  --rule: #e3e2dc;       /* hairline rules, table lines */
  --rule-2: #ecebe6;     /* lighter border */
  --rule-3: #ddddd6;     /* figure/placeholder border */
  --rule-hairline: #cfcec8;
  --masthead-rule: #2a2a26;  /* the double rule under the masthead */
  --code-bg: #f4f3ee;    /* tinted paper for code blocks */

  /* Spacing + measure. */
  --measure: 44rem;      /* readable article column width */
  --gap: 1.25rem;
  --pad: 2.5rem;

  /* Uppercase-label tracking. */
  --track-label: 0.14em;
}

/* --- Dark mode — plum accents, white text on black --------------------------
   Keyed to the SAME saved-theme attribute + localStorage("theme") key the
   Quartz toggle writes, so one preference follows the reader across the wikis
   and these static pages alike. The init/toggle script lives in page.html. */
:root[saved-theme="dark"] {
  color-scheme: dark;

  --ink: #ffffff;
  --ink-2: #f2eef4;
  --body: #e9e4ec;
  --deck: #d9d0de;
  --muted: #a898b0;
  --faint: #7d6f85;

  --accent: #c58fd1;
  --accent-soft: #5a3d63;
  --accent-line: #7b5585;

  --paper: #0d0b0f;
  --rule: #2a2430;
  --rule-2: #241f29;
  --rule-3: #322c38;
  --rule-hairline: #3b3442;
  --masthead-rule: #d9d0de;
  --code-bg: #1a1521;
}

/* The masthead-nav theme toggle: a text label styled like the other nav
   entries. Its face flips with the theme via the ::after content. */
#theme-toggle {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-left: auto;
}
#theme-toggle:hover { color: var(--accent); }
#theme-toggle::after { content: "☾ Dark"; }
:root[saved-theme="dark"] #theme-toggle::after { content: "☀ Light"; }

html {
  font-size: 18px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.62;
  /* Center the article on a readable measure with breathing room. */
  max-width: var(--measure);
  margin-inline: auto;
  padding: var(--pad) 1.5rem 4rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Site masthead: header on every inner page (Option B treatment) ------ */
#site-masthead {
  margin-bottom: 2.6rem;
}
#site-masthead .mh-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.4rem 2rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--ink);
}
#site-masthead .mh-brand {
  display: block;
  min-width: 0;
  text-decoration: none;
}
#site-masthead .mh-kicker {
  display: block;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
#site-masthead .mh-title {
  display: block;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.55rem;
  line-height: 1.0;
  letter-spacing: -0.4px;
  color: var(--ink);
}
#site-masthead .mh-brand:hover .mh-title { color: var(--accent); }
#site-masthead .mh-meta {
  flex: 0 0 auto;
  text-align: right;
  padding-top: 0.15rem;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.66rem;
  line-height: 1.7;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
#site-masthead .mh-meta-strong {
  display: block;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
#site-masthead .mh-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 1.25rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#site-masthead .mh-nav a {
  color: var(--body);
  text-decoration: none;
}
#site-masthead .mh-nav a:hover { color: var(--accent); }
#site-masthead .mh-nav .mh-wiki { color: var(--accent); }
#site-masthead .mh-nav-sep {
  width: 1px;
  height: 0.8rem;
  background: var(--rule-hairline);
}

/* --- Masthead: pandoc's --standalone title block ------------------------- */
#title-block-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 3px double var(--masthead-rule);
}

#title-block-header .title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 2.6rem;
  line-height: 1.04;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin: 0 0 0.6rem;
}

#title-block-header .subtitle {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.2rem;
  color: var(--deck);
  margin: 0 0 0.8rem;
}

#title-block-header .author,
#title-block-header .date {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

/* --- Headings ------------------------------------------------------------ */
h1, h2, h3 {
  font-family: var(--font-serif);
  color: var(--ink-2);
  letter-spacing: -0.3px;
  line-height: 1.12;
}

h1 {
  font-weight: 500;
  font-size: 2.1rem;
  color: var(--ink);
  margin: 2.4rem 0 1rem;
}

h2 {
  font-weight: 500;
  font-size: 1.6rem;
  margin: 2.2rem 0 0.8rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);  /* section rule */
}

h3 {
  font-weight: 600;
  font-size: 1.25rem;
  margin: 1.8rem 0 0.6rem;
}

/* Small subheads read as newspaper kickers: sans, uppercase, tracked. */
h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--accent);
  margin: 1.6rem 0 0.5rem;
}

h4 { font-size: 0.85rem; }
h5 { font-size: 0.78rem; }
h6 { font-size: 0.72rem; color: var(--faint); }

/* --- Body ---------------------------------------------------------------- */
p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

strong { font-weight: 600; color: var(--ink-2); }
em { font-style: italic; }

/* --- Lists --------------------------------------------------------------- */
ul, ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}

li { margin: 0.25rem 0; }

/* --- Quotes -------------------------------------------------------------- */
blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid var(--accent);
  color: var(--deck);
  font-style: italic;
}

blockquote p:last-child { margin-bottom: 0; }

/* --- Code ---------------------------------------------------------------- */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.45;
  background: var(--code-bg);
  border: 1px solid var(--rule-3);
  border-radius: 3px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* --- Rules + figures ----------------------------------------------------- */
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.2rem 0;
}

img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule-3);
}

figcaption {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 0.4rem;
}

/* --- Tables: newspaper rules, no vertical lines -------------------------- */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.4rem 0;
  font-size: 0.95rem;
}

thead th {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  color: var(--ink-2);
  border-bottom: 2px solid var(--ink);
  padding: 0.5rem 0.7rem;
}

tbody td {
  border-bottom: 1px solid var(--rule);
  padding: 0.5rem 0.7rem;
  vertical-align: top;
}

/* --- Footnotes (pandoc) -------------------------------------------------- */
.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--muted);
}

/* --- Narrow screens ------------------------------------------------------ */
@media (max-width: 40rem) {
  html { font-size: 16px; }
  #title-block-header .title { font-size: 2rem; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.4rem; }
  #site-masthead .mh-bar { flex-wrap: wrap; }
  #site-masthead .mh-meta { text-align: left; padding-top: 0.3rem; }
}
