/* Coach Kagiso — a carbon-copy duplicate book.
 *
 * Top sheet: Kagiso's letters, in ink. Carbon: your words, and the file he
 * keeps. Margin red: what is still open — the margin rule, and the underline
 * under an unanswered question. Veld: the mark and the one button per page.
 * Two typefaces: Newsreader for anything read, Courier Prime for the printed
 * form fields (dates, serial numbers, prices). No script; no icons; no cards.
 * See ../PROPOSITION.md §10 for the argument. */

:root {
  --paper: #F1F3EF;
  --sheet: #FBFCFA;
  --ink: #16191F;
  --muted: #586070;
  --feint: #CDD5DE;
  --carbon: #2B3A8C;
  --carbon-soft: rgba(43, 58, 140, .07);
  --margin: #B8432C;
  --veld: #1F6E5C;
  --on-veld: #FFFFFF;

  --serif: Newsreader, "Iowan Old Style", Georgia, serif;
  --form: "Courier Prime", "Courier New", ui-monospace, monospace;
  --line: 1.75rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1218;
    --sheet: #161A22;
    --ink: #E9EBEF;
    --muted: #9CA3B0;
    --feint: #29303C;
    --carbon: #9DA9F5;
    --carbon-soft: rgba(157, 169, 245, .08);
    --margin: #E07A62;
    --veld: #5DB597;
    --on-veld: #0C1512;
  }
}

:root[data-theme="dark"] {
  --paper: #0F1218;
  --sheet: #161A22;
  --ink: #E9EBEF;
  --muted: #9CA3B0;
  --feint: #29303C;
  --carbon: #9DA9F5;
  --carbon-soft: rgba(157, 169, 245, .08);
  --margin: #E07A62;
  --veld: #5DB597;
  --on-veld: #0C1512;
}

* { box-sizing: border-box; }

/* `hidden` has to win. The browser's own rule is display:none at the lowest
 * specificity, so `.row { display: grid }` below used to beat it: the book's
 * sign-in block stayed on screen after signing in. */
[hidden] { display: none !important; }

html, body { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: var(--line);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  padding-inline: 1rem;
}

a { color: inherit; text-decoration-color: var(--feint); text-underline-offset: .22em; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--carbon); outline-offset: 3px; }

/* ---------- The book ---------- */

.book { --gutter: 9rem; max-width: 68rem; margin: 0 auto; position: relative; }
.book::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(var(--gutter) - 1.25rem); width: 1px;
  background: var(--margin); opacity: .55;
}

.row { display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); }
.row > .in { grid-column: 2; min-width: 0; }
.stamp {
  grid-column: 1; margin: 0;
  font-family: var(--form); font-size: .8125rem; line-height: 1.25rem;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  padding: .3rem 2rem 0 0;
}

/* ---------- Header ---------- */

.top { padding-block: 1.25rem; }
.top .in { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; flex-wrap: wrap; }
/* The logo is the name itself, reversed out of a strip of ink torn along the
 * bottom — a line cut out of a page and kept. No pictogram anywhere on the
 * site; the square mark (assets/mark.svg) exists only where a square is
 * forced on us: the tab and the home screen.
 *
 * The tear is an SVG sitting just below the strip rather than a border, so
 * it stretches with the name at any font size and paints in ink, the same
 * colour as the strip it hangs off. */
.mark { display: inline-flex; align-items: center; min-height: 3rem; text-decoration: none; }
.mark .strip {
  position: relative; display: inline-block;
  background: var(--ink); color: var(--paper);
  font-style: italic; font-weight: 500; font-size: 1.25rem; line-height: 1.05;
  letter-spacing: -.015em; padding: .3em .62em .34em;
}
.mark .tear { position: absolute; left: 0; right: 0; bottom: -.17em; width: 100%; height: .2em; display: block; }
.top nav { display: flex; flex-wrap: wrap; gap: 0 1.5rem; font-family: var(--form); font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; }
.top nav a { display: inline-flex; align-items: center; min-height: 3rem; color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: .5em; }
.top nav a.go { color: var(--veld); font-weight: 700; }

/* ---------- Type ---------- */

