:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #efebe5;
  --text: #333333;
  --muted: #5A5C5B;
  --border: #e5e0d8;
  --accent: #e51483;
  --accent-dark: #b30d6a;
  --orange: #f59c06;
  --gradient: linear-gradient(135deg, #f59c06 0%, #e51483 100%);
  --google-bg: #fff3df;
  --google-fg: #8a4f00;
  --google-bd: #f3c77d;
  --meta-bg: #fde8f2;
  --meta-fg: #a30c60;
  --meta-bd: #f2a9cd;
  --radius: 12px;
  --gutter: 16px;
  --sans: "Nunito Sans", "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --accent-bg: #fdf2f8;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  overflow-x: clip;
}
a { color: var(--accent-dark); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
kbd {
  font: 600 0.75em var(--mono);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.05em 0.4em;
  background: var(--surface);
  color: var(--muted);
}
code {
  font: 0.88em var(--mono);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 0.1em 0.35em;
  overflow-wrap: anywhere;
}
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* ---------- top nav: copied from bids.getonward.agency (cheat-sheet.html + assets/brand.css + assets/mobile.css) ---------- */
.topnav { position: sticky; top: 0; z-index: 50; background: rgba(247, 245, 242, 0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 0.75rem 1.5rem; display: flex; gap: 1.5rem; align-items: center; font-size: 0.9rem; font-weight: 500; }
.topnav .brand { display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; line-height: 1; }
.topnav .brand img { display: block; height: 28px; width: auto; }
.topnav .brand:hover img { opacity: 0.85; }
.topnav .divider { width: 1px; height: 22px; background: var(--border); margin: 0 0.25rem; }
.topnav .doc-tag { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.topnav .nav-links { display: flex; gap: 1.25rem; margin-left: auto; align-items: center; }
.topnav .nav-links a { color: var(--muted); text-decoration: none; padding: 0.4rem 0; white-space: nowrap; }
.topnav .nav-links a:hover, .topnav .nav-links a.active { color: var(--text); }
.topnav .nav-links a.active { color: var(--accent); font-weight: 700; }
.nav-toggle, .nav-current, .nav-search { display: none; }
.search-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.45rem;
  font: inherit; font-weight: 700; font-size: 0.85rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 100px;
  padding: 0.4rem 0.85rem; cursor: pointer;
}
.search-btn:hover { color: var(--text); border-color: var(--muted); }
.search-btn kbd { font-size: 0.72rem; }

/* Sonar: the one link that leaves the site, so it gets its own pill and a ping */
.topnav .nav-links a.sonar-link {
  margin-left: 0.25rem; flex-shrink: 0; position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 8px;
  font: 800 0.88rem var(--sans); color: #fff; text-decoration: none; letter-spacing: 0.02em;
  padding: 6px 13px 6px 12px; border-radius: 100px; border: 1.5px solid transparent;
  background: linear-gradient(#2a2826, #2a2826) padding-box, var(--gradient) border-box;
  box-shadow: 0 2px 10px rgba(229, 20, 131, 0.18);
  transition: box-shadow 0.2s, transform 0.2s;
}
.sonar-link::before {   /* a radar sweep that crosses the pill now and then */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(245, 156, 6, 0.28) 48%, rgba(229, 20, 131, 0.28) 52%, transparent 70%);
  transform: translateX(-120%); animation: sonar-sweep 5s ease-in-out 1.5s infinite;
}
@keyframes sonar-sweep { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.topnav .nav-links a.sonar-link:hover, .topnav .nav-links a.sonar-link:focus-visible {
  color: #fff;
  background: var(--gradient) padding-box, var(--gradient) border-box;
  box-shadow: 0 6px 20px rgba(229, 20, 131, 0.35);
  transform: translateY(-1px);
}
.sonar-link:hover::before { animation: none; opacity: 0; }

@media (max-width: 1280px) { .topnav .nav-links { gap: 0.95rem; font-size: 0.85rem; } }
@media (max-width: 1180px) { .topnav .doc-tag, .topnav .divider { display: none; } }

/* Phones and tablets: Menu button and drop-down list (sops.js adds .has-menu) */
@media (max-width: 980px) {
  .topnav { padding: 0.55rem 1rem; gap: 0.75rem; }
  .topnav.has-menu { overflow: visible; }
  .topnav.has-menu .divider, .topnav.has-menu .doc-tag { display: none; }
  .topnav.has-menu .nav-current { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 600; font-size: 0.9rem; padding-left: 0.75rem; border-left: 1px solid var(--border); }
  .topnav.has-menu .nav-toggle { display: inline-flex; align-items: center; gap: 0.5rem; margin-left: auto; flex-shrink: 0; font: inherit; font-weight: 700; font-size: 0.9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 100px; padding: 0.45rem 0.95rem; min-height: 40px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .topnav.has-menu .nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .nav-toggle .bars { display: inline-grid; gap: 3px; width: 16px; }
  .nav-toggle .bars i { display: block; height: 2px; background: currentColor; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
  .topnav.menu-open .nav-toggle .bars i:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .topnav.menu-open .nav-toggle .bars i:nth-child(2) { opacity: 0; }
  .topnav.menu-open .nav-toggle .bars i:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
  .topnav.has-menu .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 0.35rem 0.75rem 0.75rem; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: 0 14px 28px rgba(26, 26, 26, 0.14); max-height: calc(100vh - 60px); max-height: calc(100dvh - 60px); overflow-y: auto; font-size: 1rem; }
  .topnav.menu-open .nav-links { display: flex; }
  .topnav.has-menu .nav-links a { display: flex; align-items: center; min-height: 48px; padding: 0.75rem; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 600; white-space: normal; }
  .topnav.has-menu .nav-links a:last-child { border-bottom: none; }
  .topnav.has-menu .nav-links a.active { color: var(--accent-dark); background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
  .topnav.has-menu .nav-links a.sonar-link { margin: 0.6rem 0 0; padding: 0.75rem; border-radius: 12px; border-bottom: 1.5px solid transparent; color: #fff; }
  .topnav.has-menu > .search-btn { display: none; }
  .topnav.has-menu .nav-links .nav-search { display: flex; align-items: center; gap: 0.6rem; min-height: 48px; padding: 0.75rem; margin: 0.35rem 0 0.25rem; font: inherit; font-weight: 700; font-size: 1rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; text-align: left; }
  .topnav.has-menu .nav-links .nav-search svg { color: var(--muted); }
  /* Without JS the links scroll sideways, as on the bids site */
  .topnav:not(.has-menu) { overflow-x: auto; scrollbar-width: none; }
  .topnav:not(.has-menu)::-webkit-scrollbar { display: none; }
}

main { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter) 64px; }

/* ---------- hero + router ---------- */
.hero { padding: 48px 0 24px; }
.eyebrow {
  display: inline-block; margin: 0 0 12px;
  font-weight: 800; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: #fff; background: var(--gradient); border-radius: 100px; padding: 4px 12px;
}
.hero h1, .page-head h1, .doc-head h1 {
  color: #1a1a1a;
  font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 12px;
  text-wrap: balance;
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 20px; max-width: 62ch; }
.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter input {
  flex: 1 1 320px; min-width: 0;
  font: 600 1rem var(--sans); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px;
}
.filter input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--meta-bg); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.seg button {
  font: 700 0.9rem var(--sans); color: var(--muted);
  background: none; border: 0; border-radius: 9px; padding: 8px 14px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.group { margin-top: 36px; }
.group h2 {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); font-weight: 800; margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.routes {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.route {
  min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  transition: border-color 0.15s, transform 0.15s;
}
.route:hover { border-color: #d6c7b8; transform: translateY(-1px); }
.route-top { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.symptom { margin: 0; font-weight: 800; font-size: 1.05rem; line-height: 1.35; }
.route-go { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.9rem; }
.route-go > span { color: var(--muted); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin-right: 2px; }
.route-go a {
  font-weight: 700; text-decoration: none; color: var(--accent-dark);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 9px;
  max-width: 100%; overflow-wrap: anywhere;
}
.route-go a:hover { border-color: var(--accent); color: var(--accent); }
.router-empty { color: var(--muted); margin-top: 32px; }

.pill {
  display: inline-block; font-weight: 800; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 100px; padding: 2px 9px; border: 1px solid;
}
.pill.google { background: var(--google-bg); color: var(--google-fg); border-color: var(--google-bd); }
.pill.meta { background: var(--meta-bg); color: var(--meta-fg); border-color: var(--meta-bd); }
.pill.tool { background: var(--surface-2); color: var(--text); border-color: var(--border); }

/* ---------- library index ---------- */
.page-head { padding: 40px 0 8px; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.cards {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.card {
  display: flex; flex-direction: column; gap: 6px; height: 100%; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: var(--text);
}
.card:hover { border-color: var(--accent); color: var(--text); }
.card.key { background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient) border-box; border: 2px solid transparent; }
.card-title { font-weight: 800; line-height: 1.3; }
.card-sum { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

/* ---------- documents ---------- */
.doc { padding-top: 28px; }
.crumbs { font-size: 0.88rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); font-weight: 700; text-decoration: none; }
.crumbs a:hover { color: var(--accent-dark); }
.doc-head { margin: 14px 0 24px; }
.doc-head h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
.doc-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.verified { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.source { font-size: 0.85rem; color: var(--muted); margin: 0; }

.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
@media (min-width: 1000px) {
  .doc-grid:has(.toc) { grid-template-columns: 230px minmax(0, 1fr); }
}
.toc { position: relative; }
@media (min-width: 1000px) { .toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; } }
.toc p { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 800; color: var(--muted); margin: 0 0 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc li a { display: block; padding: 4px 0 4px 12px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 0.9rem; line-height: 1.35; }
.toc li a:hover { color: var(--accent-dark); border-left-color: var(--accent); }

.prose { max-width: 78ch; min-width: 0; }
.prose h2 { font-size: 1.45rem; font-weight: 800; margin: 2em 0 0.5em; letter-spacing: -0.01em; scroll-margin-top: 80px; }
.prose h3 { font-size: 1.15rem; font-weight: 800; margin: 1.6em 0 0.4em; scroll-margin-top: 80px; }
.prose h4 { font-size: 1rem; font-weight: 800; margin: 1.4em 0 0.3em; }
.prose p, .prose li { overflow-wrap: break-word; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.25em 0; }
.prose blockquote { margin: 1.2em 0; padding: 0.6em 1em; border-left: 4px solid var(--orange); background: var(--surface); border-radius: 0 8px 8px 0; }
.prose pre { background: #2a2826; color: #f5efe8; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 0.85rem; line-height: 1.5; }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose a.row {
  font-weight: 800; text-decoration: none; color: var(--accent-dark);
  background: var(--meta-bg); border-radius: 5px; padding: 0 0.3em;
}
.table-wrap { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.prose th { background: var(--surface-2); font-weight: 800; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose tr[id] { scroll-margin-top: 90px; }
.prose tr[id]:target td { background: #fff4d6; }
.prose tr[id]:target td:first-child { box-shadow: inset 4px 0 0 var(--orange); }

/* ---------- search sheet ---------- */
.search-sheet {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(42, 40, 38, 0.45);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 10vh var(--gutter) var(--gutter);
}
.search-sheet[hidden] { display: none; }
.search-panel {
  width: 100%; max-width: 680px; max-height: 76vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.25); overflow: hidden;
}
.search-panel input {
  font: 700 1.05rem var(--sans); color: var(--text);
  border: 0; border-bottom: 1px solid var(--border); background: var(--surface);
  padding: 16px 18px; outline: none;
}
.search-results { list-style: none; margin: 0; padding: 6px; overflow: auto; }
.search-results a {
  display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text);
}
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--surface); }
.search-results .r-title { font-weight: 800; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-results .r-snip { display: block; color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.search-results mark { background: #ffe6a8; color: inherit; border-radius: 3px; padding: 0 2px; }
.search-hint { margin: 0; padding: 8px 18px 12px; font-size: 0.8rem; color: var(--muted); }

/* ---------- footer ---------- */
.foot { background: #2a2826; color: #e9e1d7; }
.foot-inner { max-width: 1160px; margin: 0 auto; padding: 28px var(--gutter); font-size: 0.9rem; }
.foot-inner p { margin: 0 0 6px; max-width: 80ch; }
.foot strong { color: #fff; }
.foot a { color: #fff; font-weight: 700; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.foot a:hover { color: var(--orange); }

@media (max-width: 640px) {
  .hero { padding-top: 28px; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .route { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .route, .sonar-link { transition: none; } .route:hover, .sonar-link:hover { transform: none; }
  .ping::before, .ping::after, .sonar-link::before { animation: none; opacity: 0; }
}
