/* =====================================================================
   Advoke CV — Base styles: resets, typography, accessibility primitives
   ===================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
  tab-size: 4;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--s-3);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-strong);
  text-wrap: balance;
}

h1 { font-size: clamp(1.875rem, 4vw + 0.5rem, 3rem); }
h2 { font-size: clamp(1.5rem, 2vw + 0.75rem, 2.125rem); }
h3 { font-size: clamp(1.125rem, 1vw + 0.875rem, 1.375rem); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-base); }
h6 {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color: var(--text-soft);
}

/* ---------- Paragraphs and text ---------- */
p {
  margin: 0 0 var(--s-4);
  color: var(--text-muted);
  text-wrap: pretty;
}
p:last-child { margin-bottom: 0; }

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

strong, b { font-weight: var(--fw-semibold); color: var(--text-strong); }

em, i { font-style: italic; }

mark {
  background: var(--warn-100);
  color: var(--warn-700);
  padding: 0 3px;
  border-radius: var(--r-xs);
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

/* ---------- Links ---------- */
a {
  color: var(--text-link);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--dur) var(--ease-out);
}
a:hover { color: var(--text-link-hover); text-decoration: underline; }
a:active { color: var(--brand-800); }

a.inline-link {
  border-bottom: 1px solid currentColor;
  text-decoration: none;
}

/* ---------- Lists ---------- */
ul, ol {
  margin: 0 0 var(--s-4);
  padding-left: 1.25rem;
}
li { margin-bottom: var(--s-2); }
li:last-child { margin-bottom: 0; }

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

/* ---------- Images & media ---------- */
img, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

svg { fill: none; }
svg.icon { fill: currentColor; }

/* ---------- Form controls (browser baseline) ---------- */
input, button, textarea, select {
  font: inherit;
  color: inherit;
  margin: 0;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}
textarea { resize: vertical; }

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

/* ---------- Tables ---------- */
table {
  border-collapse: collapse;
  width: 100%;
}
th, td {
  padding: var(--s-2) var(--s-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

/* ---------- Code & pre ---------- */
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--surface-2);
  color: var(--text-strong);
  padding: 1px 6px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-soft);
}
pre {
  background: var(--surface-2);
  padding: var(--s-4);
  border-radius: var(--r-md);
  overflow-x: auto;
  border: 1px solid var(--border);
  margin: 0 0 var(--s-4);
}
pre code {
  background: none;
  border: 0;
  padding: 0;
}

kbd {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  padding: 1px 6px;
  font-size: 0.85em;
}

/* ---------- Horizontal rule ---------- */
hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: var(--s-6) 0;
}

/* ---------- Selection ---------- */
::selection {
  background: var(--brand-200);
  color: var(--brand-900);
}

/* ---------- Focus visibility ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
}

/* Remove focus outline on mouse click only */
:focus:not(:focus-visible) { outline: none; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: var(--s-3) var(--s-5);
  background: var(--brand-600);
  color: #fff;
  font-weight: var(--fw-semibold);
  border-radius: 0 0 var(--r-sm) 0;
  text-decoration: none;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: 3px solid #fff;
  outline-offset: -5px;
}

/* ---------- Screen-reader-only utility ---------- */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sr-only-focusable:focus,
.sr-only-focusable:focus-within {
  position: static !important;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
  margin: 0;
}

/* ---------- Text utilities ---------- */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-soft   { color: var(--text-soft); }
.text-strong { color: var(--text-strong); }
.text-invert { color: var(--text-invert); }
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.text-balance { text-wrap: balance; }
.text-pretty  { text-wrap: pretty; }

/* ---------- Color utilities ---------- */
.color-brand   { color: var(--brand-600); }
.color-accent  { color: var(--accent-600); }
.color-ok      { color: var(--ok-600); }
.color-warn    { color: var(--warn-600); }
.color-err     { color: var(--err-600); }
.color-info    { color: var(--info-600); }

/* ---------- Display utilities ---------- */
.hidden { display: none !important; }
.block  { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex   { display: flex; }
.grid   { display: grid; }

/* ---------- Direction ---------- */
[dir="rtl"] { direction: rtl; }

/* ---------- Reduced motion: hard stop on transforms ---------- */
@media (prefers-reduced-motion: reduce) {
  .no-reduced-motion-off { animation: none !important; transition: none !important; }
}

/* ---------- Forced colors (Windows High Contrast) ---------- */
@media (forced-colors: active) {
  a { color: LinkText; }
  button { border: 1px solid ButtonText; }
  :focus-visible { outline: 2px solid Highlight; }
}

/* ---------- Print base ---------- */
@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
  }
  body { font-size: 11pt; }
  a { color: #000; text-decoration: none; }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }
}