/*! pacs008.com design system — self-hosted, WCAG 2.1 AAA (light + dark).
 *  No external CSS, fonts, or trackers. All colour pairs verified >= 7:1.
 *  (c) 2026 pacs008. Licensed Apache-2.0. */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light dark;

  /* Light theme (default). Contrast vs #fff / #eef2f6 verified >= 7:1. */
  --bg: #ffffff;
  --surface: #eef2f6;
  --surface-2: #e3e9ef;
  --border: #cbd5df;
  --text: #14181f;          /* 17.8:1 on bg */
  --muted: #41474f;         /* 9.4:1 on bg, 8.3:1 on surface */
  --brand: #1c4e9e;         /* 8.9:1 on bg, 7.9:1 on surface */
  --brand-strong: #173f86;  /* button bg, white text 9.9:1 */
  --on-brand: #ffffff;
  --ink: #14181f;           /* dark button bg */
  --on-ink: #ffffff;
  --focus: #173f86;
  --code-bg: #f3f5f8;
  --shadow: 0 1px 2px rgba(20, 24, 31, .06), 0 8px 24px rgba(20, 24, 31, .08);
  --radius: 14px;
  --maxw: 76rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas,
    "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #161c26;
    --surface-2: #1c2430;
    --border: #2a323d;
    --text: #e8eef4;        /* 16.2:1 */
    --muted: #aeb9c5;       /* 9.5:1 / 8.6:1 */
    --brand: #82b4ff;       /* 10.6:1 / 9.6:1 */
    --brand-strong: #82b4ff;
    --on-brand: #0d1117;
    --ink: #e8eef4;
    --on-ink: #0d1117;
    --focus: #82b4ff;
    --code-bg: #12181f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
  }
}

/* Explicit user override (persisted by the theme toggle). */
:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161c26;
  --surface-2: #1c2430;
  --border: #2a323d;
  --text: #e8eef4;
  --muted: #aeb9c5;
  --brand: #82b4ff;
  --brand-strong: #82b4ff;
  --on-brand: #0d1117;
  --ink: #e8eef4;
  --on-ink: #0d1117;
  --focus: #82b4ff;
  --code-bg: #12181f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important;
    animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { line-height: 1.2; color: var(--text); font-weight: 700;
  letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.25rem); margin: 0 0 .5em; }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.1rem); margin: 2.2em 0 .6em; }
h3 { font-size: 1.3rem; margin: 1.8em 0 .5em; }
p { margin: 0 0 1.1em; }
a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px;
  text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 700; }
ul, ol { padding-left: 1.3em; }
li { margin: .35em 0; }
img, svg { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ---------- Accessibility helpers ---------- */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px;
  border-radius: 4px; }
.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; }
.skip-link { position: absolute; left: 0; top: -3rem; z-index: 1000;
  background: var(--ink); color: var(--on-ink); padding: .7rem 1.1rem;
  border-radius: 0 0 8px 0; text-decoration: none; font-weight: 600;
  transition: top .15s ease; }
.skip-link:focus { top: 0; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto;
  padding-inline: clamp(1rem, .5rem + 2vw, 2rem); }
main { display: block; }
section { padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem); }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 46ch; }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--bg);
  border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; gap: 1rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 800; font-size: 1.15rem; color: var(--text);
  text-decoration: none; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { flex: 0 0 auto; }
.nav-toggle { margin-left: auto; display: none; align-items: center;
  gap: .5rem; background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: .5rem .7rem;
  font: inherit; font-weight: 600; cursor: pointer; }
.nav-menu { margin-left: auto; display: flex; align-items: center; gap: .25rem;
  list-style: none; padding: 0; }
.nav-menu a { color: var(--text); text-decoration: none; font-weight: 600;
  padding: .5rem .8rem; border-radius: 10px; display: inline-block; }
.nav-menu a:hover { background: var(--surface); }
.nav-menu a[aria-current="page"] { color: var(--brand);
  background: var(--surface); }
.theme-toggle { background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: .5rem .7rem;
  font: inherit; font-weight: 600; cursor: pointer; display: inline-flex;
  align-items: center; gap: .4rem; }
.theme-toggle:hover { background: var(--surface); }

