@layer pages {
/*
  Page layouts. The components are phone-first; this sheet is where each page grows up for a
  desktop: the hero as a two-column panel, the plan as a sticky instrument panel beside a sheet,
  the landing sections set across the width, forms centred and two-column.
*/

/* The hero on the landing page: copy on the left, the contour map on the right */
.hero {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-6);
}

.hero__copy {
  /* The column is not held to the reading measure: the figure, the headline and the strip are meant
     to use the whole of it, as the mockup draws them. The sentences inside it carry their own
     measure instead. A container so the figure can be sized against the column rather than the
     window, which is what keeps the mockup's proportions on a wide monitor. */
  container-type: inline-size;
}

.hero__lede {
  max-inline-size: var(--measure);
}

.hero__start {
  margin-block-start: var(--space-6);
  display: grid;
  gap: var(--space-2);

  & label {
    font-weight: 600;
  }
}

.hero__start-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);

  & .input {
    flex: 1 1 10rem;
    max-inline-size: 14rem;
    font-family: var(--font-data);
    font-size: var(--text-l);
    text-transform: uppercase;

    &::placeholder {
      text-transform: none;
      font-family: var(--font-body);
      font-size: var(--text-m);
    }
  }
}

@media (min-width: 60rem) {
  /* The mockup's split: the words take seven twelfths, the kitchen table five, and the table fills its column. */
  .hero:not(.hero--plan) {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: center;
    gap: var(--space-8);
    padding-block: var(--space-8);

    & .days-ready__figure {
      /* A quarter of the column, which is the proportion the mockup drew, rather than a share of
         the window: on a 2000px monitor a figure sized by vw stops growing while its column keeps
         going and the hero reads as half empty. */
      font-size: clamp(7rem, 24cqi, 13rem);
    }

    & .strip {
      max-inline-size: 46rem;
    }

    & .days-ready__unit {
      font-size: var(--text-2xl);
    }

    & h1 {
      font-size: var(--text-2xl);
    }

    & .hero__lede {
      font-size: var(--text-l);
    }
  }
}

/* Landing sections */
.pitch h2,
.how h2,
.covers h2,
.faq h2 {
  font-size: var(--text-2xl);
  text-wrap: balance;
}

.pitch,
.how,
.ways,
.covers,
.faq {
  margin-block-start: var(--space-8);
  padding-block-start: var(--space-7);
  border-block-start: var(--border);
}

.how__steps {
  max-inline-size: none;
}

@media (min-width: 60rem) {
  .how__steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-6);

    & li {
      grid-template-columns: 1fr;
      row-gap: var(--space-2);

      &::before {
        grid-row: auto;
        font-size: var(--text-display);
        line-height: 0.9;
      }

      & p {
        grid-column: 1;
      }
    }
  }

  .faq {
    max-inline-size: none;
    display: grid;
    grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
    gap: var(--space-7);
    align-items: start;

    & .faq__intro {
      position: sticky;
      inset-block-start: var(--space-5);
    }

  }

  /* Two across once the answers have the room, so a long list is scanned rather than scrolled. */
  @media (min-width: 90rem) {
    .faq__list {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      align-items: start;
    }
  }

  .faq__list {
    display: grid;
    gap: var(--space-3);
  }
}

.faq__list {
  margin-block-start: var(--space-5);
  display: grid;
  gap: var(--space-3);
}

.faq__item {
  padding: var(--space-4) var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & summary {
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-display);
    font-size: var(--text-l);
  }

  & p {
    margin-block-start: var(--space-3);
    color: var(--c-ink-muted);
  }
}

/* The closing band: paper in daylight, the roofline once more in the dark, with the lantern as the door */
.closing {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  max-inline-size: none;
  margin-block-start: var(--space-8);
  padding: var(--space-7);
  border: 2px solid light-dark(var(--c-contour), var(--c-on-roof-line));
  border-radius: var(--radius-m);
  background: light-dark(var(--c-paper), var(--c-roof));
  color: light-dark(var(--c-ink), var(--c-on-roof));
  display: grid;
  gap: var(--space-5);

  & h2 {
    font-size: var(--text-2xl);
  }

  & p {
    color: light-dark(var(--c-ink-muted), var(--c-on-roof-muted));
    max-inline-size: var(--measure);
  }

  &::before {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: -1;
    background-image: repeating-radial-gradient(ellipse 50% 60% at 85% 50%, transparent 0 1.6rem, light-dark(var(--c-contour), var(--c-on-roof-line)) 1.6rem calc(1.6rem + 1.5px));
    mask-image: linear-gradient(to left, oklch(0% 0 0 / 0.9), transparent 70%);
  }
}

@media (min-width: 60rem) {
  .closing {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: var(--space-8);
  }
}

/* The plan: one column in the order the questions come, with the verdict bar keeping the first answer in view */
.plan-flow {
  display: grid;
  gap: var(--space-7);
  /* No cap of its own: the plan is a board, a set of tiered lists and a map, and it reads better
     with the room. The page width governs it and the prose inside it keeps its own measure. */
  margin-inline: auto;
}

.hero--plan {
  padding: var(--space-6);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  overflow: hidden;

  & .contour-band {
    inset: -10%;
    opacity: 0.55;
    mask-image: radial-gradient(circle at 80% 20%, oklch(0% 0 0), transparent 75%);
  }

  & .eyebrow {
    text-transform: none;
    letter-spacing: 0;
  }

  & .days-ready {
    margin-block-start: var(--space-4);
  }

  & .days-ready__figure {
    font-size: clamp(5rem, 3rem + 6vw, 9rem);
  }
}

/* The hero's second half: what could happen, as chips */
.hero__scenarios {
  margin-block-start: var(--space-6);
}

.hero__scenarios-heading {
  font-size: var(--text-l);
}

.hero__scenarios-lede,
.plan__lede,
.risks__lede {
  margin-block: var(--space-2) var(--space-3);
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
}

/* Which flood band the plan was built on, and where that came from: a note under the risks, said whatever the band. */
.risks__flood {
  margin-block-start: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-inline-start: 4px solid var(--c-pine);
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
  background: var(--c-pine-tint);
  max-inline-size: var(--measure);

  & a {
    font-weight: 600;
  }
}

/* Above the form, when it has been filled in from the plan this browser keeps. */
.wizard__kept {
  padding: var(--space-3) var(--space-4);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
}

.rely__fields {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.plan-flow > .house-map,
.plan-flow > .risks,
.plan-flow > .rely,
.plan-flow > .plan-tools,
.plan-flow > .upkeep,
.plan-flow > .plan {
  margin-block-start: 0;
}

.risk-list {
  /* auto-fit, not auto-fill: only the top three risks are shown and auto-fill would lay six tracks
     on a wide monitor and fill three, leaving the row half empty. */
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

@media (min-width: 64rem) {
  .hero--plan {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--space-8);
    align-items: start;
  }

  .hero__scenarios {
    margin-block-start: 0;
  }

  .plan {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;

    & > :not(.sheet) {
      grid-column: 1 / -1;
    }
  }
}

/* Tier sheets fold: the header is the summary, with a chevron that turns */
.sheet > summary {
  list-style: none;
  cursor: pointer;

  &::-webkit-details-marker {
    display: none;
  }

  & h3 {
    flex: 1;
  }
}

.sheet:not([open]) > summary {
  padding-block-end: 0;
  border-block-end: none;
}

.sheet__chevron {
  inline-size: 0.6rem;
  block-size: 0.6rem;
  margin-inline-start: var(--space-2);
  border-inline-end: 2px solid var(--c-ink-muted);
  border-block-end: 2px solid var(--c-ink-muted);
  rotate: 45deg;
  translate: 0 -0.15rem;
  transition: rotate var(--duration-quick);
}

.sheet:not([open]) .sheet__chevron {
  rotate: -45deg;
  translate: 0 0.1rem;
}

/* Wizard pages: the intro beside the form */
.wizard {
  padding-block: var(--space-5);

  & h1 {
    font-size: var(--text-2xl);
    text-wrap: balance;
  }

  & > p {
    max-inline-size: var(--measure);
    text-wrap: pretty;
  }
}

.plan-form {
  max-inline-size: 46rem;
}

.form-section {
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));

  & legend {
    font-size: var(--text-l);
  }

  /* The location row takes the whole width; a short box alone does not. */
  & .field--check,
  & .field:has(select),
  & .field:has(.locate-row),
  & .field:has(.input:not(.input--short)) {
    grid-column: 1 / -1;
  }
}

