/* =====================================================
   Phantasm Landing Page — Custom Styles
   Tailwind handles layout/spacing. This file handles:
   - Custom animations and keyframes
   - Code block syntax highlighting
   - Nav blur effect
   - Hero flow diagram
   - Step connector lines
   - Scroll-triggered initial states
   ===================================================== */

/* ── Reset & Base ─────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #0f172a;
  background: #ffffff;
  overflow-x: hidden;
}

/* ── Selection ────────────────────────────────────── */
::selection {
  background: #6366f1;
  color: #ffffff;
}

/* ── Focus Visible ────────────────────────────────── */
:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Announcement Banner ─────────────────────────── */
.announcement-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: linear-gradient(90deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
  padding: 8px 0;
  overflow: hidden;
}

.announcement-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08) 50%, transparent);
  pointer-events: none;
}

.announcement-new-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
  flex-shrink: 0;
}

.announcement-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

.announcement-text strong {
  color: #ffffff;
  font-weight: 700;
}

.announcement-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  padding-bottom: 1px;
  transition: border-color 0.2s ease;
  flex-shrink: 0;
}

.announcement-link:hover {
  border-color: #ffffff;
}

/* ── Nav ──────────────────────────────────────────── */
#main-nav {
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

#main-nav.scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.nav-link {
  position: relative;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
  padding-bottom: 2px;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: #6366f1;
  transition: width 0.25s ease;
}

.nav-link:hover {
  color: #0f172a;
}

.nav-link:hover::after {
  width: 100%;
}

/* ── Products Dropdown ───────────────────────────── */
.products-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.products-toggle::after {
  display: none;
}

.products-menu {
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.products-menu.visible {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.products-chevron.rotated {
  transform: rotate(180deg);
}

.mobile-products-chevron.rotated {
  transform: rotate(180deg);
}

/* ── Buttons ──────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #6366f1;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
  text-decoration: none;
  border: 2px solid #6366f1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn-primary:hover {
  background: #4f46e5;
  border-color: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #0f172a;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
  text-decoration: none;
  border: 2px solid #cbd5e1;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: #6366f1;
  color: #6366f1;
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* ── Hero Section ─────────────────────────────────── */
.hero-section {
  background: linear-gradient(160deg, #f8faff 0%, #f1f4ff 40%, #fafafa 100%);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.07) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6366f1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: #6366f1;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

/* ── Hero Flow Diagram ────────────────────────────── */
.flow-diagram-wrapper {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}

.flow-node {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.3s ease;
}

.flow-node.active-node {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), 0 2px 12px rgba(15, 23, 42, 0.06);
}

.flow-node-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.flow-node-icon svg {
  width: 18px;
  height: 18px;
  color: #ffffff;
}

.flow-node-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.flow-node-sub {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 1px;
}

.flow-connector {
  display: flex;
  align-items: center;
  padding: 0 0 0 30px;
  height: 32px;
  position: relative;
}

.flow-connector-line {
  width: 2px;
  height: 100%;
  background: linear-gradient(to bottom, #c7d2fe, #e0e7ff);
  border-radius: 2px;
  position: relative;
}

.flow-connector-arrow {
  position: absolute;
  bottom: -1px;
  left: -4px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #c7d2fe;
}

/* Flow cycle arrow (bottom to top feedback loop) */
.flow-cycle-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 8px 16px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px dashed rgba(99, 102, 241, 0.25);
  border-radius: 8px;
  font-size: 0.78rem;
  color: #6366f1;
  font-weight: 600;
}

/* ── Section Headings ─────────────────────────────── */
.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6366f1;
  margin-bottom: 12px;
}

/* ── Problem Section ──────────────────────────────── */
.problem-section {
  background: #f8fafc;
}

/* Comparison Table */
.comparison-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.comparison-table thead tr {
  background: #f1f5f9;
}

.comparison-table th {
  padding: 13px 20px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

.comparison-table td {
  padding: 16px 20px;
  vertical-align: top;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  line-height: 1.6;
}

.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.comparison-table tbody tr {
  background: #ffffff;
  transition: background 0.15s ease;
}

.comparison-table tbody tr:hover {
  background: #f8faff;
}

.comparison-table .system-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.88rem;
  display: block;
}

.comparison-table .system-org {
  font-size: 0.78rem;
  color: #94a3b8;
  display: block;
  margin-top: 2px;
}

.comparison-table .cant-do {
  color: #94a3b8;
  font-size: 0.85rem;
}

/* ── How It Works ─────────────────────────────────── */
.hiw-section {
  background: #ffffff;
}

.step-container {
  position: relative;
}

.step-item {
  position: relative;
  padding-left: 0;
}

.step-track {
  position: absolute;
  left: 26px;
  top: 56px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #e0e7ff 0%, #f1f5f9 100%);
}

.step-item:last-child .step-track {
  display: none;
}

.step-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.1);
  position: relative;
  z-index: 1;
}

.step-content {
  padding-left: 24px;
  padding-bottom: 48px;
  flex: 1;
}

.step-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
  margin-top: 12px;
}

.step-body {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.7;
  max-width: 600px;
}

/* ── Code Block ───────────────────────────────────── */
.code-block-wrapper {
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
  margin: 24px 0 8px;
  max-width: 640px;
}

