/* mapindex account pages (accounts/*.html, mcp/consent.html), loaded after site.css
   by the templates that use them. */

/* The account's pages: sign-in, the name of a first sign-in, the account itself. */
.account__form {
  display: grid;
  gap: var(--space-4);
  justify-items: start;
  max-width: 24rem;
}

.account__form .field {
  width: 100%;
}

.account__name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

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

/* --- The account's sheet ---------------------------------------------------- */

/* The account's own pages are one sheet laid on the landscape, as wide as the page so
   its edges line up with the masthead's: a head of card colour over a deeper body,
   which holds cards. It reaches down to the footer however little a tab holds, so the
   frame stays put from tab to tab. Phones give it the whole screen. */
.page:has(> .account-area) {
  display: flex;
  flex-direction: column;
  padding-bottom: var(--space-8);
}

.account-area {
  --sheet-pad: clamp(var(--space-4), 2.5vw, var(--space-8));
  /* The body's colour where no contour line shows through it, for what joins it. */
  --sheet-body: color-mix(in srgb, var(--color-surface) 86%, var(--color-canvas));
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.account-area__body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--space-5);
  padding: var(--sheet-pad);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background: var(--color-surface-veil);
}

/* The head: the picture over its first letter, which shows when there is no picture
   or it fails to load (site.js), the name, and the tabs on its lower edge. */
.account-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  padding: var(--space-6) var(--sheet-pad) 0;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--color-card);
}

.account-head__who {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.account-head__face {
  position: relative;
  flex: none;
  width: clamp(3.5rem, 2.75rem + 2.5vw, 4.5rem);
  aspect-ratio: 1;
}

.account-head__letter,
.account-head__picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.account-head__letter {
  display: grid;
  place-items: center;
  background: var(--color-accent-soft);
  color: var(--color-accent-soft-ink);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  font-weight: 600;
}

.account-head__picture {
  object-fit: cover;
}

.account-head__text {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-head h1 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
}

/* The tabs: index tabs on the head's lower edge. The open one takes the body's colour
   and runs into it, a fillet at each foot; the others are plain labels. Where they
   do not fit they scroll sideways, the open one brought into view (site.js). */
.account-tabs {
  --tab-join: var(--radius-m);
  display: flex;
  gap: var(--space-1);
  margin-inline: calc(-1 * var(--tab-join));
  padding-inline: var(--tab-join);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.account-tabs__tab {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: 0 var(--space-4);
  border-radius: var(--tab-join) var(--tab-join) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-15);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.account-tabs__tab .icon {
  color: var(--color-text-subtle);
}

.account-tabs__tab:hover {
  background: color-mix(in srgb, var(--sheet-body) 50%, transparent);
  color: var(--color-text);
}

/* Inside the strip, which clips what leaves it. */
.account-tabs__tab:focus-visible {
  outline-offset: -3px;
}

.account-tabs__tab[aria-current="page"] {
  background: var(--sheet-body);
  color: var(--color-text);
}

.account-tabs__tab[aria-current="page"] .icon {
  color: var(--color-accent);
}

.account-tabs__tab[aria-current="page"]::before,
.account-tabs__tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: var(--tab-join);
  height: var(--tab-join);
  pointer-events: none;
}

.account-tabs__tab[aria-current="page"]::before {
  right: 100%;
  background: radial-gradient(
    circle at 0 0,
    transparent calc(var(--tab-join) - 0.5px),
    var(--sheet-body) var(--tab-join)
  );
}

.account-tabs__tab[aria-current="page"]::after {
  left: 100%;
  background: radial-gradient(
    circle at 100% 0,
    transparent calc(var(--tab-join) - 0.5px),
    var(--sheet-body) var(--tab-join)
  );
}

/* A count beside a tab's name. */
.account-tabs__count {
  color: var(--color-text-subtle);
  font-size: var(--text-13);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* A list's head: the way back to the lists, its name and count, what changes it. */
.account-head--list {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-3) var(--space-4);
  padding-bottom: var(--space-5);
}

.account-head__back {
  display: inline-flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: var(--space-1);
  width: fit-content;
  margin-left: -0.25rem;
  color: var(--color-text-muted);
  font-size: var(--text-14);
  font-weight: 600;
  text-decoration: none;
}

.account-head__back:hover {
  color: var(--color-accent);
}

.account-head__title {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-head--list .account__actions {
  justify-content: flex-end;
}

.account-head--list:has(.list-rename[open]) .account__actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

@media (max-width: 47.99rem) {
  .page:has(> .account-area) {
    padding: 0;
  }

  .page:has(> .account-area) > .messages {
    margin: var(--space-3) var(--gutter);
  }

  .account-area,
  .account-head,
  .account-area__body {
    border-radius: 0;
  }

  .account-area {
    box-shadow: none;
  }

  .account-head {
    padding-top: var(--space-5);
  }

  .account-head--list {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-head--list .account__actions {
    justify-content: flex-start;
  }

  .account-tabs__tab {
    padding: 0 var(--space-3);
    font-size: var(--text-14);
  }

  .account-tabs__tab .icon {
    display: none;
  }
}

/* --- What a tab holds ------------------------------------------------------- */

/* Cards side by side where there is room: two alike, or a narrow one beside a wide. */
.account-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--space-5);
}

@media (min-width: 64rem) {
  .account-columns {
    grid-template-columns: repeat(2, minmax(0, 44rem));
  }

  .account-columns--aside {
    grid-template-columns: minmax(0, 27rem) minmax(0, 1fr);
  }
}

/* A card of the body: a heading, then rows, facts, a chart or a note. */
.account-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--space-4);
  padding: clamp(var(--space-4), 2vw, var(--space-6));
  border-radius: var(--radius-l);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.account-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
}