@media (min-width: 60rem) {
  .wizard:has(> .plan-form) {
    grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
    column-gap: var(--space-8);
    align-content: start;

    & > * {
      grid-column: 1;
    }

    & > .plan-form {
      grid-column: 2;
      grid-row: 1 / span 8;
    }
  }

  .photo-moments {
    max-inline-size: none;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    align-items: start;
  }
}

/* A form is answered down one column, so the questions do not go two across however wide the window
   is: fieldsets of different heights leave a hole beside the tall one, which reads as a fault. The
   intro and the form are centred in the page instead, so the room left over sits evenly either side
   rather than all of it down the right. */
@media (min-width: 60rem) {
  .wizard:has(> .plan-form) {
    inline-size: min(100%, 74rem);
    margin-inline: auto;
  }
}

/* The solar estimator, one question to a screen. A step is a single column of reading width, centred, so that
   what is asked sits in the middle of the page and not down its left edge. */
.solar-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  inline-size: min(100%, 52rem);
  margin-inline: auto;
}

.solar-step__place {
  margin-inline-start: var(--space-3);
  color: var(--c-ink-muted);
}

.solar-step__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);

  & .field {
    margin: 0;
    align-content: start;
  }

  /* A step is read down one column. The panels elsewhere lay their questions several across, which here broke each label
     after a few words in a panel with room for the whole of it. */
  & .form-section {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The row of steps: a number in a ring and a name for each, joined by a rule. A step already answered is filled in and is
   a button back to it; the one being shown is the only one in full ink; those ahead are quiet. */
.solar-trail__steps {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.solar-trail__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;

  &:not(:last-child)::after {
    content: "";
    flex: none;
    inline-size: var(--space-5);
    block-size: 2px;
    background: var(--c-contour);
  }
}

.solar-trail__step {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 2.75rem;
  min-inline-size: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--text-s);
  color: var(--c-ink-muted);
  white-space: nowrap;
}

button.solar-trail__step {
  cursor: pointer;
  color: var(--c-pine);
  font-weight: 600;

  &:hover .solar-trail__name {
    text-decoration: underline;
  }
}

.solar-trail__number {
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: 1.75rem;
  block-size: 1.75rem;
  border: 2px solid currentcolor;
  border-radius: 50%;
  font-family: var(--font-data);
  line-height: 1;
}

.solar-trail__item[data-state="done"] .solar-trail__number {
  border-color: var(--c-pine);
  background: var(--c-pine);
  color: var(--c-paper);
}

.solar-trail__item[data-state="current"] .solar-trail__step {
  color: var(--c-ink);
  font-weight: 600;
}

/* On a narrow screen five names do not fit on a line, and one long name alone pushed its neighbours into each other. The
   numbers stay; the line above says which step this is and the heading below names it. The names are kept for a screen
   reader and for each button's own name. */
@media (max-width: 47.99rem) {
  .solar-trail__name {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .solar-trail__item:not(:last-child)::after {
    inline-size: var(--space-3);
  }

  .solar-trail__step {
    justify-content: center;
  }
}

/* Over the estimate the row stands alone, with room under it before the figure. */
.solar-trail-form {
  margin-block-end: var(--space-5);
}

.solar-step__lede {
  margin: 0;
  max-inline-size: var(--measure);
}

.solar-step__actions {
  margin: 0;
}

/* The two ways to give the roof: side by side where there is room, each a panel with what follows from it and its own button
   at the foot, so the two buttons sit level however long the words above them run. */
.solar-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  gap: var(--space-5);
}

.solar-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: var(--space-3);
  align-content: start;
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & h2 {
    font-size: var(--text-l);
    margin: 0;
  }

  & p {
    margin: 0;
  }

  & .button {
    justify-self: start;
    align-self: end;
  }
}

/* The roof's three questions: the compass beside the two numbers where there is room, above them on a phone. */
.solar-roof {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  gap: var(--space-5) var(--space-6);
  align-items: start;
}

.solar-roof__numbers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
}

/* The compass question is a label like the ones beside it, not a second heading for the step. */
.solar-roof .compass legend {
  font-family: var(--font-body);
  font-size: var(--text-m);
}

/* What was measured, folded away: there to change, not to read through. The questions sit inside on a grid of their own,
   because a details element does not lay out what is in it. */
.solar-change {
  border: var(--border);
  border-radius: var(--radius-s);
  padding: var(--space-3) var(--space-4);

  & summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--c-pine);
  }

  & > .field__hint {
    margin-block: var(--space-3) var(--space-4);
  }
}

.solar-answers {
  & .cluster {
    margin-block-start: var(--space-4);
  }
}

.notice,
.byok,
.narrative,
.wizard:not(:has(> .plan-form)) > p {
  max-inline-size: var(--measure);
}

/* The board: scenario cards, switches, and one sheet per source and season */
.board {
  margin-block-end: var(--space-7);

  & h2 {
    font-size: var(--text-2xl);
    text-wrap: balance;
  }

  & .board__sentence {
    margin-block-start: var(--space-3);
    color: var(--c-ink-muted);
    max-inline-size: var(--measure);
  }
}

.board__scenarios {
  margin-block-start: var(--space-5);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--space-3);
}

/* A scenario card is paper, so the sheet reads as one surface in both themes; the chosen one carries the lantern. */
.scenario {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  color: var(--c-ink);
  border: var(--border);
  text-align: start;
  cursor: pointer;
  font: inherit;

  &[aria-pressed="true"] {
    border-color: var(--c-lantern);
    box-shadow: inset 0 0 0 1px var(--c-lantern);
    background: var(--c-lantern-tint);
  }

  &:hover {
    border-color: var(--c-ink-muted);
  }
}

.scenario__mark {
  inline-size: 2.4rem;
  block-size: 2.4rem;
  color: var(--c-ink-muted);
}

.scenario__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-m);
  line-height: 1.2;
  text-wrap: balance;
}

.scenario__days {
  font-family: var(--font-display);
  font-weight: 300;
  font-stretch: 85%;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--c-lantern-ink);

  & small {
    font-family: var(--font-data);
    font-size: var(--text-s);
    color: var(--c-ink-muted);
    margin-inline-start: var(--space-1);
  }
}

.board__switches {
  margin-block-start: var(--space-5);
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 60rem) {
  .board__switches {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
}

.seg {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);

  & legend {
    font-weight: 600;
    padding: 0;
    margin-block-end: var(--space-2);
    inline-size: 100%;
  }
}

.seg__input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.seg__pill {
  display: inline-flex;
  align-items: center;
  min-block-size: 2.5rem;
  padding: var(--space-1) var(--space-3);
  border: var(--border);
  border-radius: 999px;
  background: var(--c-paper);
  font-size: var(--text-s);
  font-weight: 500;
  cursor: pointer;

  &:hover {
    border-color: var(--c-pine);
  }
}

.seg__input:checked + .seg__pill {
  background: var(--c-lantern-tint);
  border-color: var(--c-lantern);
}

