/* --------------------------------------------------------------------------
   Page skeleton: header, centred stage, footer.
   -------------------------------------------------------------------------- */

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
}

.topbar,
.footer,
.stage {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
}

/* --- header --------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  /* Four controls and a wordmark: on the narrowest phones they take two rows
     rather than pushing the page sideways. */
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  color: var(--text);
}

.brand__name {
  padding: 0.2em 0.45em;
  background-color: var(--mark-bg);
  color: var(--mark-ink);
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
}

/* Both halves share one ink; the weight and the italic carry the split, so the
   softer half never trades away contrast for the effect. */
.brand__ty {
  font-weight: 700;
}

.brand__pa {
  font-weight: 300;
  font-style: italic;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* --- stage ---------------------------------------------------------------- */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  /* A grid item's automatic minimum size is its content, which would let a
     wide child — the history table — push the whole page sideways instead of
     scrolling inside its own box. */
  min-width: 0;
}

.view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
}

/* --- footer --------------------------------------------------------------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.shortcuts {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.shortcuts li {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 640px) {
  body {
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-4) var(--sp-3);
  }

  .stage {
    gap: var(--sp-5);
    justify-content: flex-start;
    padding-top: var(--sp-4);
  }

  .shortcuts {
    display: none;
  }

  .footer {
    justify-content: center;
  }
}