.account-card__note {
  color: var(--color-text-muted);
  font-size: var(--text-14);
}

/* The head's buttons, side by side, wrapping under each other where they do not fit. */
.account-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

/* The Picker's status takes room only once it says something. */
[data-picker-status]:empty {
  display: none;
}

/* A question asked before something is deleted: its lead and the two answers. */
.account-card--ask {
  max-width: 40rem;
}

.account-card__lead {
  color: var(--color-text-muted);
  font-size: var(--text-17);
}

/* A choice that goes with the answer, on a line of its own above the buttons. */
.account-check {
  display: flex;
  flex-basis: 100%;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  cursor: pointer;
}

.account-check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--color-accent);
}

/* The words a question is about, as they were written. */
.account-quote {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-m);
  background: var(--color-raised);
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* Rows of a card, each a fill of its own: a round mark, a title over a quieter line,
   and what can be done with it at the end, below the text where the row is narrow. */
.account-rows {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.account-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-m);
  background: var(--color-raised);
}

.account-row__mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent-soft-ink);
}

.account-row__main {
  display: grid;
  flex: 1 1 6rem;
  gap: 0.125rem;
  min-width: 0;
}

.account-row__title {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.account-row__meta {
  color: var(--color-text-muted);
  font-size: var(--text-14);
}

.account-row__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

/* A row's title that leads to its page: the text's colour until it is pointed at. */
a.account-row__title {
  width: fit-content;
  color: var(--color-text);
  text-decoration: none;
}

a.account-row__title:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* What the row was about is gone. */
.account-row__title--gone {
  color: var(--color-text-muted);
  font-weight: 400;
}

/* A link standing in for a title not yet read. */
.account-row__title--link {
  font-size: var(--text-14);
  font-weight: 500;
}

/* A map as the row's mark: its preview, or the map icon while there is none. */
.account-row__mark--map {
  width: 4.5rem;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-s);
}

.account-row__mark--map img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A row about a map: its state below the title, and at the row's end where there
   is room beside it. */
