/* ==========================================================================
   ASPF.org — Base stylesheet
   Design system: tokens, reset, typography
   ========================================================================== */

/* ---------- Design tokens ------------------------------------------------- */
:root {
  /* Brand colours — swap these to rebrand */
  --color-primary:        #0F4C5C;   /* deep teal — trust, clinical calm */
  --color-primary-dark:   #072F3A;   /* hover / depth */
  --color-primary-light:  #5B8D99;   /* secondary UI */
  --color-accent:         #E36414;   /* warm amber — hope, used sparingly */
  --color-accent-dark:    #B84E0C;
  --color-support:        #9BC4BC;   /* soft sage — decorative backgrounds */
  --color-support-light:  #D9EAE6;

  /* Surfaces */
  --color-cream:          #FFF8F0;   /* warm off-white page background */
  --color-white:          #FFFFFF;
  --color-surface-raised: #FFFDF9;

  /* Ink */
  --color-ink:            #1A1A1A;
  --color-ink-muted:      #4A4A4A;
  --color-ink-soft:       #6B6B6B;

  /* Rules */
  --color-rule:           #E5E0D8;
  --color-rule-strong:    #C8C0B0;

  /* Crisis — reserved for emergency messaging only */
  --color-crisis:         #C3423F;
  --color-crisis-dark:    #8F2A28;
  --color-crisis-bg:      #FBEDEC;

  /* Typography */
  --font-display: 'Fraunces', 'Georgia', 'Times New Roman', serif;
  --font-body:    'Atkinson Hyperlegible', 'Helvetica Neue', Arial, sans-serif;

  /* Type scale — based on 1.200 minor third, adjusted for editorial feel */
  --text-xs:   0.8125rem;  /* 13px */
  --text-sm:   0.9375rem;  /* 15px */
  --text-base: 1.0625rem;  /* 17px — slightly larger than default, easier reading */
  --text-md:   1.1875rem;  /* 19px */
  --text-lg:   1.375rem;   /* 22px */
  --text-xl:   1.75rem;    /* 28px */
  --text-2xl:  2.25rem;    /* 36px */
  --text-3xl:  2.875rem;   /* 46px */
  --text-4xl:  3.75rem;    /* 60px */

  /* Spacing — 8px baseline */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  /* Layout */
  --container-sm:    40rem;    /* 640px — reading column */
  --container-md:    56rem;    /* 896px */
  --container-lg:    72rem;    /* 1152px */
  --container-xl:    80rem;    /* 1280px */

  /* Radii */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows — subtle, paper-like */
  --shadow-sm: 0 1px 2px rgba(7, 47, 58, 0.06);
  --shadow:    0 4px 12px rgba(7, 47, 58, 0.08);
  --shadow-lg: 0 12px 32px rgba(7, 47, 58, 0.10);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:   150ms;
  --duration:        250ms;
  --duration-slow:   400ms;
}

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

* {
  margin: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-ink);
  background: var(--color-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

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

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

/* ---------- Typography ---------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  color: var(--color-primary-dark);
  letter-spacing: -0.01em;
  font-variation-settings: "SOFT" 50, "WONK" 0;
}

h1 {
  font-size: clamp(var(--text-2xl), 5vw + 1rem, var(--text-4xl));
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

h2 {
  font-size: clamp(var(--text-xl), 3vw + 0.5rem, var(--text-3xl));
  font-weight: 400;
}

h3 {
  font-size: clamp(var(--text-lg), 2vw + 0.5rem, var(--text-2xl));
}

h4 {
  font-size: var(--text-lg);
  font-weight: 600;
}

h5 {
  font-size: var(--text-md);
  font-weight: 600;
}

h6 {
  font-size: var(--text-base);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

p {
  max-width: 65ch;
}

.lede {
  font-size: var(--text-md);
  line-height: 1.55;
  color: var(--color-ink-muted);
  max-width: 60ch;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease),
              text-decoration-color var(--duration-fast) var(--ease);
}

a:hover {
  color: var(--color-accent-dark);
  text-decoration-thickness: 2px;
}

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

/* Long-form content spacing */
.prose > * + * {
  margin-top: var(--space-5);
}

.prose h2 {
  margin-top: var(--space-7);
}

.prose h3 {
  margin-top: var(--space-6);
}

.prose ul, .prose ol {
  padding-left: 1.5em;
}

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

.prose blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-5);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-style: italic;
  color: var(--color-ink-muted);
}

/* ---------- Utilities ----------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-lg);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.container--wide { max-width: var(--container-xl); }
.container--narrow { max-width: var(--container-md); }
.container--reading { max-width: var(--container-sm); }

.sr-only {
  position: absolute;
  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);
  background: var(--color-primary-dark);
  color: var(--color-white);
  padding: var(--space-3) var(--space-5);
  z-index: 1000;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-4);
}

/* Respect 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;
  }
}
