@layer components {
/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 2.75rem;
  padding: var(--space-2) var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  color: var(--c-ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-quick), border-color var(--duration-quick);

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

  &.button--primary {
    background: var(--c-pine);
    border-color: var(--c-pine);
    /* In the dark the pine is lighter, so the label is dark on it rather than white. */
    color: light-dark(oklch(100% 0 0), oklch(18% 0.03 230));

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

  &.button--quiet {
    border-color: transparent;
    background: transparent;
    color: var(--c-pine);
  }
}

.theme-toggle {
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border: var(--border);
  border-radius: 50%;
  background: var(--c-paper);
  cursor: pointer;
}

/* Eyebrow: a small label that says what kind of thing follows */
.eyebrow {
  font-family: var(--font-data);
  font-size: var(--text-s);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
}

/* Hero with the Days Ready figure. The layout of each hero lives in pages.css. */
.hero {
  position: relative;
  isolation: isolate;

  & h1 {
    font-size: var(--text-xl);
    font-weight: 500;
    color: var(--c-ink-muted);
    text-wrap: balance;
  }

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

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

/* The contour band: the hill the house stands on, drawn as rings spaced by its elevation */
.contour-band {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  --elev: attr(data-elevation type(<number>), 0);
  --ring: calc(0.8rem + (1 - min(var(--elev), 300) / 300) * 1.3rem);
  background-image:
    repeating-radial-gradient(ellipse 64% 50% at 60% 44%, transparent 0 calc(var(--ring) - 1.5px), var(--c-contour) calc(var(--ring) - 1.5px) var(--ring)),
    repeating-radial-gradient(ellipse 42% 64% at 16% 82%, transparent 0 calc(var(--ring) * 1.35 - 1.5px), color-mix(in oklab, var(--c-contour) 55%, transparent) calc(var(--ring) * 1.35 - 1.5px) calc(var(--ring) * 1.35));
}

/* A hand in a dense table or beside a heading: the same button, sized to sit in a row of text. */
.button--small {
  min-block-size: 2.25rem;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-s);
}

.button--lantern {
  background: var(--c-lantern);
  border-color: var(--c-lantern);
  color: oklch(18% 0.03 230);

  &:hover {
    background: color-mix(in oklab, var(--c-lantern) 88%, white);
    border-color: color-mix(in oklab, var(--c-lantern) 88%, white);
  }
}

/* Days Ready: the signature figure. Lantern is allowed to shout here and nowhere else. */
days-ready,
.days-ready {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  --days: attr(value type(<number>), 0);
}

/* The figure as the mockup drew it: light, condensed, and as big as the column allows. */
.days-ready__figure {
  font-size: var(--text-display);
  font-weight: 300;
  font-stretch: 75%;
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--c-lantern-ink);
}

.days-ready__unit {
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--c-ink-muted);
}

@media (prefers-reduced-motion: no-preference) {
  days-ready[data-revealed] .days-ready__figure {
    animation: lift var(--duration-reveal) var(--ease-out);
  }
}

@keyframes lift {
  from {
    opacity: 0;
    translate: 0 0.2em;
  }
}

/* Progress: flat lantern bar, never a ring */
progress.tier-progress {
  inline-size: 100%;
  block-size: 0.75rem;
  appearance: none;
  border: none;
  border-radius: var(--radius-s);
  background: var(--c-contour);
  overflow: hidden;

  &::-webkit-progress-bar {
    background: var(--c-contour);
  }

  &::-webkit-progress-value {
    background: var(--c-lantern);
  }

  &::-moz-progress-bar {
    background: var(--c-lantern);
  }
}

/* The plan sheet */
.sheet {
  container-type: inline-size;
  background: var(--c-paper);
  border: var(--border);
  border-radius: var(--radius-m);
  padding: var(--space-5);
}

.sheet__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
  padding-block-end: var(--space-4);
  border-block-end: var(--border);

  & h3 {
    flex: 1;
  }
}

.sheet__index {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--c-lantern-ink);
}

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

/* An action: its mark, what it is and why, what it costs, and the household's choice about it.
   Everything hangs off one grid on the row, so the choice, the board's line and the picks all start
   under the title. */
.action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "mark title price"
    "mark why price"
    ". choice choice";
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  align-items: start;

  & + & {
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--c-contour);
  }

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

  & > .action__title {
    grid-area: title;
    font-weight: 600;
  }

  & > .action__why {
    grid-area: why;
    color: var(--c-ink-muted);
    font-size: var(--text-s);
  }

  /* The official service an action is done at, after its sentence: a link that reads as one. */
  & .action__official {
    font-weight: 600;
  }

  & > .action__cost {
    grid-area: price;
  }

  & > .choice {
    grid-area: choice;
    margin-block-start: var(--space-2);
  }

  & > .action__turns,
  & > .picks {
    grid-column: 2 / -1;
  }

  /* Have it: done, and said so the way the page always has. */
  &:has([data-choice="have"]:checked) > .action__title {
    color: var(--c-pine);
    text-decoration: line-through;
    text-decoration-color: var(--c-contour);
  }

  /* Not for me: the row stays where it was, down to its name and its choice, so it is out of the
     way and one press from coming back. */
  &:has([data-choice="skip"]:checked) {
    & > .action__title {
      font-weight: 500;
      color: var(--c-ink-muted);
    }

    & > .action__why,
    & > .action__cost,
    & > .action__turns,
    & > .picks {
      display: none;
    }
  }
}

@container (max-width: 28rem) {
  .action {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "mark title"
      "mark why"
      "mark price"
      "choice choice";
  }
}

/* The choice: three pills, one at most pressed. Each is a tick box that fills its pill, so the whole
   pill is the target and the keyboard and a screen reader meet an ordinary control. */
