/* ============================================================================
   MITCON Credensia — Modern CSS Reset
   ----------------------------------------------------------------------------
   Based on Josh Comeau's reset, with WCAG-specific adjustments:
   - Preserves form font inheritance (avoids 16px input zoom on iOS)
   - Respects prefers-reduced-motion at the property level
   - Removes outline ONLY when polyfilled focus-visible is present
   ============================================================================ */

/* 1. BOX SIZING — predictable layout math */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. REMOVE DEFAULT MARGINS */
* {
  margin: 0;
}

/* 3. ROOT — smooth scroll + base font size */
html {
  /* Allow user font-size override (16px default = 1rem). NEVER set in px. */
  -webkit-text-size-adjust: 100%;        /* prevent iOS zoom on landscape */
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;

  /* Smooth scroll for anchor jumps. Disabled if user prefers reduced motion. */
  scroll-behavior: smooth;

  /* Improve readability on retina + non-retina */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* 4. BODY DEFAULTS */
body {
  min-height: 100vh;
  min-height: 100dvh;                    /* mobile-safe — accounts for browser chrome */
  line-height: var(--lh-normal);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--color-text);
  background-color: var(--color-bg);

  /* Prevent horizontal scroll bugs from rogue elements */
  overflow-x: hidden;
}

/* 5. MEDIA — sane defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Default img height auto can cause CLS (Cumulative Layout Shift).
   Use width/height attrs in HTML to reserve space. */

/* 6. FORM ELEMENTS — inherit fonts (browser defaults break this) */
input,
button,
textarea,
select {
  font: inherit;                         /* CRITICAL — fixes iOS 16px input zoom */
  color: inherit;
}

/* Button reset — removes browser-specific styles. Component CSS adds back. */
button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* Textarea — disable manual resize (let CSS control) */
textarea {
  resize: vertical;
  min-height: 6rem;
}

/* 7. TEXT WRAPPING — prevent long words breaking layouts */
p,
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Headings shouldn't auto-balance unless we say so */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;                    /* Modern browsers — better headline wrapping */
}

p {
  text-wrap: pretty;                     /* Better paragraph rag — Chrome 117+ */
}

/* 8. LISTS — remove default markers ONLY for navigation (preserve in content) */
ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

/* 9. ANCHORS — remove default underline; component CSS or .text-link adds back */
a {
  color: inherit;
  text-decoration: none;
}

/* 10. TABLES — sensible defaults */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* 11. ROOT STACKING CONTEXT — for portals, modals, tooltips */
#root,
#__next,
main {
  isolation: isolate;
}

/* 12. PRINT — hide non-essential UI */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

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

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

  /* Don't print URLs for fragment links */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  thead {
    display: table-header-group;
  }

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

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

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

  /* Hide nav, footer, announcement bar, buttons when printing */
  nav,
  footer,
  .announcement-bar,
  .btn,
  button,
  [role="banner"],
  [role="contentinfo"] {
    display: none !important;
  }
}

/* 13. SELECTION COLORS (keep brand visible when text is selected) */
::selection {
  background-color: var(--color-primary);
  color: #FFFFFF;
}