/* ==========================================================================
   FONTS: self-hosted (the page security policy allows fonts from this site
   only). Lora for headings, Source Sans 3 for text, the same pair as
   benthepsychologist.com. Variable fonts, latin subset, from Fontsource
   (@fontsource-variable/lora 5.3.0, @fontsource-variable/source-sans-3 5.3.0).
   Both SIL Open Font License 1.1; the licences are in static/fonts/.
   ========================================================================== */
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/lora-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Lora";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/lora-latin-wght-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-sans-3-latin-wght-italic.woff2") format("woff2");
}

/* ==========================================================================
   BRANDING: the only place colours and fonts are set. To brand the site,
   change the values in this one block and nothing else.

   Palette: benthepsychologist.com's "Petrol, Paper & Clay". Paper dominates;
   petrol is the one action colour; clay is a sparse human accent (eyebrows,
   list markers, small rules), never a second action colour.
   ========================================================================== */
:root {
  color-scheme: light dark;

  --color-bg: #f7f2e8;        /* paper */
  --color-band: #eee6da;      /* a deeper paper, for bands and the footer */
  --color-raised: #fbf8f2;    /* cards and the photo frame */
  --color-text: #292421;
  --color-muted: #59514b;
  --color-border: #ddd2c3;
  --accent: #103e46;          /* petrol; a page can override it (single.html) */
  --accent-hover: #0b3137;
  --color-on-accent: #f7f2e8;
  --clay: #a04e34;
  --shadow: 0 1px 2px rgb(41 36 33 / 6%), 0 14px 36px rgb(41 36 33 / 14%);

  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Lora", Georgia, "Times New Roman", serif;

  --measure: 40rem;           /* reading width */
  --wide: 68rem;              /* header, home page, bands */
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1b1916;
    --color-band: #24211d;
    --color-raised: #2a2622;
    --color-text: #ede6da;
    --color-muted: #b5ab9e;
    --color-border: #3b352f;
    --accent: #86bec2;
    --accent-hover: #a6d3d6;
    --color-on-accent: #14201f;
    --clay: #d98c6e;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 14px 36px rgb(0 0 0 / 40%);
  }
}

/* ---- Everything below uses only the variables above. ---- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  /* The footer sits at the bottom of short pages. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-text);
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 5vw, 3rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.6rem; margin: 2.75rem 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 2rem 0 0.5rem; }

p, ul, ol { margin: 0 0 1.1rem; }

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; border-radius: 2px; }

img { max-width: 100%; height: auto; }

ul { padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }
li::marker { color: var(--clay); }

blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--clay);
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--color-muted);
}

hr { border: 0; border-top: 1px solid var(--color-border); margin: 2.5rem 0; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--color-on-accent);
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

/* ---- Containers ---- */
.wrap { max-width: var(--wide); margin-inline: auto; padding-inline: 1.25rem; }
.narrow { max-width: calc(var(--measure) + 2.5rem); }

/* ---- Header ---- */
.site-header { border-bottom: 1px solid var(--color-border); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.25rem;
}
.site-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--color-text);
  text-decoration: none;
}
.site-name:hover { color: var(--accent); }

nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; list-style: none; margin: 0; padding: 0; }
nav li { margin: 0; }
nav a {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 1.05rem;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
}
nav a:hover { color: var(--color-text); }
nav a[aria-current="page"] { color: var(--color-text); border-bottom-color: var(--clay); }

/* ---- Buttons and arrow links ---- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 1.75rem; }
.button {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--color-on-accent);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.button:hover { background: var(--accent-hover); color: var(--color-on-accent); }
.arrow-link { font-weight: 600; text-decoration: none; }
.arrow-link::after { content: " \2192"; }

/* ---- Small labels ---- */
.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--clay);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.meta, time { color: var(--color-muted); font-size: 0.95rem; }

/* ---- Home ---- */
.hero {
  display: grid;
  gap: 2rem;
  align-items: center;
  padding-block: 2.5rem 4rem;
}
.hero h1 { font-size: clamp(2.75rem, 7vw, 4.25rem); line-height: 1.05; margin-bottom: 1.25rem; }
.hero .intro { max-width: 36rem; }
.hero h1 + p { font-size: 1.3rem; line-height: 1.55; }
.hero-photo { order: -1; margin: 0; }
.hero-photo img {
  display: block;
  width: 100%;
  max-width: 11rem;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 1rem;
  box-shadow: var(--shadow);
}
/* The projects and notes are the point of the home page, so the portrait is small (Ben, 2026-11-03). */
@media (min-width: 52rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3rem;
    padding-block: 3rem 2.5rem;
  }
  .hero-photo { order: 0; justify-self: end; }
  .hero-photo img { max-width: 11rem; border-radius: 1rem; }
}

.band { background: var(--color-band); padding-block: 3.5rem 4rem; }
.band h2 { margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; }
.band .section-head, .band .post-list { max-width: 48rem; }

/* ---- Lists of posts ---- */
.post-list { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.post-list li { margin: 0; padding: 1.1rem 0; border-top: 1px solid var(--color-border); }
.post-list li:last-child { border-bottom: 1px solid var(--color-border); }
.post-list a {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}
.post-list a:hover { color: var(--accent); }
.post-list time { display: block; margin-top: 0.15rem; }
.post-list p { margin: 0.35rem 0 0; color: var(--color-muted); }

/* ---- Pages and posts ---- */
.page { padding-block: 3rem 4.5rem; }
.page-head { margin-bottom: 2.25rem; }
.page-head::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin-top: 1.5rem;
  background: var(--clay);
  border-radius: 2px;
}
.lede { font-size: 1.25rem; color: var(--color-muted); margin: 0; }
.page-body h2 { padding-top: 2.25rem; border-top: 1px solid var(--color-border); }
.page-body > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.page-body strong { font-weight: 650; }

