/* =========================================================================
   schemavalidation.org — global styles
   Light, elegant, professional palette inspired by MongoDB greens.
   ========================================================================= */

:root {
  /* Palette */
  --brand: #00684a;
  --brand-bright: #13aa52;
  --brand-soft: #e7f4ee;
  --accent: #4b6ff5;
  --accent-2: #00b5ad;
  --amber: #f5a623;
  --pink: #e1568f;

  --bg: #f5f9f7;
  --surface: #ffffff;
  --surface-2: #f0f6f3;
  --ink: #16241f;
  --ink-soft: #3d4f48;
  --muted: #6a7c74;
  --border: #dde7e2;
  --code-bg: #f3f8f5;
  --code-ink: #1d2c26;

  --header-h: 64px;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 3px rgba(16, 40, 32, 0.06), 0 1px 2px rgba(16, 40, 32, 0.04);
  --shadow-md: 0 10px 30px rgba(16, 50, 38, 0.10);
  --maxw: 1320px;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Keep in-page anchor targets clear of the sticky header. */
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Footer always at the bottom, even on short pages. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main { flex: 1 0 auto; width: 100%; }

/* Layout container — wide on desktop, comfortable on mobile. */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 3rem);
}

/* ------------------------------------------------------------------ Links */
a { color: var(--brand); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--brand-bright); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* --------------------------------------------------------------- Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 100%;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-size: 1.04rem;
}
.brand:hover { text-decoration: none; color: var(--brand); }
.brand svg, .brand img { width: 34px; height: 34px; display: block; }
.brand .brand-text { white-space: nowrap; }

