/* ==========================================================================
   Letralab Studios — Design tokens & custom styles
   Utility classes come from a locally compiled Tailwind build
   (assets/css/tailwind.css) — no external CDN/script dependency.
   This file covers what Tailwind can't: gradients, reveal animation,
   glass surfaces, focus rings, motion-safety.
   ========================================================================== */

:root {
  /* Brand palette — sampled directly from the Letralab Studios logo */
  --navy-950: #04142B;   /* deepest background */
  --navy-900: #07203F;   /* hero / footer background */
  --navy-800: #0B2A4A;   /* primary brand navy (text on light, surfaces) */
  --navy-700: #123660;

  --blue-600: #0072E3;
  --blue-500: #0095FF;   /* brand blue */
  --blue-400: #2DA9FF;

  --cyan-400: #20E1FF;   /* brand cyan */
  --cyan-300: #6FEBFF;

  --ink: #0B1220;
  --ink-soft: #475569;

  --surface: #F8FAFC;
  --surface-alt: #EEF2F7;
  --border-soft: #E2E8F0;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  scroll-behavior: smooth;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--surface);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.font-heading {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
}

/* ---- Selection & scrollbar -------------------------------------------- */

::selection {
  background: var(--blue-500);
  color: #fff;
}

html {
  scrollbar-color: var(--blue-500) transparent;
}

::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--surface);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cyan-400), var(--blue-600));
  border-radius: 999px;
}

/* ---- Focus visibility (accessibility) ---------------------------------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan-400);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Brand gradient helpers --------------------------------------------- */

.text-gradient {
  background-image: linear-gradient(95deg, var(--cyan-400) 0%, var(--blue-500) 55%, var(--blue-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bg-brand-gradient {
  background-image: linear-gradient(135deg, var(--cyan-400) 0%, var(--blue-500) 50%, var(--blue-600) 100%);
}

/* Deep navy section backdrop with mesh + grid, used by hero/footer/CTA */
.mesh-dark {
  position: relative;
  background-color: var(--navy-950);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(32, 225, 255, 0.20), transparent 42%),
    radial-gradient(circle at 85% 12%, rgba(0, 149, 255, 0.25), transparent 38%),
    radial-gradient(circle at 70% 85%, rgba(0, 114, 227, 0.18), transparent 45%),
    linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  isolation: isolate;
}

.mesh-dark::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 35%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.mesh-dark > * {
  position: relative;
  z-index: 1;
}

/* Floating ambient blobs (decorative, paused under reduced-motion) */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
  animation: float-blob 16s var(--ease-out) infinite;
}

@keyframes float-blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(24px, -30px) scale(1.08); }
  66% { transform: translate(-20px, 18px) scale(0.95); }
}

/* ---- Glass surfaces ------------------------------------------------------ */

.glass {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glass-light {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(226, 232, 240, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---- Hero light beams: rising cyan/blue streaks in the dark hero -------------- */

#hero-beams {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.light-beam {
  position: absolute;
  bottom: -10%;
  height: 75%;
  border-radius: 999px;
  background: linear-gradient(to top, transparent, rgba(32, 225, 255, 0.85) 35%, rgba(32, 225, 255, 0.4) 70%, transparent);
  opacity: 0;
  animation-name: hero-beam-rise, hero-beam-fade;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
  will-change: transform, opacity;
}

.light-beam.secondary {
  background: linear-gradient(to top, transparent, rgba(0, 149, 255, 0.85) 35%, rgba(0, 149, 255, 0.4) 70%, transparent);
}

@keyframes hero-beam-rise {
  0% { transform: translateY(40%); }
  100% { transform: translateY(-130%); }
}

@keyframes hero-beam-fade {
  0%, 100% { opacity: 0; }
  10%, 75% { opacity: 0.8; }
}

/* ---- Magnetic buttons -------------------------------------------------------- */

[data-magnetic] {
  will-change: transform;
}

/* ---- Spotlight cards: soft glow that follows the cursor --------------------- */

.spotlight-card {
  position: relative;
  overflow: hidden;
}

.spotlight-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle 240px at var(--spot-x, 50%) var(--spot-y, 50%), rgba(0, 149, 255, 0.14), transparent 70%);
  opacity: 0;
  transition: opacity 300ms var(--ease-out);
  pointer-events: none;
}

.spotlight-card:hover::before {
  opacity: 1;
}

/* ---- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.85rem 1.6rem;
  border-radius: 0.7rem;
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out), background-color 220ms var(--ease-out), color 220ms var(--ease-out), border-color 220ms var(--ease-out);
  cursor: pointer;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  background-image: linear-gradient(95deg, var(--cyan-400), var(--blue-500) 60%, var(--blue-600));
  color: #04142B;
  box-shadow: 0 8px 24px -8px rgba(0, 149, 255, 0.55);
}

.btn-primary:hover {
  box-shadow: 0 12px 32px -8px rgba(32, 225, 255, 0.6);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(11, 42, 74, 0.18);
  color: var(--navy-800);
}

.btn-ghost:hover {
  border-color: var(--blue-500);
  background: rgba(0, 149, 255, 0.06);
}

.btn-ghost-light {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ---- Above-the-fold entrance (hero, stats): pure CSS, no JS dependency.
   Runs on paint regardless of script/network timing — this is what makes
   the first viewport always render correctly even if JS loads late. ---- */

@keyframes fade-up-in {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fade-up-in 600ms var(--ease-out) both;
  animation-delay: var(--reveal-delay, 0ms);
}

