/* Alzheimer's Companions — shared design tokens and site chrome.
   Accessibility floor, per AGENTS.md: 20px body text, 44px tap targets,
   visible focus, working skip link. Spacing is deliberately tight. */

:root {
  --ground: #f3f4f3;
  --surface: #ffffff;
  --surface-2: #f8f9f8;
  --surface-3: #eceeec;
  --ink: #16191a;
  --ink-2: #3c4245;
  --muted: #5b6164;
  --line: #dfe2e0;
  --line-2: #c2c7c5;
  --accent: #1c6357;
  --accent-hover: #144a41;
  --accent-soft: #e4efec;
  --on-accent: #ffffff;
  --control-line: #767d7a;
  --warn: #7f4d0d;
  --warn-soft: #fbf1e1;
  --warn-line: #e0c58e;
  --alarm: #8d3128;
  --alarm-soft: #fbe9e6;
  --alarm-line: #e6b5ad;
  --shadow: 0 1px 2px rgba(20, 28, 24, .05), 0 8px 22px -14px rgba(20, 28, 24, .28);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #151817;
    --surface: #1d2120;
    --surface-2: #242827;
    --surface-3: #2c3130;
    --ink: #e9ecea;
    --ink-2: #bcc2bf;
    --muted: #949b98;
    --line: #2e3432;
    --line-2: #3d4442;
    --accent: #6cbdac;
    --accent-hover: #86cebf;
    --accent-soft: #19302b;
    --on-accent: #0d1a17;
    --control-line: #7d8582;
    --warn: #d9a65d;
    --warn-soft: #2d2517;
    --warn-line: #574726;
    --alarm: #e79287;
    --alarm-soft: #2f1d1a;
    --alarm-line: #5b332c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 22px -14px rgba(0, 0, 0, .8);
  }
}

:root[data-theme="dark"] {
  --ground: #151817;
  --surface: #1d2120;
  --surface-2: #242827;
  --surface-3: #2c3130;
  --ink: #e9ecea;
  --ink-2: #bcc2bf;
  --muted: #949b98;
  --line: #2e3432;
  --line-2: #3d4442;
  --accent: #6cbdac;
  --accent-hover: #86cebf;
  --accent-soft: #19302b;
  --on-accent: #0d1a17;
  --control-line: #7d8582;
  --warn: #d9a65d;
  --warn-soft: #2d2517;
  --warn-line: #574726;
  --alarm: #e79287;
  --alarm-soft: #2f1d1a;
  --alarm-line: #5b332c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 22px -14px rgba(0, 0, 0, .8);
}

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

html {
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.25rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.site-name,
.count,
legend {
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -.005em;
  text-wrap: balance;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  min-height: 2.75rem;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: .16em;
}

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

.wrap {
  width: min(46rem, calc(100% - 2rem));
  margin-inline: auto;
}

/* ---- header ---- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.15rem 1.25rem;
  padding-block: 0.7rem 0.55rem;
}

.site-name {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.2;
}

.site-name a {
  color: var(--ink);
  text-decoration: none;
}

.site-name a:hover {
  color: var(--accent);
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.6rem;
  color: var(--ink-2);
  font-size: 1.0625rem;
  font-weight: 600;
  text-decoration: none;
}

nav a:hover {
  color: var(--accent);
}

nav a[aria-current="page"] {
  color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}

/* ---- prose ---- */

main {
  padding-block: 1.6rem 2.75rem;
}

h1 {
  margin: 0 0 .5rem;
  font-size: clamp(1.9rem, 5.4vw, 2.5rem);
  line-height: 1.12;
}

h2 {
  margin: 1.55rem 0 .35rem;
  font-size: 1.5rem;
  line-height: 1.2;
}

h3 {
  margin: 1.05rem 0 .25rem;
  font-size: 1.1875rem;
  line-height: 1.25;
}

p {
  margin: 0 0 .65rem;
  max-width: 38em;
}

ul,
ol {
  margin: 0 0 .7rem;
  padding-left: 1.3rem;
  max-width: 38em;
}

li {
  margin-bottom: .2rem;
}

.lead {
  font-size: 1.3125rem;
  color: var(--ink-2);
  max-width: 34em;
}

article {
  margin-top: 1.9rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

article:first-of-type {
  border-top: 2px solid var(--line-2);
}

/* ---- components ---- */

.note {
  margin: 1.1rem 0;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 3px;
  box-shadow: var(--shadow);
}

.note h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.note p:last-child {
  margin-bottom: 0;
}

.note.pending {
  border-left-color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-line);
}

.note.pending h2 {
  color: var(--warn);
  font-family: "Source Sans 3", sans-serif;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.1rem 0 .3rem;
}

.actions a {
  display: inline-flex;
  align-items: center;
  min-height: 2.9rem;
  padding: .55rem 1.1rem;
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid var(--accent);
  border-radius: 3px;
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
}

.actions a:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

.actions a.secondary {
  background: transparent;
  color: var(--accent);
}

.actions a.secondary:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.toc {
  margin: 1.1rem 0 0;
  padding: .8rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.toc h2 {
  margin: 0 0 .15rem;
  font-family: "Source Sans 3", sans-serif;
  font-size: .9375rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li {
  margin: 0;
}

/* Only standalone list links get the 44px row. A link inside a sentence
   stays inline (WCAG 2.5.8's inline exception), or the line it sits on
   grows taller than its neighbours. */
.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 1.125rem;
}

main p a {
  min-height: 0;
}

/* Source lists with a visible verification date beside each link. */
.source-list {
  margin: 0.6rem 0 1.1rem;
  padding-left: 1.25rem;
}

.source-list li {
  margin: 0.35rem 0;
}

.source-list .verified {
  display: inline-block;
  margin-left: 0.55rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---- footer ---- */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-block: 1.1rem 1.6rem;
  font-size: 1rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0 0 .4rem;
  max-width: 44em;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

@media (max-width: 34rem) {
  body {
    font-size: 1.1875rem;
  }

  .site-header .wrap {
    justify-content: flex-start;
  }

  nav ul {
    margin-inline: -0.4rem;
  }

  nav a {
    padding: 0 .4rem;
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
