/**
 * SQL-Easy - design system (violet-light theme).
 * Built on top of Bootstrap 5; this file defines the visual language -
 * dev-tool aesthetic with violet accents, JetBrains Mono for code, Inter for UI.
 */

:root {
  /* Palette - violet-light from the design bundle */
  --c-bg:        #faf8ff;
  --c-panel:     #ffffff;
  --c-panel2:    #f1edff;
  --c-panel3:    #e7e0ff;
  --c-border:    rgba(67, 56, 202, 0.12);
  --c-border-strong: rgba(67, 56, 202, 0.22);
  --c-text:      #1e1b4b;
  --c-dim:       #4b5563;
  --c-faint:     #9ca3af;
  --c-primary:   #7c3aed;
  --c-primary-hover: #6d28d9;
  --c-primaryInk:#ffffff;
  --c-success:   #15803d;
  --c-success-bg:#ecfdf5;
  --c-danger:    #b91c1c;
  --c-danger-bg: #fef2f2;
  --c-kw:        #be185d;
  --c-string:    #15803d;
  --c-number:    #a16207;
  --c-comment:   #9ca3af;
  --c-glow:      rgba(124, 58, 237, 0.10);
  --c-glow-strong: rgba(124, 58, 237, 0.18);

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, Menlo, monospace;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(67, 56, 202, .06);
  --shadow:    0 4px 14px rgba(67, 56, 202, .08);
  --shadow-lg: 0 24px 60px rgba(67, 56, 202, .12), 0 0 0 1px var(--c-glow);

  /* Bootstrap overrides */
  --bs-primary: #7c3aed;
  --bs-primary-rgb: 124, 58, 237;
  --bs-link-color: #7c3aed;
  --bs-link-hover-color: #6d28d9;
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: #1e1b4b;
  --bs-body-bg: #faf8ff;
  --bs-border-color: rgba(67, 56, 202, 0.12);
}

/* ─── Base ─── */
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  border-top: none; /* override legacy purple stripe */
}
*, *::before, *::after { box-sizing: border-box; }

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

code, pre, .mono { font-family: var(--font-mono); }

h1, h2, h3, h4 { color: var(--c-text); font-weight: 700; letter-spacing: -0.02em; }
h1 { font-family: var(--font-mono); letter-spacing: -0.035em; }
h2 { font-family: var(--font-mono); }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.kicker::before { content: "//"; opacity: .7; }

.kicker-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
  background: var(--c-glow);
  border-radius: 999px;
  padding: 4px 12px;
}
.kicker-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-primary);
}

/* ─── Buttons ─── */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
  border: 1px solid transparent;
}
.btn:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
  box-shadow: none;
}
.btn-primary, .btn-primary:visited {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: var(--c-primaryInk);
  box-shadow: 0 6px 18px var(--c-glow);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--c-primary-hover);
  border-color: var(--c-primary-hover);
  color: var(--c-primaryInk);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px var(--c-glow-strong);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary,
.btn-outline-secondary {
  background: var(--c-panel);
  border-color: var(--c-border-strong);
  color: var(--c-text);
}
.btn-secondary:hover,
.btn-outline-secondary:hover {
  background: var(--c-panel2);
  border-color: var(--c-primary);
  color: var(--c-text);
}
.btn-success {
  background: var(--c-success);
  border-color: var(--c-success);
}
.btn-lg { padding: 0.75rem 1.4rem; font-size: 1rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8125rem; border-radius: 6px; }

.btn-ghost {
  background: var(--c-panel);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  text-align: left;
}
.btn-ghost:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-panel);
}

