/* ==========================================================================
   BASE — Modern CSS Reset + Base Typography
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Box-Sizing Reset
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   2. Remove Default Margins & Paddings
   -------------------------------------------------------------------------- */

html,
body,
h1, h2, h3, h4, h5, h6,
p,
blockquote,
pre,
dl, dd,
ol, ul,
figure,
fieldset,
legend,
menu {
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   3. Document & Smooth Scrolling
   -------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* --------------------------------------------------------------------------
   4. Body
   -------------------------------------------------------------------------- */

body {
  font-family: var(--font-secondary);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--color-text-dark);
  background-color: var(--color-white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   5. Headings
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  color: var(--color-navy);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-hero); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

/* --------------------------------------------------------------------------
   6. Paragraphs & Prose
   -------------------------------------------------------------------------- */

p {
  text-wrap: pretty;
}

p + p {
  margin-top: var(--space-4);
}

/* --------------------------------------------------------------------------
   7. Links
   -------------------------------------------------------------------------- */

a {
  color: var(--color-blue-accent);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-navy);
}

/* --------------------------------------------------------------------------
   8. Lists
   -------------------------------------------------------------------------- */

ol,
ul {
  list-style: none;
}

/* --------------------------------------------------------------------------
   9. Images & Media
   -------------------------------------------------------------------------- */

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

img {
  font-style: italic;              /* fallback alt text styling */
  background-repeat: no-repeat;
  background-size: cover;
  shape-margin: 0.75rem;
}

/* --------------------------------------------------------------------------
   10. Form Elements Reset
   -------------------------------------------------------------------------- */

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

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

textarea {
  resize: vertical;
}

fieldset {
  border: none;
}

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* --------------------------------------------------------------------------
   12. Focus-Visible Outline
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--color-blue-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   13. Selection Styles
   -------------------------------------------------------------------------- */

::selection {
  background-color: var(--color-navy);
  color: var(--color-white);
}

::-moz-selection {
  background-color: var(--color-navy);
  color: var(--color-white);
}

/* --------------------------------------------------------------------------
   14. Skip-to-Content Link
   -------------------------------------------------------------------------- */

.skip-to-content {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-white);
  background-color: var(--color-navy);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: 0;
  outline: 2px solid var(--color-blue-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   15. Screen Reader Only
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   16. Reduced 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;
  }
}

/* --------------------------------------------------------------------------
   17. Misc
   -------------------------------------------------------------------------- */

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

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

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

em,
i {
  font-style: italic;
}

small {
  font-size: var(--fs-xs);
}

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

pre {
  overflow-x: auto;
  padding: var(--space-4);
  background-color: var(--color-bg-dark);
  color: var(--color-white);
  border-radius: var(--radius-md);
}

blockquote {
  border-left: 4px solid var(--color-crimson);
  padding-left: var(--space-6);
  font-style: italic;
  color: var(--color-text-muted);
}

/* Remove default search input appearance */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}