.seg__input:focus-visible + .seg__pill {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.board__sheet {
  margin-block-start: var(--space-5);
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  --cols: 5;
}

.board__head,
.board__summary {
  display: grid;
  grid-template-columns: minmax(8rem, 1.6fr) repeat(var(--cols), minmax(0, 1fr));
  gap: var(--space-2);
  align-items: center;
}

.board__head {
  font-family: var(--font-data);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
  padding-block-end: var(--space-2);
  border-block-end: var(--border);

  & .board__col {
    text-align: center;
  }
}

/* Each rung is a band: a tinted header with its mark, name, purpose and standing, then its rows */
.board__rung {
  margin-block-start: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;

  &:first-of-type {
    margin-block-start: 0;
  }

  & .board__head {
    padding: var(--space-2) var(--space-3) var(--space-2);
    border-block-end: 1px solid var(--c-contour);
  }

  & .board__row {
    padding-inline: var(--space-3);
  }

  & .board__row:last-child {
    padding-block-end: var(--space-2);
  }
}

.board__rung-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "mark name summary"
    "mark what summary";
  column-gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--c-lantern-tint);
  border-inline-start: 4px solid var(--c-lantern);
}

.board__rung-mark {
  grid-area: mark;
  inline-size: 2rem;
  block-size: 2rem;
  color: var(--c-ink);
}

.board__rung-name {
  grid-area: name;
  font-size: var(--text-l);
  line-height: 1.1;
}

.board__rung-what {
  grid-area: what;
  font-size: var(--text-s);
  color: var(--c-ink-muted);
}

.board__rung-summary {
  grid-area: summary;
  font-size: var(--text-s);
  color: var(--c-ink-muted);
  text-align: end;
}

@media (max-width: 40rem) {
  .board__rung-head {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "mark name"
      "mark what"
      "mark summary";
  }

  .board__rung-summary {
    text-align: start;
  }
}

.board__row {
  & + & {
    margin-block-start: var(--space-1);
  }
}

.board__summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-1) 0;
  border-radius: var(--radius-s);

  &::-webkit-details-marker {
    display: none;
  }

  &:hover {
    background: var(--c-ground);
  }
}

.board__need {
  font-size: var(--text-s);
  font-weight: 600;
  padding-inline-start: var(--space-1);
}

.cell {
  display: grid;
  place-items: center;
  block-size: 1.9rem;
  border-radius: var(--radius-s);
  border: 2px solid transparent;
  font-size: 0.75rem;

  &.cell--held {
    background: var(--c-pine-tint);
    border-color: var(--c-pine);
  }

  &.cell--reduced {
    background: repeating-linear-gradient(135deg, var(--c-lantern) 0 3px, var(--c-lantern-tint) 3px 8px);
    border-color: var(--c-lantern);
  }

  &.cell--rationed {
    background: var(--c-lantern-tint);
    border-color: var(--c-lantern);
  }

  &.cell--lost {
    background: repeating-linear-gradient(135deg, var(--c-contour) 0 2px, transparent 2px 7px);
    border-color: var(--c-contour);
  }
}

/* Where a cell is too narrow for "held 14 days" it says "14 d". */
@media (max-width: 64rem) {
  .cell__long {
    display: none;
  }
}

.cell__days {
  white-space: nowrap;
  padding: 0 var(--space-1);
  border-radius: 999px;
  background: var(--c-paper);
  color: var(--c-ink);
}

.board__why {
  margin-block: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-inline-start: 4px solid var(--c-lantern);
  background: var(--c-lantern-tint);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font-size: var(--text-s);
}

/* Said after the reason when the row was worked out from a figure the household gave for itself. */
.board__own {
  font-weight: 600;
}

.board__headline {
  margin-block-start: var(--space-5);
  padding-block-start: var(--space-4);
  border-block-start: var(--border);
  text-wrap: pretty;
}

.board__key {
  margin-block-start: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: var(--text-s);
  color: var(--c-ink-muted);
  align-items: center;

  & i.cell {
    display: inline-grid;
    inline-size: 1.4rem;
    block-size: 0.9rem;
    vertical-align: middle;
    margin-inline-end: var(--space-1);
  }
}

/* Comparing a sheet with today, in the one table. A need the sheet changes is drawn twice, one line
   above the other, with "Today" and the position by name ("With the plan") in words in front of each; it says by how much under
   its name; and a sentence above says what it adds up to. A switch narrows the board to those needs,
   with no script. */
.board__compare {
  margin-block-start: var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.board__compare-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  justify-self: start;
  min-block-size: 2.25rem;
  font-weight: 600;
  cursor: pointer;

  & input {
    inline-size: 1.25rem;
    block-size: 1.25rem;
  }
}

.board__comparison {
  padding: var(--space-3) var(--space-4);
  border-inline-start: 4px solid var(--c-pine);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  background: var(--c-pine-tint);
  text-wrap: pretty;
}

.board__delta {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--c-pine);
}

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

.board__when {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--c-ink-muted);
  line-height: 1.15;
  text-align: end;
  text-wrap: balance;
}

/* A sheet with pairs has a narrow column for those words between the need and its cells. A need
   drawn once runs across it; a need drawn twice keeps its name beside both lines. */
.board__sheet[data-paired="true"] {
  & .board__head,
  & .board__summary {
    grid-template-columns: minmax(8rem, 1.6fr) 6.5rem repeat(var(--cols), minmax(0, 1fr));
  }

  & .board__corner,
  & .board__need {
    grid-column: 1 / span 2;
  }

  & .board__row[data-paired="true"] {
    margin-block: var(--space-2);
    border-radius: var(--radius-s);
    background: var(--c-ground);

    & .board__summary {
      padding-block: var(--space-2);
    }

    & .board__need {
      grid-column: 1;
      grid-row: 1 / span 2;
    }

    /* Each line's words are pinned to their column, so the second line starts a new row whatever the scenario's number of
       columns. Left to flow, it ran on into the empty columns beside the first line of a three-column board. */
    & .board__when {
      grid-column: 2;
    }
  }
}

/* Narrowed to what changes: the needs drawn once go, and so does a rung with nothing drawn twice. */
.board:has([data-board-only-changes]:checked) {
  & .board__row[data-paired="false"],
  & .board__rung:not(:has(.board__row[data-paired="true"])) {
    display: none;
  }
}

.board__note {
  margin-block-start: var(--space-3);
  font-size: var(--text-s);
  color: var(--c-ink-muted);
}

.action__turns {
  font-size: var(--text-s);
  color: var(--c-pine);
}

@media (max-width: 40rem) {
  /* On a phone the need sits above its cells, which stay in one row under the horizon labels. */
  .board__head {
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    font-size: 0.6rem;
    letter-spacing: 0.02em;

    & .board__corner {
      display: none;
    }
  }

  .board__summary {
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: var(--space-1);
  }

  .board__need {
    grid-column: 1 / -1;
  }

  .board__summary .cell {
    block-size: 1.4rem;
  }

  /* A pair on a phone: the need, then each line under its own words. */
  .board__sheet[data-paired="true"] {
    & .board__head,
    & .board__summary {
      grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    }

    & .board__need,
    & .board__row[data-paired="true"] .board__need {
      grid-column: 1 / -1;
      grid-row: auto;
    }

    & .board__row[data-paired="true"] .board__when {
      grid-column: 1 / -1;
    }
  }

  .board__when {
    grid-column: 1 / -1;
    text-align: start;
  }
}

/* What the household relies on */
.rely {
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & h2 {
    font-size: var(--text-l);
  }

  & p {
    margin-block-start: var(--space-2);
    font-size: var(--text-s);
    color: var(--c-ink-muted);
  }
}

.rely__list {
  list-style: none;
  padding: 0;
  margin-block: var(--space-3);
  display: grid;
  gap: var(--space-2);

  & li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    padding-block: var(--space-1);
    border-block-end: 1px solid var(--c-contour);
    font-size: var(--text-s);
  }

  & .button {
    min-block-size: 2rem;
    padding-block: 0;
  }
}

.rely__form {
  margin-block-start: var(--space-4);
  display: grid;
  gap: var(--space-3);
}

.rely__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

