/* ============================================
   Riem.ai Landing Page — Custom Styles
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --bg-primary: #101018;
  --bg-secondary: #141420;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-highlight: rgba(139, 92, 246, 0.5);
  --text-primary: #f0f0f3;
  --text-secondary: #8a8a9a;
  --text-muted: #5a5a6a;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(139, 92, 246, 0.15);
  --accent-green: #34d399;
}

/* --- Critical above-the-fold styles (prevent FOUC) --- */
html {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}


/* --- Skip Navigation --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  z-index: 100;
  font-size: 0.875rem;
}

.skip-link:focus {
  top: 1rem;
}

/* --- Navigation --- */
.nav-scrolled {
  border-bottom: 1px solid var(--border-subtle);
  background-color: rgba(10, 10, 15, 0.8);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* --- Pricing cards --- */
.card-pricing {
  cursor: pointer;
}

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

.card-highlight {
  border-color: var(--border-highlight);
  background: rgba(139, 92, 246, 0.03);
  cursor: pointer;
}

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

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

/* --- Focus indicators --- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* --- Timeline --- */
.timeline-line {
  position: absolute;
  left: 1.25rem;
  top: 2.5rem;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--border-highlight), transparent);
}

.timeline-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--border-highlight);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* --- Pricing badge --- */
.badge-popular {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent);
  color: white;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

/* --- Comparison table --- */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.comparison-table th {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.comparison-table td {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.comparison-table .col-highlight {
  background: rgba(139, 92, 246, 0.04);
}

/* --- Blog cards --- */
.blog-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.05));
  border-radius: 0.5rem 0.5rem 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* --- Bottom CTA gradient --- */
.cta-gradient {
  background: linear-gradient(180deg, var(--bg-primary) 0%, rgba(139, 92, 246, 0.06) 50%, var(--bg-primary) 100%);
}

/* --- Section alternating backgrounds --- */
.bg-alt {
  background-color: var(--bg-secondary);
}

/* --- Hero card with gradient background --- */
.hero-card {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  max-width: 100vw;
  min-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fade out at bottom edge — long gradual blend */
.hero-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to bottom, transparent 0%, rgba(16, 16, 24, 0.15) 30%, rgba(16, 16, 24, 0.5) 60%, #101018 100%);
  z-index: 3;
  pointer-events: none;
}

/* Base gradient — blends from page bg at top into purple */
.hero-gradient-base {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    #101018 0%,
    #0e0920 8%,
    #150a30 20%,
    #1a0e3a 35%,
    #1e1245 55%,
    #180d38 75%,
    #0f0820 100%
  );
}

/* Flowing wave shapes */
.hero-wave {
  position: absolute;
  border-radius: 50%;
}

.hero-wave-1 {
  width: 140%;
  height: 80%;
  bottom: -30%;
  right: -20%;
  background: radial-gradient(
    ellipse at 40% 50%,
    rgba(139, 92, 246, 0.35) 0%,
    rgba(99, 102, 241, 0.2) 30%,
    rgba(67, 56, 202, 0.1) 50%,
    transparent 70%
  );
  filter: blur(40px);
}

.hero-wave-2 {
  width: 100%;
  height: 70%;
  top: -20%;
  left: -10%;
  background: radial-gradient(
    ellipse at 60% 50%,
    rgba(168, 85, 247, 0.2) 0%,
    rgba(139, 92, 246, 0.15) 30%,
    transparent 60%
  );
  filter: blur(50px);
}

.hero-wave-3 {
  width: 80%;
  height: 60%;
  bottom: -10%;
  left: 20%;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(79, 70, 229, 0.25) 0%,
    rgba(99, 102, 241, 0.1) 40%,
    transparent 70%
  );
  filter: blur(60px);
}

/* Bright highlight spot — simulates light from a sphere */
.hero-highlight {
  position: absolute;
  width: 600px;
  height: 600px;
  top: 5%;
  right: 10%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(196, 181, 253, 0.05) 20%,
    rgba(167, 139, 250, 0.03) 40%,
    transparent 65%
  );
  filter: blur(30px);
  will-change: transform;
  animation: blob-drift 20s ease-in-out infinite;
  z-index: 1;
  /* DEBUG: uncomment to see blob boundary */
  /* outline: 2px dashed red; */
}

@keyframes blob-drift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  20% {
    transform: translate(-120px, 60px) scale(1.1);
  }
  40% {
    transform: translate(80px, -80px) scale(0.95);
  }
  60% {
    transform: translate(-60px, -40px) scale(1.08);
  }
  80% {
    transform: translate(100px, 50px) scale(0.97);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

/* Flowing arc lines */
.hero-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
  transform: translateZ(0);
}

/* Shimmer: a bright dot racing along each line */
.shimmer {
  fill: none;
  stroke-dasharray: 80 2500;
  stroke-linecap: round;
  opacity: 0;
}

.shimmer-a {
  animation: shimmerRun 6s ease-in-out infinite;
  animation-delay: 0s;
}
.shimmer-b {
  animation: shimmerRun 7s ease-in-out infinite;
  animation-delay: 1.5s;
}
.shimmer-c {
  animation: shimmerRun 8s ease-in-out infinite;
  animation-delay: 3s;
}
.shimmer-d {
  animation: shimmerRun 7.5s ease-in-out infinite;
  animation-delay: 4.5s;
}
.shimmer-e {
  animation: shimmerRun 5s ease-in-out infinite;
  animation-delay: 2s;
}

@keyframes shimmerRun {
  0% {
    stroke-dashoffset: 2580;
    opacity: 0;
  }
  5% {
    opacity: 0.4;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    stroke-dashoffset: -2580;
    opacity: 0;
  }
}

/* Noise texture */
.hero-noise {
  position: absolute;
  inset: 0;
  opacity: 0.025;
  border-radius: 1.5rem;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* Glass search input */
.hero-glass-input {
  width: 100%;
  max-width: 600px;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  overflow: hidden;
}

.hero-typing-text {
  display: block;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9375rem;
  min-width: 0;
  height: 2.8em;
  overflow: hidden;
  word-break: break-word;
}

@media (min-width: 640px) {
  .hero-typing-text {
    height: 1.4em;
    white-space: nowrap;
    text-overflow: ellipsis;
    word-break: normal;
  }
}

.hero-typing-text .cursor {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  background: rgba(255, 255, 255, 0.5);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 1s step-end infinite;
}

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

.hero-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.8125rem;
  gap: 0.375rem;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.hero-send-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}


@media (max-width: 639px) {
  .hero-card {
    border-radius: 1rem;
    min-height: 80vh;
  }

  .hero-highlight {
    width: 300px;
    height: 300px;
  }
}

/* --- Mobile menu overlay --- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu a {
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

/* --- Checkmark / X icons --- */
.check {
  color: var(--accent-green);
}

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

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .hero-wave,
  .hero-highlight,
  .hero-lines,
  .shimmer {
    animation: none !important;
    will-change: auto;
  }
}

/* --- Comparison table mobile: stacked cards --- */
@media (max-width: 639px) {
  .comparison-desktop {
    display: none;
  }

  .comparison-mobile {
    display: block;
  }

  .timeline-line {
    display: none;
  }
}

@media (min-width: 640px) {
  .comparison-desktop {
    display: block;
  }

  .comparison-mobile {
    display: none;
  }
}
