/* site.css: the look every page shares, except the locks page (which keeps
   breakout.css). A field notebook kept at the edge of a pond: the page is a
   sheet of green-tint grid paper, the words are written on it, and figures
   and cards are taped onto it. The two typefaces are served by this site
   from assets/fonts/ (licences beside them); nothing comes from another host.
   Light and dark follow the device setting. CLAUDE.md, "The look", says how
   to use each token. home.css adds what only the home page needs. */

@font-face {
  font-family: "Shantell Sans";
  src: url(fonts/shantell-sans-latin.woff2) format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url(fonts/atkinson-hyperlegible-next-latin.woff2) format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ----------
   tests/unit/contrast.test.mjs reads these hex values, in light and in dark,
   and checks every pair the pages use. */

:root {
  color-scheme: light dark;
  --paper: #edf4e4;        /* the sheet: green-tint lab notebook paper */
  --rule: #cfe0c4;         /* the fine grid lines, the punch holes */
  --rule-strong: #a9c99a;  /* the rule under the page header, quiet borders */
  --ink: #17301f;          /* text and drawing outlines */
  --pencil: #4a5c4f;       /* secondary text, captions, leader lines */
  --pond: #1f6b3a;         /* the site name and links */
  --pond-deep: #1f4d29;    /* dark spots and shade in drawings */
  --leaf: #7fbf6a;         /* a light green wash in drawings */
  --water: #bfe3d6;        /* pond water; a quiet panel; a button under the pointer */
  --lily: #a82f63;         /* the one accent: the margin rule, the one main action */
  --highlight: #ffe45c;    /* highlighter: selected or active, nothing else */
  --highlight-ink: #17301f;/* text on the highlighter, in both themes */
  --card: #fbfdf7;         /* taped-in cards and figures */
  --tape: #e9e2b8;         /* masking tape */
  --focus: #8a6d12;        /* the keyboard focus ring */
  --hand: "Shantell Sans", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* The same notebook at night. Screen only: a printed page keeps the light
   tokens, because printers drop the dark paper and would leave pale ink. */
@media screen and (prefers-color-scheme: dark) {
  :root {
    --paper: #101a14;
    --rule: #1b2b21;
    --rule-strong: #27402f;
    --ink: #e6f0df;
    --pencil: #a9bbaa;
    --pond: #7ccb8a;
    --pond-deep: #0c2a1a;
    --leaf: #3f7d4a;
    --water: #143a33;
    --lily: #f08db5;
    --card: #16241b;
    --tape: #3a3a22;
    --focus: #e0bd48;
  }
}

/* ---------- the sheet ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 1.5rem 1.5rem;
}

/* One sheet per page: the punch holes, the margin rule, then the writing.
   Everything sits inside the sheet's padding, so nothing scrolls sideways. */
.sheet {
  position: relative;
  max-width: 90rem;
  min-height: 100vh;
  padding: 1.25rem 3.5rem 2rem 8rem;
}

/* the lily-pink margin rule */
.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5.5rem;
  border-left: 2px solid var(--lily);
}

.holes {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  max-height: 60rem;
}

.hole {
  display: block;
  width: 1.375rem;
  height: 1.375rem;
  border: 1.5px solid var(--rule-strong);
  border-radius: 50%;
  background: var(--rule);
}

/* the writing starts a little below the page header */
.sheet > main {
  padding-top: 2.25rem;
}

/* narrow screens: the holes go and the margin tightens */
@media (max-width: 64rem) {
  .sheet {
    padding: 1rem 1rem 1.5rem 2.25rem;
  }

  .sheet::before {
    left: 1.25rem;
  }

  .holes {
    display: none;
  }

  .sheet > main {
    padding-top: 1.5rem;
  }
}

/* ---------- the page header, written on the paper ---------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  column-gap: 1.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 3px solid var(--rule-strong);
}

.masthead p {
  margin: 0;
}

.site-name {
  font-family: var(--hand);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.2;
  color: var(--pond);
}

/* On every page but the home page the site name leads home. */
.site-name a {
  color: inherit;
  text-decoration: none;
}

.site-name a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.site-class {
  font-family: var(--hand);
  font-weight: 500;
  font-size: 1.0625rem;
  color: var(--pencil);
}

/* ---------- type ---------- */

/* text-wrap evens out a heading's lines and tries to keep a lone word off
   the last line of a paragraph; a browser without it wraps as before. */
h1,
h2,
h3 {
  font-family: var(--hand);
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  margin: 0 0 1rem;
  font-weight: 800;
  font-size: 3.5rem;
  line-height: 1.1;
}

/* section headings, written on the paper like the rest */
h2 {
  margin: 2rem 0 0.375rem;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.25;
}

h3 {
  margin: 1.5rem 0 0.25rem;
  font-weight: 700;
  font-size: 1.3125rem;
  line-height: 1.3;
}

/* 29em keeps running text under 70 characters a line. In em, not rem, so
   the cap shrinks with smaller text, such as the footer's. */
p {
  margin: 0 0 1rem;
  max-width: 29em;
  text-wrap: pretty;
}

.lede {
  max-width: 32rem;
  font-size: 1.25rem;
  line-height: 1.5;
}

/* a pencilled note beside the main text */
.note {
  padding-left: 0.875rem;
  border-left: 3px solid var(--rule-strong);
  color: var(--pencil);
}

@media (max-width: 64rem) {
  h1 {
    font-size: 2.5rem;
  }
}

/* ---------- links and focus ---------- */

a {
  color: var(--pond);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

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

/* ---------- a taped-in object ----------
   A figure or an index card: a piece of card with a thin ink border, held
   by a strip of masking tape and turned about a degree. No soft shadow. */

.taped {
  position: relative;
  margin: 0;
  padding: 0.75rem 0.875rem 0.625rem;
  background: var(--card);
  border: 1.5px solid var(--ink);
  transform: rotate(1deg);
}

.taped::before {
  content: "";
  position: absolute;
  top: -0.875rem;
  left: 50%;
  width: 8.5rem;
  height: 1.75rem;
  margin-left: -4.25rem;
  background: var(--tape);
  opacity: 0.88;
  transform: rotate(-2.5deg);
}

.taped figcaption {
  margin-top: 0.125rem;
  font-family: var(--hand);
  font-weight: 500;
  font-size: 1rem;
  color: var(--pencil);
  text-wrap: pretty;
}

/* ---------- buttons, for pages that need them ----------
   Highlighter yellow means pressed, selected or current, nothing else. */

.button,
button {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  font: 600 1.0625rem/1.4 var(--hand);
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 0.375rem;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--water);
}

/* Pressed, selected or current: the highlighter, and a hard inner edge in
   its ink that doubles the border's weight, so the state shows without
   colour too (WCAG 1.4.1: in light mode the highlighter is only a little
   darker than the card). An edge, not a mark before the label, which a
   screen reader would read as part of the button's name. */
.button:active,
button:active,
button[aria-pressed="true"],
.button[aria-current],
button[aria-current] {
  color: var(--highlight-ink);
  background: var(--highlight);
  box-shadow: inset 0 0 0 2px var(--highlight-ink);
}

/* the one main action on a screen, if it has one: pink in every state, so
   it looks the same pressed by mouse or by keyboard; pressed, it takes the
   same inner edge as any button */
.button-main,
.button-main:active,
.button-main:hover {
  color: var(--card);
  background: var(--lily);
  border-color: var(--lily);
}

.button-main:hover {
  text-decoration: underline;
}

/* ---------- the footer line ---------- */

.site-footer {
  margin-top: 3rem;
  padding-top: 0.625rem;
  border-top: 2px solid var(--rule-strong);
  font-size: 0.9375rem;
  color: var(--pencil);
}

.site-footer p {
  margin: 0;
}

/* ---------- the footer's links, and the two statement pages ----------
   Every page that uses this sheet ends with the footer line, then the
   links to the privacy and accessibility pages (a short list, no dot or bar
   between the items, each link at least 44px tall for a thumb), then the
   contact line in small print. On a
   statement page its own link carries aria-current="page" and reads as
   "you are here": ink, bold, not underlined. Never the highlighter, which
   means a pressed button. The .statement rules touch only those two pages'
   <main>. */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 2rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1rem;
  margin: 0 0 0 -0.375rem;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  padding: 0.625rem 0.375rem;
}

