/* ==========================================================================
   Base — Modern CSS reset + typography + element defaults
   Built on top of tokens.css
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  font-size: 16px;
}

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

body {
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  letter-spacing: var(--tracking-normal);
  color: var(--text-primary);
  background-color: var(--surface-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
  font-variant-ligatures: common-ligatures;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

svg {
  flex-shrink: 0;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

p,
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* Typography scale */
h1, .h1 {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  font-family: var(--font-display);
}
h2, .h2 {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  font-family: var(--font-display);
}
h3, .h3 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
}
h4, .h4 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}
h5, .h5 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}
h6, .h6 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}

p {
  line-height: var(--lh-normal);
  color: var(--text-primary);
}

.text-muted {
  color: var(--text-tertiary);
}

.lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
}

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

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

/* Links */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover {
  color: var(--text-link-hover);
}
a:focus-visible {
  outline: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Selection */
::selection {
  background: color-mix(in srgb, var(--brand-500) 26%, transparent);
  color: var(--text-primary);
}

/* Focus ring for keyboard users */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 var(--ring-width) var(--ring-color);
  border-radius: var(--r-md);
  transition: box-shadow var(--dur-fast) var(--ease-out);
}

/* HR */
hr {
  border: none;
  border-top: 1px solid var(--border-base);
  margin: var(--sp-6) 0;
}

/* Code / Mono */
code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: 0.925em;
}

code {
  padding: 0.15em 0.35em;
  background: color-mix(in srgb, var(--brand-500) 10%, transparent);
  border-radius: var(--r-sm);
  color: var(--text-primary);
}

kbd {
  padding: 0.15em 0.4em;
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  border-radius: var(--r-sm);
  box-shadow: 0 1px 0 var(--border-base);
  font-size: 0.8em;
  color: var(--text-secondary);
}

/* Lists (reset for app context) */
ul,
ol {
  padding-left: 1.25rem;
}
.list-reset {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Images/media */
img {
  height: auto;
}

/* Scrollbar custom */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--r-full);
  border: 2px solid var(--surface-app);
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Accessibility 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;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  padding: var(--sp-2) var(--sp-4);
  background: var(--brand-600);
  color: #ffffff;
  border-radius: var(--r-md);
  font-weight: var(--fw-semibold);
  z-index: var(--z-tooltip);
  transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus {
  top: 1rem;
  color: #ffffff;
}

/* Prevent layout shift for no-JS Lucide icons */
[data-lucide] {
  width: 1.125rem;
  height: 1.125rem;
  stroke-width: 2;
}

/* Selection for images: disable during drag */
.no-drag {
  -webkit-user-drag: none;
  user-select: none;
}
