/* ==========================================================================
   Advoke CV — Base layer
   Reset + document defaults + accessible typography primitives.
   Consumes tokens.css. Never hardcodes colours or spacing.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BOX MODEL RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   2. DOCUMENT
   -------------------------------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h-mobile) + var(--sp-4));
  tab-size: 4;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 768px) {
  html {
    scroll-padding-top: calc(var(--header-h-desktop) + var(--sp-6));
  }
}

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

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

body.no-scroll {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   3. MEDIA DEFAULTS
   -------------------------------------------------------------------------- */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  font-style: italic;
  background-repeat: no-repeat;
  background-size: cover;
  shape-margin: var(--sp-2);
}

svg {
  fill: currentColor;
}

iframe {
  border: 0;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   4. FORMS — inherit typography
   -------------------------------------------------------------------------- */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  text-align: inherit;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

textarea {
  resize: vertical;
  min-height: 6rem;
}

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

legend {
  padding: 0;
}

/* --------------------------------------------------------------------------
   5. TEXT ELEMENTS
   -------------------------------------------------------------------------- */
p {
  line-height: var(--lh-relaxed);
  text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: inherit;
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--fs-5xl);
  letter-spacing: var(--ls-tighter);
}

h2 {
  font-size: var(--fs-4xl);
  letter-spacing: var(--ls-tighter);
}

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

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

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

h6 {
  font-size: var(--fs-lg);
}

small {
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}

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

em,
i {
  font-style: italic;
}

mark {
  background: var(--c-amber-50);
  color: var(--text-primary);
  padding: 0 var(--sp-1);
  border-radius: var(--radius-xs);
}

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

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

code {
  background: var(--surface-sunken);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

pre {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  overflow-x: auto;
  line-height: var(--lh-relaxed);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
}

blockquote {
  border-left: 3px solid var(--border-accent);
  padding-left: var(--sp-5);
  color: var(--text-secondary);
  font-style: italic;
  line-height: var(--lh-relaxed);
}

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: var(--sp-6) 0;
}

/* --------------------------------------------------------------------------
   6. LISTS
   -------------------------------------------------------------------------- */
ul,
ol {
  padding-left: 1.35em;
  line-height: var(--lh-relaxed);
}

li + li {
  margin-top: var(--sp-1);
}

li::marker {
  color: var(--text-tertiary);
}

ul.clean,
ol.clean {
  list-style: none;
  padding-left: 0;
}

ul.clean li + li,
ol.clean li + li {
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   7. TABLES
   -------------------------------------------------------------------------- */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}

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

th {
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  background: var(--surface-sunken);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   8. LINKS
   -------------------------------------------------------------------------- */
a {
  color: var(--text-link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition:
    color var(--dur-fast) var(--ease-standard),
    text-decoration-color var(--dur-fast) var(--ease-standard);
}

a:hover {
  color: var(--text-link-hover);
  text-decoration-thickness: 2px;
}

a:visited {
  color: var(--text-link);
}

a.no-underline {
  text-decoration: none;
}

a.no-underline:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   9. FOCUS VISIBILITY — never removed, always accessible
   -------------------------------------------------------------------------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-xs);
  transition: none;
}

/* Restore native focus for browsers that ignore :focus-visible selectors
   on keyboard input for older engines. */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* --------------------------------------------------------------------------
   10. SELECTION
   -------------------------------------------------------------------------- */
::selection {
  background: var(--c-blue-100);
  color: var(--c-navy-900);
}

::-moz-selection {
  background: var(--c-blue-100);
  color: var(--c-navy-900);
}

/* --------------------------------------------------------------------------
   11. SCROLLBARS — subtle, only on capable devices
   -------------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--c-neutral-300) transparent;
  }

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

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

  *::-webkit-scrollbar-thumb {
    background: var(--c-neutral-300);
    border-radius: var(--radius-full);
    border: 2px solid var(--surface-page);
  }

  *::-webkit-scrollbar-thumb:hover {
    background: var(--c-neutral-400);
  }
}

/* --------------------------------------------------------------------------
   12. ACCESSIBILITY UTILITIES
   -------------------------------------------------------------------------- */

/* Visually hidden but available to screen readers */
.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;
}

