/* piivacy-demo — Linear/Vercel-inspired aesthetic
   Dark-mode first, generous spacing, subtle gradients, real typography. */

:root {
  /* Background palette — one notch lighter than initial pass.
     The diagrams have #0b0d10 baked into them; the new --bg-0 of #0e1219
     reads as a graceful container around them rather than a hard edge. */
  --bg-0: #0e1219;
  --bg-1: #141923;
  --bg-2: #1a1f2b;
  --bg-3: #232936;
  --bg-4: #2d3442;

  --border:    rgba(255, 255, 255, 0.06);
  --border-2:  rgba(255, 255, 255, 0.12);
  --border-3:  rgba(255, 255, 255, 0.2);

  --text-0:  #f4f6fa;
  --text-1:  #d2d6df;
  --text-2:  #98a0ad;
  --text-3:  #6a7280;
  --text-4:  #4a5160;

  --accent-0:    #6cf;
  --accent-1:    #4af;
  --accent-glow: rgba(102, 204, 255, 0.18);
  --accent-mute: rgba(102, 204, 255, 0.08);

  --good:    #5dd39e;
  --good-bg: rgba(93, 211, 158, 0.1);
  --warn:    #f0b86e;
  --warn-bg: rgba(240, 184, 110, 0.1);
  --danger:  #ff7a7a;
  --danger-bg: rgba(255, 122, 122, 0.1);

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Menlo', monospace;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);

  --rad-sm: 6px;
  --rad-md: 10px;
  --rad-lg: 16px;

  --topnav-h: 56px;
}

* { box-sizing: border-box; }
html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topnav-h) + 16px);
}
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg-0);
  color: var(--text-0);
  line-height: 1.55;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle ambient gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 0%, rgba(102, 204, 255, 0.07), transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(74, 170, 255, 0.05), transparent 50%);
  pointer-events: none;
}

/* ===========================================================
   SCROLLBARS — match the dark theme. Firefox uses scrollbar-*
   shorthand on the element itself; WebKit uses pseudo-elements.
   =========================================================== */
* {
  scrollbar-color: var(--bg-4) transparent;
  scrollbar-width: thin;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border-radius: 5px;
  border: 2px solid var(--bg-0);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-3);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

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

code, pre, .mono { font-family: var(--mono); }
:not(pre) > code {
  background: var(--bg-3);
  padding: 0.12em 0.42em;
  border-radius: 4px;
  font-size: 0.88em;
  border: 1px solid var(--border);
  color: var(--text-0);
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border-2);
  background: var(--bg-3);
  color: var(--text-0);
  padding: 0.6em 1.1em;
  border-radius: var(--rad-sm);
  transition: all 0.15s ease;
  font-weight: 500;
}
button:hover:not(:disabled) {
  background: var(--bg-4);
  border-color: var(--border-3);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.65em 1.2em;
  border-radius: var(--rad-sm);
  border: 1px solid var(--border-2);
  background: var(--bg-3);
  color: var(--text-0);
  font: 500 0.95em var(--sans);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:hover {
  background: var(--bg-4);
  border-color: var(--border-3);
  color: var(--text-0);
}
.btn.primary {
  background: linear-gradient(180deg, var(--accent-0), var(--accent-1));
  color: #001;
  border: none;
  font-weight: 600;
}
.btn.primary:hover {
  filter: brightness(1.1);
  color: #001;
}
.btn.ghost {
  background: transparent;
  border-color: var(--border);
}
.btn.ghost:hover { background: var(--bg-3); border-color: var(--border-2); }
.btn.big {
  padding: 0.8em 1.6em;
  font-size: 1.05em;
}

.select {
  font: inherit;
  padding: 0.55em 1em;
  background: var(--bg-3);
  color: var(--text-0);
  border: 1px solid var(--border-2);
  border-radius: var(--rad-sm);
  cursor: pointer;
}

/* ===========================================================
   STICKY NAV
   =========================================================== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topnav-h);
  background: rgba(7, 9, 12, 0.7);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-0);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95em;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text-0); }
.brand-logo { font-size: 1.15em; line-height: 1; }
.brand-name { letter-spacing: -0.02em; }

.topnav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.topnav-tab {
  padding: 6px 14px;
  border-radius: var(--rad-sm);
  font-size: 0.92em;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.15s ease;
}
.topnav-tab:hover {
  color: var(--text-0);
  background: var(--bg-3);
}
.topnav-tab.active {
  color: var(--text-0);
  background: var(--bg-3);
  font-weight: 600;
}

.topnav-right { display: flex; align-items: center; gap: 12px; }
.topnav-github {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--rad-sm);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  font-size: 0.9em;
  font-weight: 500;
}
.topnav-github:hover {
  color: var(--text-0);
  border-color: var(--border-3);
  background: var(--bg-3);
}

@media (max-width: 800px) {
  .topnav-tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topnav-tab { padding: 6px 10px; font-size: 0.85em; }
  .topnav-github span { display: none; }
}

/* ===========================================================
   HERO
   =========================================================== */
.hero {
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 80% 50%, rgba(102, 204, 255, 0.05), transparent 60%),
    linear-gradient(180deg, rgba(102, 204, 255, 0.02), transparent 50%);
}
.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 24px 88px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}
@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; gap: 32px; padding: 56px 24px; }
  .hero-art { display: none; }
}