h1 {
  font-weight: 500; margin: 0; text-wrap: balance;
  font-size: clamp(2.25rem, 4.6vw, 3.75rem); line-height: 1.06; letter-spacing: -.02em; max-width: 18ch;
}
h1.display { font-size: clamp(2.375rem, 5.2vw, 4.25rem); line-height: 1.04; letter-spacing: -.022em; max-width: 15ch; }
h1 em, h2 em { font-style: italic; color: var(--carbon); }
h2 {
  font-weight: 500; font-size: clamp(1.75rem, 3vw, 2.375rem); line-height: 1.15;
  letter-spacing: -.015em; margin: 0 0 1.5rem; max-width: 24ch; text-wrap: balance;
}
h3 { font-weight: 600; font-size: 1.1875rem; margin: 0 0 .25rem; }
.lede { margin: 1.75rem 0 0; max-width: 36rem; font-size: 1.25rem; line-height: 1.9rem; color: var(--muted); }
.in > p { max-width: 36rem; margin: 0 0 1rem; }
.hero { padding-block: 3.5rem 2.5rem; }

/* ---------- Leaves: letters on ruled duplicate paper ---------- */

.leaves { display: grid; padding-bottom: 1rem; }
.leaf {
  background-color: var(--sheet);
  border-top: 2px dashed var(--feint);
  padding: 1.25rem 1.75rem var(--line);
  max-width: 44rem;
}
/* The rules are drawn under each paragraph's own lines rather than across
 * the sheet, so a form line that wraps onto two lines on a phone never has a
 * rule through it. A paragraph's line-height is the rule spacing. */
.leaf p, .leaf label.open {
  background-image: repeating-linear-gradient(to bottom,
    transparent 0, transparent calc(var(--line) - 1px),
    var(--feint) calc(var(--line) - 1px), var(--feint) var(--line));
}
.form {
  display: flex; flex-wrap: wrap; gap: .25rem 1.5rem;
  font-family: var(--form); font-size: .8125rem; line-height: 1.25rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding-bottom: .85rem;
}
.form b { color: var(--ink); font-weight: 700; }
.leaf p { margin: 0; font-size: 1.1875rem; line-height: var(--line); max-width: 36rem; }
.leaf p + p { margin-top: var(--line); }
.open { text-decoration: underline; text-decoration-color: var(--margin); text-decoration-thickness: 1.5px; text-underline-offset: .28em; }

.leaf.carbon { background-color: var(--carbon-soft); margin-left: 2.5rem; }
.leaf.carbon .form b, .leaf.carbon p { color: var(--carbon); }
.leaf.carbon p { font-style: italic; }
.leaf.carbon.press p { animation: impress 1.4s ease-out .5s both; }
@keyframes impress { from { filter: blur(1.2px); opacity: .5; } to { filter: blur(0); opacity: 1; } }
.leaf + .leaf { margin-top: 1.75rem; }

/* The one break per page: a question set to read across the room. */
.question {
  margin: 1rem 0 0; font-weight: 500;
  font-size: clamp(2.75rem, 8.4vw, 7.25rem); line-height: .98; letter-spacing: -.03em;
  text-wrap: balance; max-width: 13ch;
}
.question span { text-decoration: underline; text-decoration-color: var(--margin); text-decoration-thickness: .06em; text-underline-offset: .12em; }
.example { font-family: var(--form); font-size: .8125rem; color: var(--muted); margin: 1.25rem 0 0; }

/* Two leaves side by side: the same question, generic and personal. */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem; max-width: 62rem; align-items: start; }
.pair .leaf { max-width: none; margin: 0; }

/* ---------- Sections ---------- */

section { padding-block: 4.5rem 0; }

/* A register: one ruled line per entry, a printed label on the left. */
.register { list-style: none; margin: 0; padding: 0; max-width: 46rem; border-top: 1px solid var(--feint); }
.register li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1.25rem; padding-block: 1rem; border-bottom: 1px solid var(--feint); }
.register .when { font-family: var(--form); font-size: .875rem; line-height: 1.5rem; letter-spacing: .03em; color: var(--muted); padding-top: .1rem; }
.register strong { font-weight: 600; }
.register a { text-decoration: none; }
.register a:hover strong { text-decoration: underline; text-decoration-color: var(--margin); text-underline-offset: .22em; }

