/**
 * BLACKDARK Trust OS — Design System v1 (binding)
 * Calm Surface — Infinite Depth · Decision Intelligence, not data dashboard.
 *
 * REJECTED: Inter · purple/gold AI defaults · ARENA · FOMO seat counters ·
 * fake scarcity · Soft Gold #FFD700 as system color · elevated purple #1A1A2E
 *
 * Motions (intentional only): pulseIn · flipFlash · sharePop
 * Doc: docs/TRUST_OS_DESIGN_SYSTEM.md
 */

/* Fonts: Syne + IBM Plex Sans (brand); no render-blocking @import — CSP blocks fonts.googleapis.com. */

:root {
  /* Palette */
  --bd-bg: #0a0a0f;
  --bd-bg-deep: #07070b;
  --bd-surface: #111118;
  --bd-elevated: #1a1a24;
  --bd-border: #2a2a35;
  --bd-border-strong: rgba(34, 211, 238, 0.28);
  --bd-text: #f4f4f5;
  --bd-text-secondary: #e4e4e7;
  --bd-muted: #a1a1aa;
  /* Keep dim at AA-safe floor on dark surfaces (was #71717a ~3.9:1). */
  --bd-muted-dim: #a1a1aa;
  --bd-accent: #22d3ee;
  --bd-accent-deep: #06b6d4;
  --bd-accent-glow: rgba(34, 211, 238, 0.14);
  --bd-success: #22c55e;
  --bd-wait: #f59e0b;
  --bd-caution: #ef4444;
  --bd-danger: #ef4444;

  /* Aliases used across legacy templates */
  --bg: var(--bd-bg);
  --bg-card: var(--bd-surface);
  --bg-elevated: var(--bd-elevated);
  --border: var(--bd-border);
  --text: var(--bd-text-secondary);
  --text-muted: var(--bd-muted-dim);
  --accent: var(--bd-accent);
  --accent-glow: var(--bd-accent-glow);
  --success: var(--bd-success);
  --warning: var(--bd-wait);
  --danger: var(--bd-danger);

  /* Type */
  --bd-font-display: system-ui, -apple-system, "Segoe UI", sans-serif;
  --bd-font-body: system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Motion */
  --bd-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --bd-ease-io: cubic-bezier(0.45, 0, 0.55, 1);
  --bd-dur-enter: 300ms;
  --bd-dur-hover: 200ms;
  --bd-dur-flip: 450ms;

  /* Radius / space */
  --bd-radius: 12px;
  --bd-radius-lg: 16px;
  --bd-max: 1100px;
}

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

html {
  /* smooth scroll hurts INP on in-page anchors (web.dev ≤200ms). */
  scroll-behavior: auto;
}

body.bd-shell {
  margin: 0;
  min-height: 100vh;
  font-family: var(--bd-font-body);
  background:
    radial-gradient(1100px 560px at 18% -12%, rgba(34, 211, 238, 0.1), transparent 55%),
    radial-gradient(900px 480px at 92% 0%, rgba(6, 182, 212, 0.07), transparent 50%),
    linear-gradient(180deg, #0c1018 0%, var(--bd-bg) 42%, var(--bd-bg-deep) 100%);
  color: var(--bd-text-secondary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ——— Typography ——— */
.bd-display {
  font-family: var(--bd-font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--bd-text);
}

.bd-brand {
  font-family: var(--bd-font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--bd-accent);
  text-decoration: none;
  background: none;
  -webkit-text-fill-color: var(--bd-accent);
}

a {
  color: var(--bd-accent);
  text-decoration: none;
}
a:hover {
  color: #67e8f9;
}

/* ——— Buttons ——— */
.bd-btn,
.btn-primary,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: var(--bd-radius);
  font-family: var(--bd-font-body);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--bd-dur-hover) var(--bd-ease-io),
    box-shadow var(--bd-dur-hover) var(--bd-ease-io),
    border-color var(--bd-dur-hover) var(--bd-ease-io);
}

.bd-btn-primary,
.btn-primary {
  background: linear-gradient(135deg, var(--bd-accent), var(--bd-accent-deep));
  color: #041016;
}

.bd-btn-primary:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(34, 211, 238, 0.28);
  color: #041016;
}

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

.bd-btn-secondary:hover,
.btn-secondary:hover {
  border-color: var(--bd-accent);
  color: var(--bd-accent);
}

/* ——— Motions (only three intentional product motions) ——— */
@keyframes bdPulseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes bdFlipFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45);
  }
  100% {
    box-shadow: 0 0 0 18px transparent;
  }
}

@keyframes bdSharePop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

.bd-motion-enter {
  animation: bdPulseIn var(--bd-dur-enter) var(--bd-ease-out) both;
}

.bd-motion-flip {
  animation: bdFlipFlash 1.1s var(--bd-ease-out);
}

.bd-motion-share {
  animation: bdSharePop 280ms var(--bd-ease-io);
}

/* ——— Trust Pulse (shared) ——— */
.bd-trust-pulse {
  position: relative;
  background: linear-gradient(165deg, rgba(18, 32, 42, 0.96) 0%, var(--bd-surface) 58%);
  border: 1px solid var(--bd-border-strong);
  border-radius: var(--bd-radius-lg);
  padding: 1.25rem 1.35rem 1.15rem;
  animation: bdPulseIn 0.65s var(--bd-ease-out) both;
}

.bd-trust-pulse.flipped {
  animation: bdFlipFlash 1.1s var(--bd-ease-out);
  border-color: rgba(245, 158, 11, 0.55);
}

.bd-tp-action {
  font-family: var(--bd-font-display);
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.bd-tp-action.ACT {
  color: var(--bd-success);
}
.bd-tp-action.WAIT {
  color: var(--bd-wait);
}
.bd-tp-action.CAUTION {
  color: var(--bd-caution);
}

.bd-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--bd-border);
  background: var(--bd-elevated);
  color: var(--bd-muted);
  font-size: 0.75rem;
  text-decoration: none;
}

.bd-chip.ok {
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

/* ——— Pricing (interaction containers only) ——— */
.bd-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.bd-price-tier {
  background: var(--bd-surface);
  border: 1px solid var(--bd-border);
  border-radius: var(--bd-radius-lg);
  padding: 1.35rem 1.25rem;
  text-align: left;
  transition: border-color var(--bd-dur-hover) var(--bd-ease-io),
    transform var(--bd-dur-hover) var(--bd-ease-io);
}

.bd-price-tier:hover {
  border-color: rgba(34, 211, 238, 0.35);
  transform: translateY(-3px);
}

.bd-price-tier.popular {
  border-color: var(--bd-accent);
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.08), var(--bd-surface) 40%);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.15);
}

.bd-price-tier h3 {
  font-family: var(--bd-font-display);
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
  color: var(--bd-text);
}

.bd-price-tier .price {
  font-family: var(--bd-font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--bd-accent);
  margin-bottom: 0.5rem;
}

.bd-price-tier .price span {
  font-size: 0.9rem;
  color: var(--bd-muted-dim);
  font-weight: 500;
}

.bd-price-tier ul {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1.1rem;
}

.bd-price-tier li {
  color: var(--bd-muted);
  font-size: 0.88rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(42, 42, 53, 0.7);
}

.bd-price-tier li:last-child {
  border-bottom: none;
}

.bd-popular-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #041016;
  background: var(--bd-accent);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.55rem;
}

/* ——— Anti-hype foot ——— */
.bd-anti-hype {
  font-size: 0.75rem;
  color: var(--bd-muted-dim);
  line-height: 1.55;
}

/* ——— Utility helpers ——— */
.bd-hide-first-viewport-clutter {
  /* Stats / secondary strips must not sit in the first composition */
}

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

/* ——— Anti-Hype Mode (U7) ——— */
body.anti-hype-on .promo-cta,
body.anti-hype-on [data-hype],
body.anti-hype-on .pricing-card.popular .badge {
  display: none !important;
}
body.anti-hype-on {
  --bd-accent: #34d399;
}

/* ——— RTL locales (ar, he, ur, fa) ——— */
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .nav-inner,
html[dir="rtl"] .nav-links,
html[dir="rtl"] .bd-top-utility,
html[dir="rtl"] .hero,
html[dir="rtl"] .intent-grid,
html[dir="rtl"] .pricing-grid,
html[dir="rtl"] .footer-inner {
  direction: rtl;
}
html[dir="rtl"] .nav-links a {
  margin-left: 0;
  margin-right: 0.85rem;
}
html[dir="rtl"] .bd-lang-wrap {
  flex-direction: row-reverse;
}
html[dir="rtl"] .btn-upgrade,
html[dir="rtl"] .tier {
  margin-right: 0;
  margin-left: 0.5rem;
}
