/* otelevate.com — the policy pages.
 *
 * Every colour is one of the 17 OT brand hexes; there is no pure white or
 * pure black. WCAG 2.x contrast, measured (site/README.md has the table):
 *   body text  #cccccc on #001a2c  11.04:1   on #002944 (table head, boxes)  9.34:1
 *   headings   #d3c5af on #001a2c  10.45:1   on #002944  8.84:1
 *   links      #b5dbfb on #001a2c  12.24:1   on #002944 10.35:1  (always underlined:
 *              link vs body text is only 1.11:1, so colour alone cannot mark a link)
 *   muted      #c0af97 on #001a2c   8.29:1
 *   draft mark #001a2c on #ddcb2b  10.68:1   draft banner #001a2c on #fb4f14 5.26:1
 *   focus ring #ddcb2b on #001a2c  10.68:1
 * All pass AA (4.5:1) for normal text, and all but the banner pass AAA (7:1).
 *
 * No web fonts, no scripts, no images beyond the favicon: the Content Security
 * Policy in firebase.json allows nothing else.
 */

:root {
  --ground: #001a2c;
  --raised: #002944;
  --rule: #003865;
  --ink: #cccccc;
  --heading: #d3c5af;
  --muted: #c0af97;
  --link: #b5dbfb;
  --accent: #c3b091;
  --focus: #ddcb2b;
  --mark: #ddcb2b;
  --alarm: #fb4f14;
  --measure: 70ch;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* ── Chrome ─────────────────────────────────────────────────────────── */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--raised);
}

header.site,
main,
footer.site {
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.25rem;
  padding-top: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
header.site nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.brand {
  color: var(--heading);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.brand:hover { text-decoration: underline; }

footer.site {
  margin-top: 4rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9375rem;
}
footer.site ul {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}
footer.site li + li { margin-top: 0; }
footer.site strong { color: var(--heading); }
.crisis { color: var(--ink); }

/* ── Reading ────────────────────────────────────────────────────────── */

main { padding-top: 2rem; }

h1, h2, h3, h4 {
  color: var(--heading);
  line-height: 1.25;
  scroll-margin-top: 1rem;
}
h1 { font-size: 2rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.375rem; margin: 2.75rem 0 0.75rem; }
h3 { font-size: 1.125rem; margin: 2rem 0 0.5rem; }

header.page { margin-bottom: 2rem; }
.updated { color: var(--muted); margin: 0; font-size: 0.9375rem; }
.lede { font-size: 1.1875rem; margin: 0.5rem 0 0; }

p, ul, ol, blockquote, .table-wrap { margin: 0 0 1rem; }
ul, ol { padding-left: 1.5rem; }
li + li { margin-top: 0.35rem; }
strong { color: var(--heading); font-weight: 650; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible,
.table-wrap:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
a[aria-current="page"] { color: var(--heading); text-decoration: none; font-weight: 650; }

/* A heading's permalink: shown on hover and focus, never in the way. */
a.anchor {
  margin-left: 0.4em;
  color: var(--muted);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
}
h2:hover a.anchor, h3:hover a.anchor, a.anchor:focus-visible { opacity: 1; }
@media (hover: none) { a.anchor { display: none; } }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 0.75rem 1rem;
  background: var(--raised);
  border-left: 4px solid var(--accent);
}
blockquote p:last-child { margin-bottom: 0; }

/* "On this page" */
.toc {
  margin: 0 0 2.5rem;
  padding: 1rem 1.25rem;
  background: var(--raised);
  border-left: 4px solid var(--rule);
}
.toc h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.toc ol { margin: 0; padding-left: 1.25rem; }
.toc ul { margin: 0; padding-left: 0; list-style: none; }
.toc li + li { margin-top: 0.2rem; }

/* Home page list */
ul.pages { list-style: none; padding: 0; }
ul.pages li { margin: 0 0 1.25rem; }
ul.pages a { font-size: 1.125rem; font-weight: 650; }
ul.pages p { margin: 0.2rem 0 0; }

/* ── Tables ─────────────────────────────────────────────────────────── */
/* A table scrolls sideways inside its own box; the page itself never does. */

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--rule);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375rem;
  line-height: 1.45;
}
/* Wide enough that a four-column table keeps readable columns on a phone
   and scrolls, rather than squeezing each cell to a word per line. */
.table-wrap table { min-width: 36rem; }
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
th {
  background: var(--raised);
  color: var(--heading);
  font-weight: 650;
}
tbody tr:last-child td { border-bottom: 0; }
/* On a wide screen a table may run wider than the reading column, centred on
   it, so the retention schedule's four columns are not squeezed. */
@media (min-width: 64rem) {
  .table-wrap {
    width: min(60rem, 100vw - 4rem);
    max-width: none;
    margin-left: calc(50% - min(30rem, 50vw - 2rem));
  }
}
td + td, th + th { border-left: 1px solid var(--rule); }

/* ── Draft preview only ─────────────────────────────────────────────── */

.draft-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.6rem 1rem;
  background: var(--alarm);
  color: var(--ground);
  text-align: center;
  font-size: 0.9375rem;
}
.draft-banner strong { color: var(--ground); }
body.draft :is(h2, h3) { scroll-margin-top: 4.5rem; } /* clear the sticky banner */
body.draft::before {
  content: "DRAFT — NOT PUBLISHED";
  position: fixed;
  inset: 45% auto auto 50%;
  transform: translate(-50%, -50%) rotate(-24deg);
  font-size: clamp(2rem, 9vw, 6rem);
  font-weight: 800;
  white-space: nowrap;
  color: var(--alarm);
  opacity: 0.09;
  pointer-events: none;
  z-index: 0;
}
mark.draft-mark {
  background: var(--mark);
  color: var(--ground);
  padding: 0 0.15em;
  border-radius: 2px;
}
mark.draft-mark em, mark.draft-mark strong { color: var(--ground); }

/* ── Small screens ──────────────────────────────────────────────────── */

@media (max-width: 30rem) {
  body { font-size: 1rem; }
  .draft-banner { position: static; font-size: 0.875rem; }
  h1 { font-size: 1.625rem; }
  h2 { font-size: 1.25rem; }
  main { padding-top: 1.5rem; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ── Print ──────────────────────────────────────────────────────────── */

@media print {
  :root { color-scheme: light; }
  body { background: none; color: #22150c; font-size: 11pt; }
  h1, h2, h3, h4, strong, th, a, .updated, footer.site, .crisis { color: #22150c !important; }
  header.site nav, footer.site nav, .skip, a.anchor, .toc, .draft-banner { display: none; }
  body.draft::before { color: #22150c; opacity: 0.08; }
  header.site, main, footer.site { max-width: none; padding: 0; }
  main a[href^="/"]::after { content: " (otelevate.com" attr(href) ")"; font-size: 0.85em; }
  blockquote, .toc, th { background: none; }
  blockquote { border-left-color: #9c8f7f; }
  .table-wrap { overflow: visible; border: 0; }
  .table-wrap table { min-width: 0; }
  th, td { border-color: #9c8f7f; }
  h2, h3 { break-after: avoid; }
  tr, blockquote { break-inside: avoid; }
}
