/* Shared chrome + design tokens for Vibe Coding Handbook pages
   Canonical styling across Guide, Security, Mastering AI Agents, Model Routing, AI Models, Case Studies, Codex Plugin, and Resources. */

:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface2: #f4f1ec;
  --card: #ffffff;
  --text: #1a1a1a;
  --ink: #1a1a1a;
  --fg: #1a1a1a;
  --text-dim: #5c5c5c;
  --text-muted: #5c5c5c;
  --muted: #5c5c5c;
  --border: #e8e4df;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-dim: rgba(37, 99, 235, 0.12);
  --code-bg: #f4f1ec;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.08);

  /* Semantic accents */
  --green: #15803d;
  --yellow: #a16207;
  --red: #b91c1c;
  --purple: #7c3aed;
  --teal: #0f766e;
  --orange: #c2410c;
  --blue: #2563eb;
  --pink: #be185d;
  --accent-2: #0f766e;
  --oat: #e8e4df;
  --oat-soft: rgba(232, 228, 223, 0.45);
  --green-soft: rgba(15, 118, 110, 0.12);

  /* Typography */
  --serif: Inter, system-ui, sans-serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, monospace;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, monospace;

  /* Dimensions */
  --site-nav-h: 48px;
}

[data-theme="dark"],
html.dark {
  --bg: #111111;
  --surface: #1a1a1a;
  --surface2: #262626;
  --card: #1a1a1a;
  --text: #ededed;
  --ink: #ededed;
  --fg: #ededed;
  --text-dim: #a3a3a3;
  --text-muted: #a3a3a3;
  --muted: #a3a3a3;
  --border: #2e2e2e;
  --accent: #60a5fa;
  --accent-soft: #1e293b;
  --accent-dim: rgba(96, 165, 250, 0.16);
  --code-bg: #262626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.35);

  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #f87171;
  --purple: #c4b5fd;
  --teal: #5eead4;
  --orange: #fb923c;
  --blue: #60a5fa;
  --pink: #f9a8d4;
  --accent-2: #5eead4;
  --oat: #2e2e2e;
  --oat-soft: rgba(46, 46, 46, 0.5);
  --green-soft: rgba(94, 234, 212, 0.12);
}

/* ==========================================================================
   Site Nav (Fixed Top Bar)
   ========================================================================== */
.vibe-site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10050;
  min-height: var(--site-nav-h, 48px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.45rem 1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  box-sizing: border-box;
}

body.has-vibe-nav {
  padding-top: var(--site-nav-h, 48px);
}

.vibe-site-nav .brand {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-right: 0.35rem;
  white-space: nowrap;
}

.vibe-site-nav .brand:hover {
  color: var(--accent);
}

.vibe-site-nav .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.vibe-site-nav a.nav-link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.vibe-site-nav a.nav-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.vibe-site-nav a.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  font-weight: 600;
}

.vibe-site-nav .nav-spacer {
  flex: 1;
  min-width: 0.5rem;
}

.vibe-site-nav .nav-theme {
  font: inherit;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.34rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.vibe-site-nav .nav-theme:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface2);
}

.vibe-site-nav .nav-lang {
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  flex: 0 0 auto;
}

