/*
 * The page kit: tokens and patterns for the public website (#171).
 *
 * One stylesheet, custom properties for every value that means something,
 * no framework, no preprocessor, no request to anyone else. The app adopts
 * the tokens (docs/WEBSITE.md section 11.2); the patterns are the site's.
 *
 * "Lora" and "Cormorant Garamond" are the families the Phase 3 design
 * record chose (design/SCREENS.md 2), and since 22 September 2026 they
 * are served from this origin rather than named and hoped for (#324,
 * docs/WEBSITE.md 13.4). Never from anyone else's: the test refuses a
 * url() that is not one of the four files this build writes.
 */

/* The two families, served from this origin and from nowhere else
   (#324, docs/WEBSITE.md section 13.4). woff2, the latin subset, four
   files and 88,484 bytes; the licences and the provenance are in
   `fonts/README.md`. `swap` so the page renders at once in the fallback
   and changes to these when they arrive: nothing waits on a font. */

@font-face {
  font-family: "Lora";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("lora-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Lora";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("lora-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("cormorant-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("cormorant-italic.woff2") format("woff2");
}

:root {
  color-scheme: light dark;

  /* Colour: light. Accent is a stroke and a label colour, never a fill. */
  --bg: #f3f2f2;
  --ink: #201f1d;
  --surface: #f8f4f4;
  --muted: #605d5d;
  --soft: #444141;
  --accent: #b68235;
  --accent-strong: #7d5411;
  --accent-wash: #fff3e4;
  --hairline: color-mix(in srgb, var(--ink) 16%, transparent);

  /* Type. Named families, system fallbacks, nothing fetched. */
  --font-body: "Lora", Georgia, "Times New Roman", serif;
  --font-heading: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --text-s: 0.8125rem;
  --text-m: 1.125rem;
  --text-l: 1.375rem;
  --text-xl: 1.75rem;
  --text-xxl: 2.25rem;
  --leading-body: 1.7;
  --leading-tight: 1.2;
  --tracking-label: 0.16em;

  /* Measure and space. One column; the measure is set in the body font. */
  --measure: 62ch;
  --gutter: 1rem;
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 1rem;
  --s4: 1.5rem;
  --s5: 2rem;
  --s6: 3rem;
  --s7: 4rem;

  /* Controls. 44px is the smallest target the design record allows. */
  --target: 2.75rem;
  --focus: var(--accent-strong);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b1a;
    --ink: #ebe7e1;
    --surface: #262422;
    --muted: #b3ada5;
    --soft: #cdc7bf;
    --accent: #c9975a;
    --accent-strong: #e0b77e;
    --accent-wash: #2e2519;
    --hairline: color-mix(in srgb, var(--ink) 20%, transparent);
  }
}

/* Ground */

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 100%;
  line-height: var(--leading-body);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-size: var(--text-m);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--s5) var(--gutter) var(--s7);
  flex: 1;
}

/* Skip link: the first focusable thing on every page. */

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100%;
  padding: var(--s2) var(--s3);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--accent-strong);
  z-index: 1;
}
.skip:focus { top: var(--s2); }

/* Focus and links, specified once. Colour never carries meaning alone:
   a link is underlined, a focused control is outlined. */

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

a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-offset: 0.15em;
}
a:hover { text-decoration-thickness: 2px; }

/* Type */

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: var(--leading-tight);
  margin: var(--s6) 0 var(--s3);
}
h1 { font-size: var(--text-xxl); margin-top: 0; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-l); }
h1 + p, h2 + p, h3 + p { margin-top: 0; }

p, ul, ol { margin: 0 0 var(--s4); }
ul, ol { padding-left: 1.25em; }
li + li { margin-top: var(--s2); }

.label {
  font-family: var(--font-body);
  font-size: var(--text-s);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent-strong);
  margin: 0 0 var(--s3);
}

