/*
  BETR's whole stylesheet (B56, 2026-09-15: the terracotta and the paper).

  THE TYPE SYSTEM IS THE WHOLE SYSTEM. Founder, 2026-09-15: "too many font sizes… hard to know
  what's the title of the hope, what's the input label". So there are two voices and they never
  borrow each other's clothes:

    the person's words   serif, on a paper card — the prediction, what happened. Never anything
                         the app wrote.
    the app's words      sans, on the orange — one bold question per screen, a line of
                         explanation under it, and one big paper button.

  Plus one state label (LOCKED IN, small caps) and the three tags. That is all of it.

  System fonts only. A font request is a request, and "nothing is sent to us or anyone else"
  has to survive somebody opening the network tab (rule 1). Georgia and Iowan Old Style are on
  the phone already.

  Two rules B15 added, and both are cheap now and expensive later:
  1. EVERY LAYOUT PROPERTY IS LOGICAL, not physical: `margin-inline-start`, never `margin-left`.
     The browser flips them when <html dir> is rtl. i18n.test.js fails the build on a physical one.
  2. EVERY FONT SIZE IS IN REM, never px, so a person who turned their text size up gets it.
     The canvas is drawn in px at 16px to the rem: 24px is 1.5rem, 17px is 1.0625rem.

  NO DARK MODE, ON PURPOSE (B56 §3). The orange is the ground in both, and a paper card is a
  paper card. lib/theme.js still writes data-theme onto <html>; nothing here reads it.

  CONTRAST, AND IT IS THE FOUNDER'S TO DECIDE (B56 §9, raised 2026-09-15). As the canvas draws
  them, paper on the orange is 4.25:1 and the pink explanation line is 2.65:1 — both under the
  4.5:1 that small text needs. The canvas is built exactly as locked; every colour is a token
  below, so the answer is a one-line change.
*/

:root {
  color-scheme: light;
  --ground: #C4532E;
  --on-ground: #FFF6EE;
  --soft: #F2B9A4;
  --paper: #FFF6EE;
  --ink: #2B1A12;
  --printed: #8E7A70;
  /* The day label is 12px and bold; #8E7A70 is 3.8:1 on paper, so it is a shade darker. */
  --day: #7A665C;
  --link: #93371A;
  --marker: #FFE58A;
  --marker-ink: #3A2E00;
  --sort-tag: #F2B9A4;
  --sort-ink: #3A1F14;
  --not-tag: #E8D5CC;
  --not-ink: #5C4033;
  --faded: rgba(255, 246, 238, .45);
  --lift: 0 18px 40px rgba(0, 0, 0, .15);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--on-ground);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--on-ground); outline-offset: 3px; }
.paper :focus-visible, .sheet :focus-visible, .warn :focus-visible, .note :focus-visible { outline-color: var(--ground); }
/* The heading focus lands on when the screen changes (B15). Nobody clicked it, so no ring. */
[tabindex="-1"]:focus { outline: none; }

.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.arrow { display: inline-block; }
[dir="rtl"] .arrow { transform: scaleX(-1); }

/* ------------------------------------------------------------------ the frame */

.screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding-block: env(safe-area-inset-top) env(safe-area-inset-bottom);
}
/* The wordmark's row. Since 2026-09-16 it also carries the language, on the far side. */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.625rem 1.625rem 0;
}
.wordmark {
  margin: 0;
  font-weight: 800; font-size: .8125rem; letter-spacing: .18em; text-transform: uppercase;
}

/*
  The language (B16, founder's call): two grey letters and a small arrow, set like the
  LOCKED IN label so it reads as part of the frame rather than as a control asking for
  attention. The real <select> lies over it, invisible, and is the thing that is tapped: it
  opens the phone's own picker and a screen reader reads it as what it is.

  The box is 44px each way, the smallest thing a thumb hits reliably, and the negative margins
  give that back so the row is no taller than the wordmark alone. The select's font is 16px
  even though nobody sees it: under 16px, iOS zooms the whole page in when it is tapped.
*/
.lang {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-inline-size: 2.75rem; min-block-size: 2.75rem;
  margin-block: -1rem; margin-inline-end: -.75rem;
}
.lang-code { color: var(--soft); font-weight: 700; font-size: .75rem; letter-spacing: .16em; }
.lang-code::after { content: "\25BE"; letter-spacing: 0; margin-inline-start: .125rem; }
.lang select {
  position: absolute; inset: 0; inline-size: 100%; block-size: 100%;
  opacity: 0; cursor: pointer; font-size: 1rem; border: 0; appearance: none;
}
.lang:focus-within .lang-code { outline: 3px solid var(--on-ground); outline-offset: 4px; border-radius: 2px; }
.main {
  flex: 1; width: 100%; max-width: 34rem; margin-inline: auto;
  padding: 1.25rem 1.625rem;
  display: flex; flex-direction: column; justify-content: center; gap: 1.375rem;
}
/* A list and a long read start at the top rather than floating in the middle. */
.screen.list .main, .screen.long .main { justify-content: flex-start; gap: .875rem; }

