@font-face {
  font-family: 'Geist';
  src: url('/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --night: #08080c;
  --panel: #111118;
  --panel-raised: #171721;
  --editor-surface: #0d0d13;
  --text: #f7f4ee;
  --muted: #aeaab8;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.24);
  --ember: #e8572a;
  --ember-cta: #c43e16;
  --ember-cta-hover: #ad3410;
  --ember-hover: #f2683c;
  --peach: #ffb08a;
  --status-warning: #eab308;
  --status-warning-bg: rgba(234, 179, 8, 0.12);
  --status-warning-border: rgba(234, 179, 8, 0.34);
  --destructive: #ff6568;
  --destructive-bg: rgba(255, 101, 104, 0.12);
  --destructive-border: rgba(255, 101, 104, 0.34);
  --status-success: #86efac;
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
  --radius: 10px;
  --page: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
}

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

html {
  background: var(--night);
  color: var(--text);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
dt,
figure,
pre {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

.wrap {
  width: 100%;
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 8, 12, 0.94);
  border-bottom: 1px solid var(--line);
}

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

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

.brand-mark {
  display: block;
  width: 24px;
  height: 15px;
  flex: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link,
.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition:
    color 160ms ease,
    background-color 160ms ease;
}

.nav-link:hover,
.nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--ember-cta);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 160ms ease;
}

.header-cta:hover {
  background: var(--ember-cta-hover);
}

.app-main {
  flex: 1;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background-color 160ms ease,
    border-color 160ms ease;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.primary {
  border-color: transparent;
  background: var(--ember-cta);
  color: #ffffff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--ember-cta-hover);
}

.btn.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.btn.fixed-copy {
  min-width: 164px;
}

.btn.fixed-submit {
  min-width: 148px;
}

.btn.fixed-load-more {
  min-width: 124px;
}

/* Landing Hero & Product Preview */

.hero {
  padding: 40px 0 36px;
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 36px;
  align-items: center;
}

.hero-copy,
.publish-page-grid > div {
  min-width: 0;
  max-width: 100%;
}

h1 {
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

h2 {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.hero-lead {
  margin-top: 14px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 52ch;
}

.hero-cta-row {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.hero-os-list {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}

.hero-os-list a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}

.hero-os-list a:hover {
  color: var(--text);
}

.preview-figure {
  width: 100%;
}

.preview-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}

/* Filter Bar */

.filter-band {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.filter-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.text-input,
.select-input {
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

.text-input {
  width: 100%;
  min-width: 0;
}

.domain-chips {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.chip-btn {
  display: inline-block;
  max-width: 100%;
  height: 30px;
  line-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.chip-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.chip-btn[aria-pressed='true'] {
  color: var(--text);
  border-color: var(--peach);
  background: rgba(232, 87, 42, 0.16);
}

.catalog-status {
  margin-top: 12px;
  min-height: 22px;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Hairline Catalog List */

.catalog-section {
  padding: 8px 0 56px;
}

.catalog-list {
  list-style: none;
  padding: 0;
}

.mod-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.mod-main {
  min-width: 0;
}

.mod-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.mod-title-link {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mod-title-link:hover {
  color: var(--peach);
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.version-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.mod-desc {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
  max-width: 68ch;
  overflow-wrap: anywhere;
}

.mod-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pattern-tag {
  display: inline-block;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mod-stats {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: none;
  font-variant-numeric: tabular-nums;
}

.stat-numbers {
  text-align: right;
  min-width: 108px;
}

.stat-monthly {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}

.stat-monthly-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.stat-total {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.sparkline {
  display: block;
  flex: none;
}

.empty-state {
  padding: 36px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.empty-state p {
  font-size: 15px;
  color: var(--muted);
}

.catalog-pagination {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.catalog-pagination-status {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Detail View */

.detail-section {
  padding: 28px 0 56px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-size: 14px;
  color: var(--muted);
}

.back-link:hover {
  color: var(--text);
}

.detail-header {
  margin-top: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
}

.detail-header > div {
  min-width: 0;
  max-width: 100%;
}

.detail-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.detail-desc {
  margin-top: 10px;
  font-size: 16px;
  color: var(--muted);
  max-width: 66ch;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.detail-monthly-readout {
  font-size: 18px;
  font-weight: 650;
  color: var(--text);
}

.detail-total-readout {
  font-size: 13px;
  color: var(--muted);
}

.sparkline-caption {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.warning-banner {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--status-warning-border);
  background: var(--status-warning-bg);
  color: var(--status-warning);
  font-size: 14px;
  font-weight: 500;
}

.rules-strip {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 28px;
}

.rule-group {
  min-width: 0;
}

.rule-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.mono-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.action-band {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.fallback-slot {
  margin-top: 12px;
}

.fallback-panel {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  visibility: visible;
  opacity: 1;
  transition: opacity 150ms ease;
}

.fallback-panel[aria-hidden='true'],
.fallback-panel[inert] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.fallback-panel[hidden] {
  display: none;
}

/* Inspector Panel (single panel container) */

.inspector-panel {
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.tab-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  transition:
    color 160ms ease,
    background-color 160ms ease;
}

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

.tab-btn[aria-selected='true'] {
  color: var(--text);
  background: var(--night);
  border-color: var(--line-strong);
}

.tab-panel {
  padding: 18px;
  min-width: 0;
  min-height: 180px;
  max-width: 100%;
  overflow-x: auto;
}

.code-pane {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
  min-width: 0;
  max-width: 100%;
}

.notes-pane {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.api-summary-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
  gap: 14px;
}

.api-endpoints-list {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
}

.api-endpoint-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
  gap: 6px;
}

.api-endpoint-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
}

.api-method {
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  font-weight: 600;
}

.api-path {
  color: var(--peach);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.api-endpoint-desc {
  font-size: 14px;
  color: var(--muted);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-funnel-band {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: center;
}

/* Publish Dialog & Page */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 8, 12, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.dialog-backdrop[hidden] {
  display: none;
}

.dialog-panel {
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 22px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.publish-page-grid {
  padding: 32px 0 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 32px;
  align-items: start;
}

.publish-form {
  display: grid;
  gap: 14px;
}

.publish-intro {
  margin-top: 10px;
  font-size: 15px;
  color: var(--muted);
}

.dropzone {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--editor-surface);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.dropzone.active {
  border-color: var(--peach);
}

.file-input {
  max-width: 100%;
  font-size: 13px;
}

.json-textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--editor-surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.publish-preview-line {
  min-height: 22px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.publish-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.alert-slot {
  min-height: 44px;
}

.alert-box {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--destructive-border);
  background: var(--destructive-bg);
  color: var(--destructive);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.action-error-box {
  margin-top: 12px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0 28px;
  font-size: 14px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}

.footer-brand {
  color: var(--text);
  font-weight: 600;
}

.footer-link {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}

.footer-link:hover {
  color: var(--text);
}

/* Responsive */

@media (max-width: 900px) {
  .hero-grid,
  .detail-header,
  .detail-funnel-band,
  .publish-page-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-stats {
    align-items: flex-start;
  }

  .filter-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .filter-controls > .field-group:first-child {
    grid-column: 1 / -1;
  }

  .rules-strip {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .mod-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .mod-stats {
    justify-content: space-between;
    width: 100%;
  }

  .stat-numbers {
    text-align: left;
  }

  .filter-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-inner {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
