/* Roughley Mechanical — base: @font-face, reset, element defaults, a11y primitives.
   Load order: tokens.css -> tokens.ext.css -> base.css -> type.css -> layout.css -> components.css */

/* ── Archivo, self-hosted variable font ───────────────────────────────────
   One family, three widths. font-stretch: 62% 125% declares the wdth axis
   range — 62 and 125 are the extremes, there is no headroom either side.
   Subsets and unicode-ranges are carried over from the brand artifact. */

/* latin */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-var-latin.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;
}
/* latin-ext */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* vietnamese */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-var-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* ── Reset ───────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

/* Must come before any component sets display. Several components below are
   display:flex, which silently overrides the hidden attribute's UA
   display:none and leaves "hidden" error text and callouts on screen. */
[hidden] { display: none !important; }

:root {
  /* Without this, iOS/macOS dark mode auto-inverts form controls and wrecks
     the white-input-on-2px-Iron-border spec. */
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

html { min-height: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-stretch: var(--w-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--text); }

strong, b { font-weight: 700; }

button, input, select, textarea { font: inherit; color: inherit; }
textarea { resize: vertical; }

/* Fieldsets default to min-inline-size: min-content, which silently refuses
   to shrink and blows out any grid or flex parent. */
fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }
legend { padding: 0; }

:target { scroll-margin-top: var(--space-24); }

/* ── Focus ───────────────────────────────────────────────────────────── */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
/* Guard for engines that still paint a default ring on mouse focus. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus:not(:focus-visible) {
  outline: none;
}
/* Copper on Iron is 3.50:1 and fails AA. The tint is 6.46:1. */
.section--dark :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.cta-band     :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.site-footer  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline-color: var(--accent-on-dark);
}

/* ── Accessibility primitives ────────────────────────────────────────── */

/* Clip-rect, never display:none — an element hidden with display:none or
   visibility:hidden leaves the tab order AND the accessibility tree, which
   would break the urgency radio group entirely. */
.u-visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.u-no-wrap { white-space: nowrap; }

@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;
  }
}

::selection { background: var(--copper); color: var(--white); }