/* ─── Top nav ─── */
.site-header {
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 28px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--c-text);
}
.site-header .brand:hover { text-decoration: none; color: var(--c-text); }
.site-header .brand .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--c-primary);
  color: var(--c-primaryInk);
  box-shadow: 0 4px 12px var(--c-glow);
}
.site-header .brand .mark svg { display: block; }
.site-header .brand .tld { color: var(--c-faint); font-weight: 400; }
.site-header nav { display: flex; gap: 4px; margin-left: 28px; }
.site-header nav a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--c-dim);
  font-size: 13px;
  font-weight: 500;
}
.site-header nav a:hover { color: var(--c-text); background: var(--c-panel2); text-decoration: none; }
.site-header nav a.active { color: var(--c-text); font-weight: 600; }
.site-header .actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.site-header .free-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--c-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.site-header .free-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-success);
}
.site-header .menu-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 8px;
  margin-right: 4px;
  cursor: pointer;
  color: var(--c-text);
}
.site-header .menu-toggle .bars {
  display: block;
  width: 18px; height: 2px;
  background: currentColor;
  position: relative;
}
.site-header .menu-toggle .bars::before,
.site-header .menu-toggle .bars::after {
  content: "";
  position: absolute; left: 0; right: 0;
  height: 2px; background: currentColor;
}
.site-header .menu-toggle .bars::before { top: -6px; }
.site-header .menu-toggle .bars::after { bottom: -6px; }

/* ─── Site nav drawer (mobile) ─── */
.site-nav-drawer {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: min(86vw, 340px);
  background: var(--c-panel);
  border-right: 1px solid var(--c-border);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.site-nav-drawer.is-open { transform: translateX(0); }
.site-nav-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--c-border);
}
.site-nav-drawer__head .brand-mini {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
}
.site-nav-drawer__head .tld { color: var(--c-faint); font-weight: 400; }
.site-nav-drawer__close {
  background: var(--c-panel2);
  border: 1px solid var(--c-border);
  color: var(--c-dim);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.site-nav-drawer__nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 12px;
}
.site-nav-drawer__nav a {
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--c-text);
  font-size: 14px;
  font-weight: 500;
}
.site-nav-drawer__nav a.active { background: var(--c-panel2); color: var(--c-primary); }
.site-nav-drawer__cta { margin-top: 8px; align-self: flex-start; }
.site-nav-drawer__nav a:hover { background: var(--c-panel2); text-decoration: none; }
.site-nav-drawer__section {
  border-top: 1px solid var(--c-border);
  padding: 14px 16px 80px;
}
.site-nav-drawer__section h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-primary);
  margin: 0 0 10px;
  font-weight: 600;
}
.site-nav-drawer__section .menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 13px;
}
.site-nav-drawer__section .menu-item a {
  color: var(--c-text);
  padding: 6px 10px;
  border-radius: 6px;
  flex: 1;
  display: block;
}
.site-nav-drawer__section .menu-item a:hover { background: var(--c-panel2); text-decoration: none; }
.site-nav-drawer__section .menu-item strong a {
  background: var(--c-primary);
  color: white;
  font-weight: 600;
}
.site-nav-drawer__section .completion-indicator {
  color: var(--c-success);
  font-weight: 700;
}
.site-nav-drawer__backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 12, 47, 0.4);
  z-index: 199;
}
body.nav-open .site-nav-drawer__backdrop { display: block; }
body.nav-open { overflow: hidden; }

/* ─── Footer ─── */
.site-footer {
  padding: 28px 32px;
  border-top: 1px solid var(--c-border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-faint);
  background: var(--c-bg);
}
.site-footer .row-line {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  justify-content: space-between;
  max-width: 1280px; margin: 0 auto;
}
.site-footer a { color: var(--c-dim); }
.site-footer a:hover { color: var(--c-primary); }
.site-footer .langs a { margin-right: 8px; }

/* ─── Cards / panels ─── */
.panel {
  background: var(--c-panel);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
}
.panel-pad { padding: 20px 22px; }
.muted { color: var(--c-dim); }
.faint { color: var(--c-faint); }