.choice {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.choice__pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 2.25rem;
  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;

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

  &:has(.choice__input:focus-visible) {
    outline: var(--focus-ring);
    outline-offset: 2px;
  }

  /* The pressed pill carries a tick as well as a colour, so the state never rests on colour alone. */
  &:has(.choice__input:checked)::before {
    content: "";
    inline-size: 0.35rem;
    block-size: 0.65rem;
    margin-block-end: 0.15rem;
    border-inline-end: 2px solid currentcolor;
    border-block-end: 2px solid currentcolor;
    rotate: 45deg;
  }

  &:has(.choice__input:checked) {
    font-weight: 600;
  }

  &[data-choice-pill="have"]:has(.choice__input:checked) {
    background: var(--c-pine-tint);
    border-color: var(--c-pine);
  }

  /* Some of it, short of what the plan asks: half the mark and half the colour, and the words say so. */
  &[data-part] {
    font-weight: 600;
    border-color: var(--c-pine);
    background: color-mix(in oklab, var(--c-pine-tint) 45%, var(--c-paper));
  }

  &[data-part]::before {
    content: "";
    inline-size: 0.7rem;
    block-size: 0.7rem;
    border: 2px solid currentcolor;
    border-radius: 50%;
    background: linear-gradient(to right, currentcolor 50%, transparent 50%);
  }

  &[data-choice-pill="plan"]:has(.choice__input:checked) {
    background: var(--c-lantern-tint);
    border-color: var(--c-lantern);
  }

  &[data-choice-pill="skip"]:has(.choice__input:checked) {
    background: var(--c-ground);
    border-color: var(--c-ink-muted);
  }
}

.choice__input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* The household's own figure for an action's stock: a short question, a number and what it counts,
   under the choice. Out of sight until the action is held or a figure has been given. */
.amount {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-block-start: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-s);
  background: var(--c-ground);
  font-size: var(--text-s);

  &[hidden] {
    display: none;
  }

  & label {
    font-weight: 600;
  }

  /* Wide enough for four figures; the three classes outrank the short input rule further down this sheet. */
  & .input.input--short {
    inline-size: 6rem;
  }

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

.action__progress {
  grid-column: 2 / -1;
  font-size: var(--text-s);
  font-weight: 600;
  color: var(--c-pine);
}

.action:has([data-choice="skip"]:checked) > .amount,
.action:has([data-choice="skip"]:checked) > .action__progress {
  display: none;
}

/* What the plan assumes: the figures it had to choose for itself, each open to the household's own. */
.assumptions {
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

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

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

  /* One line until it is opened, so a new plan is not met with a row of boxes. */
  & .assumptions__own {
    margin-block-start: var(--space-4);

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

  /* Every figure is the same tile, as many across as there is room for. A tile is three rows, the
     question, the box and what it comes to, and the rows are the grid's own, so the boxes line up
     along a row of tiles whether a question takes one line or two. */
  & .assumptions__grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
    margin-block-start: var(--space-4);
  }

  & .assumptions__item {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
    gap: var(--space-2);
    padding: var(--space-4);
    border-inline-start: 4px solid transparent;
    border-radius: var(--radius-s);
    background: var(--c-ground);

    & label {
      font-weight: 600;
      text-wrap: balance;
    }

    & .field__hint {
      text-wrap: pretty;
    }

    /* A figure of the household's own is marked down its side, as a drafted figure is on the desk. */
    &[data-own-state="own"],
    &[data-own-state="declined"] {
      border-inline-start-color: var(--c-lantern);
    }
  }

  & .assumptions__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-self: start;
    gap: var(--space-2) var(--space-3);

    & .input.input--short {
      inline-size: 6rem;
    }

    /* The way back to the plan's figure sits under the box in every tile, not beside it in some and under it in others. */
    & .tally__button {
      flex-basis: 100%;
      justify-self: start;
      text-align: start;
    }
  }

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

/* The tally: how many of a stretch, or of the whole plan, the household has, plans, has not decided
   and has ruled out, with what the planned and the undecided would cost and a way to clear each. */
.tally {
  margin-block-start: var(--space-4);
}

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

.tally__item {
  /* Stacked where the tile is narrow: a long button beside a label squeezed the label to a letter a
     line on a phone. Wider, the label and its button share the first line (below). */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "label"
    "figure"
    "button";
  align-content: start;
  justify-items: start;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) var(--space-3);

  & > .tally__label {
    grid-area: label;
  }

  & > .tally__figure {
    grid-area: figure;
  }

  & > .tally__button {
    grid-area: button;
  }
  border-radius: var(--radius-s);
  background: var(--c-ground);
  border-inline-start: 4px solid var(--c-contour);

  &[data-tally-kind="have"] {
    border-inline-start-color: var(--c-pine);
  }

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

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

  & .tally__figure {
    font-weight: 600;
  }
}

.tally__button {
  min-block-size: 1.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-pine);
  font-size: var(--text-s);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;

  &[aria-disabled="true"] {
    color: var(--c-ink-muted);
    text-decoration: none;
    cursor: default;
  }
}

/* With room, the label and its button share the first line and the figure has the second to itself,
   so a tile is two lines tall however long the sum is. */
@container (min-width: 30rem) {
  .tally__item {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label button"
      "figure figure";
  }
}

/* Four tiles go four across where there is room and two by two where there is not, never three and
   an orphan, which is what fitting as many as will go gives at some widths. The nearest container
   is the stretch for a stretch's tally and the page for the plan's. */
@container (min-width: 52rem) {
  .tally__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tally__standing {
  margin-block-start: var(--space-3);

  &:empty {
    display: none;
  }
}

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

  & .tally {
    margin-block-start: var(--space-3);
  }
}

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

