/* Marchenholm — base.css : reset, design tokens, typography defaults. */

:root {
  /* Paper */
  --c-paper:     #FAFAFA;
  --c-paper-alt: #F1F1EE;

  /* Ink */
  --c-ink:       #1A1D22;
  --c-ink-muted: #5B6168;
  --c-stone:     #A9ADB3;

  /* Accents */
  --c-accent:    #1F4FE0;
  --c-accent-dp: #153BA8;
  --c-secondary: #E89B1A;

  /* Score-semantic */
  --c-score-hi:  #1B8E4F;
  --c-score-mid: #E89B1A;
  --c-score-lo:  #C1342E;

  /* Functional */
  --c-error:      #C1342E;
  --c-success:    #1B8E4F;
  --c-focus-ring: rgba(31, 79, 224, 0.28);

  /* Type */
  --f-display: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-body:    'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-mono:    'Geist Mono', ui-monospace, 'SFMono-Regular', monospace;

  --f-display-xl: clamp(3rem, 6vw, 4.5rem);
  --f-display-l:  clamp(2.2rem, 4vw, 3rem);
  --f-display-m:  clamp(1.6rem, 2.5vw, 2rem);
  --f-display-s:  1.375rem;
  --f-subtitle:   1.25rem;
  --f-score-xl:   clamp(2.8rem, 5vw, 3.5rem);
  --f-score-l:    clamp(4rem, 8vw, 5rem);
  --f-body-l:     1.0625rem;
  --f-body:       1rem;
  --f-body-s:     0.875rem;
  --f-caption:    0.8125rem;
  --f-label:      0.75rem;
  --f-mono:       0.8125rem;

  /* Radius */
  --r-none: 0;
  --r-sm:   2px;
  --r-md:   6px;

  /* Spacing */
  --space-section:   96px;
  --space-section-m: 56px;
  --space-block:     48px;
  --space-item:      24px;
  --container:       1240px;
  --content:         840px;
  --prose:           640px;
  --gutter:          40px;
  --gutter-m:        20px;
}

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

html {
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--f-body);
  font-weight: 500;
  font-size: var(--f-body);
  color: var(--c-ink);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

img, picture, video, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* Headings */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 900;
  color: var(--c-ink);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--f-display-l); }
h2 { font-size: var(--f-display-m); }
h3 { font-size: var(--f-display-s); font-weight: 700; }
h4 { font-size: 1.125rem; font-weight: 700; }

/* Prose */
p { font-size: var(--f-body); line-height: 1.55; max-width: 64ch; }
p + p { margin-top: 1em; }

/* Safety nets — long tokens (licences, URLs) break rather than overflow containers. */
p, li, dd, td, th, caption, .mh-lab-note, .mh-card__licence {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

strong { font-weight: 700; }
em { font-style: italic; }

/* Links (default — individual components override) */
a { transition: color 0.15s, border-color 0.15s; }
a:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--c-focus-ring);
}

/* Focus rings on any interactive */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--c-focus-ring);
}

/* Utility classes */
.mh-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Typographic conventions */
.mh-mono { font-family: var(--f-mono); font-weight: 500; font-size: var(--f-mono); }
.mh-tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* Reduced motion — disable all transitions */
@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;
  }
}

/* No dark-mode override — the publication is paper. */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: light; }
}
