/* =====================================================================
   Base: typography, layout primitives, focus, utilities
   ===================================================================== */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--rp-header-h) + var(--rp-space-4)); /* WCAG 2.4.11 */
}

body {
  font-family: var(--rp-font-sans);
  font-size: var(--rp-fs-base);
  line-height: var(--rp-lh-base);
  color: var(--rp-text);
  background-color: var(--rp-bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--rp-text);
  font-weight: var(--rp-fw-semibold);
  line-height: var(--rp-lh-tight);
  letter-spacing: var(--rp-tracking-tight);
  margin-bottom: var(--rp-space-3);
}

h1, .h1 { font-size: var(--rp-fs-3xl); font-weight: var(--rp-fw-bold); }
h2, .h2 { font-size: var(--rp-fs-2xl); }
h3, .h3 { font-size: var(--rp-fs-xl); }
h4, .h4 { font-size: var(--rp-fs-lg); }
h5, .h5 { font-size: var(--rp-fs-md); }
h6, .h6 { font-size: var(--rp-fs-base); }

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

small, .small { font-size: var(--rp-fs-sm); }

a {
  color: var(--rp-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--rp-primary-hover); }

.text-muted-strong { color: var(--rp-text-muted) !important; }
.text-body-secondary { color: var(--rp-text-muted) !important; }

.rp-eyebrow {
  display: inline-block;
  font-size: var(--rp-fs-sm);
  font-weight: var(--rp-fw-semibold);
  color: var(--rp-primary);
  letter-spacing: 0.02em;
  margin-bottom: var(--rp-space-2);
}

.rp-lead {
  font-size: var(--rp-fs-md);
  color: var(--rp-text-muted);
  line-height: var(--rp-lh-snug);
}

.rp-mono { font-family: var(--rp-font-mono); font-size: 0.9375em; }
.rp-tabular { font-variant-numeric: tabular-nums; }

/* ---------- Focus (WCAG 2.4.7 / 1.4.11) ---------- */
:focus { outline: none; }

:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.page-link:focus-visible,
.btn-close:focus-visible {
  outline: var(--rp-focus-width) solid var(--rp-focus);
  outline-offset: var(--rp-focus-offset);
  box-shadow: none;
}

/* Inputs keep a visible focus ring even when focused via mouse (text entry context). */
.form-control:focus,
.form-select:focus {
  outline: var(--rp-focus-width) solid var(--rp-focus);
  outline-offset: var(--rp-focus-offset);
  box-shadow: none;
}

.btn-primary:focus-visible,
.btn-danger:focus-visible {
  outline-color: var(--rp-slate-900);
}

/* Headings that receive programmatic focus on navigation should not show a ring box. */
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

/* ---------- Skip link ---------- */
.rp-skip-link {
  position: absolute;
  left: var(--rp-space-4);
  top: var(--rp-space-3);
  z-index: 2000;
  padding: var(--rp-space-2) var(--rp-space-4);
  background: var(--rp-surface);
  color: var(--rp-primary);
  border: 1px solid var(--rp-border-strong);
  border-radius: var(--rp-radius);
  box-shadow: var(--rp-shadow-md);
  font-weight: var(--rp-fw-semibold);
  text-decoration: none;
  transform: translateY(-200%);
}
.rp-skip-link:focus { transform: none; }

/* ---------- Layout primitives ---------- */
.rp-container {
  width: 100%;
  max-width: var(--rp-container);
  margin-inline: auto;
  padding-inline: var(--rp-space-4);
}
.rp-container--narrow { max-width: var(--rp-container-narrow); }

.rp-stack { display: flex; flex-direction: column; gap: var(--rp-space-4); }
.rp-stack--sm { gap: var(--rp-space-2); }
.rp-stack--lg { gap: var(--rp-space-6); }

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

.rp-grid { display: grid; gap: var(--rp-space-4); }
.rp-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rp-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rp-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.rp-divider {
  border: 0;
  border-top: 1px solid var(--rp-border);
  margin-block: var(--rp-space-5);
  opacity: 1;
}

.rp-hidden { display: none !important; }

/* Development-only annotations (scope labels such as NCC-xx). Visible only when
   runtime-config.js enables devNotes; never shown in production builds. */
[data-dev-note] { display: none !important; }
.rp-dev [data-dev-note] { display: inline-flex !important; }
