/* SC Engineering Suite documentation. System fonts, no external resources. */
:root {
  --navy: #0b1f3a;
  --navy-2: #13294b;
  --teal: #0f766e;
  --teal-bright: #2dd4bf;
  --bg: #ffffff;
  --surface: #f5f7fa;
  --surface-2: #eaeff5;
  --border: #cfd8e3;
  --text: #15233b;
  --text-muted: #46536a;
  --link: #0f6a63;
  --link-hover: #0b4f4a;
  --focus: #1d4ed8;
  --quality: #1d4ed8;
  --flow: #0e7490;
  --release: #6d28d9;
  --audit: #b45309;
  --badge-dev-bg: #fdf2e3;
  --badge-dev-text: #84420a;
  --badge-dev-border: #e8c79a;
  --callout-note: #0f766e;
  --callout-planned: #6d28d9;
  --callout-warn: #b45309;
  --code-bg: #eef2f7;
  --header-text: #ffffff;
  --header-muted: #c3cfe0;
  --shadow: 0 1px 2px rgb(11 31 58 / 6%), 0 4px 14px rgb(11 31 58 / 6%);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111b2e;
    --surface-2: #19253c;
    --border: #2c3d5a;
    --text: #e6ebf2;
    --text-muted: #aeb8c7;
    --link: #5eead4;
    --link-hover: #99f6e4;
    --focus: #93c5fd;
    --quality: #93c5fd;
    --flow: #67e8f9;
    --release: #c4b5fd;
    --audit: #fcd34d;
    --badge-dev-bg: #3a2a12;
    --badge-dev-text: #fcd99a;
    --badge-dev-border: #6b4a1a;
    --callout-note: #2dd4bf;
    --callout-planned: #c4b5fd;
    --callout-warn: #fbbf24;
    --code-bg: #19253c;
    --navy: #07152a;
    --navy-2: #0f2140;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
main:focus { outline: none; }

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 10;
  background: var(--bg); color: var(--text); padding: 0.6rem 1rem; border-radius: 6px;
  border: 2px solid var(--focus); font-weight: 600;
}
.skip-link:focus { top: 0.75rem; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { background: var(--navy); color: var(--header-text); border-bottom: 3px solid var(--teal-bright); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.brand { display: flex; align-items: center; gap: 0.65rem; color: var(--header-text); text-decoration: none; }
.brand:hover { color: var(--header-text); }
.brand > span { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1.05rem; }
.brand-by { font-size: 0.8rem; color: var(--header-muted); }
.site-header :focus-visible { outline-color: #ffffff; }
.primary-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.primary-nav a {
  display: inline-block; padding: 0.4rem 0.7rem; border-radius: 6px; min-height: 24px;
  color: var(--header-text); text-decoration: none; font-size: 0.95rem;
}
.primary-nav a:hover { background: var(--navy-2); color: var(--header-text); text-decoration: underline; }
.primary-nav a[aria-current] { background: var(--navy-2); box-shadow: inset 0 -2px 0 var(--teal-bright); }

/* Page grid */
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-top: 2rem; padding-bottom: 3rem; }
main { min-width: 0; }
@media (min-width: 900px) {
  .page.has-side { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (min-width: 1200px) {
  .page.has-toc { grid-template-columns: minmax(0, 1fr) 220px; }
  .page.has-side.has-toc { grid-template-columns: 220px minmax(0, 1fr) 220px; }
}

.side-nav, .toc { font-size: 0.95rem; }
.side-nav-title, .toc-title { margin: 0 0 0.5rem; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.side-nav ul, .toc ol { list-style: none; margin: 0; padding: 0; }
.side-nav a, .toc a { display: block; padding: 0.3rem 0.6rem; border-left: 3px solid transparent; color: var(--text); text-decoration: none; }
.side-nav a:hover, .toc a:hover { color: var(--link-hover); text-decoration: underline; }
.side-nav a[aria-current="page"] { border-left-color: var(--quality); font-weight: 600; background: var(--surface); }
@media (min-width: 900px) {
  .side-nav { position: sticky; top: 1rem; align-self: start; }
}
@media (max-width: 899px) {
  .side-nav { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; background: var(--surface); }
  .side-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; }
  .side-nav a { border-left: 0; border-bottom: 2px solid transparent; padding: 0.25rem 0.4rem; }
  .side-nav a[aria-current="page"] { border-bottom-color: var(--quality); background: none; }
}
.toc { display: none; }
@media (min-width: 1200px) {
  .toc { display: block; position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow: auto; }
}

/* Prose */
.prose { max-width: 46rem; }
.prose h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.4rem); line-height: 1.2; margin: 0.25rem 0 1rem; letter-spacing: -0.01em; }
.prose h2 { font-size: 1.5rem; line-height: 1.3; margin: 2.4rem 0 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.prose h3 { font-size: 1.2rem; margin: 1.8rem 0 0.5rem; }
.prose h4 { font-size: 1.05rem; margin: 1.4rem 0 0.4rem; }
.prose h2, .prose h3 { scroll-margin-top: 1rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose li { margin: 0.25rem 0; }
.prose .lead { font-size: 1.2rem; color: var(--text-muted); }
.prose code { font-family: var(--mono); font-size: 0.9em; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
.prose pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.9rem; line-height: 1.5; }
.prose pre code { background: none; padding: 0; overflow-wrap: normal; }
.prose figure { margin: 1.5rem 0; }
.prose figure img { border: 1px solid var(--border); border-radius: 8px; display: block; background: #fff; }
.prose figcaption { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; }
.page-updated { margin-top: 3rem; font-size: 0.9rem; color: var(--text-muted); }
.page-status { margin: 0 0 0.25rem; }

.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); }
thead th { background: var(--surface-2); font-weight: 700; }
tbody th { font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }

/* Badges and callouts */
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; border: 1px solid; letter-spacing: 0.01em; }
.badge-dev { background: var(--badge-dev-bg); color: var(--badge-dev-text); border-color: var(--badge-dev-border); }
.callout { border: 1px solid var(--border); border-left: 4px solid var(--callout-note); background: var(--surface); border-radius: 8px; padding: 0.85rem 1rem; margin: 0 0 1.25rem; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin: 0 0 0.35rem; }
.callout-planned { border-left-color: var(--callout-planned); }
.callout-warn, .callout-draft { border-left-color: var(--callout-warn); }

/* Home */
.hero { padding: 0.5rem 0 1rem; }
.hero h1 { max-width: 40rem; }
.cards { list-style: none; padding: 0; margin: 1.5rem 0 2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1rem; }
.prose .cards li { margin: 0; }
.card { position: relative; height: 100%; display: flex; flex-direction: column; gap: 0.5rem; padding: 1.1rem 1.1rem 1.2rem; border: 1px solid var(--border); border-top: 4px solid var(--product, var(--teal)); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0; padding: 0; border: 0; font-size: 1.2rem; }
.card h2 a, .card h3 a { color: var(--text); text-decoration: none; }
.card h2 a::after, .card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h2 a:hover, .card h3 a:hover { text-decoration: underline; color: var(--text); }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.card a:focus-visible { outline: none; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.97rem; }
.card .card-head { display: flex; align-items: center; gap: 0.75rem; }
.card .card-head img, .card .card-head svg { flex: none; width: 44px; height: 44px; }
.card .card-tag { font-weight: 600; color: var(--product); font-size: 0.95rem; }
.card .card-more { margin-top: auto; padding-top: 0.5rem; font-size: 0.92rem; }
.card-quality { --product: var(--quality); }
.card-flow { --product: var(--flow); }
.card-release { --product: var(--release); }
.card-audit { --product: var(--audit); }

.principles { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1rem; }
.prose .principles li { margin: 0; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: 8px; }
.principles strong { display: block; margin-bottom: 0.2rem; }

.shots { display: grid; gap: 1.25rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 0.92rem; }
.footer-inner { padding-top: 1.5rem; padding-bottom: 2rem; }
.footer-inner p { margin: 0 0 0.75rem; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0 0 0.75rem; padding: 0; }
.site-footer a { color: var(--link); display: inline-block; padding: 0.15rem 0; }
.footer-note { font-size: 0.85rem; }

@media (max-width: 480px) {
  body { font-size: 1rem; }
  .primary-nav a { padding: 0.35rem 0.5rem; font-size: 0.9rem; }
  .prose h2 { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media print {
  .site-header, .side-nav, .toc, .site-footer, .skip-link { display: none; }
  .page { display: block; }
}
.prose.prose-wide { max-width: none; }
.prose-wide > p, .prose-wide > ul:not(.cards):not(.principles), .prose-wide .hero p { max-width: 46rem; }