/* What a button beside a tally just did, with the way back. It sits at the foot of the window so it
   is in reach wherever the press was made, and it waits: nothing here is on a timer. */
.undo {
  position: fixed;
  inset-block-end: var(--space-4);
  inset-inline: var(--gutter);
  z-index: 30;
  inline-size: fit-content;
  max-inline-size: calc(100% - 2 * var(--gutter));
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--c-lantern);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  box-shadow: 0 0.25rem 1.5rem oklch(20% 0.03 230 / 0.25);

  &[hidden] {
    display: none;
  }
}

/* Data: measurements line up and read as instrument output */
.data {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

/* Callouts */
.callout {
  padding: var(--space-3) var(--space-4);
  border-inline-start: 4px solid var(--c-pine);
  background: var(--c-pine-tint);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;

  &.callout--warning {
    border-inline-start-color: var(--c-ember);
    background: var(--c-ember-tint);
  }
}

/* Notice page (errors) */
.notice {
  max-inline-size: var(--measure);
  padding-block: var(--space-7);
}

/* Native dialog */
.dialog {
  /* The reset takes every margin off, and a modal dialog is centred by its automatic margins. */
  margin: auto;
  inline-size: min(90vw, 28rem);
  border: var(--border);
  border-radius: var(--radius-m);
  padding: var(--space-5);
  background: var(--c-paper);
  color: var(--c-ink);

  &::backdrop {
    background: oklch(20% 0.02 230 / 0.5);
  }
}

/* The panel behind the header chip: one row for each place a plan can be kept, each a heading and a sentence. */
.keep {
  & h2 {
    font-size: var(--text-l);
  }
}

.keep__row {
  margin-block: var(--space-4);
  padding: var(--space-4);
  border: var(--border);
  border-radius: var(--radius-m);
  display: grid;
  gap: var(--space-2);

  & h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-m);
  }

  & .mark-icon {
    inline-size: 1.25rem;
    block-size: 1.25rem;
    flex: none;
  }
}

/* The row the plan is kept in now: a heavier edge, a tint and the words "Kept here", so it does not rest on colour alone. */
.keep__row[aria-current="true"] {
  border-color: var(--c-pine);
  box-shadow: inset 0 0 0 1px var(--c-pine);
  background: var(--c-pine-tint);
}

.keep__here {
  margin-inline-start: auto;
  padding: 0.1rem var(--space-2);
  border-radius: 999px;
  background: var(--c-pine);
  color: var(--c-paper);
  font-size: var(--text-xs, 0.75rem);
  font-weight: 700;
  white-space: nowrap;
}

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

/* The address of a signed-in household: it may be long, and it must never widen the panel or the header. */
.keep__who {
  overflow-wrap: anywhere;
}

/* The quiet line under the rows. */
.keep__already {
  margin-block: var(--space-3);
  font-size: var(--text-s);
}

/* What the account says, when it says anything: strips along the foot of the screen that take no room from the page.
   Sync's goes by itself and a press passes through it; the passkey offer asks something and waits. */
.foot-notes {
  position: fixed;
  inset-block-end: max(var(--space-4), env(safe-area-inset-bottom));
  inset-inline: var(--space-4);
  z-index: 30;
  display: grid;
  gap: var(--space-2);
  justify-items: center;
  pointer-events: none;
}

.foot-note {
  inline-size: fit-content;
  max-inline-size: min(34rem, 100%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: var(--border);
  border-inline-start: 4px solid var(--c-pine);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  color: var(--c-ink);
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 25%);
  font-size: var(--text-s);

  & p {
    flex: 1 1 14rem;
    font-weight: 600;
  }

  & button {
    pointer-events: auto;
  }
}

.foot-note--asks {
  border-inline-start-color: var(--c-lantern);
  pointer-events: auto;

  & p {
    flex-basis: 100%;
    font-weight: 400;
  }
}

/* The passkeys an account has, in its row of the panel. */
.keep__passkeys {
  padding-block-start: var(--space-3);
  border-block-start: var(--border);

  & h4 {
    font-size: var(--text-s);
  }
}

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

  & li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    font-size: var(--text-s);
  }
}

/* The two summaries in the choice sit apart, each a plan in its own right. */
[data-sync-choice] .receive__summary {
  margin-block: var(--space-3);
}

/* One state of a row: the same grid as the row, because a grid's gap reaches its own children only. */
.keep__part {
  display: grid;
  gap: var(--space-2);
}

/* The code for the other device's camera. Dark on white in both themes: one inverted in the dark does not scan. */
.keep__code {
  inline-size: min(100%, 15rem);
  aspect-ratio: 1;
  margin-inline: auto;
  border-radius: var(--radius-s);
  background: #fff;
  overflow: hidden;

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

.keep__says {
  font-size: var(--text-s);
  font-weight: 600;
}

/* The page a copy arrives on: one state at a time, each a heading, what arrived and a way on. */
.receive__state {
  display: grid;
  gap: var(--space-4);
  justify-items: start;

  & h1:focus {
    outline: none;
  }
}

.receive__summary {
  padding: var(--space-3) var(--space-4);
  border-inline-start: 4px solid var(--c-lantern);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  background: var(--c-lantern-tint);
  font-weight: 600;
}

/* Under a start button: the thing a visitor expects to be asked for and is not, then what an account would be for. */
.start-note {
  font-size: var(--text-s);
  max-inline-size: 34rem;
  text-wrap: pretty;

  & a {
    color: inherit;
    font-weight: 600;
  }
}

.start-note--account {
  opacity: 0.9;
}

/* Where a plan is kept: the same three rows as the panel, as cards. */
.ways {
  margin-block-start: var(--space-8);

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

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

.ways__grid {
  margin-block-start: var(--space-5);
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  list-style: none;
  padding: 0;
}

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

  /* The first is where everybody starts. */
  &:first-child {
    border-color: var(--c-pine);
    box-shadow: inset 0 0 0 1px var(--c-pine);
  }

  & h3 {
    margin-block-start: var(--space-3);
    font-size: var(--text-l);
  }

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

.ways__mark {
  inline-size: 2rem;
  block-size: 2rem;
  color: var(--c-pine);
}

.ways__promise {
  margin-block-start: var(--space-5);
  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);
}

/* Under the figure, once: the plan is saved here and no account is needed. */
.kept-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  font-size: var(--text-s);

  &[hidden] {
    display: none;
  }

  & .mark-icon {
    inline-size: 1.25rem;
    block-size: 1.25rem;
    flex: none;
  }
}

