/* NoJS Elements — Shared Styles (matching NoJS docs identity) */

:root {
  interpolate-size: allow-keywords;
  transition-behavior: allow-discrete;
  scroll-behavior: smooth;

  /* ─── Base (matching Core) ─────────────────────── */
  --white:                #FFFFFF;
  --surface:              #F8FAFC;
  --surface-alt:          #F1F5F9;
  --text:                 #0F172A;
  --text-secondary:       #334155;
  --text-muted:           #64748B;
  --text-dim:             #94A3B8;

  /* ─── Brand / Accent ────────────────────────────── */
  --primary:              #0EA5E9;
  --primary-dark:         #0284C7;
  --primary-light:        #38BDF8;
  --primary-surface:      #F0F9FF;

  /* ─── Borders ───────────────────────────────────── */
  --border:               #E2E8F0;

  /* ─── Dark / Code ───────────────────────────────── */
  --code-bg:              #0F172A;
  --code-surface:         #1E293B;

  /* ─── Semantic ──────────────────────────────────── */
  --error:                #EF4444;
  --error-dark:           #DC2626;
  --success:              #22C55E;
  --success-dark:         #16A34A;
  --warning:              #F59E0B;
  --warning-dark:         #D97706;

  /* ─── Interactive states ─────────────────────────── */
  --primary-ring:         rgba(14, 165, 233, 0.12);
  --hover-bg:             #F1F5F9;
  --hover-border:         #CBD5E1;

  /* ─── Radius ────────────────────────────────────── */
  --radius:    8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  /* ─── Fonts ─────────────────────────────────────── */
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* ─── Layout ────────────────────────────────────── */
  --header-h:   70px;
  --sidebar-w:  240px;
}

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

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-h);
}

/* ─── Layout ─────────────────────────────────────── */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

/* ─── Demo Sections ──────────────────────────────── */
.demo-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.demo-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
  text-wrap: balance;
}
.demo-section > p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.55;
}
.demo-section > p code {
  font-size: 0.8rem;
  background: var(--surface);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  border: 1px solid var(--surface-alt);
}
.demo-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.demo-area {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--surface-alt);
  border-radius: var(--radius);
}

/* ─── Buttons ────────────────────────────────────── */
button, .btn {
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
button:hover { background: var(--hover-bg); border-color: var(--hover-border); }
button:active { transform: scale(0.97); }
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger  { background: var(--error); color: var(--white); border-color: var(--error); }
.btn-danger:hover { background: var(--error-dark); border-color: var(--error-dark); }
.btn-success { background: var(--success); color: var(--white); border-color: var(--success); }
.btn-success:hover { background: var(--success-dark); border-color: var(--success-dark); }
.btn-warning { background: var(--warning); color: var(--white); border-color: var(--warning); }
.btn-warning:hover { background: var(--warning-dark); border-color: var(--warning-dark); }
.btn-info { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-info:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-default { background: var(--text-muted); color: var(--white); border-color: var(--text-muted); }
.btn-default:hover { background: var(--text-secondary); border-color: var(--text-secondary); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

/* ─── Forms ──────────────────────────────────────── */
input, select, textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
label { font-size: 0.875rem; font-weight: 500; display: block; margin-bottom: 0.25rem; }

/* ─── Utility ────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.p-sm { padding: 0.5rem; }
.p-md { padding: 1rem; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--text-muted); }
.rounded { border-radius: var(--radius-sm); }
.border { border: 1px solid var(--border); }
.bg-light { background: var(--surface); }

/* ─── API Documentation section ─────────────────────── */
.docs-api {
  margin-bottom: 2rem;
}
.docs-api h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--surface-alt);
}
.docs-api h3:first-child {
  margin-top: 0;
}
.docs-api p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.docs-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.docs-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--surface-alt);
  color: var(--text-secondary);
  vertical-align: top;
}
.docs-table tr:last-child td {
  border-bottom: none;
}
.docs-table code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--primary-surface);
  color: var(--primary-dark);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  white-space: nowrap;
}

