/* licit — minimal, technical */

:root {
  --bg: #fff;
  --fg: #111;
  --fg-muted: #666;
  --fg-faint: #999;
  --border: #e0e0e0;
  --accent: #111;
  --accent-hover: #fff;
  --input-bg: transparent;
  --code-bg: #f5f5f5;
  --success: #1a7f37;
  --error: #cf222e;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, "Cascadia Code",
    "Fira Code", Menlo, monospace;
  --max-w: 640px;
  --sp-xs: 0.25rem;
  --sp-sm: 0.5rem;
  --sp-md: 1rem;
  --sp-lg: 2rem;
  --sp-xl: 4rem;
  --sp-2xl: 6rem;
}

/* --- Reset --- */

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

/* --- Base --- */

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;

}

a {
  color: var(--fg);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--fg-muted);
}

/* --- Layout --- */

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-md);
}

main {
  flex: 1;
}

/* --- Nav --- */

nav {
  padding: var(--sp-lg) 0;
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: var(--fg);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.nav-links a {
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--fg-muted);
}

.nav-links a:hover {
  color: var(--fg);
}

/* --- Hero --- */

.hero {
  padding: var(--sp-2xl) 0 var(--sp-xl);
}

.hero h1 {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-sm);
}

.hero p {
  color: var(--fg-muted);
  font-size: 1.125rem;
  max-width: 480px;
}

.hero-actions {
  margin-top: var(--sp-lg);
  display: flex;
  gap: var(--sp-md);
}

/* --- Buttons --- */

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

.btn-sm {
  font-size: 0.8rem;
  padding: var(--sp-xs) var(--sp-sm);
}

.btn-danger {
  border-color: var(--error);
  color: var(--error);
}

.btn-danger:hover {
  background: var(--error);
  color: #fff;
}

/* --- Stats grid --- */

.stats {
  padding: var(--sp-xl) 0;
  border-top: 1px solid var(--border);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
}

.stat dt {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-xs);
}

.stat dd {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat-unit {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--fg-muted);
}

/* --- Features --- */

.features {
  padding: var(--sp-xl) 0;
  border-top: 1px solid var(--border);
}

.features h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--sp-lg);
}

.features ul {
  list-style: none;
}

.features li {
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

.features li strong {
  color: var(--fg);
  font-weight: 500;
}

/* --- Problem section --- */

.problem {
  padding: var(--sp-xl) 0;
  border-top: 1px solid var(--border);
}

.problem h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--sp-md);
}

.problem p {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}

/* --- Forms --- */

.form-page {
  padding: var(--sp-2xl) 0;
}

.form-page h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--sp-lg);
}

.form-group {
  margin-bottom: var(--sp-md);
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-xs);
}

.form-group input {
  width: 100%;
  padding: var(--sp-sm) 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--fg);
  background: var(--input-bg);
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: var(--fg);
}

.form-actions {
  margin-top: var(--sp-lg);
}

.form-error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: var(--sp-sm);
  display: none;
}

.form-error.visible {
  display: block;
}

/* --- Key display (after registration) --- */

.key-display {
  margin-top: var(--sp-lg);
  padding: var(--sp-md);
  border: 1px solid var(--border);
  display: none;
}

.key-display.visible {
  display: block;
}

.key-display p {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-bottom: var(--sp-sm);
}

.key-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--code-bg);
  padding: var(--sp-sm) var(--sp-md);
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.key-value code {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

.key-warning {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: var(--sp-sm);
}

/* --- Dashboard --- */

.dashboard {
  padding: var(--sp-2xl) 0;
}

.dashboard h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--sp-xs);
}

.dashboard-subtitle {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  margin-bottom: var(--sp-xl);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-md);
}

.section-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

/* --- Tables --- */

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

th {
  text-align: left;
  font-weight: 500;
  color: var(--fg-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border);
}

td {
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.muted {
  color: var(--fg-muted);
}

.badge-active {
  color: var(--success);
}

.badge-revoked {
  color: var(--fg-faint);
}

/* --- Footer --- */

footer {
  padding: var(--sp-xl) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--sp-xl);
}

footer .container {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--fg-faint);
}

footer a {
  color: var(--fg-faint);
}

footer a:hover {
  color: var(--fg-muted);
}

/* --- Utilities --- */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-md {
  margin-top: var(--sp-md);
}

.mt-lg {
  margin-top: var(--sp-lg);
}

