/* ==========================================================================
   SILVER Platform – Base Styles, Reset & Accessibility Foundations
   ========================================================================== */

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

html {
  font-size: calc(16px * var(--text-scale));
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-latin);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--color-ink-900);
  background-color: var(--color-canvas);
  text-align: left;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Skip to main content link (WCAG 2.2) */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 2000;
  padding: var(--space-3) var(--space-4);
  background: var(--color-teal-900);
  color: var(--color-white);
  font-weight: 700;
  font-size: var(--text-label);
  border-radius: var(--radius-button);
  text-decoration: underline;
}

.skip-link:focus {
  top: var(--space-4);
  outline: 3px solid var(--color-teal-900);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--color-focus);
}

/* Visible focus ring on every interactive element, never removed */
:focus-visible {
  outline: 3px solid var(--surface-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(245, 165, 36, 0.45);
}

/* Typography */
h1, h2, h3, h4, p, ul, ol, figure {
  margin-top: 0;
}

h1, .h1 {
  font-size: var(--text-h1);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-teal-900);
  margin-bottom: var(--space-2);
}

.display-title {
  font-size: var(--text-display);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--color-teal-900);
  margin-bottom: var(--space-3);
}

h2, .h2 {
  font-size: var(--text-h2);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--color-teal-900);
  margin-bottom: var(--space-2);
}

h3, .h3 {
  font-size: var(--text-h3);
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.008em;
  color: var(--color-ink-900);
  margin-bottom: var(--space-2);
}

h4, .h4 {
  font-size: var(--text-label);
  line-height: 1.4;
  font-weight: 700;
  color: var(--color-ink-900);
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-3);
}

.body-lg {
  font-size: var(--text-body-l);
  line-height: 1.6;
  color: var(--color-ink-600);
}

.text-muted {
  color: var(--color-ink-600);
}

.text-small {
  font-size: var(--text-caption);
}

.text-break {
  overflow-wrap: anywhere;
}

a[href^="mailto:"] {
  overflow-wrap: anywhere;
}

.caption {
  font-size: var(--text-caption);
  line-height: 1.5;
  color: var(--color-ink-600);
}

.reading-measure {
  max-width: var(--reading-width);
}

/* Links */
a {
  color: var(--color-teal-700);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--color-teal-900);
  text-decoration: underline;
}

/* Tabular figures for tables & currency */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Screen reader only */
.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;
}

/* Images */
img, svg {
  max-width: 100%;
  display: block;
}

/* Lists */
.list-plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul {
  padding-left: 1.15em;
}

li {
  margin-bottom: 6px;
}

/* Spacing utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.flex-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.flex-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.stack-sm > * + * { margin-top: var(--space-2); }
.stack-md > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-4) 0;
}

/* Programmatic focus on headings should not draw the interactive ring */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible,
h1:focus,
h1:focus-visible {
  outline: none;
  box-shadow: none;
}

/* The hidden attribute always wins over component display rules */
[hidden] { display: none !important; }
