/* ==========================================================================
   thereisanagentforthis.com — Editorial Technical Catalog (V3)
   Editorial serif masthead + precision monospace specs + interactive stack builder.
   ========================================================================== */

:root {
  --bg-canvas: #F5F7F2;
  --bg-surface: #FFFFFF;
  --bg-subtle: #EAECE6;
  --bg-hover: #EFF2EB;
  --bg-ink: #10120E;

  --text-primary: #10120E;
  --text-secondary: #4B5046;
  --text-muted: #70776A;

  --border-hairline: rgba(16, 18, 14, 0.09);
  --border-strong: rgba(16, 18, 14, 0.18);

  --accent: #4D7C0F;
  --accent-hover: #3F6212;
  --accent-soft: rgba(101, 163, 13, 0.12);
  --accent-ink: #3F6212;

  --status-oss: #4D7C0F;
  --status-oss-soft: rgba(101, 163, 13, 0.12);

  --shadow-xs: 0 1px 2px rgba(16, 18, 14, 0.04);
  --shadow-sm: 0 4px 12px rgba(16, 18, 14, 0.05), 0 1px 2px rgba(16, 18, 14, 0.04);
  --shadow-lg: 0 20px 50px rgba(16, 18, 14, 0.16);

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-serif: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 140ms;
  --container-max: 1180px;
}

[data-theme="dark"] {
  --bg-canvas: #0D0F0B;
  --bg-surface: #141711;
  --bg-subtle: #1D2119;
  --bg-hover: #191D16;
  --bg-ink: #F2F5EE;

  --text-primary: #F2F5EE;
  --text-secondary: #A1A89A;
  --text-muted: #6E7568;

  --border-hairline: rgba(242, 245, 238, 0.09);
  --border-strong: rgba(242, 245, 238, 0.18);

  --accent: #84CC16;
  --accent-hover: #A3E635;
  --accent-soft: rgba(132, 204, 22, 0.14);
  --accent-ink: #A3E635;

  --status-oss: #A3E635;
  --status-oss-soft: rgba(163, 230, 53, 0.12);

  --shadow-xs: none;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.7);
}

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

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-canvas);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }

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

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-canvas) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hairline);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: contain;
  flex-shrink: 0;
  padding: 2px;
}

[data-theme="dark"] .brand-mark {
  background: #F5F7F2;
}

.brand-tld {
  color: var(--accent-ink);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-canvas);
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-on, #FFFFFF);
}

[data-theme="dark"] .btn-accent {
  color: #0D0F0B;
}

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

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-quiet {
  background: transparent;
  color: var(--text-secondary);
  padding: 0 8px;
}

.btn-quiet:hover {
  color: var(--text-primary);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn-icon:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ==========================================================================
   Hero — Editorial Serif Masthead + Live 4-Layer Agent Stack Blueprint
   ========================================================================== */
.hero {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border-hairline);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 44px;
  align-items: center;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px;
  font-variant-numeric: tabular-nums;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.1vw, 50px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin: 0 0 14px;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 24px;
  max-width: 48ch;
}

/* Search Command Input */
.search-shell {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  max-width: 560px;
  transition: border-color var(--dur) var(--ease);
}

.search-shell:focus-within {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 48px;
  border: none;
  background: transparent;
  padding: 0 84px 0 42px;
  font-size: 14.5px;
  outline: none;
  color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.search-kbd {
  position: absolute;
  right: 12px;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 52px;
  background: transparent;
  border: none;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
}

.search-clear.is-visible {
  display: inline-flex;
}

/* Quick Task Prompt Chips */
.task-prompts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.task-prompt-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.task-chip {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.task-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.task-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Hero Visual Moment: Obsidian Terminal Lime 4-Layer Agent Stack Blueprint */
.blueprint-card {
  position: relative;
  background: #10120E;
  color: #F2F5EE;
  border: 1px solid rgba(242, 245, 238, 0.14);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.blueprint-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(242, 245, 238, 0.1);
  margin-bottom: 14px;
}

.blueprint-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blueprint-mascot {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #F5F7F2;
  padding: 3px;
  object-fit: contain;
  flex-shrink: 0;
}

.blueprint-title {
  font-size: 14px;
  font-weight: 500;
  color: #F2F5EE;
  margin: 0;
}

.blueprint-sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #8F9888;
}

.blueprint-card .btn-secondary {
  background: #1B1F17;
  border-color: rgba(242, 245, 238, 0.16);
  color: #F2F5EE;
}

.blueprint-card .btn-secondary:hover {
  background: #252B1F;
  border-color: #84CC16;
  color: #A3E635;
}

.blueprint-layers {
  display: grid;
  gap: 8px;
}

.blueprint-layer {
  display: grid;
  grid-template-columns: 26px 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(242, 245, 238, 0.09);
  background: #161A13;
  color: #F2F5EE;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.blueprint-layer:hover {
  border-color: rgba(163, 230, 53, 0.45);
  background: #1D2219;
}

.blueprint-layer.is-active {
  border-color: #84CC16;
  background: rgba(132, 204, 22, 0.14);
}

.blueprint-layer .tool-icon {
  background: #23281E;
  border-color: rgba(242, 245, 238, 0.12);
  color: #A3E635;
}

.layer-num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #A3E635;
  font-variant-numeric: tabular-nums;
}