/* ---- The stream: items grouped under a heading per day ---- */
.stream { padding-bottom: 3rem; }
.day { margin-top: 2.25rem; }
.day-head {
  margin: 0 0 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 1.05rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-muted);
}
.day-head time { font-size: inherit; color: inherit; }
.item { padding: 0.9rem 0 0.6rem; }
.item-title { margin: 0 0 0.25rem; font-size: 1.3rem; }
.item-title a { color: var(--color-text); text-decoration: none; }
.item-title a:hover { color: var(--accent); }
.item-summary { margin: 0 0 0.35rem; color: var(--color-muted); }
.item-body > :last-child { margin-bottom: 0.5rem; }
.item-meta { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--color-muted); }
.item-kind { font-weight: 600; color: var(--clay); }
.item-meta .tag { text-decoration: none; }
.item-meta .tag:hover { text-decoration: underline; }
.item-meta .permalink { text-decoration: none; }
.tag-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }

/* ---- Newsletter box ---- */
.subscribe { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--color-border); }
.subscribe h2 { margin-top: 0; font-size: 1.3rem; }
.subscribe-frame {
  display: block;
  width: 100%;
  max-width: 480px;
  height: 320px;
  border: 1px solid var(--color-border);
  background: #fff;
}

/* ---- Footer ---- */
.site-footer { background: var(--color-band); border-top: 1px solid var(--color-border); }
.site-footer .wrap { padding-block: 2rem 2.5rem; color: var(--color-muted); font-size: 0.95rem; }
.site-footer p { margin: 0 0 0.35rem; }
.footer-name { font-family: var(--font-heading); font-weight: 600; color: var(--color-text); font-size: 1.1rem; }

/* ---- Diagrams: the diagram shortcode (layouts/shortcodes/diagram.html) inlines an SVG from assets/diagrams/.
   The drawings use the classes below and nothing else, so they follow the site's light and dark colours. The
   fills are soft tints of the same palette: ops seats petrol, hubs clay, corpora green, kits ochre, boxes paper. ---- */
:root {
  --f-ops: #dbe8e8; --s-ops: #103e46;
  --f-hub: #f3dcd2; --s-hub: #a04e34;
  --f-cor: #dfeeda; --s-cor: #2f5a2a;
  --f-kit: #f1e4c6; --s-kit: #6a4a12;
  --f-box: #ece5d9; --s-box: #59514b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --f-ops: #1f3a3d; --s-ops: #86bec2;
    --f-hub: #452421; --s-hub: #d98c6e;
    --f-cor: #213a1d; --s-cor: #b3d9a8;
    --f-kit: #3d3216; --s-kit: #e5c98a;
    --f-box: #2e2a26; --s-box: #b5ab9e;
  }
}
/* A figure may be wider than the reading column, so the labels stay legible; on a phone the frame scrolls sideways. */
figure.diagram { margin: 2rem 0; position: relative; left: 50%; width: min(52rem, calc(100vw - 2.5rem)); transform: translateX(-50%); }
figure.diagram .fig-scroll { overflow-x: auto; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-raised); padding: 0.6rem; }
figure.diagram svg { display: block; width: 100%; min-width: 620px; height: auto; color: var(--color-text); }
figure.diagram figcaption { margin-top: 0.5rem; font-size: 0.95rem; line-height: 1.5; color: var(--color-muted); }
figure.diagram figcaption strong { color: var(--color-text); }
figure.diagram svg text { font-family: var(--font-body); fill: currentColor; font-size: 13px; }
figure.diagram svg .b { font-weight: 600; }
figure.diagram svg .s { font-size: 11px; fill: var(--color-muted); }
figure.diagram svg .t12 { font-size: 12px; }
figure.diagram svg .lbl { font-size: 11px; fill: var(--color-muted); font-style: italic; }
figure.diagram svg .n { stroke-width: 1.5; }
figure.diagram svg .ops { fill: var(--f-ops); stroke: var(--s-ops); }
figure.diagram svg .hub { fill: var(--f-hub); stroke: var(--s-hub); }
figure.diagram svg .cor { fill: var(--f-cor); stroke: var(--s-cor); }
figure.diagram svg .kit { fill: var(--f-kit); stroke: var(--s-kit); }
figure.diagram svg .bx { fill: var(--f-box); stroke: var(--s-box); }
figure.diagram svg .ben { fill: var(--accent); stroke: var(--accent); }
figure.diagram svg text.on-accent { fill: var(--color-bg); }
figure.diagram svg .plan { stroke-dasharray: 6 4; }
figure.diagram svg .fence { stroke-width: 3; stroke-dasharray: 2 3; }
figure.diagram svg .e { stroke: currentColor; stroke-width: 1.4; fill: none; }
figure.diagram svg .ed { stroke: currentColor; stroke-width: 1.4; fill: none; stroke-dasharray: 5 4; }
figure.diagram svg .thin { stroke: var(--color-border); stroke-width: 1.2; fill: none; }
figure.diagram svg text.warn { fill: var(--clay); font-weight: 600; font-size: 11px; }

/* ---- The Kestrel pages: the list and previous/next links at the foot of each (kestrel-nav.html) ---- */
.series { margin-top: 3.5rem; padding-top: 1.75rem; border-top: 1px solid var(--color-border); }
.series h2 { margin: 0 0 0.75rem; font-size: 1.3rem; }
.series ol { margin: 0 0 1.25rem; padding-left: 1.25rem; }
.series li { margin-bottom: 0.45rem; }
.series li::marker { color: var(--clay); }
.series li > span { display: block; color: var(--color-muted); font-size: 0.95rem; line-height: 1.45; }
.series .step { margin: 0.25rem 0; }