/* Focusable when a keyboard user tabs onto it */
.sr-only-focusable:focus,
.sr-only-focusable:focus-visible,
.sr-only.focusable:focus,
.sr-only.focusable:focus-visible {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: var(--sp-3) var(--sp-5) !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  white-space: normal !important;
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* Skip link — first focusable element on every page */
.skip-link {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: var(--z-toast);
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-navy-900);
  color: var(--c-white);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-base) var(--ease-standard);
  box-shadow: var(--shadow-lg);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid var(--c-blue-500);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   13. MOTION PREFERENCES
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   14. TEXT-LEVEL UTILITY CLASSES
   -------------------------------------------------------------------------- */
.u-text-center  { text-align: center; }
.u-text-left    { text-align: left; }
.u-text-right   { text-align: right; }

.u-text-xs      { font-size: var(--fs-xs); }
.u-text-sm      { font-size: var(--fs-sm); }
.u-text-lg      { font-size: var(--fs-lg); }
.u-text-xl      { font-size: var(--fs-xl); }

.u-text-muted    { color: var(--text-tertiary); }
.u-text-secondary{ color: var(--text-secondary); }
.u-text-accent   { color: var(--text-accent); }
.u-text-danger   { color: var(--text-danger); }
.u-text-success  { color: var(--text-success); }

.u-weight-medium   { font-weight: var(--fw-medium); }
.u-weight-semibold { font-weight: var(--fw-semibold); }
.u-weight-bold     { font-weight: var(--fw-bold); }

.u-uppercase   { text-transform: uppercase; letter-spacing: var(--ls-wide); }
.u-capitalize  { text-transform: capitalize; }
.u-balance     { text-wrap: balance; }
.u-pretty      { text-wrap: pretty; }

.u-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.u-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-nowrap   { white-space: nowrap; }
.u-break    { overflow-wrap: anywhere; word-break: break-word; }

/* --------------------------------------------------------------------------
   15. DISPLAY / FLEX / GRID UTILITIES
   -------------------------------------------------------------------------- */
.u-hidden        { display: none !important; }
.u-block         { display: block; }
.u-inline        { display: inline; }
.u-inline-block  { display: inline-block; }
.u-flex          { display: flex; }
.u-inline-flex   { display: inline-flex; }
.u-grid          { display: grid; }

.u-flex-col     { flex-direction: column; }
.u-flex-wrap    { flex-wrap: wrap; }
.u-items-center { align-items: center; }
.u-items-start  { align-items: flex-start; }
.u-items-end    { align-items: flex-end; }
.u-items-stretch{ align-items: stretch; }
.u-justify-center  { justify-content: center; }
.u-justify-between { justify-content: space-between; }
.u-justify-end     { justify-content: flex-end; }
.u-justify-start   { justify-content: flex-start; }
.u-flex-1       { flex: 1 1 0%; }
.u-flex-none    { flex: none; }

.u-gap-1 { gap: var(--sp-1); }
.u-gap-2 { gap: var(--sp-2); }
.u-gap-3 { gap: var(--sp-3); }
.u-gap-4 { gap: var(--sp-4); }
.u-gap-6 { gap: var(--sp-6); }
.u-gap-8 { gap: var(--sp-8); }

/* --------------------------------------------------------------------------
   16. SPACING UTILITIES
   -------------------------------------------------------------------------- */
.u-mt-0 { margin-top: 0; }
.u-mt-2 { margin-top: var(--sp-2); }
.u-mt-4 { margin-top: var(--sp-4); }
.u-mt-6 { margin-top: var(--sp-6); }
.u-mt-8 { margin-top: var(--sp-8); }

.u-mb-0 { margin-bottom: 0; }
.u-mb-2 { margin-bottom: var(--sp-2); }
.u-mb-4 { margin-bottom: var(--sp-4); }
.u-mb-6 { margin-bottom: var(--sp-6); }
.u-mb-8 { margin-bottom: var(--sp-8); }

.u-mt-auto { margin-top: auto; }
.u-ml-auto { margin-left: auto; }
.u-mr-auto { margin-right: auto; }
.u-mx-auto { margin-left: auto; margin-right: auto; }