/* --- Responsive --- */

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .stat dd {
    font-size: 1.25rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    text-align: center;
  }

  table {
    font-size: 0.8rem;
  }
}

/* --- Static landing extras --- */

.section {
  padding: var(--sp-xl) 0;
  border-top: 1px solid var(--border);
}

.section h2 {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--sp-md);
}

.section p {
  color: var(--fg-muted);
  margin-bottom: var(--sp-md);
}

pre {
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  padding: var(--sp-md);
  overflow-x: auto;
}

.table-wrap {
  overflow-x: auto;
}

.stack li {
  color: var(--fg-muted);
  margin-left: var(--sp-md);
}

/* --- Motion --- */

.hero {
  position: relative;
  overflow: hidden;
}

.hero .container {
  position: relative;
  z-index: 1;
}

#hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 75%);
}

.cursor {
  display: inline-block;
  margin-left: 0.05em;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
}

.icon {
  width: 1em;
  height: 1em;
}

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

.js .hero .reveal:nth-child(2) { transition-delay: 0.12s; }
.js .hero .reveal:nth-child(3) { transition-delay: 0.24s; }

.js .features li {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.js .features.in li {
  opacity: 1;
  transform: none;
}

.features li {
  transition: padding-left 0.2s ease;
}

.features li:hover {
  padding-left: var(--sp-sm);
}

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover {
  background: var(--code-bg);
}

.terminal {
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.45);
}

.terminal-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: #1c1c1c;
}

.terminal-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a3a3a;
}

.terminal pre {
  background: transparent;
  color: #e6e6e6;
  min-height: 7.5em;
  margin: 0;
}

.terminal .caret {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  vertical-align: text-bottom;
  background: #e6e6e6;
  animation: blink 1s steps(1) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .features li {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .cursor,
  .terminal .caret {
    animation: none;
  }
}

/* --- Explorer --- */

.container.wide {
  max-width: 1040px;
}

.nav-links a[aria-current="page"] {
  color: var(--fg);
}

.explorer {
  padding: var(--sp-xl) 0;
}

.explorer h1 {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.lead {
  color: var(--fg-muted);
  max-width: 620px;
  margin: var(--sp-sm) 0 var(--sp-lg);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-md);
}

.chip {
  font: inherit;
  font-size: 0.8rem;
  padding: var(--sp-xs) var(--sp-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}

.chip:hover {
  border-color: var(--fg);
  color: var(--fg);
  transform: translateY(-1px);
}

.editor {
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.45);
}

.editor .terminal-bar {
  align-items: center;
}

.editor .terminal-bar em {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-style: normal;
  color: #8a8a8a;
}

.editor textarea {
  display: block;
  width: 100%;
  min-height: 11em;
  padding: var(--sp-md);
  border: 0;
  resize: vertical;
  background: transparent;
  color: #e6e6e6;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.55;
  outline: none;
  tab-size: 2;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  border-top: 1px solid #262626;
  font-size: 0.75rem;
}

.editor-actions .muted {
  color: #8a8a8a;
  font-family: var(--font-mono);
}

.editor .btn {
  border-color: #e6e6e6;
  color: #e6e6e6;
}

.editor .btn:hover {
  background: #e6e6e6;
  color: #111;
}

.editor .btn:disabled {
  opacity: 0.4;
  cursor: progress;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.6;
  margin-left: var(--sp-xs);
}

#meta {
  margin: var(--sp-md) 0 var(--sp-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.results td {
  font-size: 0.8rem;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results tbody tr {
  animation: row-in 0.35s ease both;
}

@keyframes row-in {
  from { opacity: 0; transform: translateY(4px); }
}

/* --- Live stats on landing --- */

.stat dd {
  font-variant-numeric: tabular-nums;
}

.stats-note {
  margin-top: var(--sp-md);
  font-size: 0.75rem;
  color: var(--fg-faint);
}

@media (prefers-reduced-motion: reduce) {
  .results tbody tr { animation: none; }
}

.btn-solid {
  background: var(--accent);
  color: var(--accent-hover);
}

.btn-solid:hover {
  background: transparent;
  color: var(--accent);
}

.hero-actions {
  flex-wrap: wrap;
}

p code,
li code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
}

.section .terminal + p,
.section .terminal {
  margin-top: var(--sp-md);
}

/* --- Playground (explorar) --- */

.pg {
  padding: var(--sp-lg) 0 var(--sp-xl);
}

.pg-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-lg);
  margin-bottom: var(--sp-lg);
}

