/* WebMCP Live Demo — a small, hand-rolled stylesheet (no build step; this
   is a static, no-backend app, same pattern as qr-code/collage). */

:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-muted: #475569;
  --color-border: #e2e8f0;
  --color-accent: #4f46e5;
  --color-accent-hover: #4338ca;
  --color-ok: #15803d;
  --color-ok-bg: #f0fdf4;
  --color-error: #b91c1c;
  --color-error-bg: #fef2f2;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

a {
  color: var(--color-accent);
}
a:hover {
  color: var(--color-accent-hover);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-tagline {
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
  font-weight: 500;
  flex: none;
}

.header-nav a {
  color: var(--color-muted);
  text-decoration: none;
}
.header-nav a:hover {
  color: var(--color-text);
}

/* Main content */

main {
  padding-block: 32px 64px;
}

.hero h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2rem);
  text-wrap: balance;
  margin: 0 0 16px;
}

.lede {
  color: var(--color-muted);
  margin: 0 0 14px;
  max-width: 62ch;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 8px;
  scroll-margin-top: 80px;
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-top: 20px;
}

.hint {
  color: var(--color-muted);
  font-size: 0.92rem;
  margin: 0 0 14px;
}

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

.code-apps {
  color: #94a3b8;
  font-style: italic;
}

/* Status lines */

.status-line {
  font-size: 0.92rem;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  margin: 0 0 14px;
  min-height: 1.4em;
}

.status-ok {
  background: var(--color-ok-bg);
  border-color: #bbf7d0;
  color: var(--color-ok);
}

.status-error {
  background: var(--color-error-bg);
  border-color: #fecaca;
  color: var(--color-error);
}

.status-pending {
  color: var(--color-muted);
}

/* Forms */

.demo-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-muted);
}

select, input[type="text"] {
  font: inherit;
  font-size: 0.95rem;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  min-width: 220px;
}

.btn-primary, .btn-secondary {
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-accent-hover);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

/* Results table */

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.results-table th,
.results-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
}

.results-table thead th {
  color: var(--color-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.dot-up { background: #22c55e; }
.dot-down { background: #ef4444; }

.raw-json summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 8px;
}

/* Capability panel */

.caps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 4px 0 14px;
}

.caps-table th,
.caps-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.caps-table th {
  font-weight: 600;
  color: var(--color-text);
  width: 42%;
}

.caps-table tr:last-child th,
.caps-table tr:last-child td {
  border-bottom: 0;
}

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

.cap::before {
  font-weight: 700;
  margin-right: 6px;
}

.cap-yes { color: var(--color-ok); }
.cap-yes::before { content: "\2713"; color: var(--color-ok); }

.cap-no { color: var(--color-error); }
.cap-no::before { content: "\2717"; color: var(--color-error); }

.cap-neutral::before { content: "\2013"; color: var(--color-muted); }

@media (max-width: 520px) {
  .caps-table th { width: auto; }
  .caps-table th,
  .caps-table td { display: block; border-bottom: 0; padding: 4px 0; }
  .caps-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
}

/* Sub-headings + step lists (§6) */

h3.sub {
  font-size: 0.95rem;
  margin: 20px 0 6px;
  color: var(--color-text);
}

.steps {
  margin: 0 0 14px;
  padding-left: 22px;
  font-size: 0.92rem;
  color: var(--color-muted);
}

.steps li {
  margin-bottom: 7px;
}

.steps li::marker {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: 24px;
  color: var(--color-muted);
  font-size: 0.82rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 520px) {
  select, input[type="text"] {
    min-width: 0;
    width: 100%;
  }
  .demo-form {
    flex-direction: column;
    align-items: stretch;
  }
}
