/* ProcurementOS base styles (D-110, D-132). Colours come only from tokens.css;
   type, spacing and shape from type.css. No inline styles: the content security
   policy allows only the shell's own files. */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--pos-font-body);
  font-size: var(--pos-text-base);
  line-height: var(--pos-line-height);
}

/* Page titles only are Instrument Serif (VS-1); section and panel headings are
   Public Sans 600 (VS-2). */
h1,
h2,
h3 {
  font-family: var(--pos-font-body);
  font-weight: 600;
  line-height: 1.25;
  margin: var(--pos-space-5) 0 var(--pos-space-3);
}

h1 {
  font-family: var(--pos-font-heading);
  font-size: var(--pos-text-h1);
  font-weight: 400;
  line-height: 1.15;
  margin-top: 0;
}

h2 {
  font-size: var(--pos-text-h2);
}

h3 {
  font-size: var(--pos-text-h3);
}

h4 {
  font-family: var(--pos-font-body);
  font-weight: 600;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

/* Codes and references are mono, small and muted (VS-3, VS-30). */
code,
kbd,
samp {
  font-family: var(--pos-font-mono);
}

.pos-code-full {
  color: var(--text);
  font-family: var(--pos-font-mono);
  font-size: var(--pos-text-small);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* A small uppercase label (VS-3). */
.pos-caps {
  color: var(--text-muted);
  font-family: var(--pos-font-mono);
  font-size: var(--pos-text-label);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* A select never outgrows its container, so a long option cannot widen the
   page at 200% zoom (D-110 finding, D-115). */
select {
  max-width: 100%;
}

/* The hidden attribute always wins. A class that sets display (a chip, a button, a
   link) would otherwise override it and leave an empty element on the page. */
[hidden] {
  display: none !important;
}

/* A reading measure for running text: lines stop at a readable length on a wide
   screen. Guidance from readability and WCAG 1.4.8 (AAA), not part of the AA
   position. Applied to prose only; panels, tables and forms stay full width. */
.pos-measure {
  max-width: var(--pos-measure);
}

/* Text for assistive technology only: out of sight, still read aloud. */
.pos-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Focus is always visible, on every focusable element: a 2px ring offset 2px, so
   it sits on the page or panel colour and never on a button fill (VS-36). */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* The skip link: off screen until focused, then the first thing shown. */
.pos-skip-link {
  position: absolute;
  left: var(--pos-space-3);
  top: -100vh;
  z-index: 10;
  padding: var(--pos-space-2) var(--pos-space-4);
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--control-border);
  font-weight: 600;
}

.pos-skip-link:focus {
  top: var(--pos-space-3);
}

@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;
  }
}
