/* Fortara & The Anchor — shared stylesheet.
   One file, two themes: body.theme-fortara (sage) and body.theme-anchor (slate).
   No JavaScript, no third-party requests, no cookies. Fonts are self-hosted;
   see shared/assets/fonts/README.md. */

/* ---------------------------------------------------------------- fonts */

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300 400;
  font-display: swap;
  src: url('/assets/fonts/cormorant-garamond-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 300 400;
  font-display: swap;
  src: url('/assets/fonts/cormorant-garamond-italic-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url('/assets/fonts/jost-latin.woff2') format('woff2');
}

/* --------------------------------------------------------------- tokens */

:root {
  --warm-white: #faf9f7;
  --paper: #ffffff;
  --ink: #2a2a28;
  --ink-light: #5f5f5c;      /* 5.6:1 on --warm-white */
  --focus: #1f4f63;

  --serif: 'Cormorant Garamond', 'Iowan Old Style', Palatino, Georgia, serif;
  --sans: 'Jost', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;

  --measure: 34rem;
  --wide: 68rem;
  --step: 1.5rem;

  /* Fortara: sage. Overridden below for The Anchor. */
  --accent: #6b7f6a;         /* decorative / large text only */
  --accent-strong: #46553f;  /* 7.4:1 — links and small text */
  --accent-pale: #eef2ee;
  --rule: #d7ddd6;
}

body.theme-anchor {
  --accent: #517681;
  --accent-strong: #38555e;  /* 7.2:1 */
  --accent-pale: #ebf1f2;
  --rule: #d2dadc;
}

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

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

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

body {
  margin: 0;
  background: var(--warm-white);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.75;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }

img { max-width: 100%; height: auto; }

/* -------------------------------------------------------------- a11y */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 10;
  font-size: 0.9375rem;
}

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

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

a:focus-visible,
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ------------------------------------------------------------- layout */

.wrap {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main { flex: 1 0 auto; }

.prose {
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding-bottom: 5rem;
}

.page-head {
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding-top: 4.5rem;
  padding-bottom: 2rem;
}

/* ------------------------------------------------------------ typography */

h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.125rem, 5vw, 3rem);
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--accent-strong);
}

.prose h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--accent-strong);
  margin-top: calc(var(--step) * 2);
  margin-bottom: 0.5rem;
}

.prose h3 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin-top: var(--step);
  margin-bottom: 0.25rem;
}

.prose p,
.prose ul,
.prose ol { margin-bottom: var(--step); }

.prose ul,
.prose ol { padding-left: 1.25rem; }

.prose li { margin-bottom: 0.5rem; }

.lead {
  font-family: var(--serif);
  font-size: 1.3125rem;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink-light);
}

.prose a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.prose a:hover { text-decoration-thickness: 2px; }

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 0.75rem;
}

blockquote {
  border-left: 2px solid var(--rule);
  padding-left: 1.25rem;
  margin-bottom: var(--step);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1875rem;
  color: var(--ink-light);
}

hr,
.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: calc(var(--step) * 2) 0;
}

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

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--warm-white);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  padding-top: 1.125rem;
  padding-bottom: 1.125rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  margin-right: auto;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.mark-rule {
  display: block;
  width: 1.125rem;
  height: 1px;
  background: var(--accent);
}

.mark-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

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

.primary-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9375rem;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.primary-nav a:hover { border-bottom-color: var(--accent); }

.primary-nav a[aria-current='page'] {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
}

.lang-switch { font-size: 0.875rem; }

.lang-switch a {
  color: var(--ink-light);
  text-decoration: none;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}

.lang-switch a:hover {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
}

/* ------------------------------------------------------------------ home */

.hero {
  text-align: center;
  padding: clamp(4rem, 11vw, 8rem) 1.5rem clamp(3rem, 7vw, 5rem);
  max-width: 46rem;
  margin: 0 auto;
}

.hero .mark {
  justify-content: center;
  margin-bottom: 2rem;
}

.hero .mark-rule { width: 3rem; }

.hero h1 {
  font-size: clamp(2.5rem, 9vw, 4.75rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero .tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.125rem, 2.6vw, 1.4375rem);
  line-height: 1.55;
  color: var(--ink-light);
  max-width: 32rem;
  margin: 0 auto;
}

.section {
  padding: clamp(3rem, 6vw, 4.5rem) 0;
  border-top: 1px solid var(--rule);
}

.section-pale { background: var(--accent-pale); }

.section-inner {
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
}

.section h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 3.2vw, 1.9375rem);
  line-height: 1.25;
  color: var(--accent-strong);
  margin-bottom: 1rem;
}

.section p { margin-bottom: var(--step); }

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

.section a {
  color: var(--accent-strong);
  text-underline-offset: 0.2em;
}

.cards {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--wide);
}

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 1.75rem;
}

