/* ============================================================
   Coduo Documentation — Shared Stylesheet
   ============================================================ */

:root {
  --navy: #0D1B2A;
  --navy-light: #1B3A5C;
  --accent: #2F6FD6;
  --accent-light: #93c5fd;
  --bg: #ffffff;
  --bg-soft: #F6F7F9;
  --bg-code: #0f172a;
  --text: #1A2433;
  --text-soft: #5B6B7E;
  --border: #E3E7ED;
  --success-bg: #ECFBF1;
  --success-border: #BBF0CE;
  --success-text: #176B3A;
  --warn-bg: #FFF8E8;
  --warn-border: #F6E1A6;
  --warn-text: #7A5B05;
  --info-bg: #EBF3FF;
  --info-border: #C6DCFB;
  --info-text: #1A4C96;
  --radius: 10px;
  --max-width: 1180px;
  --sidebar-width: 290px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 15.5px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

code, pre, .mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 16px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.topbar-brand .logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.topbar-nav a {
  color: rgba(255,255,255,0.78);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  white-space: nowrap;
}

.topbar-nav a:hover {
  background: rgba(255,255,255,0.08);
  text-decoration: none;
  color: #fff;
}

.topbar-nav a.active {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ---------- Layout shell ---------- */

.shell {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  align-items: flex-start;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 32px 20px 60px 24px;
  position: sticky;
  top: 61px;
  max-height: calc(100vh - 61px);
  overflow-y: auto;
}

.sidebar nav { display: flex; flex-direction: column; }

.sidebar-group { margin-bottom: 22px; }

.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin: 0 0 8px 4px;
}

.sidebar a {
  display: block;
  font-size: 13.5px;
  color: var(--text-soft);
  padding: 6px 10px;
  border-radius: 7px;
  margin-bottom: 1px;
  font-weight: 500;
}

.sidebar a:hover {
  background: var(--bg-soft);
  text-decoration: none;
  color: var(--text);
}

.sidebar a.active {
  background: var(--info-bg);
  color: var(--accent);
  font-weight: 700;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 40px 32px 100px;
}

/* ---------- Typography ---------- */

.content h1 {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.content .subtitle {
  font-size: 16px;
  color: var(--text-soft);
  margin: 0 0 36px;
}

.content h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 56px 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--navy);
  scroll-margin-top: 80px;
}

.content > h2:first-of-type { border-top: none; padding-top: 0; }

.content h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 32px 0 14px;
  color: var(--navy);
  scroll-margin-top: 80px;
}

.content h4 {
  font-size: 15.5px;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--text);
}

.content p { margin: 0 0 16px; color: var(--text); }

.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--info-bg);
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 14px;
}

/* ---------- Nav-path breadcrumb ---------- */

.nav-path {
  display: inline-block;
  font-size: 13px;
  font-family: monospace;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--navy-light);
  margin: 0 0 18px;
}

/* ---------- Callout boxes ---------- */

.callout {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid;
}

.callout strong.callout-label {
  display: inline-block;
  margin-right: 6px;
  font-weight: 800;
}

.callout-note {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}

.callout-tip {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.callout-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

/* ---------- Code blocks ---------- */

pre.code-block {
  background: var(--bg-code);
  color: #E2E8F0;
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 16px 0;
  position: relative;
}

pre.code-block code { white-space: pre; }

.code-comment { color: #7d93b3; }

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.copy-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.copy-btn.copied { background: #16a34a; border-color: #16a34a; color: #fff; }

code.inline {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.9em;
  color: var(--navy-light);
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 18px 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table th, table td {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
  vertical-align: top;
}

table th {
  background: var(--bg-soft);
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}

table td code.inline { white-space: nowrap; }

/* ---------- Step list ---------- */

.steps { margin: 18px 0; padding: 0; list-style: none; counter-reset: step; }

.steps li {
  counter-increment: step;
  position: relative;
  padding: 4px 0 18px 42px;
  margin: 0;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 26px;
  height: 26px;
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
}

.steps li strong { display: block; margin-bottom: 3px; color: var(--text); }
.steps li p { margin: 0; color: var(--text-soft); font-size: 14px; }

/* ---------- Figure / screenshot ---------- */

figure.shot {
  margin: 22px 0 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
}

figure.shot img { width: 100%; }

figure.shot figcaption {
  font-size: 13px;
  color: var(--text-soft);
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ---------- Checklist ---------- */

.checklist { list-style: none; margin: 14px 0; padding: 0; }

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}

.checklist li::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 1.5px solid #B7C2D0;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---------- Simple grid cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.card h4 { margin: 0 0 6px; }
.card p { margin: 0; font-size: 13.5px; color: var(--text-soft); }

/* ---------- Landing page (index.html) specific ---------- */

.hero {
  background: linear-gradient(155deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  border-radius: 16px;
  padding: 56px 44px;
  margin-bottom: 8px;
}

.hero .eyebrow { background: rgba(255,255,255,0.12); color: #cfe1ff; }

.hero h1 { color: #fff; font-size: 36px; margin-bottom: 14px; }

.hero p.lead {
  font-size: 16px;
  color: rgba(255,255,255,0.75);
  max-width: 620px;
  margin: 0 0 28px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary { background: #fff; color: var(--navy); }
.btn-primary:hover { background: #e8edf5; text-decoration: none; }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #2860bd; text-decoration: none; }

.btn-outline { background: transparent; border-color: rgba(255,255,255,0.35); color: #fff; }
.btn-outline:hover { background: rgba(255,255,255,0.08); text-decoration: none; }

.landing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin: 40px 0;
}

.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color 0.15s, transform 0.15s;
}

.doc-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.doc-card .doc-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--info-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 19px;
}

.doc-card h3 { margin: 0 0 8px; font-size: 18px; }
.doc-card p { margin: 0 0 14px; font-size: 13.5px; color: var(--text-soft); }
.doc-card a.doc-card-link { font-size: 13.5px; font-weight: 700; }

.demo-panel {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin: 40px 0;
}

.demo-panel h3 { margin-top: 0; }

.cred-table { margin-top: 14px; }

.cred-table table th { white-space: normal; }

/* ---------- Footer ---------- */

.doc-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding-top: 24px;
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.page-pager {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
  gap: 16px;
}

.page-pager a {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--text);
  flex: 1;
  max-width: 280px;
}

.page-pager a:hover { border-color: var(--accent); text-decoration: none; }
.page-pager a .pager-label { display: block; font-size: 11px; color: var(--text-soft); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.06em; }
.page-pager .pager-next { text-align: right; margin-left: auto; }

/* ---------- Cost notice blocks (reused from CC listing) ---------- */

.notice-grid { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 30px; }

/* ---------- Search box (cosmetic, client-side filter) ---------- */

.sidebar-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 18px;
  font-family: inherit;
}

.sidebar-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Back to top ---------- */

.to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-size: 18px;
  z-index: 40;
  border: none;
}

.to-top.visible { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .landing-grid, .card-grid { grid-template-columns: 1fr; }

  .menu-toggle { display: inline-block; }

  .topbar-nav {
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 8px 16px 16px;
    display: none;
  }

  .topbar-nav.open { display: flex; }

  .sidebar {
    position: fixed;
    top: 58px;
    left: -100%;
    width: 280px;
    height: calc(100vh - 58px);
    background: var(--bg);
    z-index: 45;
    transition: left 0.2s;
    box-shadow: 2px 0 12px rgba(0,0,0,0.12);
  }

  .sidebar.open { left: 0; }

  .content { padding: 28px 18px 80px; }

  .hero { padding: 36px 22px; }
  .hero h1 { font-size: 26px; }
}

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