/* ============================================================================
   ADVOKE CV — base.css
   Reset, design tokens, typography defaults, global accessibility, motion.
   Mobile-first. Zero external requests. Zero layout shift.
   ============================================================================ */

/* ── 1. Box model & root resets ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(255, 193, 7, 0.22);
  scroll-behavior: smooth;
  tab-size: 4;
  hanging-punctuation: first last;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures contextual;
  overflow-x: clip;
  text-underline-offset: 0.18em;
  text-decoration-thickness: from-font;
}

/* ── 2. Design tokens ───────────────────────────────────────────────────── */
:root {
  /* ── 2.1 Brand — Yellow ── */
  --y-50:  #FFFDF0;
  --y-100: #FFF8D6;
  --y-200: #FFEFAD;
  --y-300: #FFE27A;
  --y-400: #FFD24A;
  --y-500: #FFC107;   /* primary brand yellow */
  --y-600: #F5B301;   /* hover */
  --y-700: #D99A00;   /* pressed / on-white text-safe */
  --y-800: #B37E00;
  --y-900: #8A6100;

  /* ── 2.2 Neutral — Warm charcoal ── */
  --ink:    #0F172A;  /* primary text */
  --ink-2:  #334155;  /* secondary text */
  --ink-3:  #64748B;  /* muted text */
  --ink-4:  #94A3B8;  /* disabled / hint */

  --paper:  #FFFFFF;
  --paper-2:#FDFDFC;  /* warm off-white surface */
  --paper-3:#F7F7F5;  /* subtle panel */
  --paper-4:#F1F0EE;  /* chip / divider surface */

  --line:   #E7E5E4;  /* default border */
  --line-2: #F1F0EE;  /* hairline */
  --line-3: #D6D3D1;  /* stronger border */

  /* ── 2.3 Semantic colors ── */
  --success:      #15803D;
  --success-bg:   #F0FDF4;
  --success-line: #BBF7D0;

  --warning:      #B45309;
  --warning-bg:   #FFFBEB;
  --warning-line: #FDE68A;

  --danger:       #B91C1C;
  --danger-bg:    #FEF2F2;
  --danger-line:  #FECACA;

  --info:         #1D4ED8;
  --info-bg:      #EFF6FF;
  --info-line:    #BFDBFE;

  /* ── 2.4 Focus ring ── */
  --focus-ring: 0 0 0 3px var(--paper), 0 0 0 6px var(--y-500);
  --focus-ring-inset: inset 0 0 0 2px var(--y-500);

  /* ── 2.5 Typography — system font stacks only ── */
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-display: var(--font-body);
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  /* ── 2.6 Fluid type scale (clamp = no CLS, no media queries needed) ── */
  --fs-3xs: clamp(0.625rem, 0.60rem + 0.12vw, 0.6875rem);   /* 10 → 11 */
  --fs-2xs: clamp(0.6875rem, 0.66rem + 0.14vw, 0.75rem);    /* 11 → 12 */
  --fs-xs:  clamp(0.75rem,  0.72rem + 0.15vw, 0.8125rem);   /* 12 → 13 */
  --fs-sm:  clamp(0.8125rem,0.79rem + 0.18vw, 0.875rem);    /* 13 → 14 */
  --fs-md:  clamp(0.875rem, 0.84rem + 0.20vw, 0.9375rem);   /* 14 → 15 */
  --fs-body:clamp(0.9375rem,0.90rem + 0.22vw, 1rem);        /* 15 → 16 */
  --fs-lg:  clamp(1rem,    0.96rem + 0.28vw, 1.0625rem);    /* 16 → 17 */
  --fs-xl:  clamp(1.0625rem,1.01rem + 0.34vw, 1.1875rem);   /* 17 → 19 */
  --fs-2xl: clamp(1.25rem, 1.15rem + 0.50vw, 1.5rem);       /* 20 → 24 */
  --fs-3xl: clamp(1.5rem,  1.35rem + 0.75vw, 1.875rem);     /* 24 → 30 */
  --fs-4xl: clamp(1.875rem,1.60rem + 1.35vw, 2.5rem);       /* 30 → 40 */
  --fs-5xl: clamp(2.25rem, 1.85rem + 2.00vw, 3.25rem);      /* 36 → 52 */
  --fs-6xl: clamp(2.75rem, 2.10rem + 3.25vw, 4.5rem);       /* 44 → 72 */
  --fs-7xl: clamp(3.25rem, 2.30rem + 4.75vw, 5.5rem);       /* 52 → 88 */

  /* ── 2.7 Line heights ── */
  --lh-none:  1;
  --lh-tight: 1.15;
  --lh-snug:  1.3;
  --lh-body:  1.6;
  --lh-relaxed: 1.75;

  /* ── 2.8 Letter spacing ── */
  --ls-tighter: -0.03em;
  --ls-tight:   -0.015em;
  --ls-normal:   0;
  --ls-wide:     0.02em;
  --ls-wider:    0.05em;
  --ls-widest:   0.10em;

  /* ── 2.9 Font weights ── */
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semibold:600;
  --fw-bold:    700;
  --fw-extrabold:800;
  --fw-black:   900;

  /* ── 2.10 Spacing scale (4px base) ── */
  --s-0:  0;
  --s-1:  0.25rem;   /*  4 */
  --s-2:  0.5rem;    /*  8 */
  --s-3:  0.75rem;   /* 12 */
  --s-4:  1rem;      /* 16 */
  --s-5:  1.25rem;   /* 20 */
  --s-6:  1.5rem;    /* 24 */
  --s-7:  1.75rem;   /* 28 */
  --s-8:  2rem;      /* 32 */
  --s-9:  2.25rem;   /* 36 */
  --s-10: 2.5rem;    /* 40 */
  --s-11: 2.75rem;   /* 44 */
  --s-12: 3rem;      /* 48 */
  --s-14: 3.5rem;    /* 56 */
  --s-16: 4rem;      /* 64 */
  --s-20: 5rem;      /* 80 */
  --s-24: 6rem;      /* 96 */
  --s-32: 8rem;      /* 128 */

  /* ── 2.11 Fluid section rhythm ── */
  --section-y: clamp(3rem, 5vw + 1rem, 6rem);
  --section-y-tight: clamp(2rem, 3vw + 0.5rem, 3.5rem);

  /* ── 2.12 Radii ── */
  --r-xs:  4px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 28px;
  --r-3xl: 36px;
  --r-pill: 999px;
  --r-circle: 50%;

  /* ── 2.13 Shadows — soft, yellow-tinted, never muddy ── */
  --shadow-xs:  0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:  0 6px 16px -4px rgba(15, 23, 42, 0.10), 0 3px 8px -4px rgba(15, 23, 42, 0.06);
  --shadow-lg:  0 16px 32px -12px rgba(15, 23, 42, 0.14), 0 6px 14px -8px rgba(15, 23, 42, 0.08);
  --shadow-xl:  0 28px 56px -20px rgba(15, 23, 42, 0.20), 0 12px 24px -12px rgba(15, 23, 42, 0.10);
  --shadow-2xl: 0 48px 80px -32px rgba(15, 23, 42, 0.28);
  --shadow-yellow: 0 6px 20px -8px rgba(245, 179, 1, 0.55);
  --shadow-yellow-lg: 0 14px 36px -12px rgba(245, 179, 1, 0.55);

  /* ── 2.14 Transitions ── */
  --t-fast:  120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base:  180ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow:  280ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── 2.15 Layout containers ── */
  --page-max:    1180px;
  --page-max-wide: 1360px;
  --page-max-narrow: 780px;
  --page-pad: clamp(1rem, 4vw, 2rem);
  --content-measure: 68ch;
  --content-measure-tight: 58ch;

  /* ── 2.16 Z-index scale ── */
  --z-below:   -1;
  --z-base:     0;
  --z-raised:   10;
  --z-sticky:   50;
  --z-header:   100;
  --z-dropdown: 200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
  --z-tooltip:  600;
  --z-skip:     9999;

  /* ── 2.17 Component tokens ── */
  --header-h: 64px;
  --focus-offset: 2px;

  /* ── 2.18 Color scheme hints ── */
  color-scheme: light;
  accent-color: var(--y-500);
}