@media (max-width: 56rem) {
  .nav-toggle { display: inline-flex; }
  .nav-menu { position: absolute; inset-inline: 0; top: 4rem;
    flex-direction: column; align-items: stretch; gap: 0; background: var(--bg);
    border-bottom: 1px solid var(--border); padding: .5rem 1rem 1rem;
    box-shadow: var(--shadow); }
  .nav-menu[hidden] { display: none; }
  .nav-menu li { width: 100%; }
  .nav-menu a { display: block; padding: .8rem .6rem;
    border-bottom: 1px solid var(--border); border-radius: 0; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  padding: .8rem 1.4rem; border-radius: 999px; border: 2px solid transparent;
  line-height: 1.2; transition: transform .12s ease, background .12s ease; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--brand-strong); color: var(--on-brand);
  border-color: var(--brand-strong); }
.btn-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-secondary { background: transparent; color: var(--text);
  border-color: var(--border); }
.btn-secondary:hover { background: var(--surface); }
.btn-group { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--surface);
  border-bottom: 1px solid var(--border); }
.hero .container { padding-block: clamp(3rem, 2rem + 6vw, 6.5rem); }
.hero h1 { max-width: 18ch; }
.hero .lead { max-width: 54ch; font-size: clamp(1.1rem, 1rem + .6vw, 1.35rem);
  color: var(--muted); }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: var(--brand);
  background: var(--bg); border: 1px solid var(--border);
  padding: .35rem .7rem; border-radius: 999px; margin-bottom: 1.2rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 2.5rem; }
.hero-stats div { min-width: 8rem; }
.hero-stats dt { font-size: 2rem; font-weight: 800; color: var(--text); }
.hero-stats dd { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.card { background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.section-alt .card { background: var(--bg); }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.card-icon { display: inline-flex; width: 2.75rem; height: 2.75rem;
  align-items: center; justify-content: center; border-radius: 12px;
  background: var(--surface-2); color: var(--brand); margin-bottom: 1rem; }

/* ---------- Suite cards ---------- */
.suite-card { display: flex; flex-direction: column; }
.suite-card .pkg { font-family: var(--mono); font-size: .95rem;
  color: var(--brand); font-weight: 700; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--border); }
.badge-live { color: var(--brand); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .98rem; }
caption { text-align: left; color: var(--muted); padding: .8rem 1rem;
  font-size: .95rem; }
th, td { text-align: left; padding: .8rem 1rem;
  border-bottom: 1px solid var(--border); }
thead th { background: var(--surface); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Code ---------- */
code { font-family: var(--mono); font-size: .92em; background: var(--code-bg);
  padding: .15em .4em; border-radius: 6px; border: 1px solid var(--border); }
pre { background: var(--code-bg); border: 1px solid var(--border);
  border-left: 4px solid var(--brand); border-radius: var(--radius);
  padding: 1.1rem 1.3rem; overflow: auto; line-height: 1.6; }
pre code { background: none; border: 0; padding: 0; font-size: .9rem; }

/* ---------- Callout ---------- */
.callout { border: 1px solid var(--border); border-left: 4px solid var(--brand);
  background: var(--surface); border-radius: var(--radius);
  padding: 1.2rem 1.4rem; margin: 1.5rem 0; }
.callout p:last-child { margin-bottom: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.2rem; }
label { display: block; font-weight: 600; margin-bottom: .4rem; }
input, textarea, select { width: 100%; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .9rem; }
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus);
  outline-offset: 1px; }
.hint { color: var(--muted); font-size: .9rem; margin-top: .3rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border);
  padding-block: 3rem; margin-top: 2rem; }
.footer-grid { display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.footer-grid h2 { font-size: .95rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin: 0 0 .8rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid a { color: var(--text); text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; color: var(--brand); }
.footer-bottom { margin-top: 2rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border); color: var(--muted); font-size: .92rem;
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }

/* ---------- Utilities ---------- */
.center { text-align: center; }
.btn-group.center { justify-content: center; }
.mx-auto { margin-inline: auto; }
.mt-0 { margin-top: 0; }
.prose { max-width: 68ch; }
.prose h2:first-child { margin-top: 0; }
.breadcrumb { font-size: .9rem; color: var(--muted); padding-block: 1rem 0; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem;
  padding: 0; margin: 0; }
.breadcrumb a { color: var(--muted); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }
