/* ═══════════════════════════════════════════════════════
   PRIMUS INSIGHTS — Design System
   Institutional-grade financial verification UI
   ═══════════════════════════════════════════════════════ */

/* ── Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary:    #0a0e17;
  --bg-secondary:  #0f1520;
  --bg-surface:    #141b2a;
  --bg-elevated:   #1a2236;
  --bg-hover:      #1e2842;

  /* Text */
  --text-primary:   #e8ecf4;
  --text-secondary: #8a94a6;
  --text-muted:     #505a6e;
  --text-inverse:   #0a0e17;

  /* Accent — cold cyan */
  --accent:         #00d4ff;
  --accent-dim:     #0098b8;
  --accent-glow:    rgba(0, 212, 255, 0.12);
  --accent-border:  rgba(0, 212, 255, 0.25);

  /* Status */
  --status-good:    #00c9a7;
  --status-warn:    #f0a500;
  --status-bad:     #ff4757;
  --status-info:    #4c8dff;

  /* Borders & Dividers */
  --border:         rgba(138, 148, 166, 0.12);
  --border-strong:  rgba(138, 148, 166, 0.22);
  --divider:        rgba(138, 148, 166, 0.08);

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:   0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.08);

  /* Radii */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  /* Spacing scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;
  --font-body:    'IBM Plex Mono', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 600ms;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
}

/* ── Typography ────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

p {
  line-height: 1.7;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--text-primary);
}

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* ── Layout ────────────────────────────────────────── */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg);
}

.section {
  padding: var(--space-3xl) 0;
}

.section + .section {
  border-top: 1px solid var(--divider);
}

/* ── Grid ──────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ── Surface (Card / Panel) ────────────────────────── */
.surface {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.surface-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
}

.surface-glow {
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-glow);
}

/* ── Header / Nav ──────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-out);
}

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

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  text-transform: uppercase;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: transparent;
  color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-glow);
  border-color: var(--accent);
}

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

.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 0.875rem;
}

/* ── Form Elements ─────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  outline: none;
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a94a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ── Status Badges ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-info {
  background: rgba(76, 141, 255, 0.12);
  color: var(--status-info);
}
.badge-info::before { background: var(--status-info); }

.badge-good {
  background: rgba(0, 201, 167, 0.12);
  color: var(--status-good);
}
.badge-good::before { background: var(--status-good); }

.badge-warn {
  background: rgba(240, 165, 0, 0.12);
  color: var(--status-warn);
}
.badge-warn::before { background: var(--status-warn); }

.badge-bad {
  background: rgba(255, 71, 87, 0.12);
  color: var(--status-bad);
}
.badge-bad::before { background: var(--status-bad); }

.badge-neutral {
  background: rgba(138, 148, 166, 0.12);
  color: var(--text-secondary);
}
.badge-neutral::before { background: var(--text-secondary); }

/* Pulsing status dot */
.badge-live::before {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Data Table / Ledger ───────────────────────────── */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.ledger-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
}

.ledger-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--text-secondary);
  vertical-align: top;
}

.ledger-table tr:hover td {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ledger-table .hash-cell {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Hash Display ──────────────────────────────────── */
.hash {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.5;
}

.hash-sm {
  font-size: 0.6875rem;
}

.hash-accent {
  color: var(--accent-dim);
}

/* ── Chain Visualization ───────────────────────────── */
.chain-entry {
  position: relative;
  padding-left: var(--space-xl);
  padding-bottom: var(--space-lg);
}

.chain-entry::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.chain-entry:last-child::before {
  display: none;
}

.chain-entry::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--accent-dim);
  background: var(--bg-primary);
}

.chain-entry-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.chain-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.chain-entry-type {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chain-entry-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Integrity Indicator ───────────────────────────── */
.integrity {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
}

.integrity-valid {
  background: rgba(0, 201, 167, 0.08);
  color: var(--status-good);
  border: 1px solid rgba(0, 201, 167, 0.2);
}

.integrity-broken {
  background: rgba(255, 71, 87, 0.08);
  color: var(--status-bad);
  border: 1px solid rgba(255, 71, 87, 0.2);
}

/* ── Alert / Notice ────────────────────────────────── */
.alert {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid;
}

.alert-error {
  background: rgba(255, 71, 87, 0.06);
  border-color: rgba(255, 71, 87, 0.2);
  color: var(--status-bad);
}

.alert-warn {
  background: rgba(240, 165, 0, 0.06);
  border-color: rgba(240, 165, 0, 0.2);
  color: var(--status-warn);
}

.alert-info {
  background: rgba(76, 141, 255, 0.06);
  border-color: rgba(76, 141, 255, 0.2);
  color: var(--status-info);
}

.alert-success {
  background: rgba(0, 201, 167, 0.06);
  border-color: rgba(0, 201, 167, 0.2);
  color: var(--status-good);
}

/* ── Divider ───────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

/* ── Eyebrow / Label ───────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Footer ────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ── Loading State ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* ── Typewriter / Reveal Animation ─────────────────── */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent);
  animation:
    typing 1.2s steps(40, end) forwards,
    blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent); }
}

.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: revealUp var(--duration-slow) var(--ease-out) forwards;
}

@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-delay-1 { animation-delay: 100ms; }
.reveal-delay-2 { animation-delay: 200ms; }
.reveal-delay-3 { animation-delay: 300ms; }
.reveal-delay-4 { animation-delay: 400ms; }

/* ── Utility ───────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.w-full { width: 100%; }

/* ── Document Card ─────────────────────────────────── */
.doc-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-out);
}

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

.doc-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
}

.doc-meta {
  flex: 1;
  min-width: 0;
}

.doc-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.doc-hash {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* ── Pricing Card ──────────────────────────────────── */
.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.pricing-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-glow);
}

.pricing-card-featured {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-glow);
  position: relative;
}

.pricing-amount {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--text-primary);
  line-height: 1;
}

.pricing-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pricing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.pricing-features li {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding-left: 20px;
  position: relative;
}

.pricing-features li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* ── Step Indicator ────────────────────────────────── */
.steps-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  counter-reset: step;
}

.step {
  counter-increment: step;
  position: relative;
}

.step-number {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.step-number::before {
  content: counter(step, decimal-leading-zero);
}

.step-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.step-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

@media (max-width: 768px) {
  .steps-row {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .page-wrapper {
    padding: var(--space-md);
  }

  .site-header {
    padding: var(--space-sm) var(--space-md);
  }

  .nav-links {
    gap: var(--space-md);
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  .surface, .surface-elevated, .surface-glow {
    padding: var(--space-md);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .btn-lg {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .nav-links {
    gap: var(--space-sm);
  }
  .nav-links li.nav-hide-mobile {
    display: none;
  }
}