.hero-text h1 {
  font-size: clamp(2.4em, 5.5vw, 4em);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
  color: var(--text-0);
}
.hero-em {
  background: linear-gradient(180deg, var(--accent-0), var(--accent-1));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero-subhead {
  font-size: 1.15em;
  color: var(--text-1);
  max-width: 560px;
  margin: 0 0 32px;
  line-height: 1.55;
}
.install-row {
  display: inline-flex;
  align-items: stretch;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--rad-md);
  overflow: hidden;
  margin-bottom: 40px;
  font-family: var(--mono);
  font-size: 0.95em;
}
.install-row .install {
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-0);
}
.install-row .install::before { content: '$ '; color: var(--text-3); }
.copy-btn {
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--bg-3);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 0;
  cursor: pointer;
}
.copy-btn:hover { color: var(--text-0); background: var(--bg-4); }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 40px;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num {
  font-family: var(--mono);
  font-size: 1.6em;
  font-weight: 700;
  color: var(--accent-0);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-lbl {
  font-size: 0.82em;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.hero-art {
  position: relative;
  border-radius: var(--rad-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-art img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--rad-lg);
}

/* ===========================================================
   EXPLAINER (between hero and tabs)
   =========================================================== */
.explainer {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(102, 204, 255, 0.02), transparent);
}
.explainer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 64px;
}
.explainer-block h2 {
  font-size: clamp(1.6em, 3vw, 2.1em);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--text-0);
}
.explainer-block p {
  margin: 0 0 14px;
  color: var(--text-1);
  font-size: 1.04em;
  line-height: 1.65;
  max-width: 760px;
}
.explainer-block p strong { color: var(--text-0); }
.explainer-note {
  font-size: 0.92em;
  color: var(--text-2);
  border-left: 2px solid var(--accent-0);
  padding-left: 14px;
  margin-top: 18px !important;
}

.before-after {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 14px;
  align-items: stretch;
}
@media (max-width: 900px) { .before-after { grid-template-columns: 1fr; } }
.ba-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;       /* allow content to shrink within the grid track */
}
.ba-card > header {   /* scope so this never collides with .topnav etc. */
  background: var(--bg-2);
  padding: 12px 16px;
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-0);
  border-bottom: 1px solid var(--border);
  min-height: 44px;   /* equal header heights even when text wraps */
  display: flex;
  align-items: center;
}
.ba-card pre {
  flex: 1;
  margin: 0;
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.82em;
  line-height: 1.6;
  color: var(--text-1);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 180px;  /* equal body heights so the three cards always line up */
}
.ba-card pre em {
  font-style: normal;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 0 0.3em;
  border-radius: 3px;
  border: 1px solid rgba(240, 184, 110, 0.25);
}
.ba-card:nth-child(2) pre em {
  background: var(--accent-mute);
  color: var(--accent-0);
  border-color: rgba(102, 204, 255, 0.25);
}
.ba-card:nth-child(3) pre em {
  background: var(--good-bg);
  color: var(--good);
  border-color: rgba(93, 211, 158, 0.25);
}