.layer-role {
  font-size: 12px;
  color: #8F9888;
}

.layer-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #F2F5EE;
  min-width: 0;
}

.layer-tool span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-domain {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #8F9888;
}

.blueprint-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(242, 245, 238, 0.1);
  font-size: 12px;
  color: #8F9888;
}

.blueprint-foot strong {
  color: #A3E635;
  font-weight: 500;
}

.blueprint-foot a {
  color: #A3E635;
}

/* ==========================================================================
   Featured & Sponsored Showcase (High-Converting Monetization Row)
   ========================================================================== */
.featured-section {
  padding: 28px 0 8px;
}

.featured-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.featured-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.featured-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease);
}

.featured-card:hover {
  border-color: var(--accent);
}

.featured-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.partner-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

/* Favicons / Tool Marks */
.tool-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.tool-icon.sm {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 10px;
}

.tool-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.tool-icon.sm img {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Category Strip & Toolbar
   ========================================================================== */
.directory-section {
  padding: 24px 0 88px;
}

.category-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.cat-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.cat-pill.is-active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-canvas);
}

.cat-pill .cnt {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border-hairline);
  border-bottom: 1px solid var(--border-hairline);
  margin-bottom: 20px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-tab {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-tab:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.filter-tab.is-active {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
  font-weight: 500;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: 8px;
  user-select: none;
}

.toggle-label input {
  accent-color: var(--accent);
}

.sort-select {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  font-size: 12.5px;
}

.view-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 7px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
}

.view-btn {
  height: 24px;
  padding: 0 10px;
  border: none;
  border-radius: 5px;
  background: transparent;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.view-btn.is-active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 500;
}

.results-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Rich Specimen Cards Grid + Archival Index View
   ========================================================================== */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.agent-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.agent-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.card-name-col {
  min-width: 0;
}

.agent-name {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-name a:hover {
  color: var(--accent-ink);
}

.agent-domain {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.oss-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-oss);
  flex-shrink: 0;
}

.card-tagline {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  flex: 1;
}

.card-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
}

.stack-add-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.stack-add-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.stack-add-btn.is-in-stack {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-canvas);
}

.upvote-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  min-width: 56px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.upvote-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.upvote-btn.is-upvoted {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}

.action-link {
  color: var(--text-secondary);
  font-weight: 500;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.action-link:hover {
  color: var(--accent-ink);
}

/* Archival Index Table View */
.catalog-table {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.catalog-head,
.catalog-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1.8fr) 136px 104px 80px 156px;
  gap: 14px;
  align-items: center;
  padding: 0 20px;
}

.catalog-head {
  height: 36px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-hairline);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.catalog-row {
  min-height: 64px;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-hairline);
  transition: background-color var(--dur) var(--ease);
}

.catalog-row:last-child { border-bottom: none; }
.catalog-row:hover { background: var(--bg-hover); }

.row-idx {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.row-tagline {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Floating Stack Builder Tray */
.stack-tray {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 80;
  width: min(680px, calc(100% - 32px));
  background: var(--bg-ink);
  color: var(--bg-canvas);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: transform 200ms var(--ease), opacity 200ms var(--ease);
}

.stack-tray.is-open {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.stack-tray-items {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.stack-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
}

[data-theme="dark"] .stack-pill {
  background: rgba(0, 0, 0, 0.16);
}

/* Sponsor Banner, Category Overview, Detail, Pricing, Forms, Modal, Footer */
.sponsor-banner {
  margin-top: 32px;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.sponsor-banner h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  margin: 4px 0;
  line-height: 1.15;
}

.sponsor-banner p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13.5px;
  max-width: 54ch;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  grid-column: 1 / -1;
}

.categories-overview {
  padding: 44px 0 60px;
  border-top: 1px solid var(--border-hairline);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  margin: 0;
}

.category-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.category-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  transition: border-color var(--dur) var(--ease);
}

.category-tile:hover { border-color: var(--border-strong); }
.category-tile h3 { font-size: 14.5px; font-weight: 500; margin: 0 0 6px; }
.category-tile p { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 12px; }
.category-tile-foot { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }

.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; }
.page-hero { padding: 40px 0 28px; border-bottom: 1px solid var(--border-hairline); }
.page-hero h1 { font-family: var(--font-serif); font-size: clamp(32px, 4vw, 46px); font-weight: 400; margin: 0 0 10px; line-height: 1.08; }
.page-hero p { font-size: 15px; color: var(--text-secondary); max-width: 60ch; margin: 0; }