/* Styleguide-only */
.swatches {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-3);
}

.swatch {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--c-paper);
  border: var(--border);
  border-radius: var(--radius-s);
}

/* No inline style attributes anywhere (CSP forbids them), so each token maps to a selector. */
.swatch[data-token="--c-slate"] { --swatch: var(--c-slate); }
.swatch[data-token="--c-sky"] { --swatch: var(--c-sky); }
.swatch[data-token="--c-pine"] { --swatch: var(--c-pine); }
.swatch[data-token="--c-lantern"] { --swatch: var(--c-lantern); }
.swatch[data-token="--c-lantern-ink"] { --swatch: var(--c-lantern-ink); }
.swatch[data-token="--c-contour"] { --swatch: var(--c-contour); }
.swatch[data-token="--c-ember"] { --swatch: var(--c-ember); }
.swatch[data-token="--c-paper"] { --swatch: var(--c-paper); }

.swatch__chip {
  block-size: 3rem;
  border-radius: var(--radius-s);
  background: var(--swatch, transparent);
  border: 1px solid var(--c-contour);
}

.display {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 700;
  line-height: 1;
  color: var(--c-lantern-ink);
}

.styleguide > section {
  margin-block-start: var(--space-7);
}

/* Forms */
.plan-form {
  display: grid;
  gap: var(--space-6);
  max-inline-size: var(--measure);
}

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

  & legend {
    font-family: var(--font-display);
    font-weight: 600;
    padding-inline: var(--space-2);
  }
}

.field {
  display: grid;
  gap: var(--space-1);
  /* Rows keep their own height. A field beside a taller neighbour is stretched to the row, and
     without this its rows stretched too, so a number box grew to several times its height. */
  align-content: start;

  & label {
    font-weight: 600;
  }

  &.field--check {
    grid-template-columns: auto 1fr;
    align-items: start;
    column-gap: var(--space-3);

    & input {
      inline-size: 1.5rem;
      block-size: 1.5rem;
      margin-block-start: 0.15rem;
    }

    & label {
      font-weight: 500;
    }
  }
}

.input {
  min-block-size: 2.75rem;
  padding: var(--space-2) var(--space-3);
  border: var(--border);
  border-radius: var(--radius-s);
  background: var(--c-paper);
  color: var(--c-ink);
  inline-size: 100%;

  &.input--short {
    inline-size: min(100%, 12rem);
  }

  &:user-invalid,
  &.input-validation-error {
    border-color: var(--c-ember);
  }
}

.field__error {
  color: var(--c-ember);
  font-size: var(--text-s);

  &:empty {
    display: none;
  }
}

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

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

/* Risks */
.risks {
  margin-block-start: var(--space-7);
}

.risk-list {
  list-style: none;
  padding: 0;
  margin-block-start: var(--space-4);
  display: grid;
  gap: var(--space-3);
  counter-reset: risk;
}

.risk {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "n kind"
    "n rating"
    "n why";
  column-gap: var(--space-3);
  padding: var(--space-4);
  background: var(--c-paper);
  border: var(--border);
  border-radius: var(--radius-m);
  counter-increment: risk;

  &::before {
    content: counter(risk);
    grid-area: n;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--c-lantern-ink);
  }

  & .risk__kind {
    grid-area: kind;
    font-weight: 600;
  }

  & .risk__rating {
    grid-area: rating;
    font-size: var(--text-s);
    color: var(--c-ink-muted);
  }

  & .risk__why {
    grid-area: why;
    margin-block-start: var(--space-2);
    color: var(--c-ink-muted);
  }
}

/* Plan */
.plan {
  margin-block-start: var(--space-7);
  display: grid;
  gap: var(--space-5);
}

/* The total of the four stretches, at their foot and to the right, where the total of a column of
   figures goes. It is a cell of the same paper and border as the stretches it adds up, and no rules:
   ruled above and double-ruled below was tried and read as fussy. */
.plan__total {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
  inline-size: fit-content;
  max-inline-size: 100%;
  margin-inline-start: auto;
  padding: var(--space-3) var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & .plan__total-label {
    color: var(--c-ink-muted);
    font-weight: 600;
  }

  & .plan__total-figure {
    font-size: var(--text-xl);
    font-weight: 600;
  }
}

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

.sheet > .tier-progress {
  margin-block-start: var(--space-4);
}

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

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

/* Upkeep */
.upkeep {
  margin-block-start: var(--space-7);
}

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

.reminder {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title when"
    "why why";
  gap: var(--space-1) var(--space-3);
  padding: var(--space-4);
  background: var(--c-paper);
  border: var(--border);
  border-radius: var(--radius-m);

  & .reminder__title {
    grid-area: title;
    font-weight: 600;
  }

  & .reminder__when {
    grid-area: when;
    font-size: var(--text-s);
    color: var(--c-ink-muted);
  }

  & .reminder__why {
    grid-area: why;
    color: var(--c-ink-muted);
    font-size: var(--text-s);
  }
}

