/* ============================================================
   Audit1 Developer Docs Portal — Stylesheet
   Stripe-style 3-column layout, Audit1 design-system tokens.
   Source of truth: docs/superpowers/specs/2026-04-25-audit1-design-system.md
   ============================================================ */

/* -----------------------------------------------
   1. Design Tokens
   ----------------------------------------------- */
:root {
  /* Brand (hex — intentionally NOT oklch, per spec) */
  --primary:               #4f39f6;            /* Indigo — accent: borders, rings, active states */
  --primary-foreground:    #ffffff;
  --complementary:         #8200db;            /* Purple — CTA button background */
  --complementary-foreground: #ffffff;

  /* Semantic (light mode, OKLCH per spec) */
  --background:            oklch(1 0 0);
  --foreground:            oklch(0.145 0 0);
  --card:                  oklch(1 0 0);
  --card-foreground:       oklch(0.145 0 0);
  --popover:               oklch(1 0 0);
  --popover-foreground:    oklch(0.145 0 0);
  --secondary:             oklch(0.97 0 0);
  --secondary-foreground:  oklch(0.205 0 0);
  --muted:                 oklch(0.97 0 0);
  --muted-foreground:      oklch(0.556 0 0);
  --accent:                oklch(0.97 0 0);
  --accent-foreground:     oklch(0.205 0 0);
  --destructive:           oklch(0.577 0.245 27.325);
  --border:                oklch(0.922 0 0);
  --input:                 oklch(0.922 0 0);
  --ring:                  oklch(0.708 0 0);

  /* Sidebar tokens (spec) */
  --sidebar:               oklch(0.985 0 0);
  --sidebar-foreground:    oklch(0.145 0 0);
  --sidebar-border:        oklch(0.922 0 0);

  /* Radius scale (spec) */
  --radius:    0.625rem;                       /* 10px — base */
  --radius-sm: calc(var(--radius) - 4px);      /* 6px */
  --radius-md: calc(var(--radius) - 2px);      /* 8px */
  --radius-lg: var(--radius);                  /* 10px */
  --radius-xl: calc(var(--radius) + 4px);      /* 14px */

  /* Derived primary tints (used in active/hover overlays — keep in one place) */
  --primary-tint:        rgba(79, 57, 246, 0.06);
  --primary-tint-strong: rgba(79, 57, 246, 0.10);

  /* Typography (spec — always include fallback chain) */
  --font-sans: "Geist", "Geist Sans", ui-sans-serif, system-ui, -apple-system,
               BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
               Consolas, "Liberation Mono", "Courier New", monospace;
}

.dark {
  /* Semantic overrides per spec; brand hex stays the same */
  --background:            oklch(0.145 0 0);
  --foreground:            oklch(0.985 0 0);
  --card:                  oklch(0.205 0 0);
  --card-foreground:       oklch(0.985 0 0);
  --popover:               oklch(0.205 0 0);
  --popover-foreground:    oklch(0.985 0 0);
  --secondary:             oklch(0.269 0 0);
  --secondary-foreground:  oklch(0.985 0 0);
  --muted:                 oklch(0.269 0 0);
  --muted-foreground:      oklch(0.708 0 0);
  --accent:                oklch(0.269 0 0);
  --accent-foreground:     oklch(0.985 0 0);
  --border:                oklch(1 0 0 / 10%);
  --input:                 oklch(1 0 0 / 15%);
  --ring:                  oklch(0.556 0 0);

  --sidebar:               oklch(0.205 0 0);
  --sidebar-foreground:    oklch(0.985 0 0);
  --sidebar-border:        oklch(1 0 0 / 10%);
}

/* -----------------------------------------------
   2. Reset + Base
   ----------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  font-family: inherit;
}

::selection {
  background: var(--primary-tint-strong);
  color: var(--foreground);
}

/* -----------------------------------------------
   Lucide icons (inline SVG, sized to current font)
   Default: subtle, muted, text-sized. Status variants below add weight.
   ----------------------------------------------- */