.detail-layout { padding: 32px 0 64px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.detail-main { background: var(--bg-surface); border: 1px solid var(--border-hairline); border-radius: var(--radius-md); padding: 28px; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--border-hairline); margin-bottom: 24px; }
.detail-title { font-family: var(--font-serif); font-size: 36px; font-weight: 400; margin: 0 0 8px; line-height: 1.1; }
.detail-tagline { font-size: 15px; color: var(--text-secondary); margin: 0; }
.detail-section { margin-top: 24px; }
.detail-section h2 { font-size: 15px; font-weight: 500; margin: 0 0 10px; }
.detail-list { margin: 0; padding-left: 18px; color: var(--text-secondary); }
.detail-list li { margin-bottom: 6px; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }
.sidebar-card { background: var(--bg-surface); border: 1px solid var(--border-hairline); border-radius: var(--radius-md); padding: 20px; }
.spec-list { margin: 0; display: grid; gap: 10px; }
.spec-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding-bottom: 10px; border-bottom: 1px solid var(--border-hairline); }
.spec-row:last-child { padding-bottom: 0; border-bottom: none; }
.spec-label { color: var(--text-muted); }
.spec-value { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.tag { font-family: var(--font-mono); font-size: 11.5px; padding: 2px 8px; border-radius: 4px; background: var(--bg-subtle); color: var(--text-secondary); }

.pricing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 32px 0; }
.pricing-card { display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--border-hairline); border-radius: var(--radius-md); padding: 24px; }
.pricing-card.is-popular { border-color: var(--accent); }
.price-tag { font-family: var(--font-serif); font-size: 40px; font-weight: 400; margin: 10px 0 4px; font-variant-numeric: tabular-nums; line-height: 1; }
.price-period { font-family: var(--font-sans); font-size: 13px; color: var(--text-muted); }
.pricing-features { list-style: none; padding: 0; margin: 16px 0 24px; display: grid; gap: 8px; flex: 1; font-size: 13.5px; color: var(--text-secondary); }
.pricing-features li::before { content: "–"; color: var(--text-muted); margin-right: 8px; }

.form-card { background: var(--bg-surface); border: 1px solid var(--border-hairline); border-radius: var(--radius-md); padding: 24px; max-width: 680px; margin: 32px 0 64px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 500; }
.field input, .field select, .field textarea { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-canvas); font-size: 14px; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.form-status { margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); font-size: 13.5px; display: none; }
.form-status.is-success { display: block; background: var(--status-oss-soft); color: var(--status-oss); }

.faq-list { display: grid; gap: 8px; margin-top: 16px; }
.faq-item { background: var(--bg-surface); border: 1px solid var(--border-hairline); border-radius: var(--radius-sm); padding: 14px 16px; }
.faq-item summary { font-weight: 500; cursor: pointer; }
.faq-item p { margin: 8px 0 0; color: var(--text-secondary); font-size: 13.5px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(22, 21, 19, 0.48); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.is-open { display: flex; }
.modal-dialog { width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 24px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-close { background: var(--bg-subtle); border: none; width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

.site-footer { border-top: 1px solid var(--border-hairline); padding: 40px 0; background: var(--bg-surface); font-size: 13px; color: var(--text-secondary); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
.footer-col h4 { font-size: 13px; font-weight: 500; color: var(--text-primary); margin: 0 0 12px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-col a:hover { color: var(--accent-ink); }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border-hairline); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-muted); }

@media (max-width: 1024px) {
  .hero-grid, .detail-grid, .featured-grid { grid-template-columns: 1fr; }
  .agents-grid, .pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-head, .catalog-row { grid-template-columns: 36px minmax(0, 1fr) 80px 136px; }
  .col-hide-md { display: none; }
}

@media (max-width: 680px) {
  .container { padding: 0 16px; }
  .site-nav, .catalog-head, .col-hide-sm { display: none; }
  .agents-grid, .pricing-grid, .category-cards-grid, .form-grid, .footer-grid { grid-template-columns: 1fr; }
  .catalog-row { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; }
  .blueprint-layer { grid-template-columns: 24px 86px minmax(0, 1fr); }
  .layer-domain { display: none; }
}

/* ==========================================================================
   V1 Astro Additions: Track Switcher & 9-Block Agent Dossier Components
   ========================================================================== */
.track-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.track-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.track-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.track-btn.is-active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-canvas);
}

.replaces-callout {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  margin-bottom: 24px;
}

.replaces-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent-ink);
  margin-bottom: 4px;
}

.replaces-callout p {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
}

.install-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #10120E;
  color: #A3E635;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-x: auto;
}

.field-notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-note-box {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  border: 1px solid var(--border-hairline);
}

.field-note-box h3 {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 10px;
  color: var(--text-primary);
}

.compare-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.compare-table th,
.compare-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-hairline);
}

.compare-table th {
  background: var(--bg-subtle);
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
}

.compare-table tr:last-child td {
  border-bottom: none;
}

.compare-table tr.is-current td {
  background: var(--accent-soft);
}

.compare-table a {
  font-weight: 500;
}

.compare-table a:hover {
  color: var(--accent-ink);
}

@media (max-width: 680px) {
  .field-notes-grid {
    grid-template-columns: 1fr;
  }
}