.vibe-site-nav .nav-lang button {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
  padding: 0.34rem 0.55rem;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.vibe-site-nav .nav-lang button + button {
  border-left: 1px solid var(--border);
}

.vibe-site-nav .nav-lang button:hover {
  color: var(--text);
}

.vibe-site-nav .nav-lang button[aria-pressed="true"] {
  background: var(--accent-dim);
  color: var(--accent);
  cursor: default;
}

.vibe-site-nav .nav-burger,
.vibe-site-nav .nav-scrim,
.vibe-site-nav .nav-toggle {
  display: none;
}

/* ==========================================================================
   Mobile Nav Breakdown (1280px for full site tab list)
   ========================================================================== */
@media (max-width: 1280px) {
  .vibe-site-nav {
    padding: 0 0.75rem;
    gap: 0.25rem 0.35rem;
    flex-wrap: nowrap;
  }
  .vibe-site-nav .brand {
    flex: 0 0 auto;
  }
  .vibe-site-nav .nav-spacer {
    flex: 1 1 auto;
    min-width: 0;
  }
  .vibe-site-nav .nav-theme,
  .vibe-site-nav .nav-lang {
    flex: 0 0 auto;
  }
  .vibe-site-nav .nav-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 1rem;
    line-height: 1;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
  }
  .vibe-site-nav .nav-burger:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
  .vibe-site-nav .nav-links {
    position: absolute;
    top: calc(100% + 6px);
    right: 0.6rem;
    left: auto;
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.15rem;
    min-width: 12rem;
    max-width: calc(100vw - 1.2rem);
    padding: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 10060;
  }
  .vibe-site-nav .nav-toggle:checked ~ .nav-links {
    display: flex;
  }
  .vibe-site-nav a.nav-link {
    display: block;
    white-space: nowrap;
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
  }
  .vibe-site-nav .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: transparent;
  }
  .vibe-site-nav .nav-toggle:checked ~ .nav-scrim {
    display: block;
  }
}

/* ==========================================================================
   TOC Multi-Level & Hanging Indent Components (Canonical Sidebar)
   ========================================================================== */
.ct-toc,
.toc,
.sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--site-nav-h, 48px) + 14px);
  height: calc(100vh - var(--site-nav-h, 48px) - 28px);
  max-height: calc(100dvh - var(--site-nav-h, 48px) - 28px);
  overflow-y: auto;
  padding: 10px 4px 24px 0;
  scrollbar-width: thin;
  box-sizing: border-box;
}