/* ─── Alerts (Bootstrap overrides) ─── */
.alert {
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  font-size: 0.95rem;
}
.alert-info {
  background: var(--c-panel2);
  border-color: var(--c-border);
  color: var(--c-text);
}
.alert-success {
  background: var(--c-success-bg);
  border-color: rgba(21, 128, 61, .25);
  color: var(--c-success);
}
.alert-danger {
  background: var(--c-danger-bg);
  border-color: rgba(185, 28, 28, .25);
  color: var(--c-danger);
}

/* Beekeeper Studio promo card - keep brand color, style to fit */
.bk-card {
  background: linear-gradient(135deg, #fff8e6 0%, #ffe9b8 100%);
  border: 1px solid #f0a92c;
  border-left: 5px solid #f0a92c;
  border-radius: var(--radius-lg);
  color: #2b1d05;
  padding: 18px 22px;
}
.bk-card h3, .bk-card h4 { color: #2b1d05; margin-top: 0; }
.bk-card .btn-bk {
  background: #f0a92c;
  border-color: #f0a92c;
  color: #2b1d05;
  font-weight: 700;
}
.bk-card .btn-bk:hover {
  background: #d99419;
  border-color: #d99419;
  color: #2b1d05;
}
.bk-card.bk-card--row {
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
}
.bk-card.bk-card--center { text-align: center; }
.bk-card__body { flex: 1; min-width: 240px; }
.bk-card__body p { margin: 0; }
.bk-card__heading {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 6px;
}
.bk-card.bk-card--center .bk-card__heading {
  display: inline-flex;
  justify-content: center;
}
.bk-card__sub { margin: 0 0 14px; }

/* ─── Tables ─── */
.sql-table-wrap {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: auto;
  background: var(--c-panel);
}
.sql-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12.5px;
  margin: 0;
}
.sql-table th {
  position: sticky; top: 0;
  background: var(--c-panel2);
  color: var(--c-text);
  padding: 8px 12px !important;
  font-weight: 600;
  text-align: left;
  border: none !important;
  border-bottom: 1px solid var(--c-border) !important;
  white-space: nowrap;
}
.sql-table td {
  padding: 6px 12px !important;
  border: none !important;
  border-bottom: 1px dashed var(--c-border) !important;
  color: var(--c-text);
  white-space: nowrap;
}
.sql-table tr:nth-child(even) td { background: rgba(241, 237, 255, 0.35); }
.sql-table tr:last-child td { border-bottom: none !important; }
.sql-table .null { color: var(--c-faint); font-style: italic; }

/* legacy `.table-responsive-xl` from sql-core.js - re-skin */
.table-responsive-xl {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: auto;
  background: var(--c-panel);
}
.table-responsive-xl table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12.5px; margin: 0; }
.table-responsive-xl th {
  background: var(--c-panel2) !important;
  color: var(--c-text) !important;
  padding: 8px 12px !important;
  font-weight: 600; text-align: left;
  border: none !important;
  border-bottom: 1px solid var(--c-border) !important;
}
.table-responsive-xl td {
  padding: 6px 12px !important;
  border: none !important;
  border-bottom: 1px dashed var(--c-border) !important;
  background: transparent;
}
.table-responsive-xl tr:nth-child(even) td { background: rgba(241, 237, 255, 0.35); }