.icon {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.15em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  color: var(--muted-foreground);
  opacity: 0.85;
}

/* Slightly tighter on phones so dense Next-Steps tables don't feel heavy */
@media (max-width: 768px) {
  .icon {
    width: 0.85em;
    height: 0.85em;
  }
}

/* Tighten margins when the icon sits as a leading bullet inside a table cell */
td > .icon:first-child,
th > .icon:first-child,
li > .icon:first-child,
p > .icon:first-child {
  margin-right: 0.4em;
}

/* Status-coloured variants — opaque so they read as semantic colour, not muted */
.icon-x-circle,
.icon-check-circle,
.icon-circle-check,
.icon-alert-triangle,
.icon-circle-dot,
.icon-info,
.icon-lightbulb,
.icon-party-popper { opacity: 1; }

.icon-x-circle      { color: oklch(0.577 0.245 27.325); }   /* destructive red */
.icon-check-circle  { color: oklch(0.55 0.18 152); }        /* success green   */
.icon-circle-check  { color: oklch(0.55 0.18 152); }
.icon-alert-triangle{ color: oklch(0.7 0.15 75); }          /* warning amber   */
.icon-circle-dot    { color: oklch(0.577 0.245 27.325); }   /* status red dot  */
.icon-info          { color: var(--primary); }
.icon-lightbulb     { color: oklch(0.7 0.15 75); }
.icon-party-popper  { color: var(--complementary); }

/* -----------------------------------------------
   Mermaid diagrams (themeable, glass-card surface)
   ----------------------------------------------- */
.mermaid-figure {
  margin: 32px 0;
  padding: 24px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--background);
  /* Surface glass per spec §5 */
  background: color-mix(in oklab, var(--background) 40%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-x: auto;
  text-align: center;
}

.mermaid-figure .mermaid {
  display: inline-block;
  min-width: min(100%, 280px);
  font-family: var(--font-sans);
  /* Hide the source text before Mermaid replaces it with SVG */
  color: transparent;
}

.mermaid-figure .mermaid[data-processed="true"] {
  color: inherit;
}

.mermaid-figure .mermaid svg {
  max-width: 100%;
  height: auto;
}

/* Mobile: trim padding so diagrams use full width */
@media (max-width: 768px) {
  .mermaid-figure {
    padding: 16px 8px;
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

/* -----------------------------------------------
   3. Topbar
   ----------------------------------------------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  /* Frosted UI glass level — spec §5 */
  background: color-mix(in oklab, var(--background) 95%, transparent);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--foreground);
}

.topbar-logo img {
  height: 28px;
  width: auto;
}

.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

.dark .logo-light {
  display: none;
}

.dark .logo-dark {
  display: block;
}

.logo-suffix {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-left: 4px;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 400px;
  margin: 0 auto;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  padding: 7px 14px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  transition: border-color 0.15s;
}

.search-trigger:hover {
  border-color: var(--primary);
}

.search-trigger svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.5;
}

.search-trigger span {
  flex: 1;
  text-align: left;
}

.search-trigger kbd {
  background: var(--background);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  line-height: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--foreground);
  transition: background 0.15s;
}

.theme-toggle:hover {
  background: var(--muted);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.icon-sun {
  display: block;
}

.icon-moon {
  display: none;
}

.dark .icon-sun {
  display: none;
}

.dark .icon-moon {
  display: block;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--foreground);
}

.menu-toggle:hover {
  background: var(--muted);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

/* -----------------------------------------------
   4. Sidebar
   ----------------------------------------------- */
.sidebar {
  position: fixed;
  left: 0;
  top: 56px;
  width: 240px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
  padding: 24px 16px;
  background: var(--sidebar);
  z-index: 50;
}

.sidebar-category {
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-top: 24px;
  margin-bottom: 8px;
  padding-left: 12px;
}

.sidebar-category:first-child {
  margin-top: 8px;
}

.sidebar-link {
  display: block;
  padding: 6px 12px;
  font-size: 0.875rem;
  color: var(--foreground);
  text-decoration: none;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}

.sidebar-link:hover {
  background: var(--muted);
}

.sidebar-link.active {
  border-left: 2px solid var(--primary);
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-tint);
}

/* Custom scrollbar — sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* -----------------------------------------------
   5. Content
   ----------------------------------------------- */
.content {
  margin-left: 240px;
  margin-right: 200px;
  max-width: 720px;
  margin-inline: auto;
  padding: 88px 32px 40px;
  margin-left: 240px;
  margin-right: 200px;
}

/* Wrapper to center within the available space */
.content-inner {
  max-width: 720px;
  margin: 0 auto;
}

.article h1 {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--foreground);
}

.article h2 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 48px 0 16px;
  color: var(--foreground);
  scroll-margin-top: 72px;
}

.article h3 {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 32px 0 12px;
  color: var(--foreground);
  scroll-margin-top: 72px;
}

.article h4 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--foreground);
}

.article p {
  font-size: 1rem;
  line-height: 1.7;
  margin: 12px 0;
  color: var(--foreground);
}

.article a {
  color: var(--primary);
  text-decoration: none;
  transition: text-decoration 0.1s;
}

.article a:hover {
  text-decoration: underline;
}

.article code {
  background: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--foreground);
}

.article ul,
.article ol {
  padding-left: 24px;
  margin: 12px 0;
}

.article li {
  margin: 4px 0;
  line-height: 1.7;
}

.article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.article .lead {
  font-size: 1.125rem;
  color: var(--muted-foreground);
  line-height: 1.7;
  margin-bottom: 32px;
}

/* Heading anchor links */
.heading-anchor {
  opacity: 0;
  color: var(--muted-foreground);
  margin-left: 8px;
  text-decoration: none;
  font-weight: 400;
  transition: opacity 0.15s;
}

.article h2:hover .heading-anchor,
.article h3:hover .heading-anchor,
.article h4:hover .heading-anchor {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--primary);
}

/* -----------------------------------------------
   6. Code Blocks
   ----------------------------------------------- */
.code-group {
  border-radius: var(--radius);
  overflow: hidden;
  margin: 24px 0;
  border: 1px solid #333;
}

.code-tabs {
  background: #1e1e2e;
  display: flex;
  gap: 0;
  border-bottom: 1px solid #333;
}

.code-tab {
  padding: 8px 16px;
  background: transparent;
  color: #999;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.code-tab:hover {
  color: #ccc;
}

.code-tab.active {
  color: #fff;
  border-bottom-color: var(--primary);
}

.code-block {
  background: #1e1e2e;
  padding: 16px;
  overflow-x: auto;
  position: relative;
}

.code-block pre {
  margin: 0;
  padding: 0;
  background: transparent;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e0e0e0;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* Standalone code blocks (no tabs) */
.article pre:not(.code-block pre) {
  background: #1e1e2e;
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid #333;
}

.article pre:not(.code-block pre) code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e0e0e0;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #999;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  transition: background 0.15s, color 0.15s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ccc;
}

.copy-btn.copied {
  color: #10b981;
}

/* Prism theme overrides — always dark */
.code-block .token.comment,
.code-block .token.prolog,
.code-block .token.doctype,
.code-block .token.cdata {
  color: #6a737d;
}

.code-block .token.punctuation {
  color: #bbb;
}

.code-block .token.property,
.code-block .token.tag,
.code-block .token.boolean,
.code-block .token.number,
.code-block .token.constant {
  color: #79c0ff;
}

.code-block .token.string,
.code-block .token.char,
.code-block .token.attr-value {
  color: #a5d6ff;
}

.code-block .token.selector,
.code-block .token.attr-name {
  color: #7ee787;
}

.code-block .token.function,
.code-block .token.builtin {
  color: #d2a8ff;
}

.code-block .token.keyword,
.code-block .token.operator {
  color: #ff7b72;
}

.code-block .token.class-name {
  color: #ffa657;
}

