/* ═══════════════════════════════════════════════════════════════════
   Dextra — Custom CSS (port from Tailwind + globals.css)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ────────────────────────────────────────────────── */
:root {
  --color-bg: #1E1E1E;
  --color-accent: #6665DD;
  --color-accent-dim: #7473E0;
  --color-amber: #ECECE4;
  --color-text-primary: #FAFAFA;
  --color-text-muted: #8B8B92;
  --color-surface: #19191C;
  --color-surface-2: #202024;
  --color-border-subtle: rgba(255,255,255,0.09);
  --color-dark-card: #0E0E11;
  --font-display: 'Sora', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Base Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  margin: 0;
}

/* Prevent grid/flex children from overflowing their containers */
.grid > *, .flex > * { min-width: 0; }

/* Code blocks: ensure horizontal scroll on small screens */
pre { max-width: 100%; overflow-x: auto; }
pre code { word-break: normal; white-space: pre; }

::selection { background: #7473E0; color: #FAFAFA; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #1E1E1E; }
::-webkit-scrollbar-thumb { background: #262629; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #6665DD; }

/* ── Typography ───────────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); font-weight: 300; }
.font-mono { font-family: var(--font-mono); }
.text-hero {
  font-size: clamp(2.75rem, 6vw, 4.75rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  font-weight: 300;
}
.text-section {
  font-size: clamp(2.75rem, 5vw, 4rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-weight: 300;
}
.text-gradient {
  background: linear-gradient(180deg, #FAFAFA 0%, #8B8B92 140%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Layout ───────────────────────────────────────────────────────── */
.section-shell {
  margin-inline: auto;
  width: 100%;
  max-width: 1280px;
  padding-inline: 1.5rem;
}
@media (min-width: 768px) {
  .section-shell { padding-inline: 2.5rem; }
}

/* ── Grid backdrop ────────────────────────────────────────────────── */
.grid-backdrop {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 64px 64px;
}

/* ── Hairline ─────────────────────────────────────────────────────── */
.hairline { border-top: 1px solid var(--color-border-subtle); }

/* ── Scroll Reveal ────────────────────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.21,0.47,0.32,0.98),
              transform 0.7s cubic-bezier(0.21,0.47,0.32,0.98);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── Keyframes ────────────────────────────────────────────────────── */
@keyframes pulseGlow {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.animate-pulse-glow { animation: pulseGlow 2.4s ease-in-out infinite; }
.animate-fade-in { animation: fadeIn 0.8s ease forwards; }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4,0,0.6,1) infinite; }

/* ── Panel transitions ────────────────────────────────────────────── */
.panel-enter { opacity: 0; transform: translateY(12px); }
.panel-enter-active {
  opacity: 1; transform: translateY(0);
  transition: all 0.35s ease;
}
.panel-exit {
  opacity: 0; transform: translateY(-12px);
  transition: all 0.35s ease;
}

/* ── SVG Pareto points ────────────────────────────────────────────── */
.pareto-point {
  transition: cx 0.5s cubic-bezier(0.22,1,0.36,1),
              cy 0.5s cubic-bezier(0.22,1,0.36,1),
              r 0.2s ease, opacity 0.3s ease, stroke 0.2s ease;
  cursor: pointer;
}
.pareto-point-selected {
  stroke: #ECECE4;
  stroke-width: 2px;
}

/* ── Navbar ───────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: all 0.3s;
  border-bottom: 1px solid transparent;
}
.navbar.scrolled {
  border-bottom-color: var(--color-border-subtle);
  background: rgba(30,30,30,0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.nav-link {
  position: relative;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 300;
  letter-spacing: -0.01em;
  transition: color 0.2s;
  color: var(--color-text-muted);
  text-decoration: none;
}
.nav-link:hover, .nav-link.active { color: var(--color-text-primary); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--color-accent);
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  border-radius: 0.375rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  transition: all 0.2s;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--color-accent);
  color: #06140A;
  box-shadow: 0 0 0 1px rgba(102,101,221,0.35);
}
.btn-primary:hover {
  background: var(--color-accent-dim);
  box-shadow: 0 0 24px -6px rgba(102,101,221,0.55);
}
.btn-secondary {
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-subtle);
}
.btn-secondary:hover {
  border-color: rgba(102,101,221,0.6);
  background: rgba(25,25,28,0.6);
}

/* ── Badge ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 0.125rem;
  border: 1px solid rgba(102,101,221,0.3);
  background: rgba(102,101,221,0.1);
  padding: 0.25rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-accent);
}

/* ── Card ─────────────────────────────────────────────────────────── */
.card {
  position: relative;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  padding: 1.5rem;
  transition: border-color 0.3s;
}
@media (min-width: 768px) { .card { padding: 2rem; } }
.card:hover { border-color: rgba(102,101,221,0.4); }

/* ── Section label ────────────────────────────────────────────────── */
.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-label .num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 1px solid var(--color-border-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
}
.section-label .line {
  width: 2rem;
  height: 1px;
  background: rgba(139,139,146,0.4);
}
.section-label .text {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--color-text-muted);
}