.u-p-0 { padding: 0; }
.u-p-4 { padding: var(--sp-4); }
.u-p-6 { padding: var(--sp-6); }
.u-p-8 { padding: var(--sp-8); }

/* --------------------------------------------------------------------------
   17. WIDTH / SIZE UTILITIES
   -------------------------------------------------------------------------- */
.u-w-full   { width: 100%; }
.u-w-auto   { width: auto; }
.u-max-w-full { max-width: 100%; }

.u-h-full { height: 100%; }
.u-min-h-screen { min-height: 100vh; min-height: 100dvh; }

/* --------------------------------------------------------------------------
   18. POSITION UTILITIES
   -------------------------------------------------------------------------- */
.u-relative { position: relative; }
.u-absolute { position: absolute; }
.u-fixed    { position: fixed; }
.u-sticky   { position: sticky; }

.u-inset-0  { inset: 0; }

/* --------------------------------------------------------------------------
   19. OVERFLOW UTILITIES
   -------------------------------------------------------------------------- */
.u-overflow-hidden  { overflow: hidden; }
.u-overflow-auto    { overflow: auto; }
.u-overflow-x-auto  { overflow-x: auto; overflow-y: hidden; }
.u-overflow-y-auto  { overflow-y: auto; overflow-x: hidden; }

/* --------------------------------------------------------------------------
   20. BORDER & RADIUS UTILITIES
   -------------------------------------------------------------------------- */
.u-border       { border: 1px solid var(--border-subtle); }
.u-border-top   { border-top: 1px solid var(--border-subtle); }
.u-border-bottom{ border-bottom: 1px solid var(--border-subtle); }
.u-border-none  { border: none; }

.u-radius-sm { border-radius: var(--radius-sm); }
.u-radius-md { border-radius: var(--radius-md); }
.u-radius-lg { border-radius: var(--radius-lg); }
.u-radius-xl { border-radius: var(--radius-xl); }
.u-radius-full { border-radius: var(--radius-full); }

/* --------------------------------------------------------------------------
   21. SURFACE UTILITIES
   -------------------------------------------------------------------------- */
.u-surface-raised { background: var(--surface-raised); }
.u-surface-sunken { background: var(--surface-sunken); }
.u-surface-muted  { background: var(--surface-muted); }

.u-shadow-sm { box-shadow: var(--shadow-sm); }
.u-shadow-md { box-shadow: var(--shadow-md); }
.u-shadow-lg { box-shadow: var(--shadow-lg); }

/* --------------------------------------------------------------------------
   22. RESPONSIVE VISIBILITY
   -------------------------------------------------------------------------- */
.u-show-mobile-only  { display: initial; }
.u-hide-mobile-only  { display: none; }

@media (min-width: 480px) {
  .u-hide-xs-up { display: none !important; }
}

@media (min-width: 768px) {
  .u-show-mobile-only { display: none !important; }
  .u-hide-mobile-only { display: initial; }
  .u-hide-md-up       { display: none !important; }
}

@media (min-width: 1024px) {
  .u-hide-lg-up { display: none !important; }
}

@media (max-width: 767px) {
  .u-hide-below-md { display: none !important; }
}

@media (max-width: 1023px) {
  .u-hide-below-lg { display: none !important; }
}

/* --------------------------------------------------------------------------
   23. LOADING & SKELETON PRIMITIVES
   -------------------------------------------------------------------------- */
@keyframes advoke-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes advoke-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes advoke-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

@keyframes advoke-spin {
  to { transform: rotate(360deg); }
}

@keyframes advoke-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.u-fade-in  { animation: advoke-fade-in var(--dur-base) var(--ease-decelerate) both; }
.u-fade-up  { animation: advoke-fade-up var(--dur-slow) var(--ease-decelerate) both; }

.u-skeleton {
  background: linear-gradient(
    90deg,
    var(--c-neutral-150) 0%,
    var(--c-neutral-100) 40%,
    var(--c-neutral-150) 80%
  );
  background-size: 800px 100%;
  animation: advoke-shimmer 1.4s linear infinite;
  border-radius: var(--radius-md);
  color: transparent;
  user-select: none;
}

/* --------------------------------------------------------------------------
   24. PRINT RESET (thin — full print rules live in print.css)
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .skip-link,
  .no-print {
    display: none !important;
  }
}