/* ─── Popover box ───────────────────────────────────── */
.popover-box {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.popover-box h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.popover-box p { margin: 0 0 0.75rem; font-size: 0.875rem; color: var(--text-muted); }
.popover-box button {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  font-size: 0.8rem;
}

/* ─── Table base ─────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--surface-alt);
  font-size: 0.875rem;
}
th { font-weight: 600; background: var(--surface); color: var(--text-secondary); }
td { font-variant-numeric: tabular-nums; }

/* ─── Code block shared styles ──────────────────────── */
.demo-code-scroll {
  overflow: auto;
  flex: 1;
  max-height: 320px;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}
.demo-code-scroll pre {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  color: #CBD5E1;
  margin: 0;
  padding: 16px 16px 16px 0;
  white-space: pre;
  tab-size: 2;
}
.ln {
  display: inline-block;
  width: 36px;
  text-align: right;
  padding-right: 14px;
  color: #334155;
  user-select: none;
  font-size: 11px;
}
.hl-tag  { color: #7DD3FC; }
.hl-attr { color: #FDE68A; }
.hl-str  { color: #86EFAC; }
.hl-cmt  { color: #64748B; font-style: italic; }
.hl-kw   { color: #C4B5FD; }
.hl-fn   { color: #FCA5A5; }
.hl-num  { color: #FDE68A; }
.hl-op   { color: #94A3B8; }
.hl-expr { color: #E2E8F0; }
.hl-line-highlight { color: var(--primary); }

/* ─── Demo tabbed layout (editor style) ─────────────── */
.demo-tabbed {
  border-radius: 10px;
  overflow: hidden;
  margin-top: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid #1E293B;
}
.demo-tabbed-bar {
  display: flex;
  align-items: center;
  background: #0F172A;
  padding: 0;
  gap: 0;
  height: 40px;
}
.demo-tabbed-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 0 14px;
  flex-shrink: 0;
}
.demo-tabbed-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.demo-tabbed-dots span:nth-child(1) { background: #EF4444; opacity: 0.7; }
.demo-tabbed-dots span:nth-child(2) { background: #F59E0B; opacity: 0.7; }
.demo-tabbed-dots span:nth-child(3) { background: #22C55E; opacity: 0.7; }
.demo-tabbed-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
  flex: 1;
  min-width: 0;
}
.demo-tabbed-tabs button {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: #64748B;
  background: #0B1120;
  border: none;
  border-right: 1px solid #1E293B;
  border-radius: 0;
  padding: 0 20px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.demo-tabbed-tabs button:hover { color: #94A3B8; }
.demo-tabbed-tabs button.active {
  color: #E2E8F0;
  background: #1E293B;
  border-bottom: 2px solid #94A3B8;
}
.demo-tabbed-tabs button .tab-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.demo-tabbed-actions {
  margin-left: auto;
  padding: 0 12px;
  flex-shrink: 0;
}
/* panels controlled via NoJS show directive — no CSS display override */
.demo-tabbed-panel.demo-tab-example {
  padding: 2rem;
  background:
    radial-gradient(circle, var(--surface-alt) 1px, transparent 1px);
  background-size: 20px 20px;
  background-color: var(--surface);
}
.demo-tabbed-panel.demo-tab-code {
  background: #0B1120;
}
.demo-tabbed-panel.demo-tab-code .demo-code-scroll {
  max-height: 400px;
}
.demo-tabbed-panel.demo-tab-code pre {
  padding-top: 16px;
}

/* ─── Footer ─────────────────────────────────────── */
.footer {
  background: var(--code-bg);
  border-top: 1px solid var(--code-surface);
}
.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 80px;
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand {}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.footer-logo .logo-img {
  height: 28px;
  width: auto;
}
.footer-logo .logo-title {
  color: #F1F5F9;
}
.footer-desc {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-dim);
  max-width: 300px;
  line-height: 1.6;
}
.footer-cols {
  display: flex;
  gap: 64px;
}
.footer-col {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}
.footer-col a {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-dim);
  transition: color 0.2s;
}
.footer-col a:hover {
  color: var(--white);
}
.footer-divider {
  height: 1px;
  background: var(--code-surface);
  margin: 32px 0;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Responsive Breakpoints (matching Core) ────── */
@media (max-width: 1280px) {
  .container { max-width: 100%; }
}

@media (max-width: 1024px) {
  .footer-inner { padding: 32px 24px; }
  .footer-row { flex-direction: column; gap: 32px; }
  .footer-cols { gap: 32px; }
  .container { padding: 1.5rem; }
}

@media (max-width: 768px) {
  .footer-inner { padding: 32px 20px; }
}

/* ─── Reduced motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
