/* ===============  PRIMER BASE STYLES (v2.2, 20260312)  =============== */

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }
body {
  margin: 0;
  -webkit-text-size-adjust: 100%;
  line-height: 1.65;
  font-family: Georgia, "Times New Roman", Times, serif;
  color: #0f172a;
  background: #ffffff;
}
img, svg, video, canvas, iframe {
  display: block;
  max-width: 100%;
  height: auto;
}
a {
  color: inherit;
  text-underline-offset: 0.15em;
}
:where(p, ul, ol, figure, table, blockquote) {
  margin: 0 0 1rem;
}

/* ---- Design tokens ---- */
:root {
  --accent:        teal;
  --accent-rgb:    0, 128, 128;   /* matches teal; used for rgba() variants */
  --border:        #e5e7eb;
  --muted:         #475569;
  --surface-muted: #dcdcdc;       /* replaces named keyword "Gainsboro" */
  --container:     72rem;
}

/* ---- Layout container ---- */
.wrap {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ---- Headings ---- */
h1, h2, h3, h4, h5, h6 {
  color: var(--accent);
  line-height: 1.25;
  margin: 1.2em 0 0.5em;
  font-weight: 700;
}
h1 { font-size: 1.7em;  font-style: normal; }
h2 { font-size: 1.5em;  font-style: normal; }
h3 { font-size: 1.3em;  font-style: normal; }
h4 { font-size: 1.15em; font-style: italic; }
h5 { font-size: 1.15em; font-style: normal; }
h6 { font-size: 1em;    font-style: italic; }

/* ---- Utility classes ---- */
.center  { text-align: center; }
.muted   { color: var(--muted); }
.revision {
  font-size: 0.9em;
  font-style: italic;
  color: var(--muted);
}
.ooo {
  margin: 1rem 0;
  opacity: 0.8;
}

/* ---- Path / breadcrumb bar ---- */
.pathbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}
.pathbar .wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-block: 0.5rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.pathbar a {
  text-decoration: none;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
}
.pathbar a:is(:hover, :focus) {
  background: rgba(0, 0, 0, 0.06);
}
.path-sep { opacity: 0.6; }

/* ---- Tables ---- */
table {
  border-collapse: collapse;
  width: 100%;
}
th, td {
  text-align: left;
  padding: 0.6rem 0.75rem;
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.teal thead th {
  background: var(--accent);
  color: #fff;
}
table.teal td,
table.teal th {
  border: 1px solid var(--accent);
}
tr.alt td {
  background: var(--surface-muted);
  color: #000;
}

/* ---- Blockquotes ---- */
blockquote {
  margin: 1rem 2rem;
  padding: 0.5rem 1rem;
  font-style: italic;
  border-left: 4px solid var(--accent);
  border-right: 4px solid var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  border-radius: 8px;
}

/* ---- Figures ---- */
figure {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}
figcaption {
  font-size: 0.95em;
  color: var(--muted);
  padding: 0.6rem 0.8rem;
  border-top: 1px solid var(--border);
}

/* ---- Footer ---- */
.primer-footer {
  margin-top: 1rem;
  padding-bottom: 1rem;
}
.footer-image {
  display: block;
  max-width: 100%;
  height: auto;
}
.footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
}
.footer-links a { text-decoration: none; }
.footer-links a:is(:hover, :focus) { text-decoration: underline; }

/* ---- Notes section ---- */
.notes {
  font-size: 0.95em;
}

/* ---- Accessibility helper ---- */
.sr-only {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Motion preference ---- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Print: misc spacing ---- */
@media print {
  .ooo { margin: 0.5rem 0; }
}

/* ===============  PRINT STYLES  =============== */
@media print {

  /* Page box */
  @page { margin: 12.7mm; }

  /* Paper base */
  html, body {
    background: #fff !important;
    color: #000 !important;
    height: auto !important;
    overflow: visible !important;
  }
  body {
    font-size: 12pt;
    line-height: 1.5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide site chrome */
  header.site,
  nav.pathbar,
  .breadcrumb,
  .btn {
    display: none !important;
  }

  /* Layout safety */
  main { display: block; }
  * {
    box-shadow: none !important;
    background-image: none !important;
  }
  *[style*="position:sticky"],
  *[style*="position:fixed"] {
    position: static !important;
  }

  /* Keep key blocks intact */
  figure, table, blockquote, .callout, .table-wrap {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }

  /* Spacing */
  blockquote, table, figure {
    margin-top: 1rem;
    margin-bottom: 1rem;
  }
  img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  /* Widows/orphans */
  p, li, blockquote {
    orphans: 2;
    widows: 2;
  }

  /* Links */
  a {
    text-decoration: underline;
    color: inherit;
  }
  a[href^="http"]::after,
  a[href^="#"]::after,
  a[href^="mailto:"]::after,
  a[href^="tel:"]::after {
    content: none !important;
  }

  /* Long URLs & code wrap */
  pre, code, a {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* Containers */
  .wrap { max-width: none; padding: 0; }

  /* Footer */
  .footer-nav,
  .footer-nav * {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
  .primer-footer {
    margin: 0 !important;
    padding: 0 !important;
    page-break-after: avoid;
  }
  .primer-footer hr { display: none !important; }
  .footer-image-wrap {
    margin: 0 !important;
    padding: 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
    page-break-after: avoid;
  }
  .footer-image {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0.5rem 0 0 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
    page-break-after: avoid;
  }
  .footer-links ul { display: block !important; text-align: center; }
  .footer-links li { display: inline; }
  .footer-links li + li::before { content: " | "; }
  .footer-links a { white-space: nowrap; }
  .primer-footer a[href^="http"]::after { content: none !important; }

  /* Headings: monochrome-safe */
  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
    break-after: avoid;
    page-break-after: avoid;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    hyphens: none;
    margin-top: 1em;
    margin-bottom: 0.4em;
  }
  h1 { font-size: 1.7em;  font-style: normal; font-weight: 700; }
  h2 { font-size: 1.5em;  font-style: normal; font-weight: 700; border: none !important; padding-bottom: 0 !important; }
  h3 { font-size: 1.3em;  font-style: normal; font-weight: 700; border: none !important; padding-bottom: 0 !important; }
  h4 { font-size: 1.15em; font-style: italic; font-weight: 700; }
  h5 { font-size: 1.15em; font-style: normal; font-weight: 700; }
  h6 { font-size: 1em;    font-style: italic; font-weight: 700; }
}