/* The landing hero on the night ground, bleeding to the viewport edges without widening the page */
.hero--night {
  /*
    Full bleed without widening the page: the body is the inline-size container, so 100cqi is the
    viewport less its scrollbar, and the hero is pulled out to it and padded back to the page column.
  */
  --edge: max(var(--gutter), calc((100cqi - var(--page-max)) / 2 + var(--gutter)));
  inline-size: 100cqi;
  margin-inline-start: calc(50% - 50cqi);
  padding-inline: var(--edge);
  padding-block: var(--space-7);
  margin-block-start: calc(-1 * var(--space-6));
  overflow: clip;

  & .contour-band {
    inset: -10%;
    opacity: 0.6;
    mask-image: radial-gradient(ellipse at 70% 40%, oklch(0% 0 0), transparent 70%);
  }

  /* The glow is centred behind the figure, which sits a little below and to the right of the column edge. */
  & .glow {
    inset-block-start: -2rem;
    inset-inline-start: calc(var(--edge) - 10rem);
    inline-size: 32rem;
    block-size: 32rem;
    translate: none;
  }

  & .hero__start label {
    color: var(--c-ink);
  }
}

/* The name and what it means, above the figure it introduces */
.hero__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 90%;
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--c-ink);
}

.hero__tagline {
  margin-block-start: var(--space-3);
  margin-block-end: var(--space-7);
  max-inline-size: 48ch;
  font-size: var(--text-l);
  color: var(--c-ink-muted);
  text-wrap: pretty;

  & strong {
    color: var(--c-lantern-ink);
    font-weight: 600;
  }
}

.hero__picture {
  /* An auto inline margin on a grid item cancels the stretch and shrink-wraps it, and an SVG with
     only a viewBox is 300px wide by default; without this the kitchen table shrinks to that. */
  inline-size: 100%;
  max-inline-size: 30rem;
  margin-inline: auto;
}

@media (min-width: 60rem) {
  .hero--night {
    padding-block: var(--space-8);
  }

  .hero__picture {
    max-inline-size: none;
  }
}

/* The plan's night panel: the figure, its glow and the strip, with the contour band behind */
.hero--plan.night {
  border-color: var(--c-contour);

  & .contour-band {
    opacity: 0.8;
  }

  & .glow {
    inset-block-start: 6rem;
    inset-inline-start: -2rem;
    inline-size: 26rem;
    block-size: 26rem;
  }

  & .strip {
    margin-block-start: var(--space-5);
  }
}

/* What it covers: the larder beside the words, then the grid */
.covers__head {
  max-inline-size: var(--measure);

  & p {
    margin-block-start: var(--space-3);
    color: var(--c-ink-muted);
  }
}

.covers__picture {
  margin: var(--space-5) 0 0;
  max-inline-size: 30rem;
  color: var(--c-ink-muted);
}

@media (min-width: 60rem) {
  .covers {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-5) var(--space-8);
    align-items: end;
  }

  .covers__picture {
    margin: 0;
    max-inline-size: none;
  }

  .covers > .covers__grid {
    grid-column: 1 / -1;
  }
}

/* The closing band carries the hill */
.closing__picture {
  color: light-dark(var(--c-ink-muted), var(--c-on-roof-muted));
  max-inline-size: 28rem;
}

@media (min-width: 60rem) {
  .closing {
    grid-template-columns: minmax(0, 1fr) auto minmax(14rem, 20rem);
  }

  .closing__picture {
    max-inline-size: none;
  }
}

/* Motion: the scenario cards settle in a step apart */
@media (prefers-reduced-motion: no-preference) {
  .scenario {
    animation: settle 400ms var(--ease-out) both;
  }

  .scenario:nth-child(2) { animation-delay: 80ms; }
  .scenario:nth-child(3) { animation-delay: 160ms; }
  .scenario:nth-child(4) { animation-delay: 240ms; }
  .scenario:nth-child(5) { animation-delay: 320ms; }
  .scenario:nth-child(6) { animation-delay: 400ms; }
  .scenario:nth-child(7) { animation-delay: 480ms; }
  .scenario:nth-child(8) { animation-delay: 560ms; }
}

@keyframes settle {
  from {
    opacity: 0;
    translate: 0 0.5rem;
  }
}

/* The reviewer: a table of offers, read on a desk, never on a phone */
.review h1 {
  font-size: var(--text-2xl);
}

.review__signin {
  margin-block-start: var(--space-5);
  max-inline-size: 24rem;
}

.review__state {
  margin-block: var(--space-3);
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
}

.review__table {
  margin-block-start: var(--space-5);
  overflow-x: auto;
}

.review__offers {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: var(--text-s);

  & th,
  & td {
    text-align: start;
    vertical-align: top;
    padding: var(--space-2) var(--space-3);
    border-block-end: 1px solid var(--c-contour);
  }

  & th {
    font-family: var(--font-data);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-ink-muted);
  }

  & tr[data-status="hidden"] td,
  & tr[data-status="proposed"] td {
    color: var(--c-ink-muted);
  }

  & tr[data-status="failing"] td:nth-child(6) {
    color: var(--c-ember);
    font-weight: 600;
  }

  & form {
    display: inline;
  }
}

/* The deals page: one card per action, the mark, the pick, the price and the drop */
.deals {
  margin-inline: auto;
  padding-block: var(--space-6);
}

.deals__lede {
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
}

.deals__list {
  list-style: none;
  padding: 0;
  margin-block: var(--space-5);
  display: grid;
  gap: var(--space-3);
  /* Twenty-odd cards are scanned for a price, not read in order, so they go as many across as the
     window allows rather than down one column with the page empty either side. Cheapest first still
     reads left to right, top to bottom. */
  /* min(…, 100%) or the track stays 26rem on a 390px phone and the page scrolls sideways. */
  grid-template-columns: repeat(auto-fit, minmax(min(26rem, 100%), 1fr));
  align-items: start;
}

.deal {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  &[data-drop="true"] {
    border-color: var(--c-pine);
  }

  & .deal__mark {
    inline-size: 2.5rem;
    block-size: 2.5rem;
  }

  & .deal__title {
    font-size: var(--text-m);
    margin: 0;
  }

  & p {
    margin: var(--space-1) 0 0;
  }

  & .deal__price .data {
    font-weight: 600;
  }

  & .deal__was {
    margin-inline-start: var(--space-2);
    padding: 0 var(--space-2);
    border-radius: 999px;
    background: var(--c-pine-tint);
    color: var(--c-pine);
    font-size: var(--text-s);
    font-weight: 600;
  }

  & .deal__seen,
  & .deal__others {
    color: var(--c-ink-muted);
    font-size: var(--text-s);
  }

  & .deal__seen {
    margin-inline-start: var(--space-2);
  }
}

/* Share this figure: a quiet button under the strip, and the sentence after it */
.hero__share {
  margin-block-start: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.share__status {
  font-size: var(--text-s);
  color: var(--c-ink-muted);
}

/* The share landing: the night hero alone, the figure as the whole page */
.hero--share {
  min-block-size: auto;

  & .hero__copy {
    max-inline-size: var(--measure);
  }
}

/* The reviewer's operations: readiness, runs and hands, three quiet lists under the table */
.review__ops {
  margin-block-start: var(--space-6);
  display: grid;
  gap: var(--space-5);

  & h2 {
    font-size: var(--text-l);
    margin: 0 0 var(--space-2);
  }
}

.review__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-s);
  font-variant-numeric: tabular-nums;

  & li[data-status="unhealthy"],
  & li[data-outcome="failed"] {
    color: var(--c-ember);
  }

  & li[data-status="degraded"] {
    color: var(--c-lantern-ink);
  }
}

