/* ============================================================
   Imago CRM — custom styles
   Only what Tailwind can't express: keyframes, reveal-on-scroll,
   marquee, gradient helpers, FAQ details, mockup primitives.
   ============================================================ */

/* ---------- Global niceties ---------- */

html {
  scroll-behavior: smooth;
}

::selection {
  background: rgba(37, 99, 235, 0.18);
  color: #0b1220;
}

:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Reveal on scroll (js/main.js adds .is-visible) ---------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children: set style="--i:1", "--i:2"... on each child */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
}

.reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Gradient helpers ---------- */

/* Blue-to-violet headline highlight (light backgrounds) */
.text-gradient {
  background-image: linear-gradient(92deg, #2563eb 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Brighter variant for dark hero and dark bands */
.text-gradient-bright {
  background-image: linear-gradient(92deg, #60a5fa 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Primary gradient surface (CTA band, CTA buttons) */
.bg-brand-gradient {
  background-image: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

.btn-gradient {
  background-image: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  background-size: 160% 160%;
  background-position: 0% 50%;
  box-shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.55);
  transition:
    background-position 0.4s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease;
}

.btn-gradient:hover {
  background-position: 100% 50%;
  transform: translateY(-1px);
  box-shadow: 0 16px 40px -12px rgba(79, 70, 229, 0.65);
}

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

/* Soft outer glow for highlighted cards (recommended plan, mockups) */
.ring-glow {
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.45),
    0 24px 60px -24px rgba(37, 99, 235, 0.45);
}

/* ---------- Dark hero: grid pattern and radial glows ---------- */

.bg-grid-dark {
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
}

.bg-grid-light {
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
}

/* Fades the grid out toward the bottom edge */
.grid-fade {
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
}

.glow {
  position: absolute;
  border-radius: 9999px;
  filter: blur(90px);
  pointer-events: none;
}

.glow-blue {
  background: radial-gradient(circle, rgba(37, 99, 235, 0.45) 0%, transparent 70%);
}

.glow-violet {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.4) 0%, transparent 70%);
}

/* ---------- Marquee (tools it replaces) ----------
   The track must contain the list twice; it loops on translateX(-50%). */

.marquee {
  overflow: hidden;
}

.marquee-mask {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: marquee-scroll 36s linear infinite;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

@keyframes marquee-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* ---------- FAQ (<details class="faq">) ---------- */

details.faq summary {
  list-style: none;
  cursor: pointer;
}

details.faq summary::-webkit-details-marker {
  display: none;
}

details.faq summary::marker {
  content: "";
}

/* Chevron inside the summary rotates when open */
details.faq .faq-chevron {
  transition: transform 0.25s ease;
}

details.faq[open] .faq-chevron {
  transform: rotate(180deg);
}

/* Gentle settle-in for the answer body */
details.faq[open] .faq-body {
  animation: faq-open 0.3s ease;
}

@keyframes faq-open {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Terminal card (self-host quickstart) ---------- */

.terminal {
  background-color: #0b1220;
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.14),
    0 30px 70px -30px rgba(2, 6, 23, 0.9);
}

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

.terminal .term-prompt {
  color: #60a5fa;
  user-select: none;
}

.terminal .term-comment {
  color: #64748b;
}

.terminal .term-flag {
  color: #a78bfa;
}

/* Copy button feedback state (JS toggles .is-copied) */
.copy-btn {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.copy-btn.is-copied {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}

/* ---------- Pure-CSS dashboard mockup primitives ---------- */

/* Chart bars rise in when scrolled into view; stagger with style="--i:n" */
.mockup-bar {
  transform-origin: bottom;
  animation: bar-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

@keyframes bar-rise {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

/* Soft pulse for skeleton rows and placeholder blocks */
.skeleton {
  animation: pulse-soft 2.4s ease-in-out infinite;
}

@keyframes pulse-soft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* Thin styled scrollbar inside code and terminal blocks */
.code-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.code-scroll::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.code-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 9999px;
}

.code-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .marquee-track,
  .mockup-bar,
  .skeleton,
  details.faq[open] .faq-body {
    animation: none !important;
  }

  .mockup-bar {
    transform: none;
  }
}