/* OpenEng Docs — theme matched to openeng.ai (emerald → cyan → indigo on white/slate). */
:root {
  --bg: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-soft: #f1f5f9;
  --fg: #0f172a;
  --fg-muted: #475569;
  --fg-faint: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #047857;        /* emerald-700 */
  --accent-2: #0e7490;      /* cyan-700 */
  --accent-3: #4338ca;      /* indigo-700 */
  --accent-soft: rgba(16, 185, 129, 0.10);
  --indigo-soft: rgba(67, 56, 202, 0.08);
  --warning: #92400e;
  --warning-soft: rgba(180, 83, 9, 0.10);
  --danger: #b91c1c;
  --code-bg: #0f172a;
  --code-fg: #e2e8f0;
  --brand-grad: linear-gradient(135deg, #10b981 0%, #0891b2 50%, #4338ca 100%);
  --header-h: 60px;
  --sidebar-w: 264px;
  --toc-w: 220px;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── header (matched to the openeng.app header) ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 clamp(14px, 3vw, 24px);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
}
.site-header::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, rgba(16,185,129,.5), rgba(8,145,178,.45), rgba(67,56,202,.4)); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--fg); font-size: 15px; min-width: 0; }
.brand img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.brand .wordmark { white-space: nowrap; }
.brand .pill { margin-left: 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; padding: 2px 6px; box-shadow: inset 0 0 0 1px rgba(4,120,87,.16); }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.header-nav a { color: var(--fg-muted); font-weight: 500; font-size: 13px; padding: 7px 11px; border-radius: 8px; white-space: nowrap; }
.header-nav a:hover { color: var(--fg); background: var(--bg-soft); text-decoration: none; }
.header-nav a.primary { color: #fff; background: var(--accent); margin-left: 4px; }
.header-nav a.primary:hover { background: #065f46; }
.menu-toggle { display: none; }
/* the home page has no persistent sidebar — its drawer is mobile-only */
.home-drawer { display: none; }
/* mobile-only links surfaced inside the drawer */
.mobile-links { display: none; }
.mobile-links a { display: block; padding: 9px 10px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--fg-muted); }
.mobile-links a:hover { background: var(--bg-soft); color: var(--fg); text-decoration: none; }
.mobile-links a.primary { background: var(--accent); color: #fff; text-align: center; }

/* ── layout ── */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); max-width: 1400px; margin: 0 auto; }
.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 12px 40px 20px;
  border-right: 1px solid var(--border);
}
.sidebar .group { margin-bottom: 20px; }
.sidebar .group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-faint); padding: 0 10px 6px; }
.sidebar a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--fg-muted); font-size: 14px; font-weight: 500; }
.sidebar a:hover { background: var(--bg-soft); color: var(--fg); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar a .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-grad); flex: none; }

.content { min-width: 0; padding: 40px 48px 80px; }
.doc { max-width: 800px; }
.toc { position: sticky; top: var(--header-h); align-self: start; height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 40px 20px; }
.toc .toc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-faint); margin-bottom: 10px; }
.toc a { display: block; padding: 4px 0; font-size: 13px; color: var(--fg-faint); border-left: 2px solid transparent; padding-left: 12px; margin-left: -2px; }
.toc a:hover { color: var(--fg); text-decoration: none; }