.account-row--map {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.account-row--map .account-row__mark {
  grid-row: 1 / span 2;
  align-self: start;
}

@media (min-width: 40rem) {
  .account-row--map {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .account-row--map .account-row__mark {
    grid-row: auto;
    align-self: center;
  }
}

/* Many rows stand two abreast where the sheet is wide. */
@media (min-width: 72rem) {
  .account-rows--pairs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* A row that holds a text of its own: the text below the mark and title, then the
   state at the row's foot with what can be done at its end. */
/* A submission's note, as its submitter wrote it. */
.account-row__note {
  overflow-wrap: anywhere;
}

.account-row--stacked {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  align-items: center;
}

.account-row__text,
.account-row--stacked .account-row__actions {
  grid-column: 1 / -1;
}

.account-row__text {
  align-self: start;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.account-row--stacked .account-row__actions {
  justify-content: space-between;
}

/* The state of a row or a figure, in words and an icon, never by colour alone:
   neutral, waiting (amber), done (green), known before (blue) or refused (red). */
.state {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  width: fit-content;
  min-height: 1.625rem;
  padding: 0 0.625rem;
  border-radius: var(--radius-pill);
  background: var(--color-raised);
  color: var(--color-text-muted);
  font-size: var(--text-13);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.state .icon {
  width: 0.875rem;
  height: 0.875rem;
  margin-left: -0.125rem;
}

.state--waiting {
  background: var(--color-warning-bg);
  color: var(--color-warning-ink);
}

.state--done {
  background: var(--color-success-bg);
  color: var(--color-success-ink);
}

.state--known {
  background: var(--color-accent-soft);
  color: var(--color-accent-soft-ink);
}

.state--refused {
  background: var(--color-danger-bg);
  color: var(--color-danger-ink);
}

/* Labelled values in a row, as a map's facts. */
.account-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
  margin: 0;
}

.account-facts > div {
  display: grid;
  gap: 0.1875rem;
  min-width: 0;
}

.account-facts dt {
  color: var(--color-text-subtle);
  font-size: var(--text-12);
  font-weight: 600;
}

.account-facts dd {
  display: flex;
  align-items: center;
  gap: 0.4375rem;
  margin: 0;
  font-size: var(--text-15);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.account-facts dd .icon {
  width: 1rem;
  height: 1rem;
}

/* An empty tab: the site's empty state as a card of the body. */
.account-area__body .empty-state {
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

/* --- Connecting an assistant ------------------------------------------------- */

/* Before the first assistant: why to connect one beside what to ask it, a chat's
   questions on a pane of their own. */
.connect-intro {
  gap: var(--space-6);
}

@media (min-width: 64rem) {
  .connect-intro {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-8);
  }
}

.connect-intro__text {
  display: grid;
  gap: var(--space-4);
  max-width: 38rem;
}

.connect-intro h2 {
  font-size: clamp(var(--text-24), 2.4vw, 2.125rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

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

.connect-points li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  font-size: var(--text-15);
}

.connect-points .icon {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.1875rem;
  color: var(--color-accent);
}

.connect-intro__asks {
  display: grid;
  gap: var(--space-4);
  padding: clamp(var(--space-4), 2vw, var(--space-6));
  border-radius: var(--radius-l);
  background: var(--color-raised);
}

.connect-intro__asks h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: var(--text-14);
  font-weight: 600;
  letter-spacing: 0;
}

.connect-intro__asks h3 .icon {
  color: var(--color-accent);
}

/* Questions as a chat shows them: each a bubble at the asker's side. */
.asks {
  display: grid;
  justify-items: end;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.asks__ask {
  max-width: 26rem;
  padding: 0.625rem var(--space-4);
  border-radius: var(--radius-l) var(--radius-l) var(--radius-s) var(--radius-l);
  background: var(--color-accent-soft);
  color: var(--color-accent-soft-ink);
  font-size: var(--text-15);
  font-weight: 500;
  line-height: 1.4;
}

/* The server's address, large enough to read at a glance, with the button that
   copies it. */
.connect-address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-m);
  background: var(--color-raised);
}

.connect-address__label {
  flex-basis: 100%;
  color: var(--color-text-muted);
  font-size: var(--text-13);
  font-weight: 600;
}

.connect-address__url {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-17);
  overflow-wrap: anywhere;
  user-select: all;
}

/* The steps of each assistant, side by side where they fit. */
.connect-clients {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: var(--space-6) var(--space-8);
}

.connect-client {
  display: grid;
  align-content: start;
  gap: var(--space-3);
}

.connect-client h3 {
  font-size: var(--text-17);
}

.connect-steps {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.connect-steps li {
  position: relative;
  min-height: 1.75rem;
  padding: 0.125rem 0 0 2.5rem;
  font-size: var(--text-15);
  line-height: 1.5;
  counter-increment: step;
}

.connect-steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 1.75rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent-soft-ink);
  font-size: var(--text-13);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.connect-steps strong {
  font-weight: 600;
}

/* Help that stays at hand folded: its question opens it. */
.account-help summary {
  width: fit-content;
  color: var(--color-accent);
  font-size: var(--text-14);
  font-weight: 600;
  cursor: pointer;
}

.account-help__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-3);
}

/* --- Searches against the daily budget -------------------------------------- */

/* Today: the sentence with its figure, what is left, and a meter whose fill turns
   amber from four fifths of the budget and red once nothing is left, on a track of
   the same colour's pale step. */
.quota {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.quota__figure {
  color: var(--color-text-muted);
  font-size: var(--text-17);
  font-weight: 500;
  line-height: 1.2;
}

.quota__used {
  margin-right: 0.1em;
  color: var(--color-text);
  font-size: 3.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.quota__meter {
  display: block;
  width: 100%;
  height: 0.75rem;
}

.quota__track {
  fill: var(--color-accent-soft);
}

.quota__fill {
  fill: var(--color-accent);
}

.quota--low .quota__track {
  fill: var(--color-warning-bg);
}

.quota--low .quota__fill {
  fill: var(--color-warning);
}

.quota--out .quota__track {
  fill: var(--color-danger-bg);
}

.quota--out .quota__fill {
  fill: var(--color-danger);
}

.quota__left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-14);
}

/* The days before: a column a day on a scale from 0 to the budget, the budget a
   coral line across; ticks at the start, every seventh day named below. The numbers
   are in each column's tip and in the table folded away under the chart. */
.usage-chart {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius-m);
  background: var(--color-raised);
}