.ct-toc::-webkit-scrollbar,
.toc::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.ct-toc::-webkit-scrollbar-thumb,
.toc::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.ct-toc::-webkit-scrollbar-thumb:hover,
.toc::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.toc-header-wrap {
  padding: 0 4px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.toc-title,
.sidebar-header {
  font-family: var(--mono, monospace);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 6px;
  padding: 0;
  border: none;
}

.toc-search-input,
.nav-search {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 11.5px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.toc-search-input:focus,
.nav-search:focus {
  outline: none;
  border-color: var(--accent);
}

.toc-groups {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-group,
.doc-group {
  margin-bottom: 6px;
}

.toc-group-header,
.doc-group-title {
  font-family: var(--mono, monospace);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding: 8px 6px 4px;
  margin-top: 6px;
  border-top: 1px dashed var(--border);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-group:first-child .toc-group-header,
.doc-group:first-child .doc-group-title {
  margin-top: 0;
  border-top: none;
  padding-top: 2px;
}

.toc-group-items,
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item-block {
  display: flex;
  flex-direction: column;
}

/* TOC Item Alignment with Hanging Indent */
a.toc-item,
.ct-toc a.toc-item,
.toc a.toc-item,
.sidebar a.toc-item,
.doc-list a {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  line-height: 1.35;
  font-weight: 650;
}

a.toc-item:hover,
.ct-toc a.toc-item:hover,
.toc a.toc-item:hover,
.sidebar a.toc-item:hover,
.doc-list a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

a.toc-item.active,
.ct-toc a.toc-item.active,
.toc a.toc-item.active,
.sidebar a.toc-item.active,
.doc-list a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

a.toc-item.active-parent,
.ct-toc a.toc-item.active-parent,
.toc a.toc-item.active-parent,
.sidebar a.toc-item.active-parent {
  color: var(--accent);
  font-weight: 700;
}

a.toc-item .tnum,
.ct-toc a.toc-item .tnum,
.toc a.toc-item .tnum,
.sidebar a.toc-item .tnum {
  font-family: var(--mono, monospace);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1.35;
  min-width: 14px;
  margin-right: 0;
}

a.toc-item span:last-child,
a.toc-item .ttext,
.ct-toc a.toc-item span:last-child,
.ct-toc a.toc-item .ttext,
.toc a.toc-item span:last-child,
.toc a.toc-item .ttext,
.sidebar a.toc-item span:last-child,
.sidebar a.toc-item .ttext {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.35;
  font-weight: 650;
}

/* TOC Sub-Items (Level 3) */
.toc-subitems {
  display: flex;
  flex-direction: column;
  padding-left: 14px;
  margin: 1px 0 3px;
  border-left: 1.5px solid color-mix(in srgb, var(--border) 80%, transparent);
  margin-left: 14px;
  gap: 1px;
  list-style: none;
}

a.toc-subitem,
.ct-toc a.toc-subitem,
.toc a.toc-subitem,
.sidebar a.toc-subitem {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.35;
  transition: color 0.15s, background 0.15s;
}

a.toc-subitem .sdot,
.ct-toc a.toc-subitem .sdot,
.toc a.toc-subitem .sdot,
.sidebar a.toc-subitem .sdot {
  font-family: var(--mono, monospace);
  font-size: 10px;
  opacity: 0.6;
  flex-shrink: 0;
  line-height: 1.35;
}

a.toc-subitem span:last-child,
a.toc-subitem .ttext,
.ct-toc a.toc-subitem span:last-child,
.ct-toc a.toc-subitem .ttext,
.toc a.toc-subitem span:last-child,
.toc a.toc-subitem .ttext,
.sidebar a.toc-subitem span:last-child,
.sidebar a.toc-subitem .ttext {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.35;
}

a.toc-subitem:hover,
a.toc-subitem.active,
.ct-toc a.toc-subitem:hover,
.ct-toc a.toc-subitem.active,
.toc a.toc-subitem:hover,
.toc a.toc-subitem.active,
.sidebar a.toc-subitem:hover,
.sidebar a.toc-subitem.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 600;
}

/* ==========================================================================
   Floating Mobile TOC Pill & Off-canvas Drawer
   ========================================================================== */
.sec-menu,
.ct-menu,
.mobile-menu-btn,
.btn.menu-toggle {
  display: none;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13px;
  margin: 0 0 18px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.sec-menu:hover,
.ct-menu:hover,
.mobile-menu-btn:hover,
.btn.menu-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.toc-overlay,
.ct-overlay,
.overlay {
  display: none;
}

@media (max-width: 960px) {
  .sec-menu,
  .ct-menu,
  .mobile-menu-btn,
  .btn.menu-toggle {
    display: inline-flex;
    position: fixed;
    top: calc(var(--site-nav-h, 48px) + 8px);
    left: 12px;
    z-index: 12;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }

  .ct-toc,
  .toc,
  .sidebar {
    position: fixed;
    top: var(--site-nav-h, 48px);
    left: -100%;
    z-index: 200;
    width: min(85vw, 280px);
    height: calc(100dvh - var(--site-nav-h, 48px));
    max-height: none;
    overflow-y: auto;
    margin: 0;
    padding: 20px 18px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    transition: left 0.25s ease;
  }

  .ct-toc.open,
  .toc.open,
  .sidebar.open {
    left: 0;
  }

  .toc-overlay,
  .ct-overlay,
  .overlay {
    display: none;
    position: fixed;
    inset: var(--site-nav-h, 48px) 0 0 0;
    z-index: 190;
    background: rgba(0, 0, 0, 0.45);
  }

  .toc-overlay.open,
  .ct-overlay.open,
  .overlay.open {
    display: block;
  }
}

/* ==========================================================================
   Resource Hub Cards
   ========================================================================== */
.resource-hub {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.resource-hub h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.resource-hub .lede {
  color: var(--muted);
  margin: 0 0 1.75rem;
  line-height: 1.6;
}

.resource-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.resource-card {
  display: block;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.resource-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.resource-card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--accent);
}

.resource-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.resource-card .tag {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--teal, var(--accent));
}
