/* =============================================================
   CAM Reconciliation — Site stylesheet
   Light, elegant, professional palette. Wide on desktop.
   ============================================================= */

:root {
  --bg: #f6faf9;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --surface-3: #e4eeeb;
  --text: #18272c;
  --muted: #566a70;
  --primary: #0e7c66;
  --primary-strong: #0b5e4f;
  --primary-soft: #e3f3ee;
  --accent: #1f6feb;
  --amber: #e08a1e;
  --link: #0b6fb8;
  --link-hover: #0a4f84;
  --border: #d9e6e2;
  --code-bg: #f2f6f8;
  --code-border: #e2ebef;
  --shadow-sm: 0 1px 2px rgba(16, 50, 45, 0.06), 0 1px 3px rgba(16, 50, 45, 0.08);
  --shadow-md: 0 10px 30px rgba(16, 50, 45, 0.10);
  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 66px;
  --container: 1280px;
  --measure: 1140px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.075rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* sticky footer */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

img, svg { max-width: 100%; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--link-hover); text-decoration: underline; }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2.5rem);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--primary);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; color: #fff; }

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

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.brand:hover { color: var(--primary); text-decoration: none; }
.brand__mark { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--shadow-sm); }
.brand__name { letter-spacing: -0.01em; }
.brand__name b { color: var(--primary); }

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 560;
  font-size: 0.96rem;
  transition: background var(--transition), color var(--transition);
}
.nav__link svg { width: 18px; height: 18px; }
.nav__link:hover { background: var(--surface-2); color: var(--primary-strong); text-decoration: none; }
.nav__link[aria-current="page"],
.nav__link.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.nav__toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav__toggle svg { width: 22px; height: 22px; color: var(--text); }

