/* Slate — the twelve parts, and nothing else.
 * Every value here references a token from tokens.css. No literals.
 * There is no transition, no animation, no shadow, no radius. */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--face-word);
  font-size: var(--size-body);
  line-height: var(--line-body);
  -webkit-font-smoothing: antialiased;
}

/* --- Structure. A column that refuses to grow (DS-12, TE-16). --- */
.screen {
  max-width: var(--column);
  margin: 0 auto;
  padding: var(--s5) var(--s3) var(--s6);
  min-height: 100%;
}

/* A work shows one thing at a time, so it sits in the middle of whatever
 * screen it is on rather than at the top of it. dvh, not vh: it accounts for
 * mobile Safari's dynamic toolbars, which is the hazard TE-18 is about. */
.screen--work {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stack { display: flex; flex-direction: column; gap: var(--s3); }
.stack--wide { gap: var(--s5); }
.centre { display: flex; flex-direction: column; align-items: center; gap: var(--s4); }

/* --- Part: Word. The largest thing on any screen. --- */
.word {
  font-size: var(--size-word);
  line-height: var(--line-tight);
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.01em;
}

/* --- Part: Choice pair. Two spellings, equal weight, either tappable. --- */
.pair {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: var(--s5);
  flex-wrap: wrap;
}

.choice {
  font-family: var(--face-word);
  font-size: var(--size-choice);
  line-height: var(--line-tight);
  color: var(--ink);
  background: none;
  border: var(--stroke) solid transparent;
  border-radius: var(--radius);
  padding: var(--s2) var(--s3);
  min-height: var(--target);
  min-width: var(--target);
  cursor: pointer;
  font-weight: inherit;
  letter-spacing: 0.01em;
}

.choice:active { background: var(--paper-sunk); }
.choice[hidden] { display: none; }

/* --- Part: Tile. A single letter in a box. --- */
.tile {
  font-family: var(--face-word);
  font-size: var(--size-choice);
  line-height: var(--line-tight);
  color: var(--ink);
  background: var(--paper);
  border: var(--stroke) solid var(--rule);
  border-radius: var(--radius);
  min-width: var(--target);
  min-height: var(--target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
}

.tile:active { background: var(--paper-sunk); }

/* --- Part: Slot. Where a tile can go. Drawn as a short rule. --- */
.slot {
  flex: 0 0 auto;
  min-width: var(--target);
  min-height: var(--target);
  border-bottom: var(--stroke) solid var(--ink-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Part: Rule. One width. A baseline, a divider, a cover. --- */
.rule {
  border: 0;
  border-top: var(--stroke) solid var(--rule);
  margin: 0;
  width: 100%;
}

.cover {
  border-bottom: var(--stroke) solid var(--ink-faint);
  width: 8rem;
  height: var(--size-word);
  margin: 0 auto;
}

/* --- Part: Row. A tappable line of text in a list. --- */
.row {
  font-family: var(--face-word);
  font-size: var(--size-choice);
  line-height: var(--line-tight);
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: var(--stroke) solid var(--rule);
  border-radius: var(--radius);
  width: 100%;
  text-align: left;
  padding: var(--s3) var(--s1);
  min-height: var(--target);
  cursor: pointer;
}

.row:active { background: var(--paper-sunk); }

/* --- Part: Speak. The only icon in the application (DS-17). --- */
.speak {
  background: none;
  border: var(--stroke) solid var(--rule);
  border-radius: var(--radius);
  min-width: var(--target);
  min-height: var(--target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
}

.speak:active { background: var(--paper-sunk); }
.speak svg { display: block; }

/* --- Part: Reveal. A word, not an icon. --- */
.reveal {
  font-family: var(--face-word);
  font-size: var(--size-body);
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-bottom: var(--stroke) solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s2) var(--s1);
  min-height: var(--target);
  cursor: pointer;
}

.reveal:active { color: var(--ink); }

/* --- Adult-facing only. The one place the sans face appears (DS-09). --- */
.label {
  font-family: var(--face-label);
  font-size: var(--size-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.met { font-family: var(--face-word); font-size: var(--size-body); color: var(--ink-soft); }
.met b { color: var(--ink); font-weight: inherit; }

.toggle {
  font-family: var(--face-word);
  font-size: var(--size-body);
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: var(--stroke) solid var(--rule);
  border-radius: var(--radius);
  width: 100%;
  text-align: left;
  padding: var(--s2) var(--s1);
  min-height: var(--target);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
}

.toggle span:last-child { font-family: var(--face-label); font-size: var(--size-label);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); align-self: center; }

/* --- The instruction that ends a work. --- */
.instruction { color: var(--ink-soft); text-align: center; }

/* --- Part: Way in. The foot of her list, and nowhere else (DS-24). ---
 *
 * The faintest text in the application, with no rule under it, so it reads as
 * a note rather than as one more work to tap. It was an unmarked corner first;
 * that defeated the adult as thoroughly as it defeated her (SH-18). */
.way-in {
  font-family: var(--face-word);
  font-size: var(--size-body);
  color: var(--ink-faint);
  background: none;
  border: 0;
  border-radius: var(--radius);
  width: 100%;
  text-align: left;
  padding: var(--s2) var(--s1);
  min-height: var(--target);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.way-in:active { color: var(--ink-soft); }

/* --- Inside a work the way in is not drawn at all (SH-31). It is there for
 * an adult who needs it mid-work; she has no need of an exit, because closing
 * the application is already a complete ending and nothing is lost by it. --- */
.corner {
  position: fixed;
  right: 0;
  bottom: 0;
  width: var(--target);
  height: var(--target);
  background: none;
  border: 0;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

/* --- Focus. For the keyboard she will not use but an adult might (DS-17). --- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

[hidden] { display: none !important; }

/* --- Work B: the beats of a word. ---
 * One beat per line rather than a row.
 *
 * A row was tried first and does not work: a four-beat word does not fit a
 * phone at a touch-usable size, so it wraps, and a separator between beats
 * then dangles at the line end. Stacking is also truer to the task — she is
 * working one beat at a time, not reading the word, which she is shown whole
 * at the end. It gives each beat a full-width tap target for replaying its
 * own syllable, and it holds for two beats or four on any screen. */
.beats {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s2);
  width: 100%;
}

.beat {
  font-family: var(--face-word);
  font-size: var(--size-word);
  line-height: var(--line-tight);
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: var(--radius);
  padding: var(--s1) var(--s2);
  min-height: var(--target);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--s1);
  cursor: pointer;
}

.beat:active { background: var(--paper-sunk); }
.beat .fixed { color: var(--ink); }

.vowels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
}

/* A picked vowel is held, shown by the recess it sits in rather than a colour. */
.tile[aria-pressed="true"] { background: var(--paper-sunk); border-color: var(--ink-faint); }

/* A speak control with its word beneath it. */
.speak-labelled {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s1);
}

.speak-label {
  font-family: var(--face-word);
  font-size: var(--size-body);
  color: var(--ink-soft);
}

/* --- Work C: look, cover, write, check. --- */
.cover-stage {
  min-height: calc(var(--size-word) * 1.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Work D: where the word comes apart. --- */
.split-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
}

.split-letter {
  font-size: var(--size-word);
  line-height: var(--line-tight);
  color: var(--ink);
}

/* A tappable gap between letters. Unmarked: nothing shows where the seam is,
 * and a wrong one does nothing (SP-D3). */
.gap {
  background: none;
  border: 0;
  border-radius: var(--radius);
  width: var(--s3);
  min-height: var(--target);
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.split-pieces {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--s3);
  flex-wrap: wrap;
}

.piece {
  font-size: var(--size-choice);
  color: var(--ink);
  border-bottom: var(--stroke) solid var(--rule);
}

.piece-join { font-size: var(--size-choice); color: var(--ink-faint); }
