/* timparkerphd.ca styles.
   Reading-first: ~70 characters per line, one column, line height ~1.65,
   no pure black or white. Blog layout: solid deep red header, posts as cards.
   Palette "Paper & ink" with a deep red header (chosen 2026-12-01).
   Font: Inter (chosen 2026-12-01), SIL Open Font License (static/fonts/Inter-OFL.txt).
   Self-hosted in /fonts/: nothing loads from Google or any other company.
   One variable file per style covers every weight.
   All text pairs checked for contrast (4.5:1 or better; most above 7:1). */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-italic.woff2") format("woff2");
}

:root {
  /* Font roles. Swap families here only. */
  --font-body: "Inter", system-ui, "Segoe UI", Arial, sans-serif;   /* reading text */
  --font-head: "Inter", system-ui, "Segoe UI", Arial, sans-serif;   /* titles */
  --font-ui:   "Inter", system-ui, "Segoe UI", Arial, sans-serif;   /* menus, dates, buttons */
  --head-weight: 700;

  --bg: #f3f1ec;          /* warm paper */
  --surface: #fffefb;     /* cards and forms */
  --text: #222222;        /* ink */
  --muted: #6a6560;
  --link: #8b1e1e;        /* deep red */
  --hover: #5e1212;
  --rule: #e2ddd3;
  --pill: #f4e4e1;        /* tag background */
  --header: #7a1c1c;      /* solid header band */
  --header-text: #ffffff;
  --btn: #8b1e1e;
  --btn-text: #ffffff;
  color-scheme: light;
}

/* Dark: used when the visitor's system prefers it, unless they picked light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312; --surface: #1e1c1a; --text: #e7e3dc; --muted: #a39e96;
    --link: #e3998e; --hover: #f0bdb5; --rule: #2f2c29; --pill: #3a2623;
    --header: #5a1616; --header-text: #ffffff; --btn: #e3998e; --btn-text: #181716;
    color-scheme: dark;
  }
}
/* Dark chosen with the toggle. */
:root[data-theme="dark"] {
  --bg: #141312; --surface: #1e1c1a; --text: #e7e3dc; --muted: #a39e96;
  --link: #e3998e; --hover: #f0bdb5; --rule: #2f2c29; --pill: #3a2623;
  --header: #5a1616; --header-text: #ffffff; --btn: #e3998e; --btn-text: #181716;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-feature-settings: "cv11";   /* Inter's single-storey a: a little friendlier for long reading */
}

.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--link); text-underline-offset: .15em; }
a:hover { color: var(--hover); }

/* ---------- Header: solid band ---------- */
.site-header { background: var(--header); color: var(--header-text); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; gap: .6rem 1.25rem;
  align-items: center; justify-content: space-between;
  padding-top: 1.1rem; padding-bottom: 1.1rem;
}
.site-title {
  font-family: var(--font-head); font-weight: var(--head-weight);
  font-weight: 800; font-size: 1.5rem; line-height: 1.1; letter-spacing: -.02em;
  color: var(--header-text); text-decoration: none;
}
.site-title:hover { color: var(--header-text); }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; font-family: var(--font-ui); font-weight: 700; font-size: .95rem; }
.site-header nav a { color: var(--header-text); text-decoration: none; opacity: .9; }
.site-header nav a:hover, .site-header nav a[aria-current] { opacity: 1; text-decoration: underline; text-decoration-thickness: 2px; }

.theme-toggle {
  display: inline-grid; place-items: center; cursor: pointer;
  width: 2rem; height: 2rem; padding: 0;
  color: var(--header-text); background: transparent;
  border: 0; border-radius: 50%; opacity: .85;
}
.theme-toggle:hover { opacity: 1; background: rgb(255 255 255 / .15); }
.theme-toggle:focus-visible { outline: 2px solid var(--header-text); outline-offset: 2px; }
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.icon-moon { fill: currentColor; }
.icon-sun { fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-sun, .theme-toggle[data-shows="dark"] .icon-moon { display: none; }
.theme-toggle[data-shows="dark"] .icon-sun { display: block; }

/* ---------- Text ---------- */
main.wrap { padding-top: 2.5rem; padding-bottom: 3.5rem; }

h1, h2, h3 {
  font-family: var(--font-head); font-weight: var(--head-weight);
  line-height: 1.25; letter-spacing: -.015em;
}
/* Scale, largest first: site title 1.5 > post title 1.375 > lead card 1.25 >
   section 1.15 > card 1.1 > sub-section 1.05 > body 1.0625 (17px). */
h1 { font-size: 1.375rem; margin: 0 0 .4rem; }                         /* post / page title */
h2 { font-size: 1.15rem; margin: 2.2rem 0 .5rem; }                     /* section inside a post */
h3 { font-size: 1.05rem; margin: 1.8rem 0 .4rem; }
h1 a, h2 a { color: inherit; text-decoration: none; }
h1 a:hover, h2 a:hover { color: var(--link); }

img { max-width: 100%; height: auto; display: block; margin: 1.5rem auto; border-radius: 6px; }
/* Tall pictures stay within about half a screen instead of filling it */
article img { max-height: 28rem; width: auto; }

/* Dates, tags, small labels */
.meta { font-family: var(--font-ui); font-size: .85rem; color: var(--muted); margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; }
.pill {
  background: var(--pill); color: var(--link); border-radius: 999px;
  padding: .05rem .65rem; font-weight: 700; font-size: .78rem; text-decoration: none;
}
.pill:hover { color: var(--hover); }
.label {
  font-family: var(--font-ui); font-weight: 700; font-size: .78rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--link); margin: 0 0 .5rem;
}