.footer-links a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

/* the last line, after the links and outside the <nav>: small print in
   pencil, 13px at the browser's default text size (in rem, so it follows
   the reader's own text size like all the text, and stays smaller than the
   footer line), plain text and not a link, so it carries no underline and
   none of the links' green. Beside the links where there is room, under
   them on a phone. */
.site-footer .footer-contact {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--pencil);
}

/* a text page: the words on the paper, a little more room between
   sections, lists kept to the same measure as its paragraphs. "Accessibility"
   is one long word: on the narrowest screens, with wider letter spacing,
   it may hyphenate rather than push the page sideways. */
.statement h1 {
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.statement h2 {
  margin-top: 2.5rem;
}

.statement ul {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
  list-style-type: "\2013\00a0";
}

/* a little under the 29em of every paragraph: some of these pages' long
   sentences would reach 70 characters a line at 29em */
.statement p:not(.lede),
.statement li {
  max-width: 27.5em;
}

.statement li {
  margin-bottom: 0.625rem;
  padding-left: 0.25rem;
  text-wrap: pretty;
}

/* the dash written in pencil, in the handwriting face */
.statement li::marker {
  color: var(--pencil);
  font-family: var(--hand);
  font-weight: 700;
}

.statement > .note {
  margin-top: 2.5rem;
}

/* on a phone, one size down, so most headings keep to one line */
@media (max-width: 64rem) {
  .statement h2 {
    margin-top: 2rem;
    font-size: 1.5rem;
  }
}

@media (max-width: 25rem) {
  .statement h1 {
    font-size: 2rem;
  }
}

@media print {
  .statement h2 {
    break-after: avoid;
  }

  .statement li {
    break-inside: avoid;
  }

  /* on paper a link cannot be followed: print its address after it */
  .statement a[href^="https:"]::after {
    content: " (" attr(href) ")";
  }
}

/* ---------- other settings ---------- */

/* Windows High Contrast and other forced colours: the system draws the
   colours, so every edge that carries meaning must be a border or an
   outline. The grid and the tape go; the margin rule, the card edges, the
   button edges and the focus ring stay. */
@media (forced-colors: active) {
  body {
    background-image: none;
  }

  .holes,
  .taped::before {
    display: none;
  }

  .sheet::before {
    border-left-color: CanvasText;
  }

  .taped {
    border-color: CanvasText;
  }

  .button,
  button {
    border-color: ButtonText;
  }

  /* pressed: the system's selection colours mark it; the focus ring below
     shows only on focus, pressed or not */
  .button:active,
  button:active,
  button[aria-pressed="true"],
  .button[aria-current],
  button[aria-current] {
    forced-color-adjust: none;
    color: HighlightText;
    background: Highlight;
    border-color: Highlight;
    box-shadow: none;
  }

  :focus-visible {
    outline-color: Highlight;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: none;
  }

  .sheet {
    min-height: 0;
    padding: 0;
  }

  .sheet::before,
  .holes {
    display: none;
  }

  .taped {
    transform: none;
    break-inside: avoid;
  }

  a {
    color: inherit;
  }
}
