/* =====================================================================
   NWBC Base Stylesheet
   =====================================================================
   Resets, base typography, and HTML element defaults. Loads after
   tokens.css. Components and patterns build on this foundation.
   ===================================================================== */

/* ----- Modern reset --------------------------------------------------- */

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

* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  color: var(--color-charcoal);
  background: var(--color-soft-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  animation: pageFadeIn 220ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Subtle page-load fade — pages don't pop in. Honors reduced-motion. */
@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
}

/* Cross-document page transition. Browser crossfades between pages on
   nav. Falls back to the body fade on browsers without support. */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 320ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

@supports (view-transition-name: none) {
  body { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: 1ms; }
}

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

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

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

/* ----- Typography ----------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-navy);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-h1); margin-bottom: var(--space-4); }
h2 { font-size: var(--fs-h2); margin-bottom: var(--space-4); line-height: var(--lh-snug); }
h3 { font-size: var(--fs-h3); margin-bottom: var(--space-3); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-h4); margin-bottom: var(--space-3); line-height: var(--lh-snug); }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--color-navy);
  text-decoration: underline;
  text-decoration-color: var(--color-gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--ease-standard),
              text-decoration-color var(--ease-standard);
}
a:hover {
  color: var(--color-gold-dark);
  text-decoration-color: var(--color-gold-dark);
}

strong, b { font-weight: 600; }

em, i { font-style: italic; }

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

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--color-cream);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-navy-dark);
}

blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--fs-body-lg);
  line-height: var(--lh-relaxed);
  color: var(--color-warm-gray);
  border-left: 3px solid var(--color-gold);
  padding: var(--space-3) var(--space-5);
  margin: var(--space-5) 0;
}

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

/* ----- Lists ---------------------------------------------------------- */

ul, ol {
  padding-left: var(--space-5);
  margin-bottom: var(--space-4);
}

li + li { margin-top: var(--space-2); }

/* ----- Utility: skip-to-main-content link ----------------------------- */

.skip-link {
  position: absolute;
  top: -40px;
  left: var(--space-3);
  background: var(--color-navy);
  color: var(--color-cream);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  z-index: 1000;
  transition: top var(--ease-standard);
}
.skip-link:focus {
  top: var(--space-3);
  color: var(--color-cream);
}

/* ----- Selection ------------------------------------------------------ */

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

/* ----- Focus ring (consistent across interactive elements) ------------ */

:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ----- Mobile typography scale --------------------------------------- */

@media (max-width: 640px) {
  :root {
    --fs-display: 36px;
    --fs-h1:      30px;
    --fs-h2:      24px;
    --fs-h3:      20px;
    --fs-h4:      18px;
    --fs-body-lg: 17px;
  }
}

/* ----- Layout helpers ------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

.container--reading {
  max-width: var(--reading-max);
}

.container--wide {
  max-width: 1200px;
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-7);
    padding-right: var(--space-7);
  }
}

/* ----- Visually hidden but available to screen readers --------------- */

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