/* ---------------- Footer ---------------- */
.site-footer {
  flex-shrink: 0;
  margin-top: 4rem;
  background: #0d2a28;
  color: #cfe3dd;
}
.site-footer a { color: #d9ece6; }
.site-footer a:hover { color: #fff; }
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 2rem;
  padding-block: 3rem 2rem;
}
.site-footer__brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: #fff; font-size: 1.1rem; }
.site-footer__brand img { width: 32px; height: 32px; border-radius: 8px; }
.site-footer p { color: #a9c6bf; margin: 0.75rem 0 0; max-width: 34ch; }
.site-footer h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: #7fb3a7; margin: 0 0 0.9rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.site-footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-block: 1.2rem;
  font-size: 0.9rem;
  color: #8fb0a9;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 1rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn svg { width: 20px; height: 20px; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--primary-strong); color: #fff; box-shadow: var(--shadow-md); }
.btn--ghost { background: var(--surface); color: var(--primary-strong); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--primary); color: var(--primary-strong); }

/* ---------------- Hero / Home ---------------- */
.hero {
  text-align: center;
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(1.5rem, 4vw, 3rem);
  background:
    radial-gradient(1100px 460px at 50% -120px, var(--primary-soft), transparent 70%);
}
.hero__logo {
  width: clamp(96px, 16vw, 148px);
  height: auto;
  display: block;
  margin: 0 auto 1.4rem;
  filter: drop-shadow(0 12px 28px rgba(14, 124, 102, 0.28));
}
.hero__eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-strong);
  background: var(--primary-soft);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.hero__title {
  font-size: clamp(2rem, 1.4rem + 3vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 auto 1rem;
  max-width: 20ch;
  background: linear-gradient(120deg, var(--primary-strong), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lead { max-width: 70ch; margin: 0 auto; color: var(--muted); font-size: 1.12rem; }
.hero__lead p { margin: 0 0 1rem; }
.hero__actions { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; margin-top: 1.8rem; }

.section { padding-block: clamp(2rem, 5vw, 3.5rem); }
.section__head { max-width: 70ch; margin: 0 auto 2rem; text-align: center; }
.section__head h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); margin: 0 0 0.5rem; }
.section__head p { color: var(--muted); margin: 0; }

/* Category cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}
.cat-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); text-decoration: none; }
.cat-card__icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 13px;
  margin-bottom: 1rem;
  color: #fff;
}
.cat-card__icon svg { width: 28px; height: 28px; }
.cat-card__icon--a { background: linear-gradient(135deg, #10a37f, #0b5e8a); }
.cat-card__icon--b { background: linear-gradient(135deg, #1f6feb, #6f4cf0); }
.cat-card__icon--c { background: linear-gradient(135deg, #e08a1e, #d2542b); }
.cat-card h3 { margin: 0 0 0.5rem; font-size: 1.2rem; color: var(--text); }
.cat-card p { margin: 0 0 1rem; color: var(--muted); font-size: 0.98rem; }
.cat-card__more { margin-top: auto; font-weight: 650; color: var(--primary-strong); display: inline-flex; align-items: center; gap: 0.35rem; }
.cat-card__sub { list-style: none; margin: 1rem 0 0; padding: 1rem 0 0; border-top: 1px dashed var(--border); display: grid; gap: 0.4rem; }
.cat-card__sub a { font-size: 0.92rem; }

/* ---------------- Content page ---------------- */
.page { padding-block: 1.5rem 1rem; }
/* Content fills the full page container (matching the home page, header and footer)
   instead of a narrower measure, per the wide-desktop requirement. */
.content { max-width: none; }

.breadcrumbs {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
/* `.content` prefix keeps this above the generic `.content ol` list padding */
.content .breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; align-items: center; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.35rem; }
.breadcrumbs li::after { content: "/"; color: var(--border); margin-left: 0.35rem; }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs li[aria-current="page"] { color: var(--text); font-weight: 600; }

.content h1 {
  font-size: clamp(1.85rem, 1.4rem + 2vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0.2rem 0 1.1rem;
  background: linear-gradient(120deg, var(--primary-strong) 10%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.content h2 {
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem);
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--surface-3);
  color: var(--primary-strong);
}
.content h3 { font-size: 1.28rem; margin: 1.8rem 0 0.6rem; color: var(--text); }
.content h4 { font-size: 1.1rem; margin: 1.4rem 0 0.5rem; color: var(--primary-strong); }
.content p { margin: 0 0 1.15rem; }
.content ul, .content ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.content li { margin: 0.3rem 0; }
.content li::marker { color: var(--primary); }
.content strong { color: #11343a; }
.content blockquote {
  margin: 1.4rem 0;
  padding: 0.6rem 1.2rem;
  border-left: 4px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #20413c;
}
.content a { color: var(--link); font-weight: 540; text-decoration: underline; text-decoration-color: rgba(11,111,184,0.32); text-underline-offset: 2px; }
.content a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

/* heading anchor */
.heading-anchor {
  margin-left: 0.4rem;
  color: var(--border);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}
.content h2:hover .heading-anchor,
.content h3:hover .heading-anchor,
.content h4:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: var(--primary); text-decoration: none; }

/* inline code — light bg, no border, low focus */
.content :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  color: #0c5246;
  padding: 0.12em 0.4em;
  border-radius: 5px;
  border: 0;
  white-space: break-spaces;
}

/* code blocks — light bg, theme colors, copy button */
.content pre[class*="language-"],
.content pre {
  position: relative;
  margin: 1.4rem 0;
  padding: 1.1rem 1.2rem;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
}
.content pre code { font-family: var(--mono); background: none; padding: 0; color: #243b41; }

.code-copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--primary-strong);
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.content pre:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.code-copy.is-copied { background: var(--primary); color: #fff; border-color: var(--primary); opacity: 1; }
.code-copy svg { width: 14px; height: 14px; }

/* Prism light token theme tuned to palette */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7a8a86; font-style: italic; }
.token.punctuation { color: #5b6b70; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol { color: #b5530a; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #0c7a5b; }
.token.operator, .token.entity, .token.url { color: #2a6f9e; }
.token.atrule, .token.attr-value, .token.keyword { color: #1f6feb; }
.token.function, .token.class-name { color: #7a3df0; }
.token.regex, .token.important, .token.variable { color: #c0392b; }
.token.important, .token.bold { font-weight: 700; }

/* task lists -> real checkboxes, no bullet, line-through when checked */
.content ul.contains-task-list { list-style: none; padding-left: 0.2rem; }
.content li.task-list-item { display: flex; align-items: flex-start; gap: 0.6rem; }
.content li.task-list-item::marker { content: ""; }
.content li.task-list-item input[type="checkbox"] {
  width: 1.15em; height: 1.15em;
  margin-top: 0.28em;
  accent-color: var(--primary);
  cursor: pointer;
  flex: 0 0 auto;
}
.content li.task-list-item.is-checked { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--primary); }

/* FAQ accordions */
.faq-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin: 0.7rem 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.faq-accordion > summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.2rem;
  font-weight: 650;
  color: var(--primary-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-accordion > summary::-webkit-details-marker { display: none; }
.faq-accordion > summary::after {
  content: "+";
  font-size: 1.4rem;
  line-height: 1;
  color: var(--primary);
  transition: transform var(--transition);
}
.faq-accordion[open] > summary::after { transform: rotate(45deg); }
.faq-accordion > summary:hover { background: var(--surface-2); }
.faq-accordion__body { padding: 0 1.2rem 1.1rem; }
.faq-accordion__body > *:first-child { margin-top: 0; }

/* tables */
.table-scroll { overflow-x: auto; margin: 1.4rem 0; border: 1px solid var(--border); border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
.content table { border-collapse: collapse; width: 100%; min-width: 460px; font-size: 0.95rem; }
.content thead th { background: var(--surface-2); color: var(--primary-strong); text-align: left; }
.content th, .content td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); }
.content tbody tr:hover { background: var(--surface-2); }

/* mermaid */
.content pre.mermaid, .content .mermaid { background: var(--surface); border: 1px solid var(--border); text-align: center; box-shadow: none; }

/* related / child nav on content pages */
.subnav {
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}
.subnav h2 { font-size: 1.15rem; margin: 0 0 1rem; color: var(--primary-strong); border: 0; padding: 0; }
.subnav__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.9rem; list-style: none; margin: 0; padding: 0; }
.subnav__list a {
  display: block;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.subnav__list a:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); color: var(--primary-strong); }
.subnav__list span { display: block; font-weight: 450; font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }

/* ---------------- Responsive ---------------- */
@media (max-width: 820px) {
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem;
    box-shadow: var(--shadow-md);
    transform: translateY(-130%);
    transition: transform var(--transition);
  }
  .nav.is-open { transform: translateY(0); }
  .nav__toggle { display: inline-flex; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .site-footer__grid { grid-template-columns: 1fr; }
  .hero__actions .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------- Diagrams (Mermaid) + full-screen lightbox ---------------- */
.diagram-figure {
  position: relative;
  margin: 1.6rem 0;
  padding: 1rem 1rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.diagram-figure .mermaid {
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  cursor: zoom-in;
  overflow-x: auto;
}
.diagram-figure .mermaid svg { max-width: 100%; height: auto; }
.diagram-figure figcaption {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}
.diagram-expand {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  font: 600 0.78rem var(--font);
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.diagram-figure:hover .diagram-expand,
.diagram-expand:focus-visible { opacity: 1; }
.diagram-expand:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.diagram-expand svg { width: 14px; height: 14px; }

/* Full-screen modal */
body.has-modal { overflow: hidden; }
.diagram-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(13, 42, 40, 0.82);
  backdrop-filter: blur(4px);
  animation: diagram-fade 0.18s ease;
}
@keyframes diagram-fade { from { opacity: 0; } to { opacity: 1; } }
.diagram-modal__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 96vw;
  height: 92vh;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.6rem 1.25rem 1.25rem;
}
.diagram-modal__stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.diagram-modal__stage svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}
.diagram-modal__caption {
  margin: 0.9rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
.diagram-modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.diagram-modal__close:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.diagram-modal__close svg { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .diagram-modal { animation: none; }
}