/* ── breadcrumb + title ── */
.breadcrumb { font-size: 13px; color: var(--fg-faint); margin-bottom: 8px; }
.breadcrumb a { color: var(--fg-faint); }
h1.page-title { font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 800; }
.page-title .accent { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ── doc content typography ── */
.doc-content { color: var(--fg-muted); }
.doc-content .lead { font-size: 18px; line-height: 1.6; color: var(--fg); margin: 4px 0 28px; }
.doc-content h2 { font-size: 23px; letter-spacing: -0.01em; color: var(--fg); font-weight: 700; margin: 44px 0 14px; padding-top: 8px; }
.doc-content h3 { font-size: 17.5px; color: var(--fg); font-weight: 650; margin: 28px 0 10px; }
.doc-content p { margin: 0 0 14px; }
.doc-content ul, .doc-content ol { margin: 0 0 16px; padding-left: 22px; }
.doc-content li { margin: 5px 0; }
.doc-content li::marker { color: var(--accent-3); }
.doc-content strong { color: var(--fg); font-weight: 650; }
.doc-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.doc-content a { font-weight: 500; border-bottom: 1px solid transparent; }
.doc-content a:hover { border-bottom-color: currentColor; text-decoration: none; }

/* inline + block code */
.doc-content code { font-family: var(--mono); font-size: 0.86em; background: var(--bg-soft); color: #0e7490; padding: 2px 5px; border-radius: 5px; border: 1px solid var(--border); }
.doc-content pre { background: var(--code-bg); color: var(--code-fg); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; border: 1px solid #1e293b; }
.doc-content pre code { background: none; border: none; color: inherit; padding: 0; font-size: 13.5px; }

/* callouts */
.callout { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--bg-elevated); border-radius: 10px; padding: 12px 16px; margin: 0 0 18px; font-size: 14.5px; }
.callout strong:first-child { color: var(--accent); margin-right: 6px; }
.callout.tip { border-left-color: var(--accent); }
.callout.note { border-left-color: var(--accent-3); background: var(--indigo-soft); }
.callout.note strong:first-child { color: var(--accent-3); }
.callout.warn { border-left-color: var(--warning); background: var(--warning-soft); }
.callout.warn strong:first-child { color: var(--warning); }

/* cards / grids */
.grid { display: grid; gap: 14px; margin: 0 0 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; background: var(--bg); transition: border-color 0.15s, box-shadow 0.15s; }
.card:hover { border-color: var(--border-strong); box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05); }
.card h3 { margin: 0 0 6px; font-size: 15.5px; }
.card p { margin: 0; font-size: 14px; color: var(--fg-muted); }
.card a.card-link { display: block; color: inherit; }
.card .icon { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); margin-bottom: 10px; font-size: 16px; }

/* tables */
.doc-content table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; display: block; overflow-x: auto; }
.doc-content thead th { text-align: left; background: var(--bg-elevated); color: var(--fg); font-weight: 650; padding: 9px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.doc-content tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-content tbody tr:hover { background: var(--bg-elevated); }

/* ── home hero ── */
.hero { text-align: center; padding: 32px 0 12px; }
.hero .eyebrow { display: inline-block; font-size: 12.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 5px 12px; border-radius: 999px; margin-bottom: 16px; }
.hero h1 { font-size: 44px; line-height: 1.1; letter-spacing: -0.025em; font-weight: 800; margin: 0 0 14px; }
.hero p { font-size: 18px; color: var(--fg-muted); max-width: 640px; margin: 0 auto 22px; }
.hero .cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14.5px; border: 1px solid var(--border-strong); color: var(--fg); background: var(--bg); }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #065f46; }

.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 8px 0 0; }
.app-card { border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: block; color: inherit; background: var(--bg); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.app-card:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06); }
.app-card .badge { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; color: #fff; margin-bottom: 12px; }
.app-card h3 { margin: 0 0 6px; font-size: 17px; color: var(--fg); }
.app-card p { margin: 0; font-size: 14px; color: var(--fg-muted); }
.app-card .port { font-family: var(--mono); font-size: 11.5px; color: var(--fg-faint); margin-top: 8px; }

.footer { border-top: 1px solid var(--border); padding: 28px 48px; color: var(--fg-faint); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.footer a { color: var(--fg-muted); }
.footer .sep { color: var(--border-strong); }

/* ── responsive ── */
@media (max-width: 1100px) { .toc { display: none; } .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: var(--header-h); width: 86%; max-width: 340px; height: calc(100vh - var(--header-h)); background: var(--bg); z-index: 40; transform: translateX(-105%); transition: transform 0.2s; box-shadow: 0 12px 40px rgba(15,23,42,0.16); padding: 18px 16px 40px; }
  body.nav-open .sidebar { transform: translateX(0); }
  .home-drawer { display: block; }
  /* On mobile the header collapses: hide the desktop nav, show the hamburger, and move the header
     links into the drawer — this is the responsive pattern the openeng.app header uses. */
  .header-nav { display: none; }
  .menu-toggle { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); cursor: pointer; color: var(--fg-muted); flex: none; }
  .mobile-links { display: block; margin-bottom: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
  .content { padding: 26px 18px 64px; }
  .doc-content .lead { font-size: 16.5px; }
  .doc-content h2 { font-size: 21px; }
  .page-title { font-size: 28px; }
  .app-grid, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .hero { padding: 24px 0 8px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 16.5px; }
  .footer { padding: 24px 18px; }
  .scrim { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(15,23,42,0.4); z-index: 39; display: none; }
  body.nav-open .scrim { display: block; }
}
@media (max-width: 400px) { .brand .wordmark { display: none; } }