@media (min-width: 60rem) {
  .review__ops {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* The operator's own pages: sign in, the code, enrolment, the password. One panel, centred, with
   the whole page quiet around it. Every row inside is laid out by the grid's gap rather than by
   margins on the children, which is why the button no longer sits against the box above it. */
.panel-page {
  display: grid;
  justify-items: center;
  align-content: start;
  padding-block: var(--space-8);
}

.panel {
  inline-size: min(100%, 30rem);
  display: grid;
  gap: var(--space-4);
  padding: var(--space-6);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & h1 {
    font-size: var(--text-2xl);
    margin: 0;
  }

  & .eyebrow {
    margin: 0;
  }

  & .field {
    margin: 0;
  }

  /* A form nested inside the panel, as the enrolment steps are, is laid out by the same gap. The
     panel's own gap only reaches its direct children, so a nested form had nothing but a small
     margin between its last box and its button, which reads as touching. */
  & form {
    display: grid;
    gap: var(--space-4);
  }
}

/* Saved for later: one panel a shop, side by side where there is room, each a short list of picks. */
.shortlist {
  display: grid;
  gap: var(--space-5);
  padding-block: var(--space-6);

  & h1 {
    font-size: var(--text-2xl);
  }
}

.shortlist__lede {
  max-inline-size: var(--measure);
}

.shortlist__shops {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  gap: var(--space-4);
  align-items: start;
}

.shortlist__shop {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & h2 {
    font-size: var(--text-l);
  }
}

.shortlist__sum {
  font-size: var(--text-s);
  color: var(--c-ink-muted);
}

.shortlist__list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-4);

  & .pick {
    justify-items: start;
  }
}

/* The two things an account does, on the sign-in panel. */
.panel__list {
  margin: 0;
  padding-inline-start: var(--space-5);
  display: grid;
  gap: var(--space-1);
}

.panel--wide {
  inline-size: min(100%, 46rem);
}

.panel__lede {
  color: var(--c-ink-muted);
  text-wrap: pretty;
  margin: 0;
}

/* A way out that is not part of the panel's form: under it, with room. */
.panel__aside {
  margin-block-start: var(--space-4);
}

.panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  /* No margin of its own: whatever holds it is a grid and its gap does the spacing. */
}

.field__help {
  margin-block-start: var(--space-2);
  font-size: var(--text-s);
  color: var(--c-ink-muted);
}

/* A six-digit code and a recovery code are read back character by character, so they are set in
   the data face, spaced, and never in the body face where a one and an l look alike. */
.input--code {
  font-family: var(--font-data);
  font-size: var(--text-l);
  letter-spacing: 0.12em;
  max-inline-size: 14rem;
}

.enrol__steps {
  display: grid;
  gap: var(--space-6);
  margin: 0;
  padding-inline-start: var(--space-6);

  & h2 {
    font-size: var(--text-l);
    margin-block: 0 var(--space-2);
  }

  & p {
    margin-block-end: var(--space-3);
  }
}

.enrol__secret {
  font-family: var(--font-data);
  font-size: var(--text-l);
  letter-spacing: 0.1em;
  padding: var(--space-3) var(--space-4);
  border: var(--border);
  border-radius: var(--radius-s);
  background: var(--c-sky);
  overflow-wrap: anywhere;
}

.enrol__account {
  color: var(--c-ink-muted);
  font-size: var(--text-s);
}

.codes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  gap: var(--space-2);
}

.codes__code {
  font-family: var(--font-data);
  padding: var(--space-2) var(--space-3);
  border: var(--border);
  border-radius: var(--radius-s);
  background: var(--c-sky);
  text-align: center;
}

/* The reviewer's head: the title on one side, who is signed in and their two hands on the other. */
.review__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
  justify-content: space-between;
  margin-block-end: var(--space-4);
}

.review__who {
  font-size: var(--text-s);
}

.review__operator {
  color: var(--c-ink-muted);
}

/* The part of the back office being read: its way in the menu is filled, so it reads as chosen and not as one more link. */
.review__way[aria-current="page"] {
  background: var(--c-pine-tint);
  color: var(--c-ink);
  box-shadow: inset 0 -3px 0 var(--c-pine);
}

/* A button that has been pressed and is doing its work, and the sentence that says what the work is. */
button[data-busy] {
  cursor: progress;
  opacity: 0.65;
}

.busy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  margin-block: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-inline-start: 4px solid var(--c-lantern);
  background: var(--c-lantern-tint);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  max-inline-size: 44rem;
}

.busy__time {
  font-family: var(--font-data);
  font-size: var(--text-s);
  color: var(--c-ink-muted);
}

.busy__bar {
  display: block;
  block-size: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--c-lantern) 50%, transparent 100%) 0 0 / 40% 100% no-repeat, color-mix(in oklab, var(--c-lantern) 25%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
  .busy__bar {
    animation: busy-slide 1.4s ease-in-out infinite;
  }
}

@keyframes busy-slide {
  from {
    background-position: -40% 0, 0 0;
  }

  to {
    background-position: 140% 0, 0 0;
  }
}

.review__hands {
  margin-block: var(--space-4);
}

/* The hand in a row sits in the middle of it, not hanging below the text beside it. */
.review__offers .review__hand {
  vertical-align: middle;
  white-space: nowrap;
}

.review__none {
  color: var(--c-ink-muted);
  font-size: var(--text-s);
  margin: 0;
}

/* The developer's list of accounts: the reviewer's table, the hands on each row side by side, and
   under it the form that makes an account, its three boxes in a row where there is room. */
.roster__hands {
  gap: var(--space-2);
  /* The hands stay on one line and the table scrolls inside its frame on a narrow screen. Left to
     wrap, they stacked one to a line in a column a word wide and every row was a screen tall. */
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* The developer's settings: a form to a group, and in it a grid of settings, each a control with
   the lines that describe it underneath. As many across as there is room for, one on a phone. */
.settings__group,
.secrets__key,
.check__part {
  display: grid;
  /* One column that may shrink: left automatic, it was as wide as the longest sentence in it and a phone scrolled sideways. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding-block: var(--space-5);
  border-block-start: var(--border);

  & h2 {
    font-size: var(--text-l);
    margin: 0;
  }
}

.settings__rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: var(--space-5) var(--space-6);
  align-items: start;
  max-inline-size: 90rem;
}

.settings__row {
  display: grid;
  gap: var(--space-2);
  align-content: start;

  & .field {
    margin: 0;
  }

  /* A value somebody chose is marked; one that has gone wrong is marked louder. */
  &[data-source="set"] .settings__note {
    border-inline-start: 3px solid var(--c-pine);
    padding-inline-start: var(--space-3);
  }

  &[data-source="invalid"] .settings__note {
    border-inline-start: 3px solid var(--c-ember);
    padding-inline-start: var(--space-3);
  }
}

.settings__switch {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  min-block-size: 2.75rem;
  font-weight: 600;

  & input {
    inline-size: 1.4rem;
    block-size: 1.4rem;
    flex: none;
    accent-color: var(--c-pine);
  }
}

.settings__note {
  color: var(--c-ink-muted);
  font-size: var(--text-s);
  margin: 0;
  max-inline-size: var(--measure);
}

/* The keys: one to a block, the box for a new one beside the box for the code. */
.secrets__status {
  margin: 0;
  font-weight: 600;
}

.secrets__key[data-source="unreadable"] .secrets__status,
.secrets__key[data-source="invalid"] .secrets__status {
  color: var(--c-ember);
}

.secrets__form {
  display: grid;
  gap: var(--space-4);
  max-inline-size: 50rem;
}

.secrets__fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: var(--space-4);
  align-items: start;

  & .field {
    margin: 0;
  }
}

.secrets__try {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

/* The check: each line says what is so, and one that wants attention is marked. */
.check__part li[data-state="warn"] {
  border-inline-start: 3px solid var(--c-ember);
  padding-inline-start: var(--space-3);
}

/* A row's words sit level with the hands beside them, which are taller than a line of text, and a
   name is not broken at its hyphen to save width the table can scroll for. */
.roster .review__offers td {
  vertical-align: middle;
  white-space: nowrap;
}

.roster__add {
  display: grid;
  gap: var(--space-4);
  margin-block-start: var(--space-7);
  max-inline-size: 60rem;

  & h2 {
    font-size: var(--text-l);
    margin: 0;
  }
}

.roster__fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: var(--space-4);
  align-items: start;

  & .field {
    margin: 0;
    align-content: start;
  }
}