/* Kit picks */
.picks {
  margin-block-start: var(--space-2);

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

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

.pick {
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-s);

  & .pick__meta,
  & .pick__note {
    color: var(--c-ink-muted);
  }
}

/* Beside a pick: save it for later. Pressed, it says so in words and in weight. */
.pick__save {
  justify-self: start;

  &[aria-pressed="true"] {
    border-color: var(--c-pine);
    color: var(--c-pine);
    font-weight: 700;
  }
}

/* The way from the plan to what was saved. */
.plan__saved {
  font-size: var(--text-s);
  font-weight: 600;
}

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

/* The house on the map: a sheet-edged frame, the plain panel inside it until the tiles arrive */
.house-map {
  margin-block-start: var(--space-7);
  container-type: inline-size;
}

.house-map__frame {
  margin-block-start: var(--space-4);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-block-size: 28rem;
  display: grid;
}

.house-map__fallback {
  align-self: center;
  padding: var(--space-5);
  color: var(--c-ink-muted);
  text-wrap: pretty;
}

.house-map__canvas {
  inline-size: 100%;
  block-size: 100%;
  min-block-size: 0;

  & canvas:focus-visible {
    outline: var(--focus-ring);
    outline-offset: -3px;
  }
}

.house-map__tools {
  margin-block-start: var(--space-4);
}

.house-map__status {
  margin-block-start: var(--space-3);
  min-block-size: 1.5em;
  font-size: var(--text-s);
  color: var(--c-ink-muted);
}

@container (max-width: 28rem) {
  .house-map__frame {
    aspect-ratio: 1;
  }
}

/* Past the width where four-to-three would make the map taller than the screen, it takes the whole
   column at a fixed height instead of standing as a small square with the page empty beside it. */
@container (min-width: 40rem) {
  .house-map__frame {
    aspect-ratio: auto;
    block-size: 30rem;
    max-block-size: none;
  }
}

/* The solar estimate: the saving figure is the hero, in lantern, like Days Ready */
.figure {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

.figure__amount {
  font-size: var(--text-display);
  font-weight: 700;
  font-stretch: 85%;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--c-lantern-ink);
}

.figure__unit {
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--c-ink-muted);
}

/* The compass: eight points around the house. Pure CSS; the radios do the work. */
.compass {
  border: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);

  & legend {
    font-weight: 600;
    padding: 0;
  }
}

.compass__rose {
  position: relative;
  inline-size: min(100%, 18rem);
  aspect-ratio: 1;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  place-items: center;
  border: var(--border);
  border-radius: 50%;
  background: radial-gradient(circle, var(--c-paper) 55%, var(--c-pine-tint) 56%, var(--c-pine-tint) 100%);
}

.compass__input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.compass__point {
  inline-size: 2.75rem;
  block-size: 2.75rem;
  display: grid;
  place-items: center;
  border: var(--border);
  border-radius: 50%;
  background: var(--c-paper);
  font-family: var(--font-data);
  font-weight: 500;
  font-size: var(--text-s);
  cursor: pointer;
  transition: background var(--duration-quick), border-color var(--duration-quick);

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

  &[data-aspect="North"] { grid-area: 1 / 3; }
  &[data-aspect="NorthEast"] { grid-area: 2 / 4; }
  &[data-aspect="East"] { grid-area: 3 / 5; }
  &[data-aspect="SouthEast"] { grid-area: 4 / 4; }
  &[data-aspect="South"] { grid-area: 5 / 3; }
  &[data-aspect="SouthWest"] { grid-area: 4 / 2; }
  &[data-aspect="West"] { grid-area: 3 / 1; }
  &[data-aspect="NorthWest"] { grid-area: 2 / 2; }
}

.compass__input:checked + .compass__point {
  background: var(--c-lantern);
  border-color: var(--c-lantern);
  /* Dark ink on the lantern in both themes: the slate token is near white in the dark. */
  color: oklch(18% 0.03 230);
}

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

.compass__house {
  grid-area: 3 / 3;
  inline-size: 2rem;
  block-size: 2rem;
  background: var(--c-slate);
  clip-path: polygon(50% 0, 100% 45%, 85% 45%, 85% 100%, 15% 100%, 15% 45%, 0 45%);
}

/* The monthly chart, drawn on the server as SVG */
.solar-chart,
.solar-flows,
.solar-tariffs,
.solar-cost,
.solar-notes,
.solar-grants,
.solar-answers {
  margin-block-start: var(--space-7);
}

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

.chart__svg {
  inline-size: 100%;
  block-size: auto;
  font-family: var(--font-data);
}

.chart__axis {
  stroke: var(--c-contour);
  stroke-width: 1;
}

.chart__bar--made {
  fill: var(--c-lantern);
}

.chart__bar--used {
  fill: var(--c-ink-muted);
}

.chart__label {
  fill: var(--c-ink-muted);
  font-size: 11px;
}

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

.chart__swatch {
  display: inline-block;
  inline-size: 0.9rem;
  block-size: 0.9rem;
  border-radius: 2px;

  &.chart__swatch--made {
    background: var(--c-lantern);
  }

  &.chart__swatch--used {
    background: var(--c-ink-muted);
  }
}

/* Tables: flows and roof segments */
.table-scroll {
  overflow-x: auto;
  margin-block-start: var(--space-4);
}

.flows-table,
.roof-table {
  inline-size: 100%;
  border-collapse: collapse;
  background: var(--c-paper);
  border: var(--border);
  border-radius: var(--radius-m);
  margin-block-start: var(--space-4);

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

  & thead th {
    font-family: var(--font-display);
    font-weight: 600;
  }

  & td.data {
    text-align: end;
  }

  /* A heading sits over its column: where the figures are set to the right, so is the heading above them. */
  & th[data-figures] {
    text-align: end;
  }
}

