/* ============================================================================
   VÆLARUM — Base Styles
   Modern reset + typography defaults. Body uses Plex Sans for readability;
   headings + UI use Plex Mono for brand identity.
   ============================================================================ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  hanging-punctuation: first allow-end last;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-100);
  line-height: var(--lh-base);
  color: var(--text-1);
  background: var(--surface-0);
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  font-variant-ligatures: common-ligatures contextual;
  min-height: 100vh;
  text-wrap: pretty;
}

/* ---------- Headings — Mono identity ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--text-1);
  text-wrap: balance;
  font-feature-settings: "kern" 1, "ss01" 1, "ss05" 1;
}

h1 {
  font-size: clamp(2.25rem, 5vw + 0.5rem, var(--fs-500));
  letter-spacing: var(--tracking-tight);
}

h2 {
  font-size: clamp(1.75rem, 3vw + 0.5rem, var(--fs-400));
  letter-spacing: var(--tracking-tight);
}

h3 {
  font-size: clamp(1.375rem, 2vw + 0.25rem, var(--fs-300));
  letter-spacing: 0;
}

h4 {
  font-size: var(--fs-200);
  letter-spacing: 0;
}

h5 {
  font-size: var(--fs-150);
  font-weight: var(--fw-semibold);
}

h6 {
  font-size: var(--fs-100);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-2);
}

/* ---------- Body text ---------- */
p {
  max-width: var(--container-prose);
}

p + p {
  margin-top: var(--space-4);
}

/* ---------- Links ---------- */
a {
  color: var(--brand-mid);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--border-2);
  transition: color var(--dur-fast) var(--ease-out),
              text-decoration-color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--brand-x-dark);
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-xs);
}

/* ---------- Lists ---------- */
ul, ol {
  padding-left: var(--space-5);
}

li + li {
  margin-top: var(--space-2);
}

/* ---------- Media ---------- */
img, svg, video, picture {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---------- Forms ---------- */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

/* ---------- Tables ---------- */
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums lining-nums;
}

th, td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-1);
}

th {
  font-family: var(--font-mono);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-75);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-2);
}

/* ---------- Code ---------- */
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: var(--r-xs);
}

/* ---------- Inline marks for prototype state ---------- */
.proto-note {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-50);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--status-review);
  background: rgba(138, 122, 46, 0.08);
  border: 1px solid rgba(138, 122, 46, 0.25);
  padding: 0.18rem 0.5rem;
  border-radius: var(--r-pill);
  vertical-align: 0.1em;
}

.proto-block {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-75);
  color: var(--text-3);
  background: repeating-linear-gradient(
    135deg,
    var(--surface-1) 0 12px,
    var(--surface-2) 12px 24px
  );
  border: 1px dashed var(--border-2);
  padding: var(--space-5);
  border-radius: var(--r-sm);
  text-align: center;
}

.proto-block strong {
  display: block;
  font-size: var(--fs-100);
  color: var(--text-2);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

/* ---------- Selection ---------- */
::selection {
  background: var(--brand-x-dark);
  color: var(--text-inverse);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-3);
  background: var(--brand-x-dark);
  color: var(--text-inverse);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-sm);
  z-index: var(--z-modal);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--fs-75);
}

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

/* ---------- Utilities ---------- */
.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;
}

.mono     { font-family: var(--font-mono); }
.sans     { font-family: var(--font-sans); }
.muted    { color: var(--text-3); }
.subtle   { color: var(--text-2); }
.tnum     { font-variant-numeric: tabular-nums lining-nums; }
.upper    { text-transform: uppercase; letter-spacing: var(--tracking-wider); }
