/*
 * PlusMMR base: font, reset, typography, focus, reduced motion.
 * Requires tokens/tokens.css loaded first. Tokens only, no literal colours.
 */

/* ---------- Inter, self-hosted (Cyrillic and Latin subsets, SIL OFL 1.1) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-cyrillic-wght-normal.woff2") format("woff2-variations"),
       url("/fonts/inter-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations"),
       url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Metric-matched fallback: keeps line boxes stable while Inter loads. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
  size-adjust: 107%;
  ascent-override: 90.5%;
  descent-override: 22.6%;
  line-gap-override: 0%;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--pm-surface-0);
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ol, ul {
  margin: 0;
}

ol, ul {
  padding: 0;
  list-style: none;
}

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

svg {
  flex-shrink: 0;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

[hidden] {
  display: none !important;
}

/* ---------- Document typography ---------- */
body {
  background: var(--pm-surface-0);
  color: var(--pm-text-primary);
  font-family: var(--pm-font-sans);
  font-size: var(--pm-font-size-body);
  line-height: var(--pm-line-height-body);
  font-weight: var(--pm-weight-regular);
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

/* Every number in the product is tabular; this covers inputs and tables too. */
input, select, textarea, table, time, data, output {
  font-variant-numeric: tabular-nums;
}

h1, .pm-h1 {
  font-size: var(--pm-font-size-h1);
  line-height: var(--pm-line-height-h1);
  letter-spacing: var(--pm-tracking-h1);
  font-weight: var(--pm-weight-semibold);
}

h2, .pm-h2 {
  font-size: var(--pm-font-size-h2);
  line-height: var(--pm-line-height-h2);
  letter-spacing: var(--pm-tracking-h2);
  font-weight: var(--pm-weight-semibold);
}

h3, .pm-h3 {
  font-size: var(--pm-font-size-h3);
  line-height: var(--pm-line-height-h3);
  letter-spacing: var(--pm-tracking-h3);
  font-weight: var(--pm-weight-semibold);
}

.pm-display {
  font-size: var(--pm-font-size-h1);
  line-height: var(--pm-line-height-h1);
  letter-spacing: var(--pm-tracking-display);
  font-weight: var(--pm-weight-bold);
}

@media (min-width: 768px) {
  .pm-display {
    font-size: var(--pm-font-size-display);
    line-height: var(--pm-line-height-display);
  }
}

.pm-text-small {
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
}

.pm-text-caption {
  font-size: var(--pm-font-size-caption);
  line-height: var(--pm-line-height-caption);
  letter-spacing: var(--pm-tracking-caption);
}

.pm-overline {
  font-size: var(--pm-font-size-overline);
  line-height: var(--pm-line-height-overline);
  letter-spacing: var(--pm-tracking-overline);
  font-weight: var(--pm-weight-semibold);
  text-transform: uppercase;
  color: var(--pm-text-tertiary);
}

.pm-text-secondary { color: var(--pm-text-secondary); }
.pm-text-tertiary { color: var(--pm-text-tertiary); }
.pm-text-accent { color: var(--pm-accent-text); }

.pm-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* Match time, evidence timestamps, codes */
.pm-mono, code, kbd, samp {
  font-family: var(--pm-font-mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

strong, b {
  font-weight: var(--pm-weight-semibold);
}

abbr[title] {
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

::selection {
  background: var(--pm-info-bg);
  color: var(--pm-text-primary);
}

/* ---------- Focus: visible ring on keyboard focus only ---------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: var(--pm-focus-width) solid var(--pm-focus-ring);
  outline-offset: var(--pm-focus-offset);
}

/* ---------- Visually hidden, still announced ---------- */
.pm-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.pm-skip-link {
  position: absolute;
  left: var(--pm-space-4);
  top: calc(-1 * var(--pm-space-16));
  z-index: var(--pm-z-tooltip);
  padding: var(--pm-space-2) var(--pm-space-3);
  background: var(--pm-surface-inverse);
  color: var(--pm-text-inverse);
  border-radius: var(--pm-radius-md);
}

.pm-skip-link:focus-visible {
  top: var(--pm-space-4);
}

/* ---------- Icons (Lucide, 20 px, 1.5 px stroke) ---------- */
.pm-icon {
  width: var(--pm-icon-size);
  height: var(--pm-icon-size);
  stroke: currentColor;
  stroke-width: 1.8; /* 1.5 px at 20 px in Lucide's 24-unit grid */
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pm-icon--sm {
  width: var(--pm-icon-size-sm);
  height: var(--pm-icon-size-sm);
  stroke-width: 2.25; /* 1.5 px at 16 px */
}

/* ---------- Reduced motion ---------- */
@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;
  }
}