/* The log. A row of choices over a list of lines: when, how serious, the sentence, and under it
   the request it belongs to and the first line of what was thrown. One column on a phone. */
.log__filter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  gap: var(--space-4);
  align-items: end;
  padding-block: var(--space-4);
  border-block: var(--border);

  & .field {
    margin: 0;
    align-content: start;
  }

  /* A list, a date and a search box each have a height of their own in a browser; in one row they are one height. */
  & .input {
    block-size: 2.75rem;
  }
}

.log__lines {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.log__line {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1) var(--space-4);
  padding-block: var(--space-3);
  padding-inline-start: var(--space-3);
  border-block-end: var(--border);
  border-inline-start: 3px solid transparent;

  &[data-level="warn"] {
    border-inline-start-color: var(--c-lantern);
  }

  &[data-level="error"] {
    border-inline-start-color: var(--c-ember);
  }

  @media (min-width: 60rem) {
    /* The first column holds a whole date and time in the fixed-width face, with room after it. */
    grid-template-columns: 14rem 5.5rem minmax(0, 1fr);

    & .log__where,
    & .log__threw {
      grid-column: 3;
    }
  }
}

.log__when {
  white-space: nowrap;
}

.log__level {
  font-weight: 600;
}

.log__says {
  overflow-wrap: anywhere;
}

.log__where,
.log__threw {
  overflow-wrap: anywhere;

  /* A line with no request, or nothing thrown, has nothing to say here and takes no room. */
  &:empty {
    display: none;
  }
}

.log__entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);

  & h2 {
    font-size: var(--text-l);
    margin: 0;
  }
}

.log__sentence {
  margin: 0;
  padding-inline-start: var(--space-3);
  border-inline-start: 3px solid var(--c-contour);
  font-size: var(--text-l);
  overflow-wrap: anywhere;

  &[data-level="warn"] {
    border-inline-start-color: var(--c-lantern);
  }

  &[data-level="error"] {
    border-inline-start-color: var(--c-ember);
  }
}

.log__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: var(--space-3) var(--space-5);
  margin: 0;

  & dt {
    font-weight: 600;
  }

  & dd {
    margin: 0;
    overflow-wrap: anywhere;
  }
}

.log__stack {
  margin: 0;
  padding: var(--space-3);
  border: var(--border);
  max-block-size: 28rem;
  overflow: auto;
  font-size: var(--text-s);
  white-space: pre;
}

.check__prove {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding-block: var(--space-5);
  border-block-start: var(--border);

  & h2 {
    font-size: var(--text-l);
    margin: 0;
  }
}

/* The tariffs desk: a card to a tariff, its regions in a table that scrolls sideways sooner than it crushes its columns
   (the jobs were a table a word wide on a phone), prices waiting for a person above them all. */
.tariffs__fetch {
  margin-block: var(--space-4);
}

.tariffs__waiting,
.tariffs__card,
.tariffs__changes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  padding-block: var(--space-5);
  border-block-start: var(--border);

  & h2 {
    font-size: var(--text-l);
    margin: 0;
  }

  & p {
    margin: 0;
  }
}

.tariffs__supplier {
  font-weight: 400;
  color: var(--c-ink-muted);
}

.tariffs__holds {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.tariffs__hold {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--border);
  border-color: var(--c-lantern);
  border-radius: var(--radius-m);
  background: var(--c-paper);
}

.tariffs__fetched {
  font-size: var(--text-s);
  color: var(--c-ink-muted);

  &[data-state="warn"] {
    color: var(--c-ember);
    font-weight: 600;
  }
}

.tariffs__regions {
  min-inline-size: 74rem;

  /* The sentence is the widest thing in a row; given room, a row is two lines and not twelve. */
  & [data-tariff-from] {
    min-inline-size: 20rem;
  }

  & th[scope="row"] {
    font-family: inherit;
    font-size: inherit;
    letter-spacing: normal;
    text-transform: none;
    color: inherit;
    font-weight: 600;
    white-space: nowrap;
  }

  & td.data,
  & th[data-figures] {
    text-align: end;
    white-space: nowrap;
  }
}

.tariffs__hands {
  white-space: nowrap;

  & form {
    display: inline;
  }
}

.tariffs__correct {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  max-inline-size: 44rem;
}

.tariffs__boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  gap: var(--space-4);
  align-items: end;

  & .field {
    align-content: start;
  }
}

/* The jobs: a list, one job to a row on a wide screen and one to a card on a narrow one. Each fact carries its own
   label, so nothing depends on a heading a phone has no room for. As a table it was five columns a word wide. */
.jobs__list {
  list-style: none;
  margin: var(--space-5) 0;
  padding: 0;
  border-block-start: 1px solid var(--c-contour);
}

.jobs__job {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-block-end: 1px solid var(--c-contour);
  font-size: var(--text-s);

  & p {
    margin: 0;
  }
}

.jobs__name {
  margin: 0 0 var(--space-1);
  font-size: var(--text-m);
  font-weight: 600;
}

.jobs__fact {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
}

.jobs__label {
  font-family: var(--font-data);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
}

@media (min-width: 64rem) {
  .jobs__job {
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1.4fr) auto;
    gap: var(--space-5);
    align-items: start;
  }
}

/* Street groups. One page in several states; the script shows one. The street itself is a list of
   homes, as many across as there is room for, and prints as that list and nothing else. */
.street {
  padding-block: var(--space-6);
  display: grid;
  gap: var(--space-5);

  & h1 {
    font-size: var(--text-2xl);
  }

  & h2 {
    font-size: var(--text-xl);
    margin-block-end: var(--space-2);
  }
}

.street__state {
  display: grid;
  gap: var(--space-5);
}

.street__lede {
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
  text-wrap: pretty;
}

.street__groups,
.street__between-list,
.street__circle-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-2);
}

.street__groups a {
  font-weight: 600;
}

.street__panel {
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
}

.street__form {
  display: grid;
  gap: var(--space-4);
  max-inline-size: 44rem;
}

/* A track has a ceiling as well as a floor: one home on a wide screen is a card, not a banner. */
.street__between-list {
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 24rem));
  font-weight: 600;
}

.street__manage {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.street__aside {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 72rem) {
  .street__manage {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

.street__homes {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 24rem));
  /* Homes in a row are one height, the tallest's: a row of ragged boxes reads as a mistake. */
  align-items: stretch;
}

.street__home {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  justify-items: start;
  /* Stretched to its row, a home keeps what is in it at the top. */
  align-content: start;

  &[data-home-mine],
  &[data-example-mine="True"] {
    border-color: var(--c-pine);
    box-shadow: inset 0 0 0 1px var(--c-pine);
  }

  /* A house may have a name, and a name set in the figures' face reads as a code. */
  & .street__house .data {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
  }

  & .street__name {
    font-weight: 600;
  }

  & .street__you {
    color: var(--c-ink-muted);
    font-size: var(--text-s);
  }

  & .street__home-offers {
    margin: 0;
    padding-inline-start: var(--space-4);
  }
}

.street__circle,
.street__offers {
  display: grid;
  gap: var(--space-3);
  padding: 0;
  border: 0;

  & legend {
    padding: 0;
    font-weight: 600;
    font-size: var(--text-l);
  }
}

.street__circle-list {
  grid-template-columns: repeat(auto-fill, minmax(min(10rem, 100%), 1fr));

  & label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-block-size: 2.25rem;
  }
}

.street__offer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 14rem);
  gap: var(--space-3);
  align-items: center;

  & label {
    font-weight: 500;
  }
}

.street__offer-words {
  display: grid;
  gap: var(--space-1);
}

.street__invite {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
  margin-block-start: var(--space-4);
}

