/* ============================================================================
   ICOPAD — Base v1
   Reset, typography, accessibility, motion preferences.
   ============================================================================ */

*, *::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-height-mobile) + 1rem);
  font-feature-settings: "cv11", "ss01";
}

@media (min-width: 1024px) {
  html { scroll-padding-top: calc(var(--header-height) + 1rem); }
}

body {
  min-height: 100dvh;
  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;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "cv11" 1, "ss01" 1;
  transition: background-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}

/* ── Typography ───────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-4);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: clamp(1.75rem, 1.4rem + 2vw, 3rem); font-weight: var(--fw-bold); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.4rem, 1.2rem + 1.2vw, 2.25rem); letter-spacing: -0.02em; margin-top: var(--space-10); }
h3 { font-size: clamp(1.15rem, 1.05rem + 0.6vw, 1.5rem); margin-top: var(--space-8); }
h4 { font-size: clamp(1rem, 0.95rem + 0.3vw, 1.25rem); margin-top: var(--space-6); }
h5 { font-size: var(--fs-lg); margin-top: var(--space-5); }
h6 {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-muted);
  margin-top: var(--space-5);
}

p { margin: 0 0 var(--space-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-base);
  color: var(--text-muted);
  letter-spacing: var(--tracking-snug);
}

small, .text-sm { font-size: var(--fs-sm); }
strong, b { font-weight: var(--fw-semibold); }
em, i { font-style: italic; }

abbr[title] {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
}

/* ── Links ─────────────────────────────────────────────────────────── */

a {
  color: var(--brand);
  text-decoration: none;
  text-underline-offset: 3px;
  font-weight: var(--fw-medium);
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

/* ── Media ─────────────────────────────────────────────────────────── */

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* ── Code ──────────────────────────────────────────────────────────── */

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

code {
  background: var(--bg-muted);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: var(--fw-medium);
}

pre {
  background: var(--bg-muted);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  line-height: var(--lh-snug);
  margin: var(--space-5) 0;
  border: 1px solid var(--border-subtle);
}
pre code { background: none; padding: 0; }

/* ── Blockquote / hr ───────────────────────────────────────────────── */

blockquote {
  border-left: 3px solid var(--brand);
  padding-left: var(--space-5);
  margin: var(--space-6) 0;
  font-size: var(--fs-lg);
  font-style: italic;
  color: var(--text-muted);
  line-height: var(--lh-base);
}

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: var(--space-8) 0;
}

/* ── Lists ─────────────────────────────────────────────────────────── */

ul, ol { padding-left: var(--space-6); margin: 0 0 var(--space-4); }
li + li { margin-top: var(--space-1); }
ul li::marker, ol li::marker { color: var(--text-subtle); }

/* ── Tables ────────────────────────────────────────────────────────── */

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

/* ── Forms ─────────────────────────────────────────────────────────── */

input, button, textarea, select {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; }

fieldset { border: 0; padding: 0; margin: 0; }
legend {
  padding: 0;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-lg);
  margin-bottom: var(--space-3);
}

/* ── Selection & focus ─────────────────────────────────────────────── */

::selection { background: var(--brand); color: var(--brand-ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ── Scrollbar ─────────────────────────────────────────────────────── */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ── Reduced motion ────────────────────────────────────────────────── */

@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;
  }
}

/* ── Print ─────────────────────────────────────────────────────────── */

@media print {
  body { background: white; color: black; font-size: 11pt; }
  a { color: black; text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 90%; color: #666; }
  .app-header, .app-drawer, .site-footer, .app-sidebar, .no-print { display: none !important; }
  main { padding: 0; }
  h1, h2, h3 { page-break-after: avoid; }
  img, table, figure { page-break-inside: avoid; }
}

/* ── Accessibility helpers ─────────────────────────────────────────── */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-3) var(--space-5);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-md);
  transition: top var(--dur-base) var(--ease-out);
  box-shadow: var(--shadow-lg);
}
.skip-link:focus { top: var(--space-4); }