/* ---- Hero hands: human + robot reaching toward each other, once on load ----- */

#hero-hands {
  display: none;
}

@media (min-width: 1150px) {
  #hero-hands {
    display: block;
    position: absolute;
    right: 0;
    top: 90px;
    width: min(78%, 1015px);
    aspect-ratio: 3 / 2;
    pointer-events: none;
  }
}

.hand-scene {
  position: relative;
  width: 100%;
  height: 100%;
}

.hand-scene img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes hand-in-human {
  from { opacity: 0; transform: translate(-6%, 6%); }
  to { opacity: 1; transform: translate(0, 0); }
}

@keyframes hand-in-robot {
  from { opacity: 0; transform: translate(6%, -6%); }
  to { opacity: 1; transform: translate(0, 0); }
}

.hand-human {
  animation: hand-in-human 1300ms var(--ease-out) both;
  animation-delay: 300ms;
}

.hand-robot {
  animation: hand-in-robot 1300ms var(--ease-out) both;
  animation-delay: 700ms;
}

/* ---- Below-the-fold scroll reveal (JS-driven via IntersectionObserver).
   Safe here because the user must scroll to reach these sections, giving
   the script plenty of time to initialize first. ---- */

[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

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

/* ---- Roadmap timeline: animated line-draw + sequential node pop-in ----------- */

.roadmap-line-track {
  position: absolute;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: rgba(11, 42, 74, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.roadmap-line-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue-600), var(--cyan-400));
  transition: width 1700ms var(--ease-out) 250ms;
}

[data-reveal].is-visible .roadmap-line-fill {
  width: var(--roadmap-progress, 66%);
}

.roadmap-node {
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 450ms var(--ease-out), transform 450ms var(--ease-out);
  transition-delay: var(--node-delay, 0ms);
}

[data-reveal].is-visible .roadmap-node {
  opacity: 1;
  transform: scale(1);
}

.roadmap-node-current {
  position: relative;
}

.roadmap-node-current::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--blue-600);
  opacity: 0;
  animation: roadmap-ping 2.2s var(--ease-out) infinite;
  animation-delay: 1.8s;
}

@keyframes roadmap-ping {
  0% { transform: scale(0.85); opacity: 0.7; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { opacity: 0; }
}

.roadmap-label {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 450ms var(--ease-out), transform 450ms var(--ease-out);
  transition-delay: calc(var(--node-delay, 0ms) + 150ms);
}

[data-reveal].is-visible .roadmap-label {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Tilt card: subtle 3D parallax toward the cursor ------------------------- */

.tilt-card {
  perspective: 900px;
}

.tilt-inner {
  transform-style: preserve-3d;
  transition: transform 200ms var(--ease-out);
  will-change: transform;
}

/* ---- Animated bar chart: bars rise once their card becomes visible ----------- */

.bar-fill {
  height: 0;
  transition: height 900ms var(--ease-out) var(--bar-delay, 0ms);
}

[data-reveal].is-visible .bar-fill {
  height: var(--bar-target, 50%);
}

/* ---- Nav link underline ----------------------------------------------------- */

.nav-link {
  position: relative;
  color: inherit;
  transition: color 200ms var(--ease-out);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan-400), var(--blue-500));
  transition: width 220ms var(--ease-out);
  border-radius: 2px;
}

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

/* ---- Card hover ------------------------------------------------------------- */

.card-hover {
  transition: transform 280ms var(--ease-out), box-shadow 280ms var(--ease-out), border-color 280ms var(--ease-out);
}

.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px -16px rgba(11, 42, 74, 0.18);
}

/* ---- Marquee for industries strip -------------------------------------------- */

.marquee-wrap {
  mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 40s linear infinite;
}

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

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

/* ---- Mobile menu panel -------------------------------------------------------- */

#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 380ms var(--ease-out);
}

#mobile-menu.open {
  max-height: 32rem;
}

/* ---- Misc ---------------------------------------------------------------------- */

.section-eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
}

.num-figure {
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

header.scrolled {
  background-color: rgba(4, 20, 43, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---- DriveImpact diagram: animated hub-and-spoke SVG --------------------------- */

.di-diagram {
  display: block;
  width: 100%;
  height: auto;
}

.di-trace {
  fill: none;
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.di-trace-flow {
  fill: none;
  stroke: #20e1ff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 7 15;
  opacity: 0.9;
  animation: di-flow 2.8s linear infinite;
}

@keyframes di-flow {
  to {
    stroke-dashoffset: -220;
  }
}

.di-chip {
  fill: rgba(255, 255, 255, 0.05);
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1.5;
}

.di-chip-icon {
  stroke: #67e8f9;
}

.di-node-glow {
  transform-box: fill-box;
  transform-origin: center;
  animation: di-node-pulse 3.4s ease-in-out infinite;
}

@keyframes di-node-pulse {
  0%, 100% {
    opacity: 0.25;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.18);
  }
}

.di-hub-glow {
  transform-box: fill-box;
  transform-origin: center;
  animation: di-hub-pulse 2.6s ease-in-out infinite;
}

@keyframes di-hub-pulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.14);
  }
}

.di-hub-ring {
  fill: none;
  stroke: rgba(32, 225, 255, 0.35);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: di-ring-expand 2.8s ease-out infinite;
}

@keyframes di-ring-expand {
  0% {
    opacity: 0.6;
    transform: scale(0.75);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

/* ---- Reduced motion: respect user preference ----------------------------------- */

@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 !important;
    transform: none !important;
  }
}
