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

:root {
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;

  --bg: #ffffff;
  --bg-code: #fff;

  --border: #e4e4e7;
  --border-hover: #d4d4d8;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --surface-subtle: rgba(37, 99, 235, 0.06);

  --syntax-comment: #94a3b8;
  --syntax-keyword: #7c3aed;
  --syntax-function: #1d4ed8;
  --syntax-string: #059669;
  --syntax-variable: #334155;
  --syntax-operator: #94a3b8;
  --syntax-number: #b45309;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* ── Top layout ───────────────────────────────────────────── */

.top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
}

.top-left {
  padding: 48px 40px 40px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.top-right {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* ── Hero text ────────────────────────────────────────────── */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

h1 {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--text);
}

.hero-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

/* ── Stats ────────────────────────────────────────────────── */

.stats {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  width: fit-content;
}

.stat {
  padding: 8px 18px;
  border-right: 1px solid var(--border);
  text-align: center;
  min-width: 80px;
}
.stat:last-child {
  border-right: none;
}

.stat-value {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.2;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
  margin-top: 1px;
}

/* ── Code block ───────────────────────────────────────────── */

.code-block {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.code-title {
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.code-tabs {
  display: flex;
  gap: 4px;
}

.tab {
  background: none;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
  letter-spacing: 0.03em;
}
.tab:hover {
  color: var(--text-muted);
  border-color: var(--border);
}
.tab.active {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--surface-subtle);
}

.code-title-dots {
  display: flex;
  gap: 5px;
}
.code-title-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.pre-wrap {
  position: relative;
  height: 375px;
}

pre[data-tab] {
  position: absolute;
  inset: 0;
  padding: 16px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  overflow: auto;
}

/* ── Libraries grid ───────────────────────────────────────── */

.libraries {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 20px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.12s ease;
}
.card:nth-child(4n) {
  border-right: none;
}
.card:hover {
  background: #f1f3f5;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-badge img {
  height: 16px;
  display: block;
  transition: opacity 0.15s;
}
.card:hover .card-badge img {
  opacity: 0.6;
}

.card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 2px;
}

/* ── Footer ───────────────────────────────────────────────── */

footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font-mono);
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
footer a:hover {
  color: var(--text);
}

.footer-links {
  display: flex;
  gap: 16px;
}

/* ── Deep section ─────────────────────────────────────────── */

.deep {
  max-width: 1200px;
  margin: 0 auto;
}

.lib-entry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

.lib-entry-info {
  padding: 32px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lib-entry-info h3 {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.lib-entry-info > p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 380px;
}

.install-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.docs-link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
}

.install {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  width: fit-content;
}

.install code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 7px 14px;
}

.copy-btn {
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0 10px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
}
.copy-btn img {
  width: 10px;
  height: 10px;
  opacity: 0.5;
}
.copy-btn:hover {
  color: var(--text-muted);
  background: var(--surface-subtle);
}

.lib-entry-usage pre {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  height: 100%;
}

.lib-entry-why {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lib-entry-why h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 10px 0 0;
  display: inline-block;
  cursor: pointer;
}
.lib-entry-why p,
.lib-entry-why ul {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.lib-entry-why ul {
  padding-left: 14px;
}

/* ── Prism overrides ──────────────────────────────────────── */

pre[class*="language-"],
code[class*="language-"] {
  background: var(--bg-code) !important;
  color: var(--text);
  font-family: var(--font-mono) !important;
  font-size: 12.5px !important;
  line-height: 1.7 !important;
  text-shadow: none;
  border: none;
  border-radius: 0;
}

.token.comment { color: var(--syntax-comment); }
.token.keyword { color: var(--syntax-keyword); }
.token.function { color: var(--syntax-function); }
.token.string,
.token.attr-value { color: var(--syntax-string); }
.token.operator,
.token.punctuation { color: var(--syntax-operator); }
.token.number { color: var(--syntax-number); }
.token.class-name,
.token.maybe-class-name { color: var(--syntax-variable); }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 900px) {
  .top {
    grid-template-columns: 1fr;
  }
  .top-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 32px 24px;
  }
  .top-right {
    padding: 20px 24px;
  }
  .libraries {
    grid-template-columns: repeat(2, 1fr);
  }
  .card:nth-child(4n) {
    border-right: 1px solid var(--border);
  }
  .card:nth-child(2n) {
    border-right: none;
  }
}

@media (max-width: 560px) {
  .libraries {
    grid-template-columns: 1fr;
  }
  .card {
    border-right: none !important;
  }
  h1 {
    font-size: 28px;
  }
}
