:root {
  --bg: #0d0d0d;
  --surface: #171717;
  --surface2: #212121;
  --border: #2a2a2a;
  --text: #ececec;
  --muted: #a8a8a8;
  --accent: #8b6cf7;
  --accent-dim: #6a4fd1;
  --radius: 10px;
  --max-width: 800px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px 80px;
}

header.site {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

header.site .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

header.site a.brand {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

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

header.site .brand-mark {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 6px;
}

header.site nav a {
  margin-left: 18px;
  color: var(--muted);
  position: relative;
  padding-bottom: 2px;
}

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

header.site nav a.is-active {
  color: var(--text);
}

header.site nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

h1, h2, h3 {
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 1.6em 0 0.5em;
}

h1 { font-size: 2.2rem; margin-top: 0.4em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

p { color: var(--text); }

p.muted, .muted { color: var(--muted); }

.hero {
  padding: 40px 0 16px;
}

.hero .logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 28px;
  color: #fff;
  margin-bottom: 20px;
}

.hero .hero-mark {
  width: 96px;
  height: 96px;
  display: block;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 12px rgba(139, 108, 247, 0.18));
}

.tagline {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 560px;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  margin-top: 8px;
}

.btn:hover {
  background: var(--accent-dim);
  text-decoration: none;
}

.btn.secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.card.placeholder {
  opacity: 0.5;
}

.card a {
  color: var(--text);
}

.card .icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 24px;
  color: var(--accent);
  overflow: hidden;
}

.card .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.card-title {
  min-width: 0;
}

.card-title h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.card-version {
  display: inline-block;
  margin-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
}

.card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.badges--lg {
  margin: 14px 0 22px;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.badges--lg .badge {
  font-size: 0.85rem;
  padding: 5px 12px;
}

.app-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 12px 0 18px;
}

.app-hero-icon {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 40px;
  color: var(--accent);
  overflow: hidden;
}

.app-hero-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app-hero-text {
  min-width: 0;
}

.app-hero-text h1 {
  margin: 0 0 4px;
}

.app-hero-text p {
  margin: 0;
}

@media (max-width: 520px) {
  .app-hero {
    gap: 14px;
  }
  .app-hero-icon {
    width: 64px;
    height: 64px;
    font-size: 28px;
    border-radius: 14px;
  }
}

details summary {
  cursor: pointer;
  color: var(--muted);
  padding: 6px 0;
}

details summary:hover {
  color: var(--text);
}

details[open] summary {
  color: var(--text);
  margin-bottom: 10px;
}

/* Reference tables on docs pages (Build spec, future spec docs). The
 * dark-theme default is to render <table> with no styling, which makes
 * Required-files / Theme-tokens tables on /docs/contributing.html look
 * broken. Same dark-surface treatment as <pre>. */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0 22px;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface2);
}

td code {
  white-space: nowrap;
}

/* Focus rings — keyboard users see a clear, on-brand outline. The
 * default browser ring on the very dark --bg is inconsistent across
 * Chromium / Firefox / Safari and easy to miss. */
a:focus-visible,
.card:focus-visible,
.btn:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

header.site nav a:focus-visible {
  outline-offset: 4px;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.88rem;
}

code {
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: transparent;
  padding: 0;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 6px 0 18px;
}

.meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

ul { padding-left: 1.4em; }
li { margin: 0.3em 0; }

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

footer.site .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 520px) {
  h1 { font-size: 1.8rem; }
  .container { padding: 24px 16px 60px; }
  header.site nav a { margin-left: 12px; }
  /* Hero mark shrinks so it stays proportional to the smaller h1. */
  .hero .hero-mark { width: 72px; height: 72px; margin-bottom: 14px; }
  /* Catalog cards' icon proportionally smaller too — keeps the
   * head row's icon : title ratio steady on narrow widths. */
  .card .icon { width: 48px; height: 48px; border-radius: 10px; }
}
