/* Number Meadow base rules (art spec 4; the @font-face is in fonts.css, plan P1): box model, the page
   (no scroll, touch rules, the paper grain of docs/STYLE.md 7.2), the app frame, screens, the focus
   ring, reduced motion and the landscape notice. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  height: 100%; margin: 0; overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
html { font-size: 16px; }
/* Step 3: the Grown-ups text boxes can be selected, so a report can be copied by hand. */
textarea, input { -webkit-user-select: text; user-select: text; }
body {
  font-family: var(--font);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(83deg, var(--grain) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-7deg, var(--grain) 0 1px, transparent 1px 7px);
}
h1, h2, h3, p { margin: 0; }

/* One scrolling app box, one screen at a time. */
#app {
  position: relative;
  height: 100vh; height: 100dvh;
  overflow-x: hidden; overflow-y: auto;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.screen {
  position: relative;
  max-width: 48rem; min-height: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 0.375rem;
  padding: 0.375rem var(--sp-2);
}

/* Keyboard focus: a 4 px ring on every control (finding 21). */
button:focus { outline: none; }
button:focus-visible, [data-action]:focus-visible, summary:focus-visible, [role=button]:focus-visible {
  outline: 4px solid var(--focus); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Phones held sideways are not a target: ask nicely to turn upright. */
@media (orientation: landscape) and (max-height: 430px) and (pointer: coarse) {
  body::after {
    content: "Turn me upright!"; position: fixed; inset: 0; z-index: 50;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-xl); font-weight: var(--fw-strong); color: var(--ink); background: var(--bg);
  }
}