@media (min-width: 768px) {
  :root { --header-h: 72px; }
}

@media (min-width: 1024px) {
  :root { --header-h: 76px; }
}

/* ── 3. Media defaults ──────────────────────────────────────────────────── */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

img {
  border-style: none;
  font-style: italic;              /* alt-text fallback style */
  background-repeat: no-repeat;
  background-size: cover;
  shape-margin: 0.75rem;
}

svg { fill: currentColor; }

/* ── 4. Form elements — inherit fonts, kill platform quirks ─────────────── */
input,
button,
textarea,
select,
optgroup {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  margin: 0;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  appearance: button;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: inherit;
}

button:disabled,
[type="button"]:disabled,
[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

::-webkit-file-upload-button {
  -webkit-appearance: button;
  font: inherit;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
  overflow: auto;
  vertical-align: top;
}

select {
  cursor: pointer;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

label {
  cursor: pointer;
}

progress {
  vertical-align: baseline;
}

/* Placeholder contrast: ≥ 4.5:1 */
::placeholder {
  color: var(--ink-4);
  opacity: 1;
}

/* Remove number spinners where used */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Autofill: keep yellow identity instead of Chrome's blue */
:-webkit-autofill,
:-webkit-autofill:hover,
:-webkit-autofill:focus,
:-webkit-autofill:active {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--y-50) inset;
  box-shadow: 0 0 0 1000px var(--y-50) inset;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: var(--ink);
}

/* ── 5. Headings — fluid, tight, no default margins ────────────────────── */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-tighter);
}