.pg-head h1 {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.pg-head .lead {
  margin: var(--sp-xs) 0 0;
}

.pg-status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-shrink: 0;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.pg-status b {
  font-weight: 400;
}

.pg-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-faint);
}

.pg-status[data-state="loading"] i {
  background: #d4a017;
  animation: pulse 1s ease-in-out infinite;
}

.pg-status[data-state="ready"] i {
  background: var(--success);
}

.pg-status[data-state="error"] {
  color: var(--error);
  border-color: var(--error);
  white-space: normal;
}

.pg-status[data-state="error"] i {
  background: var(--error);
}

@keyframes pulse {
  50% { opacity: 0.3; }
}

/* examples */

.pg-examples {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
}

.pg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.pg-card:hover {
  border-color: var(--fg);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -12px rgba(0, 0, 0, 0.35);
}

.pg-card[aria-current="true"] {
  border-color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--fg);
}

.pg-card strong {
  font-size: 0.85rem;
  font-weight: 600;
}

.pg-card span {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.pg-card em {
  align-self: flex-start;
  margin-top: 0.35rem;
  padding: 0 0.4rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-style: normal;
  background: var(--code-bg);
  color: var(--fg-muted);
}

.pg-card em[data-fast="true"] {
  background: #e8f5ec;
  color: var(--success);
}

/* layout */

.pg-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: var(--sp-md);
  align-items: start;
}

.pg-main {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}

/* schema */

.pg-schema {
  position: sticky;
  top: var(--sp-md);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  font-size: 0.8rem;
}

.pg-schema > details > summary {
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.4rem;
}

.pg-schema ul {
  list-style: none;
}

.pg-schema ul ul {
  margin: 0.2rem 0 0.5rem 0.7rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
}