/* A code is always dark on white, whatever the theme: one inverted in the dark does not scan. */
.street__qr {
  padding: var(--space-2);
  background: #fff;
  border-radius: var(--radius-s);
}

@media (max-width: 40rem) {
  .street__offer,
  .street__invite {
    grid-template-columns: minmax(0, 1fr);
  }

  .street__qr {
    max-inline-size: 12rem;
  }
}

/* How a group goes, for somebody deciding whether to begin: three steps side by side where there is room. */
.street__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  counter-reset: step;

  & > li {
    counter-increment: step;
    padding: var(--space-5);
    border: var(--border);
    border-radius: var(--radius-m);
    background: var(--c-paper);
  }

  & > li::before {
    content: counter(step);
    font-family: var(--font-data);
    font-weight: 600;
    color: var(--c-pine);
  }

  & h2 {
    font-size: var(--text-l);
    margin-block: var(--space-2);
  }

  & p {
    color: var(--c-ink-muted);
    text-wrap: pretty;
  }
}

/* The one next step: said plainly, with its button where it has one. */
.street__next {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
  max-inline-size: var(--measure);
}

.street__gaps {
  margin-block-start: var(--space-3);
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
}

/* Without a connection the street is something to read and to print: nothing that would change it is drawn. */
.street[data-street-offline] :is(.street__manage, .street__next, [data-invite-slot]) {
  display: none;
}

/* The slips are only ever paper. */
.street__slips {
  display: none;
}

/* On paper: the street and what it has between it, and nothing that is a control or the site's own furniture. */
@media print {
  body:has(.street) :is(.site-header, .site-footer, .foot-notes) {
    display: none !important;
  }

  .street__screen,
  .street .eyebrow,
  .street__says {
    display: none !important;
  }

  .street__home {
    break-inside: avoid;
  }

  /* When slips were asked for, they are the whole sheet: four to a page, with room to cut between them. */
  .street[data-print="slips"] > :not(.street__slips) {
    display: none !important;
  }

  .street[data-print="slips"] .street__slips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .street__slip {
    display: grid;
    gap: 0.5rem;
    align-content: start;
    padding: 1.25rem;
    border: 1px dashed #777;
    break-inside: avoid;
    font-size: 0.8rem;
    color: #000;
  }

  .street__slip-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
  }

  .street__slip-from {
    font-weight: 600;
  }

  .street__slip-code {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.75rem;
    align-items: center;
    font-weight: 600;
  }

  .street__slip-foot {
    font-size: 0.7rem;
  }
}

/* The landing page's case for a street: the reasons on one side, a street as one of its homes sees it on the other. */
.streets {
  margin-block-start: var(--space-8);
  display: grid;
  gap: var(--space-6);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;

  & h2 {
    font-size: var(--text-2xl);
    text-wrap: balance;
  }
}

/* In one column the copy's parts are the section's own, so the example can stand between the scene and the reasons:
   it is the picture of what the scene describes, and after the buttons it would be an afterthought. */
.streets__copy {
  display: contents;
}

.streets__points,
.streets__actions,
.streets__note {
  order: 2;
}

.streets__lede {
  max-inline-size: var(--measure);
  font-size: var(--text-l);
  text-wrap: pretty;
}

.streets__points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1fr);

  & h3 {
    font-size: var(--text-l);
  }

  & p {
    margin-block-start: var(--space-1);
    color: var(--c-ink-muted);
    text-wrap: pretty;
  }
}

/* Four reasons are two rows of two, never three and one left over. */
@media (min-width: 40rem) {
  .streets__points {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
  }
}

.streets__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.streets__note {
  color: var(--c-ink-muted);
  font-size: var(--text-s);
  max-inline-size: var(--measure);
}

.streets__example {
  order: 1;
  margin: 0;
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-pine-tint);

  & figcaption {
    margin-block-start: var(--space-3);
    color: var(--c-ink-muted);
    font-size: var(--text-s);
    text-wrap: pretty;
  }
}

/* The example is a picture, so all four of its homes are one size, not only the two that share a row. A real street
   is not: one home with nine offers would stretch every other. */
.streets__homes {
  grid-auto-rows: 1fr;
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
}

@media (min-width: 72rem) {
  .streets {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--space-7);
  }

  .streets__copy {
    display: grid;
    gap: var(--space-4);
  }

  .streets__example,
  .streets__points,
  .streets__actions,
  .streets__note {
    order: 0;
  }
}

/* The plan's way to the street: the case on one side, what this home could offer and the button on the other. */
.street-card {
  margin-block-start: var(--space-5);
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  display: grid;
  gap: var(--space-4) var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  align-items: start;

  & h3 {
    font-size: var(--text-xl);
    margin-block: var(--space-1) var(--space-2);
  }
}

.street-card__copy p:not(.eyebrow) {
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
  text-wrap: pretty;
}

.street-card__could {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
}

.street-card__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);

  & li {
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
    background: var(--c-pine-tint);
    font-weight: 600;
    font-size: var(--text-s);
  }
}

/* The assumptions desk. It is laid out as the board is, a heading for each need and a card for each
   thing that meets it, so somebody who knows stairlifts and not software finds the stairlift where a
   household would. A figure is a line: its name, its value in the instrument face, and a box that
   opens under it. Read on a desk, and it still folds to one column on a phone. */
.desk__state {
  max-inline-size: none;
}

.desk__bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
  justify-content: space-between;
  border-block-end: var(--border);
  margin-block-end: var(--space-5);
}

.desk__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.desk__tab {
  display: inline-flex;
  align-items: center;
  min-block-size: 2.75rem;
  padding: var(--space-2) var(--space-4);
  border-block-end: 4px solid transparent;
  margin-block-end: -2px;
  color: var(--c-ink-muted);
  font-weight: 600;
  text-decoration: none;

  &:hover {
    color: var(--c-ink);
  }

  &[aria-current="page"] {
    color: var(--c-ink);
    border-block-end-color: var(--c-pine);
  }
}

.desk__search {
  display: grid;
  grid-template-columns: minmax(0, 18rem) auto;
  gap: var(--space-1) var(--space-2);
  align-items: center;
  padding-block-end: var(--space-3);

  & label {
    grid-column: 1 / -1;
    font-size: var(--text-s);
    font-weight: 600;
  }
}

.desk__lede {
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
  margin-block-end: var(--space-5);
}

.desk__group {
  padding-block: var(--space-5);
  border-block-start: var(--border);

  & > h2 {
    font-size: var(--text-xl);
    margin-block-end: var(--space-3);
    text-wrap: balance;
  }
}

/* On a desk the sheet is a ledger: the need down the side, where it stays while its cards go past,
   and the cards across. The cards share the line between them, and a card lays its figures as many
   across as it has room for, so a need with one card fills its line as well as a need with five. */
@media (min-width: 60rem) {
  .desk__group {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: var(--space-5);
    align-items: start;

    & > h2 {
      position: sticky;
      inset-block-start: calc(var(--header-height) + var(--space-3));
      margin: 0;
    }
  }
}

.desk__cards {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(28rem, 100%), 1fr));
  align-items: start;
}

.figure-card {
  padding: var(--space-4);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & h3 {
    font-size: var(--text-l);
    margin: 0;
  }

  & .figure-card__says {
    margin-block-start: var(--space-1);
    color: var(--c-ink-muted);
    text-wrap: pretty;
  }

  & .figure-card__drafted {
    margin-block-start: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-inline-start: 4px solid var(--c-lantern);
    background: var(--c-lantern-tint);
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
  }

  & .figure-card__mark {
    font-family: var(--font-data);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-inline-end: var(--space-2);
  }
}

.figure-card__rows {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr));
  /* A figure whose box is open grows; the figures beside it keep their own height. */
  align-items: start;

  /* A card with no heading of its own starts at its first figure. */
  &:first-child {
    margin: 0;
  }
}