/* ─── Browser-chrome accent (used at top of lesson page) ─── */
.url-bar {
  display: flex; align-items: center; gap: 8px;
  height: 32px;
  padding: 0 12px;
  background: var(--c-panel2);
  border-bottom: 1px solid var(--c-border);
}
.url-bar .dots { display: flex; gap: 6px; }
.url-bar .dots span {
  width: 11px; height: 11px; border-radius: 50%;
}
.url-bar .dots span:nth-child(1) { background: #ff5f57; }
.url-bar .dots span:nth-child(2) { background: #febc2e; }
.url-bar .dots span:nth-child(3) { background: #28c840; }
.url-bar .url {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--c-panel); border: 1px solid var(--c-border);
  border-radius: 6px; padding: 3px 12px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--c-dim);
  margin: 0 auto;
}
.url-bar .url .scheme { color: var(--c-faint); }
.url-bar .url .host { color: var(--c-text); }

/* ─── Mobile ─── */
@media (max-width: 860px) {
  .site-header { padding: 0 12px; }
  .site-header .primary-nav { display: none; }
  .site-header .free-badge { display: none; }
  .site-header .menu-toggle { display: inline-flex; }
}
@media (max-width: 480px) {
  /* Tighten header on phones; show only logo + CTA */
  .site-header .header-cta { display: inline-flex; padding: 6px 10px; font-size: 12px; }
}

/* ─── Floating CTA ─── */
.floating-cta {
  position: fixed; bottom: 20px; right: 20px;
  background: #fdd23a; color: #2b1d05;
  padding: 10px 16px 10px 12px; border-radius: 50px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-weight: 700; font-size: 14px;
  z-index: 1000;
  display: inline-flex; align-items: center; gap: 10px;
  transition: transform .2s, box-shadow .2s;
}
.floating-cta:hover {
  transform: translateY(-2px);
  background: #f0a92c;
  color: #2b1d05;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  text-decoration: none;
}
.floating-cta .bk-icon { width: 28px; height: 28px; flex: 0 0 auto; }
@media (max-width: 768px) {
  .floating-cta { bottom: 12px; right: 12px; padding: 8px 14px 8px 10px; font-size: 12px; }
  .floating-cta .bk-icon { width: 22px; height: 22px; }
}

/* ─── 404 page ─── */
.not-found-page main { padding: 56px 24px 80px; }
.not-found-page .inner { max-width: 880px; margin: 0 auto; text-align: center; }
.not-found-page h1 {
  font-family: var(--font-mono);
  font-size: clamp(34px, 5vw, 52px);
  letter-spacing: -0.035em;
  margin: 8px 0 16px;
}
.not-found-page .lead {
  font-size: 17px;
  color: var(--c-dim);
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto 32px;
}
.not-found-page .cta-row {
  display: flex; gap: 12px; justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 56px;
}
.not-found-page .popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  text-align: left;
}
.not-found-page .popular-card {
  background: var(--c-panel);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  color: var(--c-text);
  transition: transform .15s, border-color .15s, box-shadow .15s;
  display: block;
}
.not-found-page .popular-card:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: var(--c-primary);
  box-shadow: 0 6px 20px var(--c-glow);
}
.not-found-page .popular-card .num {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--c-faint);
  margin-bottom: 4px;
}
.not-found-page .popular-card .title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
}
.not-found-page .popular-card .blurb {
  font-size: 13px;
  color: var(--c-dim);
  line-height: 1.5;
}

/* ─── Prose pages (narrow long-form text) ─── */
.page-prose main { padding: 56px 24px 80px; }
.page-prose .inner { max-width: 760px; margin: 0 auto; }
.page-prose h1 {
  font-family: var(--font-mono);
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: -0.035em;
  margin: 8px 0 24px;
}
.page-prose .lead {
  font-size: 18px;
  color: var(--c-dim);
  line-height: 1.6;
  margin: 0 0 24px;
}
.page-prose p { line-height: 1.7; }
.page-prose .signoff {
  font-style: italic; color: var(--c-dim);
}
.page-prose hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--c-border);
}

/* ─── Beekeeper logo helper ─── */
.bk-icon {
  display: inline-block;
  flex: 0 0 auto;
  object-fit: contain;
  /* small downward nudge counteracts the SVG's tall viewBox so the
     icon visually centers with text when used inside a flex parent */
  vertical-align: middle;
}
.bk-icon-sm { width: 18px; height: 18px; }
.bk-icon-md { width: 24px; height: 24px; }
.bk-icon-lg { width: 32px; height: 32px; }