/* The file he keeps: carbon, plain sentences, each one yours. */
.file { max-width: 46rem; border-left: 3px solid var(--carbon); padding: .25rem 0 .25rem 1.5rem; }
.file dl { margin: 0; display: grid; grid-template-columns: 11rem minmax(0, 1fr) auto; gap: .9rem 1.25rem; align-items: baseline; }
.file dt { font-family: var(--form); font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.file dd { margin: 0; color: var(--carbon); font-style: italic; font-size: 1.125rem; }
.file dd.act { font-style: normal; font-family: var(--form); font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.file dl.short { grid-template-columns: 11rem minmax(0, 1fr); }
.file .foot { margin: 1.5rem 0 0; font-family: var(--form); font-size: .8125rem; color: var(--muted); }

.wont { list-style: none; margin: 0; padding: 0; max-width: 40rem; display: grid; gap: 1rem; }
.wont li { padding-left: 1.5rem; position: relative; }
.wont li::before { content: "—"; position: absolute; left: 0; color: var(--margin); }

.qa { margin: 0; max-width: 42rem; display: grid; gap: 0; border-top: 1px solid var(--feint); }
.qa div { padding-block: 1.1rem; border-bottom: 1px solid var(--feint); }
.qa dt { font-weight: 600; font-size: 1.125rem; }
.qa dd { margin: .25rem 0 0; color: var(--muted); }

/* ---------- Price, as a printed form ---------- */

.price { max-width: 46rem; border-top: 2px dashed var(--feint); padding-top: 1.75rem; }
.fig { font-family: var(--form); font-weight: 700; font-size: clamp(2.5rem, 6vw, 4rem); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fig.huge { font-size: clamp(4rem, 13vw, 10rem); letter-spacing: -.04em; }
.fig small { font-size: 1rem; font-weight: 400; letter-spacing: .02em; color: var(--muted); margin-left: .5rem; }
.terms { font-family: var(--form); font-size: .9375rem; line-height: 1.6rem; color: var(--muted); margin: 1rem 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0 1.75rem; margin-top: 2rem; border: 0; cursor: pointer;
  background: var(--veld); color: var(--on-veld); text-decoration: none;
  font-family: var(--serif); font-weight: 600; font-size: 1.125rem; border-radius: 2px;
}
.btn:hover { filter: brightness(1.06); }
.after { font-size: 1rem; color: var(--muted); margin: .75rem 0 0; max-width: 34rem; }

/* A form field on a duplicate book: a printed label and a dotted line. */
.signup { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.5rem; max-width: 40rem; margin-top: 1.5rem; }
.field { flex: 1 1 16rem; display: flex; flex-direction: column; gap: .25rem; }
.field label { font-family: var(--form); font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.field input {
  font: inherit; font-size: 1.1875rem; min-height: 3rem; padding: 0 .25rem;
  background: transparent; color: var(--carbon); font-style: italic;
  border: 0; border-bottom: 2px dotted var(--muted); border-radius: 0;
}
.field input::placeholder { color: var(--muted); opacity: .6; }
.field input:focus-visible { outline: none; border-bottom: 2px solid var(--carbon); }
.signup .btn { margin-top: 0; }

/* Archive of questions: date, then the question. */
.archive { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.archive li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1.25rem; padding-block: .9rem; border-bottom: 1px solid var(--feint); }
.archive .when { font-family: var(--form); font-size: .875rem; color: var(--muted); padding-top: .15rem; }
.archive q { quotes: none; font-size: 1.25rem; }

/* Return to sender. */
.return { font-family: var(--form); font-weight: 700; font-size: clamp(2.5rem, 9vw, 6rem); line-height: 1; letter-spacing: -.02em; color: var(--margin); margin: 0; transform: rotate(-4deg); display: inline-block; border: 4px solid var(--margin); padding: .5rem 1rem; opacity: .85; }

/* ---------- Footer ---------- */

footer { padding-block: 6rem 3rem; }
footer .in { border-top: 1px solid var(--feint); padding-top: 2rem; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.cols h4 { margin: 0 0 .5rem; font-family: var(--form); font-size: .8125rem; font-weight: 400; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cols ul { list-style: none; margin: 0; padding: 0; }
.cols a { display: inline-flex; align-items: center; min-height: 2.25rem; text-decoration: none; }
.cols a:hover { text-decoration: underline; }
.sign { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; margin-top: 2.5rem; color: var(--muted); font-size: 1rem; }
.sign .say { font-family: var(--form); font-size: .8125rem; }

/* ---------- Phone ---------- */

@media (max-width: 760px) {
  .book { --gutter: 0rem; padding-left: 1rem; }
  .book::before { left: 0; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row > .in, .stamp { grid-column: 1; }
  .stamp { padding: 0 0 .5rem; }
  .top { padding-block: .5rem; }
  .top nav { gap: 0 1.1rem; }
  .hero { padding-block: 1.5rem 2rem; }
  .leaf { padding-inline: 1.1rem; }
  .leaf.carbon { margin-left: 1rem; }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .register li, .archive li { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  .file dl, .file dl.short { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .file dd { margin-bottom: .6rem; }
  .file dd.act { margin-bottom: 1rem; }
  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols a { min-height: 3rem; }
  section { padding-block: 3.5rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  .leaf.carbon.press p { animation: none; }
}
