/* lmscript.io — Unified Stylesheet for LMScript & LMCode Documentation and Guides */
:root {
  --bg: #0b0f17;
  --bg-elevated: #111826;
  --bg-surface: #161f30;
  --bg-code: #0d131f;
  --bg-hover: #1d2940;
  --border: #233047;
  --border-subtle: #1a2436;
  --text: #e6edf7;
  --text-muted: #97a6ba;
  --text-dim: #687890;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.13);
  --lmscript: #38bdf8;
  --lmscript-soft: rgba(56, 189, 248, 0.14);
  --lmcode: #a78bfa;
  --lmcode-soft: rgba(167, 139, 250, 0.14);
  --lmaws: #fbbf24;
  --lmaws-soft: rgba(251, 191, 36, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --danger: #f87171;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
  --max-w: 1240px;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-code: #0f172a;
  --bg-hover: #e2e8f0;
  --border: #cbd5e1;
  --border-subtle: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --lmscript: #0284c7;
  --lmscript-soft: rgba(2, 132, 199, 0.11);
  --lmcode: #7c3aed;
  --lmcode-soft: rgba(124, 58, 237, 0.11);
  --lmaws: #d97706;
  --lmaws-soft: rgba(217, 119, 6, 0.11);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.11);
  --shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Top Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 23, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .topbar {
  background: rgba(248, 250, 252, 0.9);
}

.topbar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--text);
  text-decoration: none !important;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--lmscript), var(--lmcode));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0b0f17;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.84rem;
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

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

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg-surface);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-btn {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.36rem 0.65rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Containers & Layout */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.hero {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background:
    radial-gradient(800px circle at 15% 10%, rgba(56, 189, 248, 0.09), transparent 60%),
    radial-gradient(800px circle at 85% 15%, rgba(167, 139, 250, 0.09), transparent 60%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.28);
  margin-bottom: 1rem;
}

.eyebrow.lmcode {
  background: var(--lmcode-soft);
  color: var(--lmcode);
  border-color: rgba(167, 139, 250, 0.3);
}

.eyebrow.lmaws {
  background: var(--lmaws-soft);
  color: var(--lmaws);
  border-color: rgba(251, 191, 36, 0.3);
}

h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}

h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 2.4rem 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

h3 {
  font-size: 1.18rem;
  line-height: 1.35;
  margin: 1.6rem 0 0.55rem;
}

h4 {
  font-size: 1rem;
  margin: 1.2rem 0 0.4rem;
}

p {
  margin: 0 0 1rem;
}

.lead {
  font-size: 1.14rem;
  color: var(--text-muted);
  max-width: 78ch;
  margin-bottom: 1.5rem;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-lmscript {
  background: var(--lmscript-soft);
  color: var(--lmscript);
  border-color: rgba(56, 189, 248, 0.3);
}

.badge-lmcode {
  background: var(--lmcode-soft);
  color: var(--lmcode);
  border-color: rgba(167, 139, 250, 0.3);
}

.badge-lmaws {
  background: var(--lmaws-soft);
  color: var(--lmaws);
  border-color: rgba(251, 191, 36, 0.3);
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.3);
}

/* Buttons */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none !important;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  transition: all 0.15s ease;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
  background: var(--bg-surface);
}

.btn-primary {
  background: var(--accent);
  color: #08101d;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
}

.btn-lmcode {
  background: var(--lmcode-soft);
  color: var(--lmcode);
  border-color: rgba(167, 139, 250, 0.4);
}

.btn-lmcode:hover {
  background: rgba(167, 139, 250, 0.24);
  border-color: var(--lmcode);
}

/* Grids & Cards */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
}

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

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

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

.card.lmcode-card:hover {
  border-color: rgba(167, 139, 250, 0.55);
}

.card h3 {
  margin: 0.15rem 0;
  font-size: 1.12rem;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.card-footer {
  margin-top: auto;
  padding-top: 0.65rem;
  font-size: 0.86rem;
  font-weight: 600;
}

/* Documentation Layout with Sidebar */
.docs-shell {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 2.25rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.sidebar-group {
  margin-bottom: 1.15rem;
}

.sidebar-group:last-child {
  margin-bottom: 0;
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin: 0 0 0.45rem;
  padding: 0 0.5rem;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.36rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.87rem;
  text-decoration: none;
}

.sidebar-nav a:hover {
  background: var(--bg-surface);
  color: var(--text);
}

.sidebar-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav a.active-lmcode {
  background: var(--lmcode-soft);
  color: var(--lmcode);
  font-weight: 600;
}

.docs-main {
  min-width: 0;
}

/* Code Blocks & Inline Code */
code, kbd {
  font-family: var(--font-mono);
  font-size: 0.87em;
}

p code, li code, td code, h2 code, h3 code, h4 code {
  background: var(--bg-surface);
  color: var(--text);
  padding: 0.14rem 0.38rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  position: relative;
  background: var(--bg-code);
  color: #e6edf7;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.2rem;
  overflow-x: auto;
  margin: 0.85rem 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.56;
}

pre code {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  color: inherit !important;
  font-size: inherit;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.45rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 0.85rem;
}

.code-header + pre {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.copy-btn {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.18rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Interactive Tabs */
.tabs {
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.45rem 0.6rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: var(--border);
}

.tab-panel {
  display: none;
  padding: 1.15rem;
}

.tab-panel.active {
  display: block;
}

.tab-panel pre:last-child {
  margin-bottom: 0;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

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

th, td {
  text-align: left;
  padding: 0.68rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

th {
  background: var(--bg-surface);
  font-weight: 600;
  color: var(--text);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

/* Callouts */
.callout {
  border-left: 4px solid var(--accent);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.95rem 1.15rem;
  margin: 1.15rem 0;
}

.callout-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.callout.lmcode {
  border-left-color: var(--lmcode);
}

.callout.lmaws {
  border-left-color: var(--lmaws);
}

.callout.ok {
  border-left-color: var(--ok);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Search & Filter Input */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1.1rem 0 1.35rem;
}

.filter-input {
  flex: 1 1 280px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.58rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Section spacing */
.section {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 2.5rem 0;
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

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

.footer-col h4 {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (max-width: 920px) {
  .docs-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    max-height: none;
  }
}
