/* ============================================================
   Base / reset
   ============================================================ */

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

html {
  /* Set precisely by main.js to viewportWidth / 10 (clamped on
     desktop). The calc() below is the pre-JS fallback so the very
     first paint is already proportional rather than 16px. */
  font-size: calc(100vw / 10);
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  min-height: 100%;
  background: var(--stage-surround);
  color: var(--text-primary);
  font-family: var(--font-serif-zh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* The stage is translated, not scrolled. The document itself must
     never grow a scrollbar or the cinematic model breaks. */
  overflow: hidden;
  overscroll-behavior: none;
}

/* Headings carry no extra weight: the reference sets every text element
   at 400 and relies on size, colour and spacing for hierarchy. Leaving
   the UA's bold makes headings look like a web page. */
h1,
h2,
h3 {
  font-weight: 400;
  font-size: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

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

/* Visible focus for keyboard users only — never on touch/mouse. */
:focus-visible {
  outline: 2px solid var(--heading-primary);
  outline-offset: 2px;
}

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