.card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--accent-strong);
  margin: 0 0 0.5rem;
}

.card p {
  font-size: 0.9375rem;
  color: var(--ink-light);
  margin: 0;
}

.card a { color: var(--accent-strong); }

.cta {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 3px;
}

.cta:hover { border-bottom-width: 2px; }

/* -------------------------------------------------------------- articles */

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

.article-card {
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
}

.article-card:last-child { border-bottom: 1px solid var(--rule); }

.article-card h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.4375rem;
  line-height: 1.3;
  margin: 0.25rem 0 0.5rem;
}

.article-card h2 a {
  color: var(--accent-strong);
  text-decoration: none;
}

.article-card h2 a:hover { text-decoration: underline; }

.article-summary {
  color: var(--ink-light);
  font-size: 0.9375rem;
  margin: 0;
}

.article-date {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 0.75rem;
}

.feed-link {
  margin-top: var(--step);
  font-size: 0.875rem;
}

.feed-link a {
  color: var(--ink-light);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}

.feed-link a:hover {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
}

.article-back {
  margin-top: calc(var(--step) * 2);
  padding-top: var(--step);
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.article-back a {
  color: var(--accent-strong);
  text-decoration: none;
}

.article-back a:hover { text-decoration: underline; }

/* ------------------------------------------------- crisis / disclaimer */

.crisis,
.disclaimer {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 1.75rem;
  margin: calc(var(--step) * 1.5) 0;
}

.crisis h2,
.disclaimer h2 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 0 0 0.75rem;
}

.disclaimer p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--ink-light);
}

.crisis-intro,
.crisis-note {
  font-size: 0.9375rem;
  color: var(--ink-light);
  margin: 0 0 1.25rem;
}

.crisis-note {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.crisis-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

.crisis-list > li {
  display: grid;
  gap: 0.125rem;
  margin: 0;
}

.crisis-number {
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.2;
  margin: 0;
}

.crisis-number a {
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.crisis-number a:hover { border-bottom-color: var(--accent-strong); }

.crisis-name {
  font-size: 0.9375rem;
  font-weight: 400;
  margin: 0;
}

.crisis-name a { color: var(--accent-strong); }

.crisis-desc {
  font-size: 0.875rem;
  color: var(--ink-light);
  line-height: 1.6;
  margin: 0;
}

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

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--warm-white);
  padding: 2.5rem 0;
  flex-shrink: 0;
}

.footer-inner {
  max-width: var(--wide);
  display: grid;
  gap: 1rem;
}

.footer-org {
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--ink-light);
  margin: 0;
  max-width: 34rem;
}

.footer-note {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--ink-light);
  margin: 0;
  max-width: 44rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--ink-light);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.footer-links a:hover {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
}

.footer-legal {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin: 0;
}

/* -------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
  .layout-home .hero > * {
    opacity: 0;
    animation: fade-in 0.9s ease forwards;
  }

  .layout-home .hero > *:nth-child(1) { animation-delay: 0.1s; }
  .layout-home .hero > *:nth-child(2) { animation-delay: 0.25s; }
  .layout-home .hero > *:nth-child(3) { animation-delay: 0.4s; }

  @keyframes fade-in {
    to { opacity: 1; }
  }
}

/* ---------------------------------------------------------------- print */

/* Someone printing a page from here is most likely printing the support
   numbers for another person. Keep those intact and legible; drop everything
   that only makes sense on screen. */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }

  .skip-link,
  .primary-nav,
  .lang-switch,
  .feed-link,
  .article-back,
  .footer-links { display: none; }

  .site-header,
  .site-footer {
    border-color: #999;
  }

  .hero { padding: 0 0 1.5cm; }

  .prose,
  .page-head,
  .section-inner { max-width: none; }

  h1, h2, h3,
  .brand-name,
  .crisis-number a { color: #000; }

  .section { border-top: 1px solid #999; }

  .section-pale { background: none; }

  /* Print the destination of links that leave the page, so a printout is
     still usable — but not for internal navigation, which would be noise. */
  .prose a[href^="http"]::after,
  .crisis-name a::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    word-break: break-all;
  }

  .crisis,
  .disclaimer {
    border: 1px solid #000;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .crisis-list > li {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  h1, h2, h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .cards { display: block; }

  .card {
    border: 1px solid #999;
    margin-bottom: 0.5cm;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* --------------------------------------------------------------- narrow */

@media (max-width: 44rem) {
  .header-inner {
    gap: 0.75rem 1.25rem;
  }

  .brand { margin-right: auto; }

  .primary-nav {
    order: 3;
    width: 100%;
  }

  .primary-nav ul { gap: 1rem 1.25rem; }

  .page-head { padding-top: 3rem; }

  .crisis,
  .disclaimer { padding: 1.25rem; }
}