/* -----------------------------------------------
   7. Callout Boxes
   ----------------------------------------------- */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 24px 0;
  border-left: 3px solid;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.callout-info {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.06);
}

.callout-warning {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

.callout-tip {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.06);
}

.dark .callout-info {
  background: rgba(59, 130, 246, 0.1);
}

.dark .callout-warning {
  background: rgba(245, 158, 11, 0.1);
}

.dark .callout-tip {
  background: rgba(16, 185, 129, 0.1);
}

.callout-title {
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout-info .callout-title {
  color: #3b82f6;
}

.callout-warning .callout-title {
  color: #f59e0b;
}

.callout-tip .callout-title {
  color: #10b981;
}

.callout p {
  margin: 4px 0;
  font-size: 0.925rem;
  line-height: 1.6;
}

/* -----------------------------------------------
   8. Tables
   ----------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  background: var(--muted);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  color: var(--foreground);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
}

tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

.dark tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

tr:last-child td {
  border-bottom: none;
}

td code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--muted);
  padding: 2px 5px;
  border-radius: 3px;
}

/* -----------------------------------------------
   9. Right Nav (On This Page)
   ----------------------------------------------- */
.right-nav {
  position: fixed;
  right: 0;
  top: 56px;
  width: 200px;
  height: calc(100vh - 56px);
  padding: 32px 16px;
  overflow-y: auto;
  z-index: 10;
}

.right-nav-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: 12px;
}

.right-nav-inner ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.right-nav-inner li {
  margin: 0;
}

.right-nav-inner a {
  display: block;
  font-size: 0.8rem;
  color: var(--muted-foreground);
  padding: 4px 0;
  padding-left: 12px;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}

.right-nav-inner a:hover {
  color: var(--foreground);
}

.right-nav-inner a.active {
  color: var(--primary);
  border-left-color: var(--primary);
}

/* Nested sub-items */
.right-nav-inner ul ul a {
  padding-left: 24px;
  font-size: 0.75rem;
}

/* -----------------------------------------------
   10. Search Modal
   ----------------------------------------------- */
.search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
}

.search-modal[aria-hidden="false"] {
  display: flex;
}

.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.search-modal-content {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 12px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.2),
    0 0 0 1px var(--border);
  border: 1px solid var(--border);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.search-input-wrap svg {
  width: 18px;
  height: 18px;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--foreground);
  outline: none;
  font-family: var(--font-sans);
}

.search-input::placeholder {
  color: var(--muted-foreground);
}

.search-input-wrap kbd {
  background: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}

.search-results {
  overflow-y: auto;
  padding: 8px;
}

.search-results:empty::after {
  content: "No results";
  display: block;
  padding: 24px 16px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.9rem;
}

.search-category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  padding: 8px 16px 4px;
  font-weight: 600;
}

.search-result {
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.search-result:hover,
.search-result.selected {
  background: var(--muted);
}

.search-result-title {
  font-weight: 500;
  color: var(--foreground);
  font-size: 0.9rem;
}

.search-result-desc {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  margin-top: 2px;
}

/* -----------------------------------------------
   11. Page Navigation
   ----------------------------------------------- */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
}

.page-nav a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: opacity 0.15s;
}

.page-nav a:hover {
  opacity: 0.8;
}

.page-nav-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  display: block;
  margin-bottom: 4px;
  font-weight: 400;
}

.page-nav-prev {
  text-align: left;
}

.page-nav-next {
  text-align: right;
  margin-left: auto;
}

/* -----------------------------------------------
   12. Footer
   ----------------------------------------------- */