/* Tariffs and costs */
.tariff-list,
.grant-list,
.notes-list {
  margin-block-start: var(--space-4);
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.tariff-list {
  list-style: none;
  counter-reset: tariff;
}

/* Whose prices these are, and when they were checked: said once, above the list. */
.tariff-fit {
  margin-block-start: var(--space-3);
  max-inline-size: var(--measure, 62ch);
  color: var(--c-ink-muted);
}

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

  & .tariff__name {
    font-weight: 600;
  }

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

  & .tariff__suits,
  & .tariff__prices {
    grid-column: 1 / -1;
    color: var(--c-ink-muted);
    font-size: var(--text-s);
  }

  &:first-child {
    border-color: var(--c-lantern);
  }
}

.cost-list {
  margin-block-start: var(--space-4);
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

  & > div {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
  }

  & dd {
    margin: 0;
  }

  & .cost-list__total {
    padding-block-start: var(--space-2);
    border-block-start: var(--border);
    font-weight: 600;
  }
}

.notes-list {
  padding-inline-start: 1.2em;
}

.grant-list {
  list-style: none;
}

.grant {
  display: grid;
  gap: var(--space-1);

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

@container (max-width: 28rem) {
  .tariff {
    grid-template-columns: 1fr;
  }
}

/* Offline banner: honest, quiet, and only when the browser says so */
.offline-banner {
  padding: var(--space-2) var(--gutter);
  background: var(--c-lantern-tint);
  border-block-end: var(--border);
  font-size: var(--text-s);
  text-wrap: pretty;
}

/* Anything that needs the server is shown as such when offline */
:root[data-offline] .plan-form button[type="submit"] {
  opacity: 0.5;
}

.site-nav .button {
  min-block-size: 2.5rem;
  padding-block: 0;
}

/* Photo moments: three sheets, each a form, each answered in place */
.photo-moments {
  margin-block-start: var(--space-6);
  display: grid;
  gap: var(--space-5);
  max-inline-size: var(--measure);
}

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

.photo-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-block-start: var(--space-2);
}

.photo-pick {
  display: inline-block;
  cursor: pointer;

  &:has(input:focus-visible) .button {
    outline: var(--focus-ring);
    outline-offset: 2px;
  }
}

.photo-pick__name {
  flex: 1 1 12rem;
  color: var(--c-ink-muted);
  font-size: var(--text-s);
}

.photo-result {
  padding: var(--space-5);
  border: 2px solid var(--c-lantern);
  border-radius: var(--radius-m);
  background: var(--c-lantern-tint);
  display: grid;
  gap: var(--space-3);
}

.kit-items {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.kit-item {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
}

.kit-item__match {
  font-size: var(--text-s);
  color: var(--c-pine);
  font-weight: 600;
}

.kit-ticks {
  display: grid;
  gap: var(--space-2);
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--c-contour);
}

.byok {
  margin-block-start: var(--space-7);
  max-inline-size: var(--measure);

  & .field {
    margin-block-start: var(--space-3);
  }
}

.narrative {
  display: grid;
  gap: var(--space-4);
  max-inline-size: var(--measure);

  & p {
    text-wrap: pretty;
  }
}

.plan__photos,
.plan__street,
.plan__explain {
  margin-block-start: var(--space-4);
}

/* The landing page beyond the hero: the pitch, the steps, the privacy strip, what it covers, the questions */
.pitch,
.how,
.covers,
.faq,
.closing {
  margin-block-start: var(--space-8);
}

.pitch__grid,
.covers__grid {
  margin-block-start: var(--space-5);
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  list-style: none;
  padding: 0;
}

.pitch__card,
.covers__grid > li {
  padding: var(--space-5);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);

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

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

/* The steps are a true sequence, so they are numbered; nothing else on the page is. */
.how__steps {
  margin-block-start: var(--space-5);
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: var(--space-4);
  max-inline-size: var(--measure);

  & li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 3rem 1fr;
    column-gap: var(--space-3);
    align-items: start;

    &::before {
      content: counter(step);
      grid-row: 1 / span 2;
      font-family: var(--font-display);
      font-size: var(--text-2xl);
      font-weight: 700;
      line-height: 1;
      color: var(--c-lantern-ink);
    }

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

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

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

.faq__item {
  /* No margin of its own: the list is a grid and its gap owns the spacing. A margin here was
     cleared only for items that follow another, so the first item in a second column kept it and
     the first item in the first column did not, and the two columns started at different heights. */
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  padding: var(--space-3) var(--space-4);

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

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

.closing {
  padding-block: var(--space-7);
  max-inline-size: var(--measure);

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

/* Legal pages */
.legal {
  max-inline-size: var(--measure);

  & h2 {
    margin-block-start: var(--space-6);
  }

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

.legal__table {
  margin-block-start: var(--space-4);
  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);
  }
}

.legal__list {
  margin-block-start: var(--space-3);
  padding-inline-start: 1.2em;
  display: grid;
  gap: var(--space-2);
}

.site-footer__links {
  margin-block-start: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}

.site-footer__made {
  margin-block-start: var(--space-3);
}

/* The night: a surface where the figure is the flame. Everything inside reads its colours from here. */
/*
  In daylight the surface is paper: the kitchen at dawn, the figure a deep amber. In the dark it is
  the night the design direction drew, deeper than the roofline so the glow has somewhere to sit.
  Every token is set with light-dark() so the toggle flips the whole page, not most of it.
*/
.night {
  --c-ink: light-dark(var(--c-slate), var(--c-on-roof));
  --c-ink-muted: light-dark(color-mix(in oklab, var(--c-slate) 70%, var(--c-sky)), var(--c-on-roof-muted));
  --c-contour: light-dark(oklch(85% 0.012 190), var(--c-on-roof-line));
  --c-paper: light-dark(oklch(100% 0 0), var(--c-night));
  --c-ground: light-dark(oklch(100% 0 0), var(--c-night));
  --c-lantern-ink: light-dark(oklch(45% 0.12 75), var(--c-lantern));
  --c-pine: light-dark(oklch(43% 0.08 165), oklch(68% 0.1 165));
  --c-pine-tint: light-dark(color-mix(in oklab, oklch(43% 0.08 165) 12%, oklch(100% 0 0)), color-mix(in oklab, oklch(68% 0.1 165) 22%, var(--c-night)));
  --c-lantern-tint: light-dark(color-mix(in oklab, var(--c-lantern) 18%, oklch(100% 0 0)), color-mix(in oklab, var(--c-lantern) 22%, var(--c-night)));
  background: var(--c-paper);
  color: var(--c-ink);

  & a {
    color: light-dark(var(--c-pine), var(--c-on-roof-link));
  }

  & .days-ready__figure {
    color: var(--c-lantern-ink);
    font-weight: 300;
    /* The mockup's cut: the narrowest width the subset carries, which is what makes the figure read as drawn rather than typed. */
    font-stretch: 75%;
  }

  & .input {
    background: light-dark(oklch(100% 0 0), oklch(26% 0.03 230));
    color: var(--c-ink);
    border-color: var(--c-contour);
  }

  & .still-life {
    color: light-dark(var(--c-ink-muted), var(--c-on-night-line));
  }
}

/* The glow: the light behind the figure, which comes in once and pulses when the figure moves. */
.glow {
  position: absolute;
  z-index: -1;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: 34rem;
  block-size: 34rem;
  translate: -30% -35%;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c-glow) 0, transparent 62%);
}

@media (prefers-reduced-motion: no-preference) {
  .glow {
    animation: glow-in var(--duration-glow) var(--ease-out) both;
  }

  [data-pulse] .glow {
    animation: pulse var(--duration-glow) var(--ease-out);
  }
}

@keyframes glow-in {
  from {
    opacity: 0;
    scale: 0.8;
  }
}

@keyframes pulse {
  50% {
    opacity: 1;
    scale: 1.15;
  }
}

/* The strip: a bar per need from now, ending where it runs out, against the 3, 7 and 30 marks. */
.strip {
  --scale: attr(data-scale type(<number>), 30);
  margin-block-start: var(--space-5);
  display: grid;
  gap: var(--space-2);
  font-size: var(--text-s);
}

.strip__bar,
.strip__ticks {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) 3.2rem;
  gap: var(--space-3);
  align-items: center;
}

.strip__bar {
  --d: attr(data-days type(<number>), 0);
}

.strip__name {
  font-weight: 600;
  color: var(--c-ink);
}

.strip__track {
  position: relative;
  block-size: 0.75rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--c-contour) 60%, transparent);
  overflow: hidden;
}

.strip__fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: max(0.5rem, calc(min(var(--d), var(--scale)) / var(--scale) * 100%));
  border-radius: 999px;
  background: var(--c-pine);
  transform-origin: left center;
}

.strip__bar[data-reduced="true"] .strip__fill {
  background: repeating-linear-gradient(135deg, var(--c-lantern) 0 3px, var(--c-lantern-tint) 3px 7px);
}

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

.strip__bar[data-throughout="true"] .strip__days::after {
  content: "+";
}

.strip__ticks {
  color: var(--c-ink-muted);
  font-size: 0.7rem;

  &::before,
  &::after {
    content: "";
  }
}

.strip__ticks > .strip__tick {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  --at: attr(data-at type(<number>), 0);
  inset-inline-start: calc(var(--at) / var(--scale) * 100%);
  inline-size: 0;
  white-space: nowrap;
  translate: -50% 0;

  &::before {
    content: "";
    position: absolute;
    inset-block-end: 100%;
    inset-inline-start: 50%;
    block-size: 0.4rem;
    border-inline-start: 1px solid var(--c-ink-muted);
  }
}

.strip__ticks > .strip__tick:last-child {
  translate: -100% 0;
}

@media (prefers-reduced-motion: no-preference) {
  .strip__fill {
    animation: draw var(--duration-reveal) var(--ease-out) both;
  }

  .strip__bar:nth-child(2) .strip__fill { animation-delay: 120ms; }
  .strip__bar:nth-child(3) .strip__fill { animation-delay: 240ms; }
  .strip__bar:nth-child(4) .strip__fill { animation-delay: 360ms; }
}

@keyframes draw {
  from {
    scale: 0 1;
  }
}

/* The marks: one small drawing per need and per source, in the text colour, from the sprite. */
.mark-icon {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  flex: none;
  vertical-align: -0.3em;
  margin-inline-end: var(--space-2);
  color: var(--c-ink-muted);
}

