/* ============================================================================
 * The Elder Dignity Project — Base styles
 * Reset, typography, layout primitives
 * See docs/DESIGN_STANDARDS.md §4, §5, §12
 * ============================================================================ */

/* ---- Modern reset (modified from Josh Comeau) ---- */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* Base type: 18px (Design Standards §12.1) */
  font-family: var(--edp-font-body);
  font-size: 18px;
  font-weight: 400;
  color: var(--edp-color-text);
  background: var(--edp-color-bg);
}

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

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(--edp-font-display);
  color: var(--edp-color-heading);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 var(--edp-space-4);
}

h1 {
  font-size: clamp(2.25rem, 4vw + 1rem, 3rem);
  line-height: 1.1;
  margin-bottom: var(--edp-space-5);
}
h2 {
  font-size: clamp(1.875rem, 2.5vw + 1rem, 2.25rem);
  line-height: 1.2;
  margin-top: var(--edp-space-7);
}
h3 {
  font-size: var(--edp-text-2xl);
  font-weight: 600;
  line-height: 1.3;
  margin-top: var(--edp-space-6);
}
h4 {
  font-size: var(--edp-text-xl);
  font-weight: 600;
  line-height: 1.4;
}
h5, h6 {
  font-family: var(--edp-font-body);
  font-size: var(--edp-text-lg);
  font-weight: 600;
  letter-spacing: 0;
}

p {
  margin: 0 0 var(--edp-space-4);
  max-width: var(--edp-prose-max);
}

/* Lead paragraph */
.lead {
  font-size: var(--edp-text-lg);
  line-height: 1.6;
  color: var(--edp-color-text);
}

a {
  color: var(--edp-color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--edp-duration-base) var(--edp-ease);
}
a:hover,
a:focus-visible {
  color: var(--edp-color-link-hover);
}

strong, b { font-weight: 600; }

em, i { font-style: italic; }

hr {
  border: 0;
  border-top: 1px solid var(--edp-color-border-subtle);
  margin: var(--edp-space-8) auto;
  max-width: 120px;
}

small { font-size: var(--edp-text-sm); color: var(--edp-color-text-muted); }

ul, ol {
  margin: 0 0 var(--edp-space-4);
  padding-left: 1.5rem;
  max-width: var(--edp-prose-max);
}
li + li { margin-top: var(--edp-space-2); }

blockquote {
  margin: var(--edp-space-6) 0;
  padding: var(--edp-space-2) 0 var(--edp-space-2) var(--edp-space-5);
  border-left: 4px solid var(--edp-sage-500);
  font-family: var(--edp-font-display);
  font-size: var(--edp-text-xl);
  font-style: italic;
  line-height: 1.5;
  color: var(--edp-ink-800);
  max-width: var(--edp-prose-max);
}
blockquote cite {
  display: block;
  margin-top: var(--edp-space-3);
  font-family: var(--edp-font-body);
  font-size: var(--edp-text-sm);
  font-style: normal;
  color: var(--edp-color-text-muted);
}

/* ---- Focus ring (Design Standards §12.1) ---- */

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

/* ---- Layout primitives ---- */

.container {
  width: 100%;
  max-width: var(--edp-container-max);
  margin-inline: auto;
  padding-inline: var(--edp-container-gutter);
}

.prose {
  max-width: var(--edp-prose-max);
  margin-inline: auto;
}
.prose--centered { text-align: center; }
.prose--centered h1,
.prose--centered h2,
.prose--centered h3 { text-align: center; }

.section {
  padding-block: var(--edp-space-7);
}
@media (min-width: 768px) {
  .section { padding-block: var(--edp-space-9); }
}

.section--alt    { background: var(--edp-color-bg-alt); }
.section--muted  { background: var(--edp-color-bg-alt); }
.section--narrow { padding-block: var(--edp-space-6); }
@media (min-width: 768px) {
  .section--narrow { padding-block: var(--edp-space-8); }
}

.section__header {
  text-align: center;
  max-width: 60ch;
  margin: 0 auto var(--edp-space-6);
}
.section__header h2 { margin-top: 0; }
.section__subhead {
  font-size: var(--edp-text-lg);
  color: var(--edp-color-text-muted);
  margin-top: var(--edp-space-2);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--edp-text-sm);
  font-weight: 600;
  color: var(--edp-color-primary);
  margin: 0 0 var(--edp-space-3);
}

.plain-links {
  list-style: none;
  padding: 0;
  margin: var(--edp-space-5) 0;
  display: flex;
  flex-direction: column;
  gap: var(--edp-space-2);
  text-align: left;
  max-width: 32ch;
  margin-inline: auto;
}
.plain-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--edp-space-2);
  text-decoration: none;
  padding: var(--edp-space-2) var(--edp-space-3);
  border-radius: var(--edp-radius-md);
  background: var(--edp-color-bg-alt);
  color: var(--edp-color-primary);
}
.plain-links a:hover,
.plain-links a:focus-visible { background: var(--edp-cream); }
.plain-links i { width: 1.5em; text-align: center; color: var(--edp-color-primary); }

.section--ink  { background: var(--edp-ink-800); color: var(--edp-cream); }
.section--ink h1, .section--ink h2, .section--ink h3,
.section--ink h4, .section--ink h5, .section--ink h6 { color: var(--edp-cream); }
.section--ink a { color: var(--edp-gold-400); }

.section-title {
  text-align: center;
  margin-top: 0;
}
.section-subtitle {
  text-align: center;
  font-size: var(--edp-text-lg);
  color: var(--edp-color-text-muted);
  max-width: 50ch;
  margin-inline: auto;
  margin-bottom: var(--edp-space-7);
}

.divider {
  border: 0;
  border-top: 1px solid var(--edp-color-border-subtle);
  width: 120px;
  margin: var(--edp-space-7) auto;
}

/* ---- Utilities ---- */

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

.text-center { text-align: center; }
.text-muted  { color: var(--edp-color-text-muted); }

/* ---- Skip link (Design Standards §12.4) ---- */

.skip-link {
  position: absolute;
  top: -100px; left: var(--edp-space-4);
  z-index: 100;
  padding: var(--edp-space-3) var(--edp-space-5);
  background: var(--edp-ink-800);
  color: var(--edp-cream);
  text-decoration: none;
  font-weight: 600;
  border-radius: var(--edp-radius-sm);
  transition: top var(--edp-duration-base) var(--edp-ease);
}
.skip-link:focus {
  top: var(--edp-space-4);
  color: var(--edp-cream);
}

/* ---- Responsive grid ---- */

.grid {
  display: grid;
  gap: var(--edp-space-6);
}
.grid--2  { grid-template-columns: 1fr; }
.grid--3  { grid-template-columns: 1fr; }
.grid--4  { grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .grid--2  { grid-template-columns: repeat(2, 1fr); }
  .grid--3  { grid-template-columns: repeat(3, 1fr); }
  .grid--4  { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid--4  { grid-template-columns: repeat(4, 1fr); }
}