.footer {
  margin-top: 48px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer a {
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s;
}

.footer a:hover {
  color: var(--foreground);
}

.footer-links {
  display: flex;
  gap: 16px;
}

/* -----------------------------------------------
   13. Responsive
   ----------------------------------------------- */

/* Sidebar overlay (hidden by default) */
.sidebar-overlay {
  display: none;
}

/* Hide right nav below 1280px */
@media (max-width: 1279px) {
  .right-nav {
    display: none;
  }

  .content {
    margin-right: 0;
  }
}

/* Tablet + mobile */
@media (max-width: 768px) {
  /* Mobile topbar — single row, fixed pixel grid so nothing overlaps.
     Hamburger (32) + gap (8) + logo (flex, with min-width:0 so it truncates)
     + gap (8) + search (32) + gap (4) + theme (32). Total fits 375px easily. */
  .topbar {
    height: 52px;
    padding: 0 12px;
    gap: 8px;
    /* Keep desktop's space-between behaviour but rely on topbar-left
       growing to fill the gap so center + right end up flush right. */
  }

  .topbar-left {
    gap: 8px;
    min-width: 0;            /* allow the logo wordmark to truncate */
    flex: 1 1 auto;
    overflow: hidden;
  }

  .topbar-logo {
    font-size: 0.95rem;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
  }

  .topbar-logo img {
    height: 22px;
    flex-shrink: 0;
  }

  .topbar-logo span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* Hide the secondary wordmark on mobile so the brand stays clean */
  .logo-suffix {
    display: none;
  }

  /* Compact action buttons — uniform 32×32 with 16×16 icons inside */
  .menu-toggle,
  .theme-toggle,
  .search-trigger {
    width: 32px;
    height: 32px;
    padding: 0;
    flex: 0 0 32px;          /* never shrink; never grow */
  }

  .menu-toggle svg,
  .theme-toggle svg,
  .search-trigger svg {
    width: 16px;
    height: 16px;
  }

  /* Center column collapses to fit its icon-only search button */
  .topbar-center {
    flex: 0 0 auto;
    max-width: none;
    margin: 0;
  }

  .search-trigger {
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }

  /* "Back to audit1.com" is redundant on mobile — top-left logo handles it */
  .topbar-back {
    display: none;
  }

  .topbar-right {
    flex: 0 0 auto;
    gap: 4px;
  }

  /* Content sits under the slimmer topbar */
  .content {
    padding-top: 72px;
  }

  /* Anchor-link scroll offset matches the slimmer mobile topbar */
  html {
    scroll-padding-top: 64px;
  }

  /* Sidebar off-canvas */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 50;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(0, 0, 0, 0.3);
  }

  /* Content reflow */
  .content {
    margin-left: 0;
    margin-right: 0;
    padding: 24px 16px;
  }

  /* Show hamburger */
  .menu-toggle {
    display: flex;
  }

  /* Search modal full-width */
  .search-modal-content {
    max-width: calc(100% - 32px);
  }

  /* Adjust heading sizes */
  .article h1 {
    font-size: 1.6rem;
  }

  .article h2 {
    font-size: 1.3rem;
  }

  .article h3 {
    font-size: 1.1rem;
  }

  /* Tables scroll */
  .table-wrap {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* Code blocks edge-to-edge */
  .code-group {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
  }

  /* Page nav stack on small screens */
  .page-nav {
    flex-direction: column;
    gap: 12px;
  }

  .page-nav-next {
    text-align: left;
    margin-left: 0;
  }
}

/* -----------------------------------------------
   Utility Classes
   ----------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 8px;
}

.gap-4 {
  gap: 16px;
}

/* Badge / pill for versioning */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-primary {
  background: var(--primary-tint-strong);
  color: var(--primary);
}

.badge-green {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-orange {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

/* Method badges for endpoint tables */
.method {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.method-get {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.method-post {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.method-put {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.method-delete {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.method-patch {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
}

/* Parameter table styling */
.param-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--foreground);
}

.param-type {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.param-required {
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 600;
}

.param-optional {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

/* -----------------------------------------------
   Transitions + Animations
   ----------------------------------------------- */
.sidebar-link,
.right-nav-inner a,
.search-trigger,
.theme-toggle,
.menu-toggle {
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

/* Smooth color scheme transition */
body,
.topbar,
.sidebar,
.content,
.right-nav,
.search-modal-content {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
