/* ============================================================================
   Merit — base layer
   Reset, page furniture, focus and motion policy. Copied into web/ and
   landing/ by `npm run design:sync`; edit it here.
   ========================================================================= */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: var(--t-4);
  font-weight: var(--w-regular);
  line-height: var(--lh-body);
  letter-spacing: var(--track-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

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

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

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }

textarea { resize: vertical; }

hr { border: 0; height: 1px; background: var(--line); margin: 0; }

/* Tabular figures wherever a number is compared to another number. */
.num, time, .tabular { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- headings
   Display sizes carry negative tracking; body copy does not. */
h1, .h-display {
  font-size: var(--t-8);
  font-weight: var(--w-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--track-display);
}
h2, .h-title {
  font-size: var(--t-6);
  font-weight: var(--w-bold);
  line-height: var(--lh-heading);
  letter-spacing: var(--track-heading);
}
h3, .h-card {
  font-size: var(--t-5);
  font-weight: var(--w-semi);
  line-height: 1.3;
  letter-spacing: var(--track-card);
}
h4 {
  font-size: var(--t-4);
  font-weight: var(--w-semi);
  line-height: 1.35;
  letter-spacing: var(--track-card);
}

/* ----------------------------------------------------------------- focus
   Visible, high-contrast, and never removed. Only shown for keyboard use so
   pointer interaction stays quiet. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
/* Fields draw the ring on the control itself rather than around it. */
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

::selection { background: var(--accent-soft); color: var(--label); }

/* --------------------------------------------------------------- scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-full);
}

/* ------------------------------------------------------------ a11y basics */
.skip,
.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -60px;
  z-index: 200;
  padding: var(--s-2) var(--s-4);
  background: var(--surface-1);
  color: var(--label);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: none;
  transition: top var(--t-fast) var(--ease);
}
.skip:focus,
.skip-link:focus {
  top: var(--s-4);
  box-shadow: var(--shadow-float);
}

[hidden] { display: none !important; }

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

/* ------------------------------------------------------------ motion policy
   Every animation in the system is opt-out. Users who ask for less motion
   get the final state immediately, never a broken intermediate one. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------- safe areas */
.safe-top { padding-top: var(--safe-top); }
.safe-bottom { padding-bottom: var(--safe-bottom); }