/* A phone's plot needs the width. */
@media (max-width: 47.99rem) {
  .usage-chart {
    padding: var(--space-3);
  }
}

.usage-chart__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
}

.usage-chart__head h3 {
  font-size: var(--text-15);
}

.usage-chart__key {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-13);
}

.usage-chart__key-line {
  width: 1.25rem;
  height: 2px;
  border-radius: 1px;
  background: var(--color-earth);
}

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

.usage-chart__ticks,
.usage-chart__days {
  margin: 0;
  padding: 0;
  color: var(--color-text-subtle);
  font-size: var(--text-12);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  list-style: none;
  white-space: nowrap;
}

/* Each tick centred on its line: the top, the middle and the baseline. */
.usage-chart__ticks {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.usage-chart__ticks li {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 0;
}

.usage-chart__svg {
  display: block;
  width: 100%;
  height: clamp(8rem, 16vw, 11rem);
  overflow: visible;
}

.usage-chart__column {
  fill: var(--color-series-1);
}

.usage-chart__budget {
  stroke: var(--color-earth);
  stroke-width: 1.5px;
}

/* A name centred under its day; the first and the last keep inside the plot. */
.usage-chart__days {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  grid-column: 2;
  height: 0.75rem;
}

.usage-chart__days li {
  position: relative;
}

.usage-chart__days span {
  position: absolute;
  left: 50%;
  translate: -50% 0;
}

.usage-chart__days li:first-child span {
  left: 0;
  translate: none;
}

.usage-chart__days li:last-child span {
  right: 0;
  left: auto;
  translate: none;
}

.usage-chart__table summary {
  width: fit-content;
  color: var(--color-accent);
  font-size: var(--text-14);
  font-weight: 600;
  cursor: pointer;
}

.usage-chart__table table {
  margin-top: var(--space-3);
  border-collapse: collapse;
  font-size: var(--text-14);
  font-variant-numeric: tabular-nums;
}

.usage-chart__table :is(th, td) {
  padding: 0.1875rem var(--space-6) 0.1875rem 0;
  text-align: left;
}

.usage-chart__table :is(th, td):last-child {
  padding-right: 0;
  text-align: right;
}

.usage-chart__table th {
  color: var(--color-text-subtle);
  font-size: var(--text-12);
  font-weight: 600;
}

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

/* A list as a stack of maps: one tile with a thumbnail, the edges of two more showing
   above it, its count and name. */
.stacks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5) var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

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

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