/* ---------- Cards (post previews, book box, forms) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  padding: 1.3rem 1.5rem; margin-bottom: 1.25rem; box-shadow: 0 1px 2px rgb(0 0 0 / .05);
}
.card h2 { margin: 0 0 .3rem; font-size: 1.1rem; }
/* Whole card is clickable: the title link stretches over it; tag pills stay on top */
.card.linked { position: relative; transition: border-color .15s, box-shadow .15s; }
.card.linked h2 a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }
.card.linked .pill, .card.linked .more { position: relative; z-index: 1; }
.card.linked:hover { border-color: var(--link); box-shadow: 0 3px 10px rgb(0 0 0 / .08); }
.card.linked:hover h2 a { color: var(--link); }
.card.linked p:last-child { margin-bottom: 0; }
.card.lead h2 { font-size: 1.25rem; }
.card p { margin: 0 0 .8rem; }
.card .meta { margin-bottom: .7rem; }
.more { font-family: var(--font-ui); font-weight: 700; font-size: .92rem; text-decoration: none; }

.book-box { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1.2rem; align-items: center; }
.book-box img { margin: 0; border-radius: 3px; }
.book-box p { margin: 0 0 .8rem; }
.book-box .book-title { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; margin: 0; }
.book-box .book-sub { color: var(--muted); font-size: .95rem; }

/* Hidden on screen, still read by screen readers */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.btn {
  display: inline-block; font-family: var(--font-ui); font-weight: 700; font-size: .95rem;
  color: var(--btn-text); background: var(--btn); border: 0; border-radius: 6px;
  padding: .55rem 1.1rem; text-decoration: none; cursor: pointer;
}
.btn:hover { color: var(--btn-text); filter: brightness(1.1); }

.all-posts { font-family: var(--font-ui); font-weight: 700; font-size: .95rem; }

/* Archive list (Writing page, tag pages) */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid var(--rule);
}
.post-list a { font-family: var(--font-head); font-weight: 600; text-decoration: none; color: var(--text); }
.post-list a:hover { color: var(--link); }
.post-list li:last-child { border-bottom: 0; }
.post-list time { white-space: nowrap; font-family: var(--font-ui); font-size: .85rem; color: var(--muted); }

.prev-next {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-family: var(--font-ui); font-weight: 700; font-size: .95rem;
}
.prev-next a { text-decoration: none; }
.prev-next .next { text-align: right; }

.site-footer { border-top: 1px solid var(--rule); padding: 1rem 0 2rem; color: var(--muted); font-family: var(--font-ui); font-size: .88rem; }

/* ---------- Reader forms (book order, contact) ---------- */
.reader-form {
  display: grid; gap: 1rem; margin: 2rem 0; padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
}
.reader-form label { display: grid; gap: .3rem; font-family: var(--font-ui); font-weight: 700; font-size: .95rem; }
.reader-form input, .reader-form textarea {
  font-family: var(--font-body); font-weight: 400; font-size: 1rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 6px; padding: .55rem .65rem; width: 100%;
}
.reader-form input:focus, .reader-form textarea:focus { outline: 2px solid var(--link); outline-offset: 1px; }
h1.visually-hidden + .reader-form, h1.visually-hidden + p + .reader-form { margin-top: 0; }
.reader-form input[type="number"] { max-width: 6rem; }
.reader-form button { justify-self: start; }
.optional { font-weight: 400; color: var(--muted); }
.form-note { margin: 0; color: var(--muted); font-family: var(--font-ui); font-size: .88rem; }
/* Honeypot: off-screen, not display:none (some bots skip hidden fields) */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Book page: cover beside the text, not a full-width poster */
article[data-page="trapped-by-the-high"] > p:first-of-type img {
  float: right; width: 40%; max-width: 15rem; margin: .3rem 0 1rem 1.75rem;
  box-shadow: 0 4px 14px rgb(0 0 0 / .18);
}
article[data-page="trapped-by-the-high"] .reader-form { clear: both; }

@media (max-width: 30rem) {
  .site-title { font-size: 1.25rem; }
  .site-header nav { gap: .9rem; font-size: .9rem; }
  article[data-page="trapped-by-the-high"] > p:first-of-type img { float: none; width: 60%; margin: 0 auto 1.25rem; }
  .book-box { grid-template-columns: 4rem 1fr; gap: .9rem; }
  .card { padding: 1.1rem 1.15rem; }
}