.usecase-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}
@media (max-width: 800px) { .usecase-grid { grid-template-columns: 1fr; } }
.usecase {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 20px 22px;
}
.usecase-icon {
  font-size: 1.4em;
  display: block;
  margin-bottom: 10px;
}
.usecase strong {
  display: block;
  color: var(--text-0);
  font-size: 1.05em;
  margin-bottom: 6px;
  font-weight: 600;
}
.usecase p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.94em;
  line-height: 1.55;
}

.explainer-block .code-block {
  max-width: 760px;
  margin-top: 12px;
}
.code-block .hl-keyword { color: var(--accent-0); font-weight: 500; }
.code-block .dim { color: var(--text-3); }

/* External / outbound nav tab marker */
.topnav-tab-external {
  font-size: 0.85em;
  opacity: 0.85;
}
.topnav-tab-external:hover { opacity: 1; }

/* ===========================================================
   CONTACT FORM (in About tab)
   =========================================================== */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 24px;
  max-width: 640px;
}
.contact-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .contact-form .form-row { grid-template-columns: 1fr; } }
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92em;
}
.form-field span {
  color: var(--text-1);
  font-weight: 500;
}
.form-field .optional { color: var(--text-3); font-style: normal; font-weight: 400; }
.form-field .required { color: var(--accent-0); font-style: normal; }
.form-field input,
.form-field textarea {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-0);
  border: 1px solid var(--border-2);
  color: var(--text-0);
  padding: 10px 12px;
  border-radius: var(--rad-sm);
  outline: none;
  transition: border-color 0.15s;
}
.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--accent-0);
}
.form-field textarea { resize: vertical; min-height: 120px; }
.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.form-status {
  font-size: 0.9em;
  color: var(--text-2);
}
.form-status.success { color: var(--good); }
.form-status.error { color: var(--danger); }
.contact-form .small {
  margin: 0;
  font-size: 0.82em;
  color: var(--text-3);
}

/* ===========================================================
   TAB HOST
   =========================================================== */
.tab-host {
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-inner { display: flex; flex-direction: column; gap: 24px; }
.panel-header { display: flex; flex-direction: column; gap: 8px; }
.panel-header h2 {
  font-size: clamp(1.7em, 3vw, 2.2em);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-0);
}
.panel-header p {
  margin: 0;
  color: var(--text-1);
  max-width: 740px;
  font-size: 1.02em;
}
.panel-inner h3 {
  font-size: 1.25em;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--text-0);
}
.panel-inner h4 {
  font-size: 1.05em;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text-0);
}

.diagram-figure {
  margin: 0 auto;
  border-radius: var(--rad-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-1);
  box-shadow: var(--shadow-md);
  max-width: 1100px;
  width: 100%;
}
.diagram-figure img {
  width: 100%;
  height: auto;
  display: block;
}
/* The roundtrip diagram has lots of empty top/bottom whitespace; crop the
   visible area to a wider aspect ratio so only the diagram shows. */
.diagram-figure.crop-tight img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
}

.badge {
  display: inline-block;
  padding: 0.15em 0.55em;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  font-size: 0.6em;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}
.badge.live {
  background: var(--good-bg);
  color: var(--good);
  border-color: var(--good);
}
.callout {
  border-radius: var(--rad-md);
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  padding: 18px 22px;
  margin: 16px 0;
}
.callout.danger {
  border-color: rgba(255, 122, 122, 0.4);
  background: var(--danger-bg);
}
.callout strong { color: var(--danger); }

/* ===========================================================
   DEMO TAB
   =========================================================== */
.demo-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.dice { font-size: 1.05em; line-height: 1; }
.sample-info {
  margin-left: auto;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 0.85em;
}

.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 320px;
  gap: 16px;
  height: 540px;
}
@media (max-width: 1100px) {
  .demo-grid { grid-template-columns: 1fr; height: auto; }
  .demo-grid .pane { min-height: 240px; }
}