.site-nav { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .8rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .95rem;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.site-nav a svg { width: 18px; height: 18px; }
.site-nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.site-nav a.is-active { background: var(--brand); color: #fff; }
.site-nav a.is-active:hover { background: var(--brand); color: #fff; }

@media (max-width: 640px) {
  .brand .brand-text { display: none; }
  .site-nav a { padding: .5rem .6rem; }
  .site-nav a .nav-label { display: none; }
}

/* --------------------------------------------------------------- Footer */
.site-footer {
  flex-shrink: 0;
  margin-top: 4rem;
  background: var(--brand);
  color: #dff1e9;
}
.site-footer .container { padding-block: 2.5rem; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 2.5rem; justify-content: space-between; }
.footer-brand { max-width: 30ch; }
.footer-brand .brand { color: #fff; }
.footer-brand p { color: #bfe0d2; font-size: .92rem; }
.site-footer h4 { color: #fff; margin: 0 0 .7rem; font-size: .95rem; letter-spacing: .02em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.site-footer a { color: #cfe9de; }
.site-footer a:hover { color: #fff; }
.footer-bottom { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,.16); font-size: .85rem; color: #a9d3c3; }

/* --------------------------------------------------------- Page content */
.page { padding-block: 2.2rem 1rem; }
.page-layout { display: block; }

/* Content fills the full width of its container (which is itself centered and
   narrower than the page), rather than sitting in a narrow reading column. */
.prose { max-width: 100%; }
.prose > * { max-width: 100%; }

.prose h1, .page-title {
  font-size: clamp(1.9rem, 1.2rem + 2.4vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: .2em 0 .6em;
  background: linear-gradient(95deg, var(--brand) 0%, var(--brand-bright) 45%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prose h2 {
  font-size: clamp(1.4rem, 1.05rem + 1.1vw, 1.95rem);
  margin: 2.2rem 0 .8rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  position: relative;
  padding-left: .85rem;
}
.prose h2::before {
  content: "";
  position: absolute; left: 0; top: .18em; bottom: .18em;
  width: 5px; border-radius: 6px;
  background: linear-gradient(var(--brand-bright), var(--accent-2));
}
.prose h3 { font-size: 1.28rem; margin: 1.8rem 0 .6rem; color: var(--brand); letter-spacing: -0.01em; }
.prose h4 { font-size: 1.08rem; margin: 1.4rem 0 .5rem; color: var(--ink-soft); }
.prose p { margin: 0 0 1.1rem; color: var(--ink-soft); }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.4rem; color: var(--ink-soft); }
.prose li { margin: .35rem 0; }
.prose li::marker { color: var(--brand-bright); }
.prose strong { color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.prose blockquote {
  margin: 1.4rem 0;
  padding: .6rem 1.2rem;
  border-left: 4px solid var(--brand-bright);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
}

/* Heading anchor links (markdown-it-anchor headerLink) */
.prose :is(h2,h3,h4) > a { color: inherit; text-decoration: none; }
.prose :is(h2,h3,h4) > a:hover { text-decoration: none; color: var(--brand-bright); }

/* ---------------------------------------------------------- Inline code */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: .12em .4em;
  border-radius: 6px;
  border: 0;
}

/* ----------------------------------------------------------- Code blocks */
.code-block {
  position: relative;
  margin: 1.4rem 0;
}
.prose pre[class*="language-"],
.prose pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-size: .9rem;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
  tab-size: 2;
}
.prose pre code { font-family: var(--font-mono); background: none; padding: 0; }

.copy-btn {
  position: absolute;
  top: .6rem; right: .6rem;
  display: inline-flex; align-items: center; gap: .35rem;
  font: 600 .76rem/1 var(--font-sans);
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .4rem .55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease, color .15s ease, transform .1s ease;
}
.code-block:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: var(--brand-soft); }
.copy-btn.copied { color: #fff; background: var(--brand-bright); border-color: var(--brand-bright); }
.copy-btn svg { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1.4rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}
.prose table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .92rem; }
.prose thead th {
  background: var(--brand-soft);
  color: var(--brand);
  text-align: left;
  font-weight: 700;
  padding: .8rem 1rem;
  white-space: nowrap;
}
.prose tbody td { padding: .75rem 1rem; border-top: 1px solid var(--border); color: var(--ink-soft); vertical-align: top; }
.prose tbody tr:nth-child(even) { background: var(--surface-2); }
.prose tbody tr:hover { background: var(--brand-soft); }

/* ------------------------------------------------- Task list checkboxes */
.prose ul.tasklist { list-style: none; padding-left: .2rem; }
.tasklist li.task {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin: .5rem 0;
}
.tasklist li.task::marker { content: ""; }
.task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.25em; height: 1.25em;
  margin-top: .18em;
  border: 2px solid var(--brand-bright);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.task input[type="checkbox"]:hover { border-color: var(--brand); }
.task input[type="checkbox"]:checked { background: var(--brand-bright); border-color: var(--brand-bright); }
.task input[type="checkbox"]:checked::after {
  content: "";
  position: absolute; left: 4px; top: 0px;
  width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.task .task-label { cursor: pointer; }
.task input[type="checkbox"]:checked + .task-label { text-decoration: line-through; color: var(--muted); }

/* ----------------------------------------------------------- Accordions */
.faq { margin: 1.5rem 0; display: grid; gap: .7rem; }
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.2rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background .15s ease;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { background: var(--brand-soft); }
.faq summary::after {
  content: "+";
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--brand-bright);
  transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .faq-body { padding: 0 1.2rem 1.1rem; color: var(--ink-soft); }
.faq .faq-body > *:first-child { margin-top: 0; }

/* --------------------------------------------------------- Breadcrumbs */
.breadcrumbs { font-size: .86rem; color: var(--muted); margin: 0 0 .4rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.breadcrumbs a { color: var(--muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs .sep { color: var(--border); }
.breadcrumbs [aria-current="page"] { color: var(--ink-soft); }

/* ------------------------------------------------------- Related content */
.related {
  margin-top: 3rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border);
}
.related h2 { font-size: 1.25rem; margin: 0 0 1rem; color: var(--ink); }
.card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-bright); text-decoration: none; }
.card .card-title { font-weight: 700; color: var(--ink); display: block; margin-bottom: .25rem; }
.card .card-desc { font-size: .88rem; color: var(--muted); }
.card:hover .card-title { color: var(--brand); }

/* -------------------------------------------------- Mermaid / diagrams */
.diagram {
  position: relative;
  margin: 1.8rem 0;
  padding: 1.2rem 1.2rem 1rem;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.mermaid { margin: 0; text-align: center; min-height: 1em; }
.mermaid svg { max-width: 100%; height: auto; }
.diagram.is-ready .mermaid { cursor: zoom-in; }
.diagram.is-ready .mermaid:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
/* Pre-render / offline fallback: show the source legibly. */
.mermaid.diagram-fallback {
  white-space: pre;
  text-align: left;
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--ink-soft);
  background: var(--code-bg);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.diagram-expand {
  position: absolute;
  top: .6rem; right: .6rem;
  display: inline-flex; align-items: center; gap: .35rem;
  font: 600 .76rem/1 var(--font-sans);
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .4rem .55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease, transform .1s ease;
}
.diagram:hover .diagram-expand,
.diagram-expand:focus-visible { opacity: 1; }
.diagram-expand:hover { background: var(--brand-soft); transform: translateY(-1px); }
.diagram-expand svg { width: 14px; height: 14px; }

/* Full-screen overlay */
body.no-scroll { overflow: hidden; }
.diagram-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(10, 30, 24, 0.82);
  backdrop-filter: blur(6px);
}
.diagram-overlay.open { display: flex; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.diagram-stage {
  background: #ffffff;
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 2.5rem);
  width: min(1500px, 96vw);
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.diagram-stage svg { width: 100%; height: auto; }
.diagram-close {
  position: absolute;
  top: 1rem; right: 1.2rem;
  width: 44px; height: 44px;
  font-size: 1.8rem; line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.diagram-close:hover { background: rgba(255, 255, 255, 0.25); transform: scale(1.05); }

/* =======================================================================
   Homepage
   ======================================================================= */
.hero { padding: clamp(2.5rem, 5vw, 5rem) 0 1rem; text-align: center; }
.hero-logo { display: block; margin: 0 auto 1.4rem; width: clamp(96px, 14vw, 140px); height: auto; filter: drop-shadow(0 12px 24px rgba(0,104,74,.22)); transition: transform .3s ease; }
.hero-logo:hover { transform: translateY(-4px) rotate(-2deg); }
.hero h1 {
  font-size: clamp(2.1rem, 1.2rem + 3.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0 0 .5rem;
  background: linear-gradient(100deg, var(--brand) 0%, var(--brand-bright) 50%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .tagline { font-size: clamp(1.05rem, 1rem + .5vw, 1.4rem); color: var(--ink-soft); max-width: 60ch; margin: 0 auto 2rem; }

.cta-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-bottom: 1rem; }
.cta {
  display: inline-flex; align-items: center; gap: .7rem;
  padding: .85rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.cta:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.cta .cta-icon { display: inline-flex; width: 30px; height: 30px; border-radius: 9px; align-items: center; justify-content: center; }
.cta .cta-icon svg { width: 18px; height: 18px; color: #fff; }
.cta-primary { background: var(--brand); color: #fff; }
.cta-primary .cta-icon { background: rgba(255,255,255,.18); }
.cta-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.cta-secondary .cta-icon { background: var(--accent); }
.cta-tertiary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.cta-tertiary .cta-icon { background: var(--amber); }

/* Intro spans the full container width, aligning with the feature grid and
   header below/above it rather than sitting in a narrow centered column. */
.home-intro { max-width: 100%; margin: 1.5rem 0 0; }
.home-intro p { color: var(--ink-soft); }

.section-block { margin-top: 3.5rem; }
.section-block > h2 { font-size: 1.6rem; letter-spacing: -.01em; color: var(--ink); margin-bottom: .3rem; }
.section-block > p.section-lead { color: var(--muted); margin-top: 0; }

.feature-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 1.3rem; }
.feature-card {
  display: block; padding: 1.4rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--brand-bright); text-decoration: none; }
.feature-card .fc-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: .8rem; }
.feature-card .fc-icon svg { width: 24px; height: 24px; color: #fff; }
.feature-card h3 { margin: 0 0 .35rem; color: var(--ink); font-size: 1.15rem; }
.feature-card:hover h3 { color: var(--brand); }
.feature-card p { margin: 0; color: var(--muted); font-size: .92rem; }

.bg-brand { background: linear-gradient(135deg, var(--brand), var(--brand-bright)); }
.bg-accent { background: linear-gradient(135deg, var(--accent), #6f86ff); }
.bg-teal { background: linear-gradient(135deg, var(--accent-2), #2fd0c8); }
.bg-amber { background: linear-gradient(135deg, var(--amber), #ffc15e); }
.bg-pink { background: linear-gradient(135deg, var(--pink), #f37aaa); }

/* Section landing intro list of children */
.subnav-list { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; gap: .6rem; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
