/* Base: reset and elements. Only sheet allowed to style bare elements. */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Page scrollbar drawn explicitly. D-236. */
html { color-scheme: dark; }

@media (pointer: fine) {
  html::-webkit-scrollbar { width: var(--scrollbar-w); }
  html::-webkit-scrollbar-track { background: var(--scrollbar-track); }
  html::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-os);
  }
  /* Thumb gets a hover; press and focus stay with the browser. */
  html::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hv); }

  /* Firefox only: scrollbar-color here would strip Chromium of the rules above. */
  @supports not selector(::-webkit-scrollbar) {
    html { scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
  }
}

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--type-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* Guard rail, not a fix: nothing overflows today. D-163. */
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; }
p, ul, ol, figure, blockquote, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }

img, video, svg { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  margin: 0;
  padding: 0;
}

/* Only table on the site is the Dungeon stats sheet. */
td, th { padding: 0; }

button { cursor: pointer; }

/* Browser monospace on code/kbd/samp/pre would be a fifth family. */
code, kbd, samp, pre {
  font-family: var(--type-family-mono);
  font-size: 0.9em;
}

hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 0;
}

/* Focus: 2px dotted, 3px offset. Dotted is deliberate, not a solid rule. */
:focus { outline: none; }

:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

/* Selection */
::selection {
  background: var(--action-default);
  color: var(--text-on-action);   /* jamais blanc sur orange, §1.3.2 */
}

/* Utilities. One property per class. */
.u-visually-hidden {
  position: absolute !important;   /* only !important on the site */
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.u-measure { max-width: var(--measure); }
.u-no-scroll { overflow: hidden; }
