/* Reset and page furniture. */

*, *::before, *::after { box-sizing: border-box; }

/* `hidden` must win over any display we set later, or a hidden element keeps
   taking up space. This bit the boot spinner once already. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;                 /* the page itself never scrolls sideways */
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.005em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0 0 var(--space-4); max-width: 62ch; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 800; color: var(--ink); }

ul, ol { margin: 0 0 var(--space-4); padding-left: 1.35em; }
li { margin-bottom: var(--space-2); }
li:last-child { margin-bottom: 0; }

a { color: var(--primary); text-underline-offset: 3px; }

img, svg { max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}
/* Never remove the ring without replacing it. */
:focus:not(:focus-visible) { outline: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  transition: top var(--motion);
}
.skip-link:focus { top: var(--space-4); }

/* App shell ---------------------------------------------------------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
#app-shell { display: contents; }

#main {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  /* Clears the fixed tab bar (min-height + padding + safe area) with room to spare. */
  padding: var(--space-5) var(--space-4) calc(var(--tap) + var(--space-7) + var(--space-6) + env(safe-area-inset-bottom));
}
#main:focus { outline: none; }

@media (min-width: 900px) {
  #main { padding-bottom: var(--space-7); }
}

.boot {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-4);
  color: var(--ink-faint);
}
.boot__mark {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 5px solid var(--line);
  border-top-color: var(--primary);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#app[data-motion='reduced'] .boot__mark { animation: none; }

.noscript {
  max-width: 40ch;
  margin: 15vh auto;
  padding: var(--space-5);
  font-family: system-ui, sans-serif;
}

/* Utility ------------------------------------------------------------ */
.stack > * + * { margin-top: var(--gap, var(--space-4)); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: var(--step--1); }
.centre { text-align: center; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