h2 {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
}

h3 {
  font-size: var(--fs-2xl);
}

h4 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
}

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

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

/* ── 6. Body copy elements ──────────────────────────────────────────────── */
p {
  margin: 0;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

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

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

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

em, i { font-style: italic; }

mark {
  background: var(--y-200);
  color: var(--ink);
  padding: 0.05em 0.3em;
  border-radius: var(--r-xs);
}

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

sub, sup {
  font-size: 0.72em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub { bottom: -0.28em; }
sup { top: -0.5em; }

/* ── 7. Links ───────────────────────────────────────────────────────────── */
a {
  color: var(--ink);
  text-decoration: none;
  transition: color var(--t-fast), background-color var(--t-fast), opacity var(--t-fast);
}

a:hover {
  color: var(--y-700);
}

a:active {
  color: var(--y-800);
}

a.link-underline,
.content a {
  text-decoration: underline;
  text-decoration-color: var(--y-400);
  text-decoration-thickness: 0.11em;
  text-underline-offset: 0.18em;
  border-radius: var(--r-xs);
}

a.link-underline:hover,
.content a:hover {
  text-decoration-color: var(--y-600);
  color: var(--y-800);
}

/* ── 8. Lists ───────────────────────────────────────────────────────────── */
ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.content ul,
.content ol {
  padding-left: 1.35em;
}

.content ul { list-style: disc; }
.content ol { list-style: decimal; }

.content li + li { margin-top: 0.4em; }

.content li::marker {
  color: var(--y-600);
  font-weight: var(--fw-semibold);
}

/* ── 9. Tables ──────────────────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

caption {
  text-align: left;
  font-size: var(--fs-sm);
  color: var(--ink-3);
  padding-bottom: var(--s-2);
}

th, td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}

th {
  font-weight: var(--fw-semibold);
  color: var(--ink-2);
  background: var(--paper-3);
}

thead th {
  border-bottom-color: var(--line);
}

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

/* ── 11. Code & pre ─────────────────────────────────────────────────────── */
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--paper-4);
  padding: 0.12em 0.38em;
  border-radius: var(--r-xs);
  color: var(--ink-2);
}

kbd {
  background: var(--ink);
  color: var(--paper);
  padding: 0.15em 0.45em;
  border-radius: var(--r-xs);
  font-size: 0.82em;
  font-weight: var(--fw-semibold);
}

pre {
  background: var(--ink);
  color: #F1F5F9;
  padding: var(--s-5);
  border-radius: var(--r-md);
  overflow-x: auto;
  line-height: 1.55;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* ── 12. Details / summary ──────────────────────────────────────────────── */
details {
  border-radius: var(--r-md);
}

summary {
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker { display: none; }

summary::marker { content: ""; }

/* ── 13. Focus visibility — global & accessible ─────────────────────────── */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--y-500);
  outline-offset: var(--focus-offset);
  border-radius: var(--r-sm);
}

/* Elements that manage their own ring */
.ring-focus:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: var(--z-skip);
}

.skip-link:focus,
.skip-link:focus-visible {
  position: fixed;
  left: var(--s-4);
  top: var(--s-4);
  width: auto;
  height: auto;
  overflow: visible;
  background: var(--ink);
  color: var(--paper);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  outline: 3px solid var(--y-500);
  outline-offset: 3px;
}

/* ── 14. Selection ──────────────────────────────────────────────────────── */
::selection {
  background: var(--y-300);
  color: var(--ink);
}

::-moz-selection {
  background: var(--y-300);
  color: var(--ink);
}

/* ── 15. Scrollbars (progressive enhancement) ───────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--line-3);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--ink-4);
  background-clip: content-box;
}

/* ── 16. Motion preferences — global kill switch ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 17. Print base (full rules live in print.css) ──────────────────────── */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
}

/* ── 18. Utility: visibility helpers ────────────────────────────────────── */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] { display: none !important; }

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

/* ── 19. Content-visibility optimisation for below-fold sections ───────── */
.cv-auto {
  content-visibility: auto;
  contain-intrinsic-size: 1px 900px;
}

.cv-auto-sm {
  content-visibility: auto;
  contain-intrinsic-size: 1px 400px;
}

/* ── 20. Text truncation helpers ────────────────────────────────────────── */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-1,
.line-clamp-2,
.line-clamp-3,
.line-clamp-4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.line-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }
.line-clamp-4 { -webkit-line-clamp: 4; line-clamp: 4; }

/* ── 21. Numeric alignment helper ───────────────────────────────────────── */
.tnum { font-variant-numeric: tabular-nums; }