/* ============================================================================
   EVIDENT CORE STYLES
   Minimal, accessible base layer — depends on tokens.css
   Conservative resets, typography, containers, accessibility, print
   ============================================================================ */

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: var(--text-base, 1rem);
  line-height: var(--line-height-normal, 1.6);
  color: var(--color-fg, #1a1a2e);
  background-color: var(--color-bg, #ffffff);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

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

img {
  height: auto;
}

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

/* ===== LAYOUT CONTAINERS ===== */
.evident-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--container-max, 1200px);
  margin-inline: auto;
  padding-inline: var(--space-4, 1rem);
}

.container-narrow {
  max-width: var(--container-narrow, 720px);
}

.container-wide {
  max-width: var(--container-wide, 1400px);
}

main,
.main-content {
  width: 100%;
  flex: 1;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-4, 1rem) 0;
  font-weight: var(--font-weight-bold, 700);
  line-height: var(--line-height-tight, 1.2);
  color: var(--color-fg, #1a1a2e);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 2.5vw + 1rem, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 2vw + 0.75rem, 2.25rem);
}

h3 {
  font-size: clamp(1.15rem, 1.2vw + 0.5rem, 1.5rem);
}

h4 {
  font-size: 1.125rem;
}

p {
  margin: 0 0 var(--space-4, 1rem) 0;
  line-height: var(--line-height-relaxed, 1.7);
  text-wrap: pretty;
}

small {
  font-size: 0.875em;
}

strong {
  font-weight: 600;
}

a {
  color: var(--color-primary, #0b73d2);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover, #084a92);
}

a:focus-visible {
  outline: 2px solid var(--color-primary, #0b73d2);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== SELECTION ===== */
::selection {
  background: rgba(11, 115, 210, 0.15);
  color: inherit;
}

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

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

.skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: var(--color-primary, #0b73d2);
  color: #fff;
  border-radius: 0.375rem;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

:where(button, input, textarea, select):focus-visible {
  outline: 2px solid var(--color-primary, #0b73d2);
  outline-offset: 2px;
}

/* ===== UTILITIES ===== */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 1rem);
}

.cluster {
  display: flex;
  gap: var(--space-4, 1rem);
  flex-wrap: wrap;
  align-items: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== REDUCED MOTION ===== */
@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;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .no-print,
  .skip-link {
    display: none !important;
  }

  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
  }

  abbr[title]::after {
    content: ' (' attr(title) ')';
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  img {
    max-width: 100% !important;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