.pg-schema li li {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.pg-schema li li span {
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  white-space: nowrap;
}

.pg-schema li.pg-group {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.4rem;
  margin: 0.9rem 0 0.3rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.pg-schema li.pg-group:first-child {
  margin-top: 0.2rem;
  padding-top: 0;
  border-top: 0;
}

.pg-schema li.pg-group strong {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pg-schema li.pg-group span {
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.pg-schema li.pg-group small {
  flex-basis: 100%;
  color: var(--fg-faint);
  font-size: 0.7rem;
  line-height: 1.35;
}

.pg-schema li.pg-about {
  display: block;
  color: var(--fg-faint);
  font-size: 0.72rem;
  line-height: 1.4;
  padding-bottom: 0.3rem;
}

.pg-schema details details > summary {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  padding: 0.25rem 0;
}

.pg-schema small {
  color: var(--fg-faint);
  font-size: 0.7rem;
}

.pg-ident {
  border: 0;
  background: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pg-ident:hover {
  text-decoration: underline;
}

.pg-hint {
  margin-top: 0.5rem;
  color: var(--fg-faint);
  font-size: 0.7rem;
}

/* editor */

.pg-editor {
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 12px 32px -18px rgba(0, 0, 0, 0.5);
}

.pg-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: 9px 12px;
  background: #1c1c1c;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #8a8a8a;
}

.pg-bar .dots {
  display: flex;
  gap: 6px;
}

.pg-bar .dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a3a3a;
}

.pg-keys {
  margin-left: auto;
}

.pg-keys kbd,
.pg-bar kbd {
  margin: 0 1px;
  padding: 0 4px;
  border: 1px solid #3a3a3a;
  border-radius: 3px;
  font-size: 0.65rem;
  opacity: 1;
}

.pg-code {
  position: relative;
}

.pg-code pre,
.pg-code textarea {
  margin: 0;
  padding: var(--sp-md);
  border: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
}

.pg-code pre {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: #e6e6e6;
  background: transparent;
}

.pg-code textarea {
  position: relative;
  display: block;
  width: 100%;
  min-height: 160px;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: transparent;
  caret-color: #fff;
  outline: none;
}

.pg-code textarea::selection {
  background: rgba(255, 255, 255, 0.18);
  color: transparent;
}

.t-kw { color: #ff8fa3; }
.t-fn { color: #82aaff; }
.t-str { color: #c3e88d; }
.t-num { color: #f78c6c; }
.t-com { color: #6b6b6b; font-style: italic; }
.t-tbl { color: #ffcb6b; }

.pg-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-top: 1px solid #262626;
}

.pg-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 1.1rem;
  border: 1px solid #fff;
  border-radius: 4px;
  background: #fff;
  color: #111;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, color 0.15s, transform 0.1s;
}

.pg-btn:hover {
  background: #e6e6e6;
}

.pg-btn:active {
  transform: translateY(1px);
}

.pg-btn:disabled {
  opacity: 0.45;
  cursor: progress;
}

.pg-btn.ghost {
  background: transparent;
  color: #e6e6e6;
  border-color: #3a3a3a;
}

.pg-btn.ghost:hover {
  border-color: #e6e6e6;
}

.pg-results .pg-btn.ghost {
  color: var(--fg);
  border-color: var(--border);
}

.pg-results .pg-btn.ghost:hover {
  border-color: var(--fg);
  background: transparent;
}

.pg-btn.small {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

/* results */

.pg-results {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.pg-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.pg-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.pg-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.pg-toggle[hidden],
.pg-btn[hidden] {
  display: none;
}

.pg-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.pg-toggle button {
  border: 0;
  padding: 0.2rem 0.6rem;
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  color: var(--fg-muted);
  cursor: pointer;
}

.pg-toggle button[aria-selected="true"] {
  background: var(--fg);
  color: var(--bg);
}

.pg-out {
  min-height: 140px;
  transition: opacity 0.2s;
}

.pg-out.busy {
  opacity: 0.45;
}

.pg-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  color: var(--fg-faint);
  font-size: 0.85rem;
}

.pg-error {
  margin: var(--sp-md);
  padding: var(--sp-md);
  border-left: 3px solid var(--error);
  background: #fdf2f2;
  color: var(--error);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
}

.pg-table {
  max-height: 560px;
  overflow: auto;
}

.pg-table table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.pg-table th {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  color: var(--fg-muted);
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.pg-table th,
.pg-table td {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  text-align: left;
}

.pg-table td {
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid #f0f0f0;
}

.pg-table .num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pg-table .time {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.pg-table tbody tr:hover {
  background: #fafafa;
}

.pg-chart {
  padding: var(--sp-md);
}

.pg-chart-cap {
  margin-bottom: var(--sp-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
}

.pg-bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 34%) 1fr auto;
  align-items: center;
  gap: var(--sp-sm);
  padding: 2px 0;
  font-size: 0.78rem;
}

.pg-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-muted);
}

.pg-bar-track {
  height: 14px;
  background: var(--code-bg);
  border-radius: 2px;
}

.pg-bar-fill {
  display: block;
  height: 100%;
  width: var(--w);
  background: var(--fg);
  border-radius: 2px;
  transform-origin: left;
  animation: grow 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes grow {
  from { transform: scaleX(0); }
}

.pg-bar-val {
  min-width: 5.5em;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 860px) {
  .pg-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-sm);
  }

  .pg-grid {
    grid-template-columns: 1fr;
  }

  .pg-schema {
    position: static;
    max-height: none;
    order: 2;
  }

  .pg-examples {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 calc(-1 * var(--sp-md)) var(--sp-md);
    padding: 2px var(--sp-md) var(--sp-sm);
    scrollbar-width: none;
  }

  .pg-examples::-webkit-scrollbar {
    display: none;
  }

  .pg-card {
    flex: 0 0 62%;
    scroll-snap-align: start;
  }

  .pg-head h1 {
    font-size: 1.6rem;
  }

  .pg-keys {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-bar-fill,
  .pg-status i {
    animation: none;
  }
}

/* --- Arquitectura --- */

.arq .container.wide {
  max-width: 1120px;
}

.arq-hero {
  padding: var(--sp-xl) 0 var(--sp-lg);
}

.arq-hero h1 {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.arq-hero .lead {
  max-width: 720px;
  font-size: 1.1rem;
  margin: var(--sp-sm) 0 var(--sp-lg);
}

.arq-hero .lead strong {
  color: var(--fg);
}

.arq-live {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-md);
  max-width: 820px;
}

.arq-live dt,
.arq-facts dt {
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.arq-live dd {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* diagram */

.arq-diagram-wrap {
  padding: var(--sp-md) 0 var(--sp-lg);
}

.arq-diagram {
  overflow-x: auto;
  padding: var(--sp-md);
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    radial-gradient(circle at 1px 1px, #e9e9e9 1px, transparent 0) 0 0 / 18px 18px,
    #fcfcfc;
}

.arq-diagram svg {
  display: block;
  width: 100%;
  min-width: 860px;
  height: auto;
  font-family: var(--font-sans);
}

.arq-node rect {
  fill: #fff;
  stroke: #cfcfcf;
  stroke-width: 1.2;
}

.arq-group rect {
  fill: #f6f6f6;
  stroke: #d9d9d9;
  stroke-dasharray: 5 4;
}

.arq-node .t,
.arq-group .t {
  font-size: 15px;
  font-weight: 600;
  fill: var(--fg);
  text-anchor: middle;
}

.arq-node .s,
.arq-group .s {
  font-size: 12px;
  fill: var(--fg-muted);
  text-anchor: middle;
}

.arq-node .tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-anchor: middle;
}

.tag.gov { fill: #666; }
.tag.gh { fill: #3d444d; }
.tag.cf { fill: #c25e00; }
.tag.you { fill: #1a7f37; }

.accent-cf rect { stroke: #f0a35e; }
.accent-duck rect { stroke: #e3c34b; fill: #fffbea; }
.accent-you rect { stroke: #7cc49a; fill: #f4fbf6; }

.arq-edge {
  fill: none;
  stroke: #9a9a9a;
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
  animation: flow 1.2s linear infinite;
}

.arq-edge.back {
  stroke: #c9c9c9;
  animation-direction: reverse;
}

.arq-arrowhead {
  fill: #9a9a9a;
}

.arq-edge-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--fg-faint);
  text-anchor: middle;
}

@keyframes flow {
  to { stroke-dashoffset: -22; }
}

.arq-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-md);
  margin-top: var(--sp-sm);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.arq-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 2px;
  vertical-align: -1px;
}

.dot.gh { background: #6e7681; }
.dot.cf { background: #f38020; }
.dot.duck { background: #e3c34b; }
.dot.you { background: #1a7f37; }

/* sections */

.arq-section {
  padding: var(--sp-xl) 0;
  border-top: 1px solid var(--border);
}

.arq-section h2 {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--sp-lg);
}

.arq-section h3 {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: var(--sp-xs);
}

.arq-section p {
  color: var(--fg-muted);
  font-size: 0.92rem;
}

.arq-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-lg) var(--sp-xl);
  counter-reset: none;
}

.arq-steps li {
  display: flex;
  gap: var(--sp-md);
}

.arq-steps .n {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
}

.arq-table {
  overflow-x: auto;
}

.arq-table table {
  min-width: 640px;
}

.arq-table td {
  font-size: 0.86rem;
  vertical-align: top;
  padding: var(--sp-sm) var(--sp-md) var(--sp-sm) 0;
}

.arq-table td:first-child {
  font-weight: 500;
  white-space: nowrap;
}

.arq-table td:last-child {
  color: var(--fg-muted);
}

.arq-table .num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.arq-table tbody td.num:last-child {
  color: var(--success);
  font-weight: 600;
}

.pill {
  display: inline-block;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.74rem;
  white-space: nowrap;
}

.pill.gh { background: #eef0f2; color: #3d444d; }
.pill.cf { background: #fff1e5; color: #b85400; }
.pill.you { background: #e8f5ec; color: var(--success); }

.arq-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-md);
}

.arq-cards article {
  padding: var(--sp-md);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, transform 0.15s;
}

.arq-cards article:hover {
  border-color: var(--fg);
  transform: translateY(-2px);
}

.arq-split {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--sp-xl);
  align-items: start;
}

.arq-note {
  margin-top: var(--sp-sm);
  font-size: 0.75rem !important;
  color: var(--fg-faint) !important;
}

.arq-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg) var(--sp-md);
}

.arq-facts dd {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.arq-cta {
  text-align: left;
}

.arq-cta p {
  font-size: 1rem;
  margin-bottom: var(--sp-md);
}

.arq-swipe {
  display: none;
  margin-left: auto;
  font-family: var(--font-mono);
}

@media (max-width: 860px) {
  .arq-hero h1 {
    font-size: 1.8rem;
  }

  .arq-live dd {
    font-size: 1.05rem;
  }

  .arq-swipe {
    display: inline;
  }

  .arq-live {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arq-steps,
  .arq-cards,
  .arq-split {
    grid-template-columns: 1fr;
  }

  .arq-diagram {
    padding: var(--sp-sm);
  }
}

@media (prefers-reduced-motion: reduce) {
  .arq-edge {
    animation: none;
  }
}

.arq-split .arq-table table {
  min-width: 0;
}