.pane {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.88em;
  flex-shrink: 0;
}
.pane-title { font-weight: 600; color: var(--text-0); }
.pane-meta { color: var(--text-3); font-family: var(--mono); font-size: 0.85em; }
.pane-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 0.85em;
  color: var(--text-3);
  flex-shrink: 0;
}

.pane textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-0);
  padding: 16px;
  resize: none;
  font-family: var(--mono);
  font-size: 0.88em;
  line-height: 1.6;
  outline: none;
  width: 100%;
}

.output {
  flex: 1;
  margin: 0;
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.88em;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  color: var(--text-0);
}
.output .token {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 0.05em 0.3em;
  border-radius: 3px;
  border: 1px solid rgba(240, 184, 110, 0.25);
  font-weight: 500;
}
.output .fake {
  background: var(--good-bg);
  color: var(--good);
  padding: 0.05em 0.3em;
  border-radius: 3px;
  border: 1px solid rgba(93, 211, 158, 0.25);
}

.mode-tabs { display: flex; gap: 4px; }
.mode-tab {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.85em;
  border-radius: var(--rad-sm);
  color: var(--text-2);
  font-weight: 500;
}
.mode-tab:hover { background: var(--bg-3); color: var(--text-0); }
.mode-tab.active {
  background: var(--bg-1);
  border-color: var(--border-2);
  color: var(--text-0);
  font-weight: 600;
}

.inventory {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.inventory-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.88em;
  line-height: 1.5;
}
.inv-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--rad-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 0.82em;
  font-family: var(--mono);
  line-height: 1.4;
}
.inv-label {
  display: inline-block;
  background: var(--accent-mute);
  color: var(--accent-0);
  padding: 0.05em 0.5em;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.85em;
  margin-bottom: 4px;
}
.inv-arrow { color: var(--text-3); margin: 0 6px; }
.inv-value { color: var(--danger); word-break: break-all; }
.inv-id { color: var(--good); word-break: break-all; }
.inv-meta { color: var(--text-3); font-size: 0.85em; margin-top: 2px; }

/* ===========================================================
   MODES TAB
   =========================================================== */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 8px 0;
}
@media (max-width: 900px) { .modes-grid { grid-template-columns: 1fr; } }

.mode-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mode-card h3 {
  font-family: var(--mono);
  margin: 0;
  font-size: 1.2em;
  color: var(--accent-0);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.mode-card ul {
  font-size: 0.92em;
  color: var(--text-1);
  padding-left: 1.2em;
  margin: 0;
}
.mode-card li { margin-bottom: 6px; }
.mode-card li strong { color: var(--text-0); }

.code-snippet {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--rad-sm);
  padding: 14px;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.82em;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  color: var(--text-1);
}
.code-snippet .dim { color: var(--text-3); }
.code-snippet .hl {
  padding: 0 0.3em;
  border-radius: 3px;
  font-weight: 500;
}
.code-snippet .hl.token { color: var(--warn); background: var(--warn-bg); }
.code-snippet .hl.fake { color: var(--good); background: var(--good-bg); }
.code-snippet .hl.pass {
  color: var(--text-1);
  background: var(--bg-3);
  border: 1px solid var(--border-2);
}

/* ===========================================================
   PATTERNS TAB
   =========================================================== */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.loading-msg {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-3);
  padding: 40px;
}

