/* =========================================================
   ZealPHP — Design System
   Clean, developer-focused, indigo accent
   ========================================================= */

:root {
  --accent:       #6366f1;
  --accent-dark:  #4f46e5;
  --accent-light: #e0e7ff;
  --bg:           #ffffff;
  --bg-alt:       #f8fafc;
  --bg-dark:      #0f172a;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --nav-bg:       #0f172a;
  --nav-text:     #e2e8f0;
  --code-bg:      #1e1e2e;
  --code-text:    #cdd6f4;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --font:         system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  --nav-w:        240px;
  --content-max:  1100px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.65; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Typography ── */
h1 { font-size: 2.25rem; font-weight: 800; line-height: 1.2; letter-spacing: -.03em; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p  { max-width: 70ch; }

/* ── Layout: Shell ── */
.shell { display: flex; min-height: 100vh; }

/* ── Top Nav (horizontal) ── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 0;
  padding: 0 1.5rem; height: 56px;
}
.topnav .logo {
  font-size: 1.1rem; font-weight: 800; color: #fff;
  display: flex; align-items: center; gap: 0;
  margin-right: 2rem; text-decoration: none;
  white-space: nowrap;
}
.topnav .logo span { color: var(--accent); }
.topnav nav { display: flex; gap: .1rem; flex: 1; }
.topnav nav a {
  color: #94a3b8; font-size: .85rem; font-weight: 500;
  padding: .4rem .75rem; border-radius: 5px;
  transition: background .15s, color .15s;
}
.topnav nav a:hover, .topnav nav a.active {
  color: #fff; background: rgba(255,255,255,.08); text-decoration: none;
}
.topnav .actions { display: flex; gap: .5rem; margin-left: auto; }
.topnav .actions a {
  color: #cbd5e1; font-size: .82rem; padding: .35rem .8rem;
  border: 1px solid rgba(255,255,255,.12); border-radius: 5px;
}
.topnav .actions a:hover { background: rgba(255,255,255,.06); text-decoration: none; }

/* ── Page body ── */
.page-body { flex: 1; display: flex; flex-direction: column; }

/* ── Container ── */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 1.5rem; width: 100%; }

/* ── Section ── */
.section { padding: 3rem 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-title { font-size: 1.6rem; font-weight: 800; margin-bottom: .4rem; }
.section-desc  { color: var(--text-muted); max-width: 60ch; margin-bottom: 2rem; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
  color: #fff; padding: 5rem 1.5rem 4rem;
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,.25) 0%, transparent 65%);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); color: #fff; position: relative; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.15rem; color: #94a3b8; margin: 1rem auto 2rem; position: relative; }
.hero .cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; position: relative; }
.oss-badges {
  display: flex;
  justify-content: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  position: relative;
}
.oss-badges a {
  display: inline-flex;
  line-height: 0;
}
.oss-badges img {
  display: block;
  height: 20px;
  width: auto;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.4rem; border-radius: 7px; font-size: .9rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s; text-decoration: none !important;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { border: 1px solid rgba(255,255,255,.25); color: #fff; background: transparent; }
.btn-outline:hover { background: rgba(255,255,255,.08); }
.btn-sm { padding: .35rem .9rem; font-size: .8rem; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-alt); }

/* ── Benchmark bar ── */
.bench-note {
  text-align: center;
  color: #cbd5e1;
  font-size: .82rem;
  margin: 1.75rem auto .75rem;
  position: relative;
}
.bench {
  display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap;
  padding: 1.5rem; background: rgba(255,255,255,.04); border-radius: var(--radius);
  margin: 0 auto 0; max-width: 700px; position: relative;
}
.bench-stat { text-align: center; }
.bench-stat .num { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.bench-stat .label { font-size: .78rem; color: #64748b; margin-top: .15rem; }

/* ── Feature grid ── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

/* ── Cards ── */
.card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-icon { font-size: 1.8rem; margin-bottom: .75rem; }
.card h3 { margin-bottom: .4rem; }
.card p { font-size: .875rem; color: var(--text-muted); }
.card .card-link {
  display: inline-block; margin-top: 1rem; font-size: .82rem;
  font-weight: 600; color: var(--accent);
}

/* ── Demo panel (code + live output split) ── */
.demo-panel {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin: 1.5rem 0; box-shadow: var(--shadow);
}
.demo-panel.full { grid-template-columns: 1fr; }
.demo-code {
  background: var(--code-bg); padding: 1.25rem;
  overflow-x: auto; border-right: 1px solid rgba(255,255,255,.06);
}
.demo-code pre { margin: 0; }
.demo-code code { font-family: var(--font-mono); font-size: .82rem; line-height: 1.6; }
.demo-output {
  background: var(--bg-alt); padding: 1.25rem;
  font-family: var(--font-mono); font-size: .82rem;
  min-height: 120px; position: relative;
}
.demo-output .label {
  position: absolute; top: .5rem; right: .75rem;
  font-size: .7rem; color: var(--text-muted); font-family: var(--font); text-transform: uppercase;
}
.demo-output pre { white-space: pre-wrap; word-break: break-all; color: #1e293b; }
.demo-loading { color: var(--text-muted); font-style: italic; font-family: var(--font); }
.demo-run-btn {
  position: absolute; bottom: .75rem; right: .75rem;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: .3rem .8rem; border-radius: 5px; font-size: .78rem; font-weight: 600;
}
.demo-run-btn:hover { background: var(--accent-dark); }

/* ── Code block (display only) ── */
.code-block {
  background: var(--code-bg); border-radius: var(--radius);
  padding: 1.25rem; overflow-x: auto; margin: 1rem 0;
}
.code-block pre { margin: 0; }
.code-block code { font-family: var(--font-mono); font-size: .82rem; line-height: 1.6; color: var(--code-text); }
.code-label {
  background: rgba(255,255,255,.04); color: #94a3b8; font-size: .72rem;
  padding: .2rem .6rem; border-radius: 4px 4px 0 0; font-family: var(--font);
  display: inline-block; margin-bottom: -.1rem; text-transform: uppercase; letter-spacing: .05em;
}

/* ── HTTP method badges ── */
.badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 4px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; font-family: var(--font-mono);
}
.badge-get     { background: #d1fae5; color: #065f46; }
.badge-post    { background: #dbeafe; color: #1e40af; }
.badge-put     { background: #fef3c7; color: #92400e; }
.badge-patch   { background: #ede9fe; color: #5b21b6; }
.badge-delete  { background: #fee2e2; color: #991b1b; }
.badge-ws      { background: #ecfdf5; color: #047857; border: 1px solid #6ee7b7; }
.badge-sse     { background: #fdf4ff; color: #7e22ce; }
.badge-feature { background: var(--accent-light); color: var(--accent-dark); }

/* ── Table ── */
.ztable { width: 100%; border-collapse: collapse; font-size: .875rem; margin: 1rem 0; }
.ztable th { background: var(--bg-alt); font-weight: 600; padding: .6rem 1rem; text-align: left; border-bottom: 2px solid var(--border); }
.ztable td { padding: .6rem 1rem; border-bottom: 1px solid var(--border); }
.ztable tr:last-child td { border-bottom: none; }
.ztable code { font-size: .8rem; background: var(--bg-alt); padding: .1rem .35rem; border-radius: 3px; font-family: var(--font-mono); }

/* ── Injection table (routing page) ── */
.inject-grid { display: grid; gap: 1.25rem; }
.inject-case { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.inject-case-header {
  background: var(--bg-alt); padding: .6rem 1rem;
  font-size: .82rem; font-weight: 600; display: flex; gap: .5rem; align-items: center;
  border-bottom: 1px solid var(--border);
}
.inject-case-body { display: grid; grid-template-columns: 1fr 1fr; }
.inject-case-body .demo-code { border-radius: 0; border-top: none; border-right: 1px solid var(--border); }
.inject-case-body .demo-output { border-radius: 0; }

/* ── Quick start ── */
.quickstart {
  background: var(--bg-dark); color: var(--code-text);
  border-radius: var(--radius); padding: 2rem;
  font-family: var(--font-mono); font-size: .875rem; line-height: 1.8;
  margin: 2rem 0;
}
.quickstart .comment { color: #6272a4; }
.quickstart .cmd     { color: #50fa7b; }
.quickstart .php     { color: #ff79c6; }

/* ── Alert / callout ── */
.callout {
  padding: 1rem 1.25rem; border-radius: var(--radius);
  border-left: 4px solid var(--accent);
  background: var(--accent-light); margin: 1rem 0;
  font-size: .875rem;
}
.callout.warn  { border-color: var(--warning); background: #fffbeb; }
.callout.info  { border-color: var(--accent);  background: var(--accent-light); }

/* ── Footer ── */
footer {
  background: var(--bg-alt); border-top: 1px solid var(--border);
  padding: 2rem 1.5rem; margin-top: auto;
}
.footer-inner {
  max-width: var(--content-max); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
}
.footer-brand { font-weight: 700; color: var(--text); }
.footer-brand span { color: var(--accent); }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { font-size: .85rem; color: var(--text-muted); }
.footer-copy { font-size: .82rem; color: var(--text-muted); }

/* ── WebSocket demo ── */
.ws-shell {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin: 1.5rem 0;
}
.ws-topbar {
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: .7rem 1rem; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.ws-status { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; font-weight: 700; }
.ws-dot { width: .6rem; height: .6rem; border-radius: 50%; background: #94a3b8; display: inline-block; }
.ws-status[data-state="connecting"] .ws-dot { background: #f59e0b; }
.ws-status[data-state="open"] .ws-dot { background: #16a34a; }
.ws-status[data-state="error"] .ws-dot { background: #dc2626; }
.ws-meta { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; color: var(--text-muted); font-size: .78rem; }
.ws-meta code { background: var(--bg-alt); padding: .16rem .42rem; border-radius: 4px; color: var(--text); }
.ws-log {
  background: var(--code-bg); color: var(--code-text);
  font-family: var(--font-mono); font-size: .78rem;
  min-height: 200px; max-height: 300px; overflow-y: auto;
  padding: 1rem;
}
.ws-msg { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.ws-msg.sent { color: #58a6ff; }
.ws-msg.recv { color: #3fb950; }
.ws-msg.sys  { color: #8b949e; font-style: italic; }
.ws-msg.err  { color: #f85149; }
.ws-quick {
  background: #f8fafc; border-top: 1px solid var(--border);
  padding: .6rem 1rem; display: flex; gap: .45rem; flex-wrap: wrap;
}
.ws-chip {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 5px; padding: .25rem .6rem; font-size: .78rem;
  cursor: pointer; font-weight: 600;
}
.ws-chip:hover { border-color: var(--accent); color: var(--accent); }
.ws-controls {
  background: var(--bg-alt); border-top: 1px solid var(--border);
  padding: .75rem 1rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
}
.ws-select {
  padding: .4rem .7rem; border: 1px solid var(--border);
  border-radius: 5px; font-size: .85rem; background: var(--bg);
  min-width: 14rem;
}
.ws-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 5px; padding: .4rem .7rem; font-size: .85rem; outline: none;
  min-width: 13rem;
}
.ws-input:focus { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: not-allowed; }

/* ── SSE log ── */
.sse-log {
  background: var(--code-bg); color: var(--code-text);
  font-family: var(--font-mono); font-size: .78rem;
  min-height: 120px; max-height: 200px; overflow-y: auto;
  padding: 1rem; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.06);
}
.sse-event { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.sse-event.open { color: #3fb950; }
.sse-event.tick { color: #58a6ff; }
.sse-event.done { color: #f78166; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; gap: 0; }
.tab-btn {
  padding: .55rem 1.1rem; font-size: .85rem; font-weight: 500; cursor: pointer;
  border: none; background: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; color: var(--text-muted); transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .demo-panel { grid-template-columns: 1fr; }
  .demo-code { border-right: none; border-bottom: 1px solid var(--border); }
  .inject-case-body { grid-template-columns: 1fr; }
  .topnav nav { display: none; }
  h1 { font-size: 1.75rem; }
  .hero { padding: 3rem 1rem 2.5rem; }
  .bench { gap: 1rem; }
}

/* ── Highlight.js overrides ── */
.hljs { background: transparent !important; padding: 0 !important; }
