@font-face {
  font-family: 'Geist';
  src: url('Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', Menlo, Consolas,
    'Liberation Mono', monospace;
  --radius: 0.625rem;
}

html.dark {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #171717;
  --muted: #262626;
  --muted-foreground: #a1a1a1;
  --accent: #404040;
  --accent-foreground: #fafafa;
  --border: rgb(255 255 255 / 0.07);
  --border-strong: rgb(255 255 255 / 0.14);
  --ring: #737373;
  --edge: rgb(255 255 255 / 0.28);
}

html:not(.dark) {
  --background: #fff;
  --foreground: #0a0a0a;
  --card: #fff;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #171717;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --ring: #a1a1a1;
  --edge: #737373;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--accent-foreground);
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 96px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(12px);
}

.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark-pod {
  color: var(--muted-foreground);
  font-weight: 500;
}

.wordmark-logo {
  flex-shrink: 0;
}

.hero-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-logo {
  flex-shrink: 0;
}

.header-spacer {
  flex: 1;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.8);
  font-size: 12px;
  color: var(--muted-foreground);
  transition:
    color 0.15s,
    border-color 0.15s;
}

.theme-toggle:hover {
  color: var(--foreground);
  border-color: var(--border-strong);
}

/* ---------- hero ---------- */

.hero {
  padding: 56px 0 8px;
  max-width: 640px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

h1 {
  margin: 8px 0 0;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-copy {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted-foreground);
  max-width: 560px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.hero-stats strong {
  color: var(--foreground);
  font-weight: 600;
}

/* ---------- search ---------- */

.search-wrap {
  position: sticky;
  top: 56px;
  z-index: 10;
  padding: 16px 0;
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(12px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  padding: 0 14px;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.15s;
}

.search-box:focus-within {
  border-color: var(--ring);
}

.search-box svg {
  flex-shrink: 0;
  color: var(--muted-foreground);
}

.search-box input {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
}

.search-box input::placeholder {
  color: var(--muted-foreground);
}

.search-kbd {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.search-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted-foreground);
  min-height: 15px;
}

/* ---------- gallery ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

@media (max-width: 760px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.pod-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  background: var(--card);
  text-decoration: none;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.pod-card:hover {
  background: color-mix(in srgb, var(--accent) 32%, var(--card));
  border-color: var(--border-strong);
}

.pod-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pod-card h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pod-card-count {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted-foreground);
}

.pod-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted-foreground);
}

.chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.chain-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-foreground);
}

.chain-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}

.chain-node .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-sep {
  color: var(--muted-foreground);
  opacity: 0.6;
  font-size: 11px;
}

.pod-card-bottom {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pod-card-bottom .spacer {
  flex: 1;
}

.view-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: color 0.15s;
}

.pod-card:hover .view-link {
  color: var(--foreground);
}

.agent-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.agent-badge.small {
  width: 16px;
  height: 16px;
  font-size: 9px;
}

.empty {
  margin-top: 24px;
  padding: 40px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: calc(var(--radius) * 1.4);
  text-align: center;
  color: var(--muted-foreground);
  font-size: 14px;
}

/* ---------- detail ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: calc(var(--radius) * 0.8);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  transition:
    color 0.15s,
    background 0.15s;
}

.back-link:hover {
  color: var(--foreground);
  background: var(--muted);
}

.detail-head {
  margin-top: 16px;
  max-width: 640px;
}

.detail-head h1 {
  font-size: 28px;
}

.detail-head .lede {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted-foreground);
}

.detail-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.workflow {
  margin-top: 40px;
}

.workflow-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.workflow-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.workflow-head .count {
  font-size: 12px;
  color: var(--muted-foreground);
}

/* ---------- architecture diagram ---------- */

.diagram {
  position: relative;
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  background: var(--card);
  overflow-x: auto;
}

.diagram-canvas {
  position: relative;
  display: flex;
  gap: 72px;
  width: max-content;
  min-width: 100%;
  padding: 4px 2px;
}

.diagram svg.edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.diagram-col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 28px;
}

.dag-node {
  position: relative;
  z-index: 1;
  width: 190px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) * 0.9);
  background: var(--background);
}

.dag-node .row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dag-node .name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dag-node .agent {
  margin-top: 3px;
  padding-left: 27px;
  font-size: 11px;
  color: var(--muted-foreground);
}

.dag-order {
  position: absolute;
  top: -7px;
  left: -7px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-foreground);
}

/* ---------- node detail cards ---------- */

.node-card {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.1);
  background: var(--card);
}

.node-card .head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.node-card .order {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}

.node-card .name {
  font-size: 14px;
  font-weight: 600;
}

.node-card .agent-name {
  font-size: 12px;
  color: var(--muted-foreground);
}

.node-card .combines {
  font-size: 11px;
  color: var(--muted-foreground);
}

.node-meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted-foreground);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted-foreground);
}

.chip strong {
  font-weight: 500;
  color: var(--foreground);
  opacity: 0.85;
}

.prompt-block {
  position: relative;
  margin-top: 12px;
}

.prompt-block pre {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.8);
  background: var(--background);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--foreground) 88%, transparent);
  white-space: pre-wrap;
  overflow-x: auto;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  font-size: 11px;
  color: var(--muted-foreground);
  transition:
    color 0.15s,
    border-color 0.15s;
}

.copy-btn:hover {
  color: var(--foreground);
  border-color: var(--border-strong);
}

/* ---------- use-template aside ---------- */

.use-aside {
  margin-top: 44px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  background: var(--card);
  font-size: 14px;
  line-height: 1.6;
}

.use-aside .title {
  font-weight: 600;
  margin-bottom: 4px;
}

.use-aside a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 4px;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 72px;
}

.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted-foreground);
}

.site-footer a {
  color: var(--muted-foreground);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