.code-block-header {
  background: #1e293b;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.code-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.code-dot-red   { background: #f87171; }
.code-dot-yellow { background: #fbbf24; }
.code-dot-green { background: #34d399; }

.code-filename {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  margin-left: 4px;
}

.code-block-inner {
  padding: 20px 24px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8rem;
  line-height: 1.75;
}

/* JSON syntax highlighting */
.json-key     { color: #93c5fd; }  /* light blue */
.json-str     { color: #86efac; }  /* green */
.json-num     { color: #fca5a5; }  /* soft red */
.json-bool    { color: #c4b5fd; }  /* purple */
.json-null    { color: #94a3b8; }  /* gray */
.json-brace   { color: #e2e8f0; }  /* near-white */
.json-colon   { color: #64748b; }  /* muted */
.json-comment { color: #475569; font-style: italic; }

.code-caption {
  font-size: 0.8rem;
  color: #94a3b8;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  line-height: 1.5;
}

.step-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 20px;
  max-width: 600px;
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.6;
  font-style: italic;
}

.step-note-icon {
  flex-shrink: 0;
  color: #94a3b8;
  margin-top: 1px;
}

/* ── Verticals / Use Cases ────────────────────────── */
.use-cases-section {
  background: #f8fafc;
}

/* Vertical cards */
.vertical-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  transition: box-shadow 0.4s ease, transform 0.4s ease, border-color 0.4s ease;
}

.vertical-card:hover {
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
  transform: translateY(-4px);
}

/* Card icon */
.vertical-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.vertical-card-icon svg {
  width: 24px;
  height: 24px;
}

.vertical-card-icon.indigo {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(129, 140, 248, 0.08) 100%);
  color: #6366f1;
}

.vertical-card-icon.teal {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.15) 0%, rgba(34, 211, 238, 0.08) 100%);
  color: #0891b2;
}

.vertical-card-icon.violet {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(167, 139, 250, 0.08) 100%);
  color: #7c3aed;
}

.vertical-card:hover .vertical-card-icon.indigo {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(129, 140, 248, 0.12) 100%);
}

.vertical-card:hover .vertical-card-icon.teal {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.22) 0%, rgba(34, 211, 238, 0.12) 100%);
}

.vertical-card:hover .vertical-card-icon.violet {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22) 0%, rgba(167, 139, 250, 0.12) 100%);
}

/* Card title */
.vertical-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

/* Card hook */
.vertical-card-hook {
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 14px;
}

/* Card body */
.vertical-card-body {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.7;
  margin-bottom: 20px;
  flex: 1;
}

/* Card tags */
.vertical-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.vtag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 100px;
}

.vtag.indigo {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
}

.vtag.teal {
  background: rgba(8, 145, 178, 0.08);
  color: #0891b2;
}

.vtag.violet {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
}

/* "And more" pills */
.more-verticals {
  padding-top: 8px;
}

.more-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 100px;
  padding: 6px 16px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.more-pill:hover {
  border-color: #6366f1;
  color: #6366f1;
}

/* ── CTA Section ──────────────────────────────────── */
.cta-section {
  background: linear-gradient(160deg, #f5f3ff 0%, #ede9fe 50%, #f5f3ff 100%);
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.email-form {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 440px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.2);
}

.email-input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid #e2e8f0;
  border-right: none;
  border-radius: 10px 0 0 10px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
}

.email-input::placeholder {
  color: #94a3b8;
}

.email-input:focus {
  border-color: #6366f1;
}

.email-btn {
  background: #6366f1;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  padding: 14px 22px;
  border: none;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.email-btn:hover {
  background: #4f46e5;
}

.cta-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.cta-footer-links a {
  font-size: 0.82rem;
  color: #6366f1;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.cta-footer-links a:hover {
  color: #4f46e5;
  text-decoration: underline;
}

.cta-footer-links span {
  color: #c4b5fd;
  font-size: 0.7rem;
}

/* ── Footer ───────────────────────────────────────── */
.site-footer {
  background: #0f172a;
  color: #64748b;
  font-size: 0.82rem;
  padding: 24px 0;
  text-align: center;
}

/* ── Scroll Animation Initial States ──────────────── */
/* These are applied by JS. Graceful fallback: visible without JS */
.gsap-hidden {
  opacity: 0;
  transform: translateY(30px);
}

/* ── Responsive Adjustments ───────────────────────── */
@media (max-width: 640px) {
  .announcement-text {
    font-size: 0.72rem;
  }
  .announcement-link {
    font-size: 0.72rem;
  }
  .announcement-new-badge {
    font-size: 0.6rem;
  }
  .email-form {
    flex-direction: column;
    border-radius: 10px;
    overflow: visible;
    box-shadow: none;
  }
  .email-input {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    border-right: 2px solid #e2e8f0;
    margin-bottom: 10px;
  }
  .email-btn {
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
  }
  .vertical-card {
    padding: 24px 20px;
  }
  .code-block-inner {
    font-size: 0.72rem;
    padding: 16px;
  }
  .comparison-table {
    font-size: 0.8rem;
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 768px) {
  .step-track {
    left: 20px;
  }
  .step-badge {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }
}

/* ── Reduced Motion ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .gsap-hidden {
    opacity: 1;
    transform: none;
  }
  .hero-badge-dot,
  .beta-dot {
    animation: none;
  }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