.desk-figure {
  padding: var(--space-3);
  border-radius: var(--radius-s);
  background: var(--c-ground);
  /* A correction comes back to its figure by the address; the header must not sit over it. */
  scroll-margin-block-start: calc(var(--header-height) + var(--space-4));

  &:target {
    outline: var(--focus-ring);
    outline-offset: 2px;
  }

  & .desk-figure__line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-3);
    align-items: baseline;
  }

  & .desk-figure__name {
    font-weight: 600;
    text-wrap: pretty;
  }

  & .desk-figure__value {
    text-align: end;

    & .data {
      font-size: var(--text-l);
      font-weight: 600;
    }
  }

  & .desk-figure__unit {
    display: block;
    color: var(--c-ink-muted);
    font-size: var(--text-s);
  }

  &[data-state="drafted"] .desk-figure__value .data {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: var(--c-lantern);
  }
}

.desk-figure__chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
}

.desk-figure__chip {
  margin-block-start: var(--space-2);
  padding: 0 var(--space-2);
  border: 1px solid var(--c-contour);
  border-radius: 999px;
  font-size: var(--text-s);

  &[data-chip="corrected"] {
    border-color: var(--c-pine);
    background: var(--c-pine-tint);
  }

  &[data-chip="drafted"] {
    border-color: var(--c-lantern);
    background: var(--c-lantern-tint);
  }
}

.desk-figure__edit {
  margin-block-start: var(--space-2);

  & summary {
    display: inline-block;
    padding-block: var(--space-1);
    color: var(--c-pine);
    font-size: var(--text-s);
    font-weight: 600;
    cursor: pointer;
  }
}

.desk-figure__form {
  display: grid;
  gap: var(--space-3);
  margin-block-start: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--c-contour);
  border-radius: var(--radius-s);
  background: var(--c-paper);

  & .desk-figure__facts {
    color: var(--c-ink-muted);
    font-size: var(--text-s);
  }
}

/* Where there is no switch, a quiet line in its place says why. */
.desk-figure__fixed {
  margin-block-start: var(--space-1);
  color: var(--c-ink-muted);
  font-size: var(--text-s);
}

/* The second line under a figure: whether a household may give its own, which opens the box that changes it.
   A figure a household may give carries the lantern's mark down the line, so the ones that are on can be picked out down a card. */
.desk-figure__edit[data-ask] {
  margin-block-start: 0;

  &[data-ask-allowed="true"] > summary {
    padding-inline-start: var(--space-2);
    border-inline-start: 4px solid var(--c-lantern);
  }
}

.desk-figure__choice {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  padding: 0;
  border: 0;

  & legend {
    padding: 0;
    margin-block-end: var(--space-1);
    font-weight: 600;
  }

  & label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-block-size: 2.25rem;
  }
}

/* The draft, a list of changes, and the published sets: each a quiet panel with the account of itself. */
.desk__drafts,
.desk__sets {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-6);
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(28rem, 100%), 1fr));
  align-items: start;
}

.desk__draft,
.desk__set {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & h2,
  & h3 {
    font-size: var(--text-l);
    margin: 0;
  }
}

.desk__set[data-state="in-force"] {
  border-color: var(--c-pine);
}

.desk__account {
  display: grid;
  gap: var(--space-1);
  margin: 0;

  & div {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: var(--space-2);
  }

  & dt {
    color: var(--c-ink-muted);
    font-size: var(--text-s);
  }

  & dd {
    margin: 0;
    overflow-wrap: anywhere;
  }
}

.desk__by,
.desk__note:not(:empty) {
  color: var(--c-ink-muted);
  font-size: var(--text-s);
}

.desk__note {
  overflow-wrap: anywhere;

  &:empty {
    display: none;
  }
}

.desk__preview,
.desk__changes {
  margin-block-end: var(--space-6);

  & > h2 {
    font-size: var(--text-xl);
    margin-block-end: var(--space-2);
  }
}

.desk__publish,
.desk__restore {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
  max-inline-size: 36rem;
  margin-block-start: var(--space-4);

  & .field {
    inline-size: 100%;
  }
}

/* The legal pages. A column of prose at its reading measure is right for the prose and wrong for
   the page: on a wide screen it sat alone against the left edge. The measure stays, because it is
   what makes a long legal text readable, and the room either side is given to the two things a
   reader actually wants from a page like this: where the sections are, and what it says in plain
   words. Both rails stick while the prose scrolls past them. */
.legal-page {
  display: grid;
  gap: var(--space-6);
  align-items: start;
}

.legal__head {
  & h1 {
    font-size: var(--text-2xl);
    text-wrap: balance;
  }
}

.legal__lede {
  margin-block-start: var(--space-3);
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
  font-size: var(--text-l);
  text-wrap: pretty;
}

/* On a phone the contents fold away above the prose and the plain version follows it, so the
   reading order is contents, text, summary rather than three columns of nothing. */
.legal__contents {
  font-size: var(--text-s);

  & ol {
    margin: var(--space-3) 0 0;
    padding-inline-start: 1.2em;
    display: grid;
    gap: var(--space-2);
  }
}

.legal__contents-heading {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--c-ink);
  margin: 0;
}

.legal__reviewed {
  margin-block-start: var(--space-4);
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-s);
}

.legal__aside-heading {
  font-size: var(--text-l);
  margin: 0;
}

.legal__aside-note {
  margin-block-start: var(--space-4);
  color: var(--c-ink-muted);
  font-size: var(--text-s);
  text-wrap: pretty;
}

.promises {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
  display: grid;
  gap: var(--space-3);
}

.promise {
  padding: var(--space-4);
  border: var(--border);
  border-inline-start: 4px solid var(--c-pine);
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
  background: var(--c-paper);

  & h3 {
    font-size: var(--text-m);
    margin: 0;
  }

  & p {
    margin-block-start: var(--space-2);
    color: var(--c-ink-muted);
    font-size: var(--text-s);
    text-wrap: pretty;
  }
}

/* A long table of upstreams is the one thing here wider than the measure. */
.legal__scroll {
  overflow-x: auto;
  margin-block-start: var(--space-4);
}

@media (min-width: 64rem) {
  .legal-page {
    grid-template-columns: minmax(11rem, 15rem) minmax(0, var(--measure)) minmax(13rem, 21rem);
    column-gap: var(--space-7);
    justify-content: center;
  }

  .legal__head {
    grid-column: 1 / -1;
  }

  .legal__contents,
  .legal__aside {
    position: sticky;
    inset-block-start: calc(var(--header-height) + var(--space-4));
  }

  .legal__contents {
    grid-column: 1;
    grid-row: 2;
    border-inline-end: var(--border);
    padding-inline-end: var(--space-5);
  }

  .legal {
    grid-column: 2;
    grid-row: 2;
  }

  .legal__aside {
    grid-column: 3;
    grid-row: 2;
  }
}

/* The questions section's own column: the heading, why the section is here, and a way to ask one
   that is not on the list. It used to be a heading alone, which left a third of a wide row empty. */
.faq__lede {
  margin-block-start: var(--space-3);
  color: var(--c-ink-muted);
  text-wrap: pretty;
}

.faq__ask {
  margin-block-start: var(--space-5);
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  display: grid;
  gap: var(--space-3);
  justify-items: start;

  & h3 {
    font-size: var(--text-l);
    margin: 0;
  }

  & p {
    margin: 0;
    color: var(--c-ink-muted);
    font-size: var(--text-s);
    text-wrap: pretty;
  }

  & .button {
    font-family: var(--font-data);
    font-size: var(--text-s);
  }
}

/* The enrolment code. Always on white with a quiet border, whatever the theme: a reader expects
   dark modules on a light ground, and a code inverted in the dark does not scan. */
.enrol__qr {
  margin-block: var(--space-4);
  inline-size: min(100%, 15rem);
  padding: var(--space-3);
  border: var(--border);
  border-radius: var(--radius-m);
  background: #fff;

  & svg {
    display: block;
    inline-size: 100%;
    block-size: auto;
  }
}
}