/* The still lifes: flat, geometric, 2 px strokes, the lantern the only light. */
.still-life {
  display: block;
  inline-size: 100%;
  block-size: auto;
  color: var(--c-ink-muted);

  & .still-life__lines {
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  & .still-life__light {
    fill: var(--c-lantern);
  }

  & .still-life__glow--small {
    fill: var(--c-glow);
  }

  /* Filled shapes: the panel colour of the surface the picture sits on, heavy outlines, and the pale light a lantern throws. */
  & .still-life__fill {
    fill: var(--c-paper);
    stroke: currentColor;
    stroke-width: 3;
    stroke-linejoin: round;
  }

  & .still-life__heavy {
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  & .still-life__pale {
    fill: color-mix(in oklab, var(--c-lantern) 35%, var(--c-paper));
  }

  & .still-life__flame {
    fill: oklch(97% 0.04 85);
  }
}

/* The verdict bar: the hero's shadow, fixed to the top once the hero has scrolled away */
.verdict {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 20;
  border-block-end: 2px solid var(--c-contour);
  box-shadow: 0 0.25rem 1rem oklch(20% 0.03 230 / 0.15);
}

.verdict__inner {
  inline-size: min(100%, var(--page-max));
  margin-inline: auto;
  padding: var(--space-2) var(--gutter);
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: var(--space-3);
}

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

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

.verdict__strip {
  grid-column: 1 / -1;

  & .strip {
    margin-block-start: var(--space-1);
    gap: 0.15rem;
    font-size: 0.7rem;
  }

  & .strip__bar,
  & .strip__ticks {
    grid-template-columns: 5.5rem minmax(0, 1fr) 3.4rem;
    gap: var(--space-2);
    white-space: nowrap;
  }

  & .strip__track {
    block-size: 0.4rem;
  }

  & .strip__ticks {
    display: none;
  }
}

@media (min-width: 48rem) {
  .verdict__inner {
    grid-template-columns: auto auto auto minmax(0, 1fr);
  }

  .verdict__strip {
    grid-column: 4;
    max-inline-size: 28rem;
    justify-self: end;
    inline-size: 100%;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .verdict:not([hidden]) {
    animation: settle 240ms var(--ease-out) both;
  }
}

/* Scenario chips: what could happen, in a row that scrolls sideways on a phone */
.chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-block: var(--space-1) var(--space-2);
  scrollbar-width: thin;
}

.chip {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "mark name"
    "mark days";
  column-gap: var(--space-2);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  color: var(--c-ink);
  text-align: start;
  cursor: pointer;
  font: inherit;
  inline-size: 11rem;

  &[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);
  }
}

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

.chip__name {
  grid-area: name;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-s);
  line-height: 1.2;
}

.chip__days {
  grid-area: days;
  font-family: var(--font-display);
  font-weight: 300;
  font-stretch: 75%;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--c-lantern-ink);

  & small {
    font-family: var(--font-data);
    font-size: 0.7rem;
    color: var(--c-ink-muted);
  }
}

/* On a desktop the scenario chips are the mockup's cards: a grid of them, the mark above the name, the figure large. */
@media (min-width: 60rem) {
  .chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: var(--space-3);
    overflow: visible;
  }

  .chip {
    inline-size: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "mark"
      "name"
      "days";
    row-gap: var(--space-2);
    align-items: start;
    padding: var(--space-4);
  }

  .chip__mark {
    inline-size: 2.4rem;
    block-size: 2.4rem;
  }

  .chip__name {
    font-size: var(--text-m);
  }

  .chip__days {
    font-size: 2.6rem;
  }
}

@media (min-width: 64rem) {
  .chips {
    flex-wrap: wrap;
    overflow: visible;
  }
}

/* Where a tier takes the house, under its header */
.sheet__outcome {
  flex-basis: 100%;
  font-size: var(--text-s);
  color: var(--c-pine);

  &:empty {
    display: none;
  }
}

/* The risks beyond the top three fold away */
.risks__more {
  margin-block-start: var(--space-4);

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

/* Use my location: the button first, then "or", then the postcode box, and the sentence it leaves beneath */
.locate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.locate-row__or {
  font-weight: 600;
  color: var(--c-ink-muted);
}

/* The box fills what the button and the "or" leave, so the row runs the full width of its panel. */
.locate-row > .input,
.locate-row > .input.input--short {
  flex: 1 1 10rem;
  max-inline-size: none;
}

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

/* The location button stands beside the start button, with the pin, and reads as the other way in */
.button--locate {
  gap: var(--space-2);

  & .mark-icon {
    margin: 0;
    color: currentColor;
  }

  /* While it looks: the pin gives way to a ring that turns, and the button cannot be pressed again. */
  &[aria-busy="true"] {
    cursor: progress;

    & .mark-icon {
      display: none;
    }

    &::before {
      content: "";
      inline-size: 1.1rem;
      block-size: 1.1rem;
      border-radius: 50%;
      border: 2px solid currentColor;
      border-inline-end-color: var(--c-lantern);
      animation: turn 0.8s linear infinite;
    }
  }
}

@keyframes turn {
  to {
    rotate: 1turn;
  }
}

.hero__start-row + .locate__status {
  margin-block-start: var(--space-2);
  color: var(--c-ink-muted);
}

/* Clearing the plan: folded away, with its sentence, and a button that looks like what it does */
.clear {
  margin-block-start: var(--space-5);
  max-inline-size: var(--measure);

  & summary {
    cursor: pointer;
    font-weight: 600;
  }

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

.button--danger {
  background: var(--c-ember);
  border-color: var(--c-ember);
  /* Ember is deep in the light and bright in the dark, so the words on it change sides with it.
     White on the dark theme's ember measured 2.9:1. */
  color: light-dark(oklch(98% 0 0), oklch(18% 0.03 28));

  &:hover {
    background: color-mix(in oklab, var(--c-ember) 85%, var(--c-slate));
    border-color: color-mix(in oklab, var(--c-ember) 85%, var(--c-slate));
  }
}

/* Picks: how the list works */
.picks__how {
  margin-block: var(--space-2) var(--space-3);
  font-size: var(--text-s);
  color: var(--c-ink-muted);
  max-inline-size: var(--measure);
}

/* Found it cheaper? A folded link box under an action's picks */
.tip {
  margin-block-start: var(--space-3);
  font-size: var(--text-s);

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

  & label {
    display: block;
    margin-block: var(--space-2) var(--space-1);
    color: var(--c-ink-muted);
  }
}

.tip__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);

  & .input {
    flex: 1 1 16rem;
    min-block-size: 2.5rem;
  }
}
}
