/* =============================================================================
   Aethyr Agent Registry — Styles
   Minimal, clean, trustworthy. This is infrastructure.
   ============================================================================= */

:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #555555;
  --border: #ebebeb;
  --accent: #1a1a1a;
  --accent-hover: #333333;
  --code-bg: #f5f5f5;
  --success: #16a34a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --transition: 0.2s ease;
}

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

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Everything above the canvas */
nav,
main,
footer {
  position: relative;
  z-index: 1;
}

/* ─── Nav ──────────────────────────────────────────────── */

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: opacity var(--transition);
}

.nav-brand:hover {
  opacity: 0.7;
}

.nav-sep {
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition);
  position: relative;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links a.active {
  color: var(--text);
  font-weight: 500;
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--text);
  border-radius: 1px;
}

/* ─── Mobile nav toggle ───────────────────────────────── */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ─── Main ─────────────────────────────────────────────── */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

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

.hero {
  padding: 5rem 0 4rem;
  max-width: 640px;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
}

/* ─── Buttons ──────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary:hover {
  border-color: var(--text-muted);
  background: rgba(0, 0, 0, 0.02);
}

.btn-disabled {
  background: var(--code-bg);
  color: var(--text-muted);
  cursor: default;
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  display: inline-block;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── How It Works ─────────────────────────────────────── */

.how-it-works {
  padding: 4rem 0;
}

.how-it-works h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2.5rem;
  letter-spacing: -0.02em;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.step {
  position: relative;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.step h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.step p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.step code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

/* ─── Verify Section ───────────────────────────────────── */

.verify-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.verify-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.verify-section > p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.verify-section pre {
  background: var(--text);
  color: #e5e5e5;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.7;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow-md);
}

.verify-section pre code {
  font-family: var(--font-mono);
}

.verify-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ─── API Section ─────────────────────────────────────── */

.api-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.api-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.api-section > p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.api-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.api-section h3:first-of-type {
  margin-top: 0;
}

.api-section pre {
  background: var(--text);
  color: #e5e5e5;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.7;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow-sm);
}

.api-section pre code {
  font-family: var(--font-mono);
}

/* ─── Pricing ──────────────────────────────────────────── */

.pricing {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.pricing h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2.5rem;
  letter-spacing: -0.02em;
}

.tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.tier {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
}

.tier:hover {
  box-shadow: var(--shadow-md);
}

.tier-active {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.tier-active:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tier h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.tier-price {
  font-size: 2rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.tier-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.tier ul {
  list-style: none;
  margin-bottom: 2rem;
  flex: 1;
}

.tier ul li {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.35rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.tier ul li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 600;
}

.tier-coming {
  opacity: 0.55;
}

.tier-coming:hover {
  opacity: 0.7;
}

/* ─── Standards ────────────────────────────────────────── */

.standards {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.standards h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

.standard-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.standard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.standard strong {
  font-size: 0.9375rem;
  font-weight: 500;
}

.standard span {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ─── Legal Pages ─────────────────────────────────────── */

.legal-page {
  max-width: 680px;
  padding: 3rem 0 4rem;
}

.legal-page h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.legal-updated {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2.5rem;
}

.legal-page h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-page p,
.legal-page ul {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.legal-page ul {
  padding-left: 1.5rem;
}

.legal-page li {
  margin-bottom: 0.4rem;
}

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

.legal-page a:hover {
  text-decoration: underline;
}

.legal-page code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

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

footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

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

/* ─── Tier Selector ───────────────────────────────────── */

.tier-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.tier-option {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}

.tier-option:hover {
  border-color: var(--text-muted);
}

.tier-option-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.tier-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tier-option-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.tier-option-price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.tier-option-period {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tier-option-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .tier-selector {
    grid-template-columns: 1fr;
  }
}

/* ─── Forms (register page) ────────────────────────────── */

.page-header {
  padding: 3rem 0 2rem;
  max-width: 540px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--text-muted);
  line-height: 1.7;
}

.form-card {
  max-width: 540px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 4rem;
  box-shadow: var(--shadow-sm);
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.form-group label .optional {
  font-weight: 400;
  color: var(--text-muted);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

.form-group input::placeholder {
  color: #b0b0b0;
}

.form-submit {
  margin-top: 1.5rem;
}

.form-submit .btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.9375rem;
}

.form-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  display: none;
}

.form-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 1rem;
  text-align: center;
}

/* ─── Credential page ──────────────────────────────────── */

.credential-lookup {
  max-width: 540px;
  margin-bottom: 2rem;
}

.credential-lookup .form-group {
  display: flex;
  gap: 0.5rem;
}

.credential-lookup input {
  flex: 1;
}

.credential-lookup .btn {
  white-space: nowrap;
}

.credential-card {
  max-width: 720px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 4rem;
  display: none;
  box-shadow: var(--shadow-sm);
}

.credential-card.visible {
  display: block;
}

.credential-field {
  margin-bottom: 1rem;
}

.credential-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.credential-field-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  word-break: break-all;
  background: var(--code-bg);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

.credential-json {
  margin-top: 1.5rem;
}

.credential-json pre {
  background: var(--text);
  color: #e5e5e5;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
  max-height: 400px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow-md);
}

.credential-json pre code {
  font-family: var(--font-mono);
}

.credential-actions {
  margin-top: 1rem;
}

/* API key warning box */
.api-key-box {
  display: none;
  margin-top: 1.5rem;
  padding: 1rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
}

.api-key-box .credential-field-label {
  color: #92400e;
}

.api-key-box .api-key-note {
  font-size: 0.8rem;
  color: #92400e;
  margin-top: 0.5rem;
}

.api-key-box.visible {
  display: block;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.status-active {
  background: #dcfce7;
  color: #166534;
}
.status-revoked {
  background: #fee2e2;
  color: #991b1b;
}
.status-pending {
  background: #fef3c7;
  color: #92400e;
}

/* ─── Pending notice (credential page) ────────────────── */

.pending-notice {
  display: none;
  align-items: center;
  gap: 1rem;
  max-width: 540px;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.pending-notice.visible {
  display: flex;
}

.pending-notice strong {
  font-size: 0.9375rem;
  display: block;
  margin-bottom: 0.25rem;
}

.pending-notice p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.pending-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ─── Loading spinner ─────────────────────────────────── */

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 768px) {
  nav {
    padding: 1rem;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    right: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    flex-direction: column;
    padding: 0.75rem 0;
    min-width: 160px;
    z-index: 10;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.5rem 1.25rem;
  }

  .nav-links a.active::after {
    display: none;
  }

  nav {
    position: relative;
  }

  main {
    padding: 0 1rem;
  }

  .hero {
    padding: 3rem 0 2rem;
  }
  .hero h1 {
    font-size: 2rem;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .steps {
    grid-template-columns: 1fr 1fr;
  }
  .tiers {
    grid-template-columns: 1fr;
  }

  .standard {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .footer-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .steps {
    grid-template-columns: 1fr;
  }
  .hero-actions {
    flex-direction: column;
  }
}
