/* The parent screen: a phone held in one hand, in the kitchen. */

:root {
  --n: 0.75rem; /* the unit of a note on the phone */
  --ground: #f3f4f8;
  --surface: #ffffff;
  /* A darker patch on whatever ground lies under it. */
  --sunken: rgba(var(--night-rgb), 0.09);
  --ink: var(--night);
  /* Text that steps back. --muted never changes; --ink-soft follows the page. */
  --muted: #565a70;
  --ink-soft: var(--muted);
  /* What cannot be used right now, and the scrollbar. */
  --faint: #a9acbd;
  /* Text printed on the ink of a child, or on a filled button. */
  --on-ink: #ffffff;
  --selection: #cbd3f2;
  --line: #d4d7e2;
  --control: #8589a0;
  /* The colour of commands. */
  --accent: var(--ink);
  --tabs-height: 3.5rem;
  /* The header: 3.5rem at least, or more under the notch of a phone. Where the text is set
     large it takes two lines: js/parent.js then writes its real height in --bar-size. */
  --bar-height: max(3.5rem, calc(env(safe-area-inset-top, 0px) + 3.0625rem));
  --bar-size: var(--bar-height);
  /* Text sizes, named after the role DESIGN.md gives each one; a size can serve several roles. */
  --size-serial: 0.75rem;
  --size-detail: 0.875rem;
  --size-label: 0.9375rem;
  --size-figure: 1rem;
  --size-body: 1.0625rem;
  --size-figure-large: 1.125rem;
  --size-title: 1.375rem;
  --size-name: 1.625rem;
  --size-name-large: 2rem;
  --size-value: 3rem;
  /* Radii follow the nesting: a container, a command, what sits inside a container, a plate of points. */
  --radius-container: 0.625rem;
  --radius-control: 0.5rem;
  --radius-inner: 0.4375rem;
  --radius-plate: 0.3125rem;
}

/* On the pages of one child the screen is their note until the entry is confirmed:
   its paper is the ground; its ink writes the header, the commands and the secondary text.
   js/parent.js sets the pair on the root element. */
:root.in-note {
  --ground: var(--note-paper);
  --ink-soft: var(--note-ink);
  --accent: var(--note-ink);
  --control: var(--note-ink);
}

html {
  background: var(--ground);
  scrollbar-color: var(--faint) var(--ground);
  /* What the keyboard reaches is scrolled clear of the header, of the choice that sticks
     under it, and of the tabs: never left behind them. */
  scroll-padding-top: calc(var(--bar-size) + 4.25rem);
  scroll-padding-bottom: calc(var(--tabs-height) + env(safe-area-inset-bottom, 0px) + 0.5rem);
}

body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--ground);
  font: var(--size-body)/1.45 var(--text);
  caret-color: var(--ink);
  accent-color: var(--accent);
}

::selection {
  color: var(--ink);
  background: var(--selection);
}

a {
  color: inherit;
}

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

:focus:not(:focus-visible) {
  outline: none;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Before sign-in --------------------------------------------------------- */

.gate {
  display: grid;
  align-content: center;
  gap: 1.5rem;
  max-width: 26rem;
  min-height: 100vh;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.gate__title {
  font-family: var(--display);
  font-size: var(--size-name-large);
  font-weight: 400;
  line-height: 1.1;
}

.gate__boot {
  color: var(--ink-soft);
}

/* The frame of the app: header, page, tabs ------------------------------- */

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 36rem;
  min-height: 100vh;
  margin: 0 auto;
}

@supports (min-height: 100dvh) {
  .gate,
  .app {
    min-height: 100dvh;
  }
}

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  /* One line; where the text is set large, the balance and the account go to a second
     one rather than squeeze the title out. */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.25rem;
  min-height: var(--bar-height);
  padding: 0.25rem 0.5rem;
  padding-top: max(0.25rem, env(safe-area-inset-top));
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}

.in-note .bar {
  color: var(--on-ink);
  background: var(--accent);
  border-bottom-color: transparent;
}

.in-note .bar :focus {
  outline-color: var(--on-ink);
}