.pattern-cat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 18px;
}
.pattern-cat-card h3 {
  font-family: var(--mono);
  margin: 0 0 14px;
  color: var(--accent-0);
  text-transform: uppercase;
  font-size: 0.82em;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.pattern-cat-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85em;
}
.pattern-cat-card li {
  padding: 6px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.pattern-cat-card li:last-child { border-bottom: none; }
.pattern-cat-card .label {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text-0);
  font-size: 0.92em;
}
.pattern-cat-card .has-realistic {
  font-size: 0.7em;
  background: var(--good-bg);
  color: var(--good);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(93, 211, 158, 0.25);
  font-family: var(--sans);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===========================================================
   LLM TAB
   =========================================================== */
.webllm-loader {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.webllm-loader-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.webllm-loader h3 { margin: 0 0 8px; font-size: 1.2em; }
.webllm-blurb {
  margin: 0;
  color: var(--text-1);
  font-size: 0.95em;
  max-width: 640px;
}
.webllm-compat {
  margin-top: 10px;
  font-size: 0.85em;
  color: var(--text-2);
}
.webllm-compat.error { color: var(--danger); }
.webllm-compat.ok { color: var(--good); }

.webllm-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.bar {
  height: 8px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-0), var(--accent-1));
  transition: width 0.2s ease;
}
.webllm-progress-text {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--text-2);
}

.webllm-demos {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.webllm-demo {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.webllm-demo h3 { margin: 0; font-size: 1.15em; }
.webllm-demo-blurb {
  margin: 0 0 4px;
  color: var(--text-1);
  font-size: 0.92em;
}
.webllm-demo-blurb .hint {
  display: block;
  margin-top: 6px;
  color: var(--text-3);
  font-size: 0.92em;
  font-style: italic;
}
.webllm-input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border-2);
  border-radius: var(--rad-sm);
  color: var(--text-0);
  padding: 12px;
  font-family: var(--mono);
  font-size: 0.88em;
  line-height: 1.55;
  resize: vertical;
}
.webllm-input:focus {
  outline: none;
  border-color: var(--accent-0);
}
.webllm-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.webllm-step {
  border: 1px solid var(--border);
  border-radius: var(--rad-sm);
  background: var(--bg-2);
  padding: 14px 16px;
}
.webllm-step-label {
  font-size: 0.78em;
  font-weight: 600;
  color: var(--accent-0);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.webllm-step-content {
  font-family: var(--mono);
  font-size: 0.85em;
  line-height: 1.55;
  color: var(--text-0);
  white-space: pre-wrap;
  word-break: break-word;
}
.webllm-step.error .webllm-step-label { color: var(--danger); }

.codepeek {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 16px 22px;
}
.codepeek summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-0);
  user-select: none;
  list-style: none;
}
.codepeek summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 8px;
  font-size: 0.7em;
  color: var(--text-3);
  transition: transform 0.15s;
}
.codepeek[open] summary::before { transform: rotate(90deg); }
.codepeek summary:hover { color: var(--accent-0); }

/* ===========================================================
   USAGE / DOCS / NAMES TABLES
   =========================================================== */
.code-block {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.55;
  margin: 12px 0;
  font-family: var(--mono);
  color: var(--text-0);
}
.code-block code { background: none; padding: 0; border: none; font-size: 1em; }

.usage-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) { .usage-blocks { grid-template-columns: 1fr; } }
.usage-block {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  padding: 22px;
}
.usage-block h3 { margin-top: 0; }
.usage-block .small { font-size: 0.85em; color: var(--text-3); margin-top: 8px; }

.examples-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
  font-size: 0.92em;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rad-md);
  overflow: hidden;
}
.examples-table th {
  background: var(--bg-2);
  color: var(--text-0);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.examples-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
}
.examples-table td:first-child {
  font-family: var(--mono);
  color: var(--text-0);
  font-weight: 600;
}
.examples-table td:nth-child(2) {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--accent-0);
}
.examples-table tr:last-child td { border-bottom: none; }

.stats-list { color: var(--text-1); padding-left: 1.5em; }
.stats-list li { margin-bottom: 4px; }
.stats-list strong { color: var(--text-0); }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.two-col h4 { margin-top: 0; }
.two-col ul { color: var(--text-1); padding-left: 1.5em; }
.two-col li { margin-bottom: 4px; }
.small { font-size: 0.9em; color: var(--text-3); }

/* ===========================================================
   FOOTER
   =========================================================== */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-1);
  padding: 40px 24px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } }
.footer p { color: var(--text-3); margin: 6px 0; font-size: 0.92em; }
.footer a { display: inline-block; margin-bottom: 4px; }

/* ===========================================================
   MISC
   =========================================================== */
.loading {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent-0);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