/* ── Use case carousel ────────────────────────────────────────────── */
.carousel-slide {
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.carousel-dot {
  height: 6px;
  border-radius: 9999px;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  background: var(--color-border-subtle);
}
.carousel-dot.active {
  width: 2rem;
  background: var(--color-accent);
}
.carousel-dot:not(.active) {
  width: 6px;
}
.carousel-dot:not(.active):hover {
  background: var(--color-text-muted);
}

/* ── Pipeline stages ──────────────────────────────────────────────── */
.pipeline-stage-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100px;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s;
}
.pipeline-stage-btn:hover { border-color: rgba(102,101,221,0.4); }
.pipeline-stage-btn.active {
  border-color: var(--color-accent);
  background: rgba(102,101,221,0.1);
}

/* ── Chat typing indicator ────────────────────────────────────────── */
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Chat message animation ───────────────────────────────────────── */
.chat-message {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeIn 0.45s ease forwards;
}

/* ── Form inputs ──────────────────────────────────────────────────── */
.form-input {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-dark-card);
  padding: 0.75rem 1rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.form-input::placeholder { color: rgba(139,139,146,0.5); }
.form-input:focus { border-color: rgba(102,101,221,0.6); }

/* ── Comparison table ─────────────────────────────────────────────── */
.comparison-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}
.comparison-table th {
  padding: 1rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-text-muted);
}
.comparison-table td {
  padding: 1rem;
  text-align: center;
}
.comparison-table thead tr { background: var(--color-dark-card); }
.comparison-table tbody tr { border-top: 1px solid var(--color-border-subtle); }
.comparison-table .dextra-col { background: rgba(102,101,221,0.06); }
.comparison-table .dextra-header { background: rgba(102,101,221,0.1); color: var(--color-text-primary); }

/* ── Reduced motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ── Line clamp utility ───────────────────────────────────────────── */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Code cursor blink ────────────────────────────────────────────── */
.code-cursor {
  display: inline-block;
  width: 6px;
  height: 1rem;
  background: var(--color-accent);
  animation: cursorBlink 1s step-end infinite;
}

/* ── Platform sidebar ─────────────────────────────────────────────── */
.platform-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  border-radius: 0.375rem;
  padding: 0.625rem 0.75rem;
  text-align: left;
  transition: color 0.2s, background 0.2s;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
}
.platform-sidebar-btn:hover { color: var(--color-text-primary); }
.platform-sidebar-btn.active {
  background: rgba(102,101,221,0.1);
  color: var(--color-text-primary);
}
.platform-sidebar-btn .bar {
  height: 1px;
  width: 1.5rem;
  flex-shrink: 0;
  transition: all 0.2s;
  background: var(--color-border-subtle);
}
.platform-sidebar-btn.active .bar {
  width: 2rem;
  background: var(--color-accent);
}
.platform-sidebar-btn:hover .bar { width: 2rem; }