.bar__title {
  flex: 1 1 8rem;
  min-width: 0;
  overflow: hidden;
  padding: 0 0.5rem;
  font-size: var(--size-title);
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Focused by the script on each new page, for screen readers: no ring on a title. */
.bar__title:focus {
  outline: none;
}

/* The name of the child, in the face of their note. */
.in-note .bar__title {
  font-family: var(--display);
  font-weight: 400;
}

/* A number to act on is set in the text face: at this size the display face
   lets a 3 pass for an 8. */
.bar__aside {
  margin-left: auto;
  padding: 0 0.25rem;
  font-size: var(--size-body);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar__button {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
}

.bar__button svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view {
  display: grid;
  align-content: start;
  gap: 1.25rem;
  min-width: 0;
  padding: 1rem 1rem 1.5rem;
}

.tabs {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  /* Each tab as wide as its name, and the room left shared out: « À valider » and its count fit.
     Where the text is set large they slide sideways, as the segments do, rather than widen the page. */
  grid-template-columns: repeat(4, auto);
  overflow-x: auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

/* A name never breaks; where the text is set large, the count of « À valider » goes under its name. */
.tabs__link {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 0.125rem 0.375rem;
  min-height: var(--tabs-height);
  padding: 0.25rem;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* How many requests wait: a plate in the night, whichever tab is current. */
.tabs__count {
  display: inline-grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.375rem;
  color: var(--on-ink);
  background: var(--ink);
  border-radius: var(--radius-plate);
  font-size: var(--size-detail);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.tabs__link:focus {
  outline-offset: -3px;
}

/* The current tab is darker and carries a mark: not the colour alone. */
.tabs__link[aria-current="page"] {
  color: var(--ink);
}

.tabs__link[aria-current="page"]::before {
  position: absolute;
  top: 0;
  right: 28%;
  left: 28%;
  height: 3px;
  background: var(--ink);
  border-radius: 0 0 3px 3px;
  content: "";
}

/* Step 1: the notes of the children, as buttons -------------------------- */

.notes {
  display: grid;
  gap: 0.875rem;
}

.notes > li {
  display: grid;
}

.note--pick {
  display: grid;
  grid-template-areas:
    "name value"
    "serial unit";
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 1rem;
  min-height: 7.25rem;
  padding: 1.125rem 1.375rem 0.9375rem;
  text-decoration: none;
  transition: transform 180ms var(--ease-out);
}

.note--pick:active {
  transform: scale(0.985);
}

.note--pick > * {
  position: relative;
}

/* The engraved field stops above the foot: the serial number and the unit are printed
   on clean paper. Its cut falls on a hairline, like the edge of a panel on a banknote. */
.note--pick > .note__field {
  position: absolute;
  bottom: 2.375rem;
}

.note--pick > .note__field::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-bottom: 1px solid currentColor;
  opacity: 0.42;
  content: "";
}

.note--pick .note__rosette {
  top: 57%;
  right: -2.75rem;
  width: 14rem;
  height: 14rem;
  transform: translateY(-50%);
}

.note--pick .note__name {
  grid-area: name;
  font-size: var(--size-name);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.note--pick .note__digits {
  grid-area: value;
  font-size: var(--size-value);
  line-height: 1;
  text-align: right;
}

.note--pick .note__serial {
  grid-area: serial;
  align-self: end;
  font-size: var(--size-serial);
}

.note--pick .note__unit {
  grid-area: unit;
  align-self: end;
  font-size: var(--size-label);
  text-align: right;
}

/* Up to three children, on a screen tall enough: the notes share its height, the largest
   buttons the phone can offer, and each one is laid out as on the TV. */
@media (min-height: 40rem) {
  .view--fill {
    align-content: stretch;
  }

  .view--fill > .notes {
    grid-auto-rows: minmax(7.25rem, 1fr);
  }

  .view--fill .note--pick {
    grid-template-areas:
      "name name"
      "value value"
      "serial unit";
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  /* Here the field lies between the name and the foot, as a band across the note. */
  .view--fill .note--pick > .note__field {
    top: 3.5rem;
  }

  .view--fill .note--pick > .note__field::after {
    border-top: 1px solid currentColor;
  }

  .view--fill .note__rosette {
    top: 50%;
    right: auto;
    left: 50%;
    width: 22.5rem;
    height: 22.5rem;
    transform: translate(-50%, -50%);
  }

  .view--fill .note__name {
    font-size: var(--size-name-large);
  }

  /* A third of the screen, less what the header, the tabs, the name and the serial number take. */
  .view--fill .note__digits {
    justify-self: center;
    font-size: clamp(3rem, calc(33.3vh - 10.5rem), 5.5rem);
  }

  @supports (height: 100dvh) {
    .view--fill .note__digits {
      font-size: clamp(3rem, calc(33.3dvh - 10.5rem), 5.5rem);
    }
  }
}

/* Lists ------------------------------------------------------------------ */

.segments {
  display: grid;
  grid-auto-columns: minmax(max-content, 1fr);
  grid-auto-flow: column;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.25rem;
  background: var(--sunken);
  border-radius: var(--radius-container);
}

/* At the top of a page, the choice stays in reach while the list scrolls under it:
   opaque where the lines pass behind, with a margin of the ground around it. */
@media (min-height: 30rem) {
  .view > .segments {
    position: sticky;
    top: calc(var(--bar-size) + 0.5rem);
    z-index: 1;
    background: linear-gradient(var(--sunken), var(--sunken)), var(--ground);
    box-shadow: 0 0 0 0.5rem var(--ground);
  }
}

.segments__link {
  display: grid;
  place-items: center;
  min-height: 2.75rem;
  padding: 0 0.625rem;
  color: var(--ink);
  border-radius: var(--radius-inner);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.segments__link:focus {
  outline-offset: -3px;
}

/* The current one is a raised plate: a shape, not a colour. */
.segments__link[aria-current="page"] {
  background: var(--surface);
  /* Ringed in the ink of the page: the plate alone is too close to its strip to be seen in daylight. */
  box-shadow:
    inset 0 0 0 2px var(--accent),
    0 1px 2px rgba(var(--night-rgb), 0.2);
}

.days {
  display: grid;
  gap: 1.25rem;
}

.group {
  display: grid;
  gap: 0.5rem;
}

.group__title {
  padding: 0 0.25rem;
  color: var(--ink-soft);
  font-size: var(--size-label);
  font-weight: 600;
}

/* The name of a category leads to its page: a target of 44 px that takes no more room than the title. */
.group__link {
  display: inline-flex;
  align-items: center;
  min-width: 2.75rem; /* a short name, such as "Écran", is still a full target */
  min-height: 2.75rem;
  margin: -0.5rem 0;
  text-decoration: underline;
  text-decoration-color: var(--control);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.rows {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
}

.rows > li + li {
  border-top: 1px solid var(--line);
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: 3.5rem;
  padding: 0.625rem 0.875rem;
  color: inherit;
  text-decoration: none;
}

/* A line asked for on the child's page keeps the focus of its button, the ring inside the list. */
.row--link:focus,
.row[tabindex="-1"]:focus {
  outline-offset: -3px;
}

/* A line that acts instead of leading somewhere: a child asks for the points of a task. */
.row--button {
  width: 100%;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.row--link:active {
  background: var(--sunken);
}

@media (hover: hover) {
  /* The line under the pointer takes the tint of the page. */
  .row--link:hover {
    background: var(--ground);
  }

  .note--pick:hover {
    transform: translateY(-2px);
  }

  .grid-row__link:hover .row__title {
    text-decoration-color: currentColor;
  }
}

.row__text {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.row__title {
  overflow-wrap: anywhere;
}

/* A long note keeps to three lines in a list; the page of its entry shows it whole. */
.row__detail {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: var(--size-detail);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.row__detail--done {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--ink);
  font-weight: 600;
}

.row__detail--done .icon {
  width: 1rem;
  height: 1rem;
}

/* What a parent wrote when sending a request back to the child: whole, in the size of the text. */
.row__note {
  overflow-wrap: anywhere;
}

/* The answers of the child to a request sent back, on a line of their own under it. */
.row__actions {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 0.5rem;
}

.row__actions > .button {
  flex: 1 1 auto;
}

/* Out of reach for now: said in words under the title, and printed in grey, not in the ink. */
.row--off,
.row--off .row__detail,
.row--off .chip {
  color: var(--muted);
}

/* A number of points. Gain: a filled plate. Spend: an outlined one, with its minus sign. */
.chip {
  display: inline-grid;
  place-items: center;
  min-width: 2.75rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: var(--radius-plate);
  font-size: var(--size-figure);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.chip--gain {
  color: var(--on-ink);
  background: var(--accent);
}

.chip--spend {
  color: var(--accent);
  box-shadow: inset 0 0 0 2px currentColor;
}

.fold {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
}

/* The triangle of the browser is replaced by a chevron drawn like the other icons. */
.fold__summary {
  display: block;
  list-style: none;
  cursor: pointer;
}

.fold__summary::-webkit-details-marker {
  display: none;
}

.fold__summary:focus {
  outline-offset: -3px;
}

.fold__line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.5rem 0.875rem;
  font-weight: 600;
}

.fold__line .icon {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  transition: transform 180ms var(--ease-out);
}

.fold[open] > .fold__summary .icon {
  transform: rotate(90deg);
}

.fold__count {
  color: var(--ink-soft);
  font-weight: 400;
}

.fold > .rows {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.fold > .field {
  padding: 0.25rem 0.875rem 1rem;
}

.hint {
  color: var(--ink-soft);
  font-size: var(--size-label);
}

/* Two hints in a row read as one block. */
.hint + .hint {
  margin-top: -0.75rem;
}

/* Forms ------------------------------------------------------------------ */

.sheet {
  display: grid;
  gap: 1.125rem;
}

/* On two lines, a heading is cut in two halves, not left with one word alone. */
.gate__title,
.sheet__what,
.sheet__title,
.danger__title {
  text-wrap: balance;
}

/* A paragraph does not leave one word alone on its last line, where the browser knows how. */
.hint,
.field__hint,
.sheet__line,
.danger__text,
.notice__text {
  text-wrap: pretty;
}

.sheet__what {
  font-size: var(--size-title);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* The value being confirmed is large enough for the face of the notes. */
.sheet__worth .chip {
  min-width: 3.75rem;
  height: 2.625rem;
  font-family: var(--display);
  font-size: var(--size-title);
  font-weight: 400;
}

.sheet__mark .row__detail--done {
  font-size: var(--size-figure);
}

.sheet__line {
  color: var(--ink-soft);
}

/* A code a parent gives, read out or typed: large, in the figures of the serial number. */
.code {
  font-family: var(--serial);
  font-size: var(--size-name);
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* The address of the child's page: one long word, broken anywhere rather than off the screen. */
.address {
  overflow-wrap: anywhere;
}

.sheet > .button {
  width: 100%;
}

/* The third gesture: the page fills the screen. What was chosen stays at the top;
   the boxes and the button sit together at the bottom, under the thumb. */
.view--confirm {
  align-content: stretch;
}

.view--confirm > .sheet {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.view--confirm > .sheet > * {
  order: 2;
}

.view--confirm > .sheet > * + * {
  margin-top: 1.125rem;
}

.view--confirm > .sheet > .sheet__what,
.view--confirm > .sheet > .sheet__mark,
.view--confirm > .sheet > .sheet__worth {
  order: 0;
}

.view--confirm > .sheet > .sheet__mark {
  margin-top: 0.375rem;
}

/* A spacer between the two halves: it takes what is left of the screen. */
.view--confirm > .sheet::before {
  flex: 1 0 0.5rem;
  order: 1;
  content: "";
}

.field {
  display: grid;
  gap: 0.375rem;
  justify-items: start;
}

.field__label {
  padding: 0;
  font-size: var(--size-label);
  font-weight: 600;
}

.field__hint {
  color: var(--ink-soft);
  font-size: var(--size-detail);
}

.input {
  width: 100%;
  min-height: 3rem;
  padding: 0 0.75rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--control);
  border-radius: var(--radius-control);
  font: inherit;
}

.checks,
.pick {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  cursor: pointer;
}

.check__box {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
}

/* A bonus that is not ticked is not counted yet: its plate waits in grey. */
.check__box:not(:checked) ~ .chip {
  color: var(--muted);
  background: var(--sunken);
}

.pick__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.5rem;
}

/* Choices with longer names, such as the categories: two side by side on a phone, each word whole. */
.pick__options--wide {
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}

.pick__option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 0.75rem;
  background: var(--surface);
  border: 1.5px solid var(--control);
  border-radius: var(--radius-control);
  cursor: pointer;
}

.pick__radio {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
}

/* 3rem outside: 44 px of touch target stay inside the border.
   It narrows a little rather than leave its line when the text is set very large. */
.stepper {
  display: inline-grid;
  grid-template-columns: minmax(2.75rem, 3rem) minmax(2.5rem, 4rem) minmax(2.75rem, 3rem);
  max-width: 100%;
  height: 3rem;
  overflow: hidden;
  background: var(--surface);
  border: 1.5px solid var(--control);
  border-radius: var(--radius-control);
}

.stepper :focus {
  outline-offset: -3px;
}

.stepper__button {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.stepper__button:active:not([aria-disabled="true"]) {
  background: var(--sunken);
}

/* At its bound: still reachable with the keyboard, but it does nothing. */
.stepper__button[aria-disabled="true"] {
  color: var(--faint);
  cursor: default;
}

.stepper__value {
  width: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0;
  font-family: inherit;
  font-size: var(--size-figure-large);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper__value::-webkit-outer-spin-button,
.stepper__value::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

/* A line of the grid: the name, its stepper and, once the value has moved, its two
   buttons on a line of their own. The stepper drops under the name when room is short. */
.grid-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.grid-row > .row__text {
  flex: 1 1 5.25rem;
}

.grid-row > .stepper {
  margin-left: auto;
}

/* The name of a task leads to its page: a target of 44 px, told from plain text by the line under it. */
.grid-row__link {
  align-content: center;
  min-height: 2.75rem;
  border-radius: var(--radius-inner);
  text-decoration: none;
}

.grid-row__link .row__title {
  text-decoration: underline;
  text-decoration-color: var(--control);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.grid-row__link:active {
  background: var(--sunken);
}

.grid-row__actions {
  display: flex;
  flex: 1 1 100%;
  gap: 0.5rem;
  justify-content: flex-end;
}

.grid-row .form-error {
  flex: 1 1 100%;
}

/* Takes the focus when its two buttons leave the page: the ring stays inside the list. */
.grid-row:focus {
  outline-offset: -3px;
}

.button {
  display: inline-grid;
  place-items: center;
  min-height: 3rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button--primary {
  color: var(--on-ink);
  background: var(--accent);
}

.button--secondary {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--ink);
}

.button--danger {
  color: var(--danger);
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--danger);
}

.button--danger-solid {
  color: var(--on-ink);
  background: var(--danger);
}

.button:disabled {
  color: var(--ink-soft);
  background: var(--sunken);
  box-shadow: none;
  cursor: default;
}

.form-error {
  padding: 0.75rem 0.875rem;
  color: var(--danger);
  background: var(--danger-ground);
  border-radius: var(--radius-control);
  font-weight: 600;
}

/* Empty, the alert stays in the page for screen readers, out of sight (css/base.css). */
.form-error:empty {
  padding: 0;
}

/* Cancelling an entry: kept well away from the other commands. */
.danger {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* What a retirement takes away is listed across the page, like any other list. */
.danger > .rows {
  justify-self: stretch;
}

.sheet__title,
.danger__title {
  font-size: var(--size-body);
  font-weight: 700;
}

/* Focused by the script when they ask their question, or when the button under them leaves: no ring on a heading. */
.sheet__what:focus,
.sheet__title:focus,
.danger__title:focus {
  outline: none;
}

.danger__text {
  color: var(--ink-soft);
}

.danger__actions {
  display: grid;
  gap: 0.5rem;
  width: 100%;
}

/* States ----------------------------------------------------------------- */

.notice {
  display: grid;
  gap: 1rem;
  justify-items: start;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
}

/* Focused by the script when the child's page cannot be read, for screen readers: no ring on a message. */
.notice__text:focus {
  outline: none;
}

.skeleton {
  display: grid;
  gap: 0.625rem;
}

.skeleton__line {
  height: 3.5rem;
  background: var(--sunken);
  border-radius: var(--radius-container);
  animation: pulse 1.1s ease-in-out infinite alternate;
}

@keyframes pulse {
  to {
    opacity: 0.5;
  }
}

.toast {
  position: fixed;
  bottom: calc(var(--tabs-height) + env(safe-area-inset-bottom, 0px) + 0.75rem);
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: calc(100% - 2rem);
  max-width: 34rem;
  min-height: 3.25rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  color: var(--night-text);
  background: var(--night);
  border-radius: var(--radius-container);
  box-shadow: 0 6px 20px rgba(var(--night-rgb), 0.28);
  transform: translateX(-50%);
  animation: toast-in 220ms var(--ease-out);
}

.toast__action {
  flex: none;
  min-height: 2.75rem;
  padding: 0 0.875rem;
  color: var(--night);
  background: var(--night-text);
  border: 0;
  border-radius: var(--radius-inner);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.toast__action:focus {
  outline-color: var(--night-text);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 0.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton__line,
  .toast {
    animation: none;
  }

  .note--pick,
  .fold__line .icon {
    transition: none;
  }
}