@media (min-width: 80rem) {
  .stacks {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 100rem) {
  .stacks {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/* The name comes first for a screen reader, beneath the pile for the eye. */
.stack {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: var(--space-2);
  height: 100%;
  border-radius: var(--radius-m);
  color: var(--color-text);
  text-decoration: none;
}

.stack__pile {
  position: relative;
  display: block;
  padding-top: 0.625rem;
}

.stack__pile::before,
.stack__pile::after {
  content: "";
  position: absolute;
  height: 1rem;
  border-radius: var(--radius-m) var(--radius-m) 0 0;
}

.stack__pile::before {
  top: 0;
  inset-inline: 1.25rem;
  background: var(--color-hover);
}

.stack__pile::after {
  top: 0.3125rem;
  inset-inline: 0.625rem;
  background: var(--color-scrollbar);
}

.stack__cover {
  position: relative;
  z-index: 1;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: var(--color-raised);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s var(--ease);
}

.stack__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stack:hover .stack__cover {
  box-shadow: var(--shadow-lift);
}

.stack:hover .stack__name {
  color: var(--color-accent);
}

.stack__count {
  position: absolute;
  z-index: 2;
  right: var(--space-2);
  bottom: var(--space-2);
  padding: 0.125rem var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  color: var(--color-text);
  font-size: var(--text-12);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stack__name {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--text-15);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.list-entry {
  position: relative;
  height: 100%;
}

.list-entry__remove {
  position: absolute;
  z-index: 2;
  top: calc(var(--card-mat) + var(--space-1));
  left: calc(var(--card-mat) + var(--space-1));
  margin: 0;
}

.list-entry__remove .button {
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

@media (hover: hover) {
  .list-entry__remove {
    opacity: 0;
    transition: opacity 0.15s var(--ease);
  }

  .list-entry:hover .list-entry__remove,
  .list-entry__remove:focus-within {
    opacity: 1;
  }
}

.list-entry__gone {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius-l);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.list-entry__gone .preview-placeholder {
  flex: none;
  aspect-ratio: 4 / 3;
  height: auto;
}

.list-entry__gone p {
  margin: 0;
  padding: var(--space-2) var(--space-3) var(--space-3);
  color: var(--color-text-subtle);
  font-size: var(--text-13);
}

/* While a list is renamed its form has the row, and deleting waits. */
.list-rename[open] {
  flex-basis: 100%;
}

.account__actions:has(.list-rename[open]) > .button {
  display: none;
}

.list-rename summary {
  width: fit-content;
  list-style: none;
}

.list-rename summary::-webkit-details-marker {
  display: none;
}

.list-rename__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* On the head, whose colour a field shares. */
.list-rename__form .input {
  width: min(24rem, 100%);
  background: var(--sheet-body);
}

.google-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--color-google-line);
  border-radius: 1.25rem;
  background: var(--color-google);
  color: var(--color-google-ink);
  font: inherit;
  font-size: var(--text-14);
  font-weight: 500;
  cursor: pointer;
}

.google-button:hover {
  background: color-mix(in srgb, var(--color-google) 92%, var(--color-google-ink));
}