.note {
  font-size: var(--text-s);
  color: var(--muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: var(--s5) 0;
}

/* Tables: for the check-it-yourself pages. They scroll rather than
   overflow the column on a phone. */

.table-wrap { overflow-x: auto; margin: 0 0 var(--s4); }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375rem;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: var(--s2) var(--s3) var(--s2) 0;
  border-bottom: 1px solid var(--hairline);
}
th {
  font-weight: 400;
  color: var(--muted);
  font-size: var(--text-s);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* The passage: the one pattern the site and the app share. A matted
   panel; the blockquote holds the passage and nothing else, so the
   question beneath is never read as Marcus's (docs/STYLE.md rule 7). */

.passage {
  margin: var(--s5) 0;
  padding: 6px;
  border: 1px solid var(--hairline);
  background: var(--surface);
}
.passage__inner {
  border: 1px solid var(--hairline);
  padding: var(--s4) var(--s4) var(--s4);
}
.passage blockquote { margin: 0; }
.passage blockquote p { margin: 0 0 var(--s3); }
.passage figcaption { margin: 0; }
.passage cite {
  font-style: normal;
  font-size: var(--text-s);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
}
.passage hr { margin: var(--s4) 0 var(--s3); }
.passage .question {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  line-height: 1.3;
  margin: 0;
}

/* The decline: the app's own words when nothing sits close enough. Set
   plainly, in the same panel, with no passage and no question. */

.passage--declined .decline { margin: 0; color: var(--soft); }

/* The entry a demonstration starts from, shown as what somebody wrote. */

.entry {
  margin: 0 0 var(--s3);
  padding-left: var(--s3);
  border-left: 2px solid var(--hairline);
  color: var(--soft);
  font-style: italic;
}

/* The safety statement: reachable in one click from every page. It is
   an aside with its own heading, calm, and the resources come first. */

.safety {
  margin: var(--s5) 0;
  padding: var(--s4);
  border: 1px solid var(--accent);
}
.safety h2, .safety h3 { margin-top: 0; }
.safety p:last-child { margin-bottom: 0; }

/* The call to action: one link, set like a control, never a form. */

.cta {
  display: inline-block;
  min-height: var(--target);
  padding: var(--s2) var(--s4);
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  text-decoration: none;
  line-height: 1.9;
}
.cta:hover { background: var(--accent-wash); }

/* The bar and the footer. Four items and one call to action in the bar;
   the rest in the footer (docs/WEBSITE.md section 6.5). */

.bar, .foot {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--s3) var(--gutter);
}
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s2) var(--s4);
  border-bottom: 1px solid var(--hairline);
}
.bar .name {
  font-family: var(--font-heading);
  font-size: var(--text-l);
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.bar ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  list-style: none;
  margin: 0;
  padding: 0;
}
.bar li { margin: 0; }
.bar a { min-height: var(--target); display: inline-flex; align-items: center; }
.bar .cta { padding: 0 var(--s3); }

.foot {
  border-top: 1px solid var(--hairline);
  font-size: var(--text-s);
  color: var(--muted);
}
.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  list-style: none;
  margin: 0 0 var(--s3);
  padding: 0;
}
.foot li { margin: 0; }
.foot a { min-height: var(--target); display: inline-flex; align-items: center; }
.foot p { margin: 0; }

/* Zoom and small screens: the column is already fluid; only the bar
   changes shape, so nothing needs a breakpoint to remain readable. */

@media (max-width: 30rem) {
  .bar .name { width: 100%; }
}

/* The demonstration: one <details> per situation. The summary is the
   control, sized like one; the outcome is already on the page. */

.demonstration details {
  border-top: 1px solid var(--hairline);
  padding: var(--s2) 0 var(--s3);
}
.demonstration details:last-child { border-bottom: 1px solid var(--hairline); }
.demonstration summary {
  cursor: pointer;
  min-height: var(--target);
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: var(--text-l);
  color: var(--accent-strong);
}
.demonstration summary:hover { text-decoration: underline; }
.demonstration details[open] summary { margin-bottom: var(--s3); }
.demonstration .passage { margin-top: var(--s3); }