/* ------------------------------------------------------------------ the app's voice */

.headline {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.25rem, 11vw, 2.75rem); line-height: 1.06; letter-spacing: -.01em;
  margin: 0 0 .375rem; text-wrap: balance;
}
.ask { font-weight: 700; font-size: 1.5rem; line-height: 1.25; letter-spacing: -.01em; margin: 0; }
.say { font-size: 1.0625rem; margin: 0; color: var(--soft); text-align: center; }
/*
  A subtitle, under the headline on the front and under the ask on Locked in (2026-09-16).
  It answers the question its heading leaves open, so it has to read as part of that heading
  rather than as the next thing: the negative top margin pulls it back out of the column's
  1.375rem gap and sits it just under the words it belongs to.
*/
.sub {
  margin: -.9375rem 0 0; font-size: 1.0625rem; line-height: 1.35;
  color: var(--soft); text-wrap: balance;
}
.say.start { text-align: start; }
.plainsay { font-size: 1.1875rem; margin: 0; }
.label { font-weight: 700; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--soft); margin: 0; }

.big {
  display: flex; align-items: center; justify-content: center; width: 100%;
  background: var(--paper); color: var(--ground); border: 0; border-radius: 20px;
  padding: 1.375rem 1.875rem; font-weight: 800; font-size: 1.4375rem; letter-spacing: -.01em;
  box-shadow: var(--lift);
}
/* Empty blanks: drawn at 45%, and a tap on it does nothing a sighted person can see (B56 §3). */
.big[aria-disabled="true"] { opacity: .45; box-shadow: none; }
.link {
  background: none; border: 0; padding: .25rem 0; align-self: center;
  color: var(--soft); font-size: 1.0625rem; text-align: center;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ the person's voice */

.paper {
  background: var(--paper); color: var(--ink); border-radius: 20px;
  padding: 1.25rem 1.375rem; margin: 0;
  font-family: var(--serif); font-weight: 400; font-size: 1.5rem; line-height: 1.3;
  overflow-wrap: anywhere;
}
/* On the loop screens after the first, the prediction is context, not the thing being written. */
.paper.small { font-size: 1.1875rem; line-height: 1.4; }
.paper .fixed { color: var(--printed); }

/*
  A blank inside the printed sentence. Empty, it is an inline-block with a width, so there is a
  line to write on, as the canvas draws it. Written in, it is INLINE: the words flow inside the
  sentence and the underline follows them line by line. An inline-block holding a long answer
  dropped onto a line of its own and left "If I" and ", then" stranded above it (walked
  2026-09-15).
*/
.blank {
  display: inline;
  padding: 0 .125rem .1875rem; line-height: 1.5;
  border-block-end: 3px solid var(--ground);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  white-space: pre-wrap; caret-color: var(--ground); outline: none;
}
.blank:empty { display: inline-block; vertical-align: bottom; min-width: 6.875rem; min-height: 1.2em; max-width: 100%; line-height: 1.15; }
/*
  How long an empty blank is. It was a fixed width drawn for a 390px phone, and below that it
  would not fit beside "If I" or "then", so the words and the punctuation broke onto lines of
  their own (founder, 2026-09-16, at 338 and 324). Now each blank is at most its old width and
  otherwise the card's width less room for the words beside it: "If I" and ",", or "then" and
  "." — measured in em so French's « Si je » and « alors » fit too. The first line of each pair
  is the fallback for a browser without container units (iOS before 16).
*/
.sentence { container-type: inline-size; }
.glue { white-space: nowrap; }
#if.blank:empty { min-width: min(11.875rem, 100%); min-width: min(11.875rem, max(4rem, calc(100cqi - 3em))); }
#then.blank:empty { min-width: min(14.375rem, 100%); min-width: min(14.375rem, max(4rem, calc(100cqi - 3.5em))); }
.blank:focus { background: rgba(196, 83, 46, .08); border-start-start-radius: 4px; border-start-end-radius: 4px; }

.box { display: block; width: 100%; min-height: 9.375rem; border: 0; resize: vertical; }

/* ------------------------------------------------------------------ 4 · the three answers */

.pills { display: flex; flex-direction: column; gap: .75rem; }
.pill {
  display: flex; align-items: center; justify-content: center; gap: .625rem; width: 100%;
  border: 0; border-radius: 18px; padding: 1.25rem 1.375rem;
  font-weight: 800; font-size: 1.375rem;
}
.pill.yeah { background: var(--marker); color: var(--marker-ink); box-shadow: 0 14px 30px rgba(0, 0, 0, .14); }
.pill.sort { background: var(--paper); color: var(--ink); }
.pill.not { background: var(--faded); color: var(--sort-ink); font-weight: 700; }
.spark { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.tag {
  display: inline-flex; align-items: center; border-radius: 999px; padding: .1875rem .625rem;
  font-family: var(--sans); font-weight: 800; font-size: .75rem; letter-spacing: .04em;
  line-height: 1.35; text-transform: uppercase; white-space: nowrap;
}
.tag.yeah { background: var(--marker); color: var(--marker-ink); }
.tag.sort { background: var(--sort-tag); color: var(--sort-ink); }
.tag.not, .tag.locked { background: var(--not-tag); color: var(--not-ink); }
.askrow { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------ 6 · the results */

.results { list-style: none; display: flex; flex-direction: column; gap: 1rem; padding: 1.125rem 1.25rem; }
.entry { display: flex; flex-direction: column; gap: .375rem; }
.meta { display: flex; gap: .625rem; align-items: center; margin: 0; }
.day { font-family: var(--sans); font-weight: 700; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--day); }
.entry .t { font-size: 1.0625rem; line-height: 1.4; margin: 0; }
.wrote { white-space: pre-line; }

/* ------------------------------------------------------------------ 7 · your predictions */

.card { display: flex; flex-direction: column; gap: .625rem; width: 100%; border: 0; text-align: start; }
.card .said { display: block; }
.tags { display: flex; gap: .375rem; flex-wrap: wrap; }
.label.away { margin-block-start: .75rem; }
.quiet { display: flex; justify-content: center; gap: .5rem 1.25rem; flex-wrap: wrap; margin: 0; }
.quiet .link { font-size: .875rem; }

/* ------------------------------------------------------------------ notes, on paper */

.warn, .note {
  background: var(--paper); color: var(--ink); border-radius: 16px;
  padding: 1rem 1.125rem; font-size: 1rem; line-height: 1.45; text-align: start;
}
.warn p, .note p { margin: 0 0 .5rem; }
.warn a { color: var(--link); font-weight: 700; text-underline-offset: 3px; }
.warn ul.places { list-style: none; padding: 0; margin: 0 0 .5rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-block-start: .625rem; }
.ghost { background: none; border: 2px solid var(--not-tag); border-radius: 14px; padding: .625rem 1rem; font-weight: 700; font-size: .9375rem; color: var(--ink); }
.tiny { font-size: .875rem; color: var(--day); }
.plain { background: none; border: 0; padding: 0; font-size: .875rem; color: var(--day); text-decoration: underline; text-underline-offset: 3px; margin-inline-end: .875rem; }

/* ------------------------------------------------------------------ the foot */

.foot { display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem 1.625rem; padding: 1rem 1.625rem 1.75rem; }
.foot button {
  background: none; border: 0; padding: .25rem 0;
  color: var(--soft); font-size: .9375rem; text-decoration: underline; text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ Help and the country list */

.backrow { margin: 0; display: flex; }
.backrow .link { align-self: flex-start; font-size: .9375rem; }
.sheet {
  background: var(--paper); color: var(--ink); border-radius: 20px;
  padding: 1.375rem 1.5rem; font-size: .96875rem; line-height: 1.5; text-align: start;
}
.sheet h2 { font-weight: 700; font-size: 1rem; line-height: 1.35; margin: 1.25rem 0 .375rem; }
.sheet h2.title { font-size: 1.25rem; margin-block-start: 0; }
.sheet h3 { font-weight: 700; font-size: .875rem; color: var(--not-ink); margin: .875rem 0 .25rem; }
.sheet p { margin: 0 0 .375rem; }
.sheet ol { padding-inline-start: 1.125rem; margin: 0; }
.sheet li { margin-block-end: .375rem; }
.sheet a { color: var(--link); text-underline-offset: 3px; }
.sheet .quiet { display: block; font-size: .875rem; color: var(--day); }
.sheet ul.places { list-style: none; padding: 0; margin: 0; }
.sheet ul.places li { margin-block-end: .5625rem; line-height: 1.4; }
.sheet .proof { display: flex; gap: 1.625rem; margin: .5rem 0 .75rem; flex-wrap: wrap; }
.sheet .proof b { display: block; font-weight: 800; font-size: 1.5625rem; line-height: 1; }
.sheet .proof small { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--day); }
.sheet .primer { border-inline-start: 3px solid var(--ground); padding-inline-start: .9375rem; margin: .5rem 0 .25rem; }
.sheet .primer p { margin: 0 0 .5625rem; }
.sheet textarea { display: block; width: 100%; font-size: .75rem; min-height: 9.375rem; margin-block-start: .625rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sheet .build { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .75rem; color: var(--day); word-break: break-all; }
.sheet .warn { border: 2px solid var(--not-tag); margin-block-start: .5rem; }
.sheet .countries .plain { font-size: 1rem; color: var(--ink); text-decoration: none; padding: .375rem 0; }
