/* ─── Dark-only CSS variables ─────────────────────────────────────────────── */
:root {
  --font-geist: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
  --bg: #000000;
  --fg: #f8fafc;
  --muted: rgb(161 161 170 / 0.95);
  --muted-2: rgb(113 113 122 / 0.95);
  --surface: rgb(255 255 255 / 0.04);
  --surface-strong: rgb(255 255 255 / 0.07);
  --surface-elevated: rgb(255 255 255 / 0.03);
  --panel: #07070a;
  --panel-deep: #050507;
  --glass: rgb(10 10 15 / 0.94);
  --border: rgb(255 255 255 / 0.1);
  --border-strong: rgb(255 255 255 / 0.15);
  --shadow: 0 25px 50px -12px rgb(0 0 0 / 0.45);
  --overlay: rgb(0 0 0 / 0.2);
  --overlay-strong: rgb(0 0 0 / 0.35);
  --accent: #3b82f6;
  --accent-2: #38bdf8;
  --dot-grid: rgb(255 255 255 / 0.18);
  --hero-unicorn-filter: saturate(2) brightness(1.25);
  --karaoke-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* ─── Custom scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--surface-elevated); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ─── Theme UI utilities ───────────────────────────────────────────────────── */
.ui-bg { background-color: var(--bg); }
.ui-text { color: var(--fg); }
.ui-muted { color: var(--muted); }
.ui-muted-2 { color: var(--muted-2); }
.ui-surface { background-color: var(--surface); }
.ui-surface-strong { background-color: var(--surface-strong); }
.ui-surface-elevated { background-color: var(--surface-elevated); }
.ui-panel { background-color: var(--panel); }
.ui-panel-deep { background-color: var(--panel-deep); }
.ui-glass { background-color: var(--glass); }
.ui-border { border-color: var(--border); }
.ui-border-strong { border-color: var(--border-strong); }
.ui-shadow { box-shadow: var(--shadow); }
.ui-overlay { background-color: var(--overlay); }
.ui-overlay-strong { background-color: var(--overlay-strong); }

/* ─── Scroll-triggered animation ────────────────────────────────────────────── */
.animate-on-scroll {
  animation-play-state: paused !important;
}
.animate-on-scroll.animate {
  animation-play-state: running !important;
}

/* ─── Karaoke text ─────────────────────────────────────────────────────────── */
.k-word {
  /* Scope will-change: auto initially; promote only during transition */
  will-change: auto;
  transition:
    opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    color 0.4s ease;
}
.k-word.active {
  opacity: 1 !important;
  color: var(--fg) !important;
  text-shadow: var(--karaoke-shadow);
}

/* ─── Beam animation path (SVG stroke) ──────────────────────────────────────── */
/* Beam paths only animate on desktop where the diagram is visible (lg:block).
   Promote to its own compositor layer via will-change to avoid invalidating
   the surrounding paint layer. */
.animate-beam-path {
  stroke-dasharray: 80 600;
  stroke-dashoffset: 600;
  animation: beamFlow 4s linear infinite;
  will-change: stroke-dashoffset, opacity;
}
@keyframes beamFlow {
  0%   { stroke-dashoffset: 600; opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
.beam-delay-100 { animation-delay: 0.5s; }
.beam-delay-200 { animation-delay: 1s; }
.beam-delay-300 { animation-delay: 1.5s; }
.beam-delay-500 { animation-delay: 2.5s; }

/* ─── Orbit rings (decorative tilt) ─────────────────────────────────────────── */
.orbit-ring-tilt-40  { transform: rotate(40deg); }
.orbit-ring-tilt-neg20 { transform: rotate(-20deg); }

/* ─── Hero background mask ───────────────────────────────────────────────────── */
.hero-mask-fade {
  mask-image: linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
}
.unicorn-background-layer {
  filter: var(--hero-unicorn-filter);
  /* Isolate the filter into its own stacking context so it does not repaint
     the rest of the document when the canvas updates internally. */
  isolation: isolate;
}

/* ─── Gradient CTA button ────────────────────────────────────────────────────── */
.btn-gradient-primary {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
}
.btn-gradient-primary-subtle {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.6) 0%,
    rgba(59, 130, 246, 0.6) 50%,
    rgba(96, 165, 250, 0.6) 100%
  );
  transition: background 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-gradient-primary-subtle:hover {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
}

/* ─── Grid dot patterns ──────────────────────────────────────────────────────── */
.grid-radial-dots-light,
.grid-radial-dots {
  background-image: radial-gradient(var(--dot-grid) 1px, transparent 1px);
  background-size: 26px 26px;
}
.grid-radial-dots-blue {
  background-image: radial-gradient(#3b83f670 1px, transparent 1px);
  background-size: 20px 20px;
}
.grid-radial-dots-indigo {
  background-image: radial-gradient(#6366f1 1px, transparent 1px);
  background-size: 16px 16px;
}

/* ─── Icon column scroll mask ────────────────────────────────────────────────── */
.grid-mask-fade-vertical {
  mask-image: linear-gradient(180deg, transparent, black 20%, black 80%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, black 20%, black 80%, transparent);
}

/* ─── Stacking cards ─────────────────────────────────────────────────────────── */
/* Use contain:style+layout on cards so JS style writes don't trigger
   ancestor repaints. The JS scroll driver sets transform/opacity/filter
   directly; brightness() is compositor-friendly for opacity changes
   but we keep it only for the actual scroll-driven dimming effect. */
.stack-card {
  contain: style layout;
  will-change: transform, opacity, filter;
}
.stack-card--behind {
  transform: scale(0.92);
  opacity: 0.5;
  filter: brightness(50%);
}
.stack-card--front {
  transform: scale(1.02);
  opacity: 1;
  filter: brightness(100%);
}

/* ─── Navbar / footer brand logo (SVG mask) ──────────────────────────────────── */
.nav-brand-logo {
  display: inline-block;
  height: 2rem;
  width: auto;
  aspect-ratio: 2070 / 1726;
  flex-shrink: 0;
  background-image: linear-gradient(
    to bottom,
    var(--fg),
    var(--fg),
    color-mix(in srgb, var(--fg) 60%, transparent)
  );
  -webkit-mask-image: url('../media/hudhud-systems-logo.svg');
  mask-image: url('../media/hudhud-systems-logo.svg');
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* ─── SVG fill helpers ───────────────────────────────────────────────────────── */
.fill-theme-muted   { fill: var(--muted); }
.fill-theme-muted-2 { fill: var(--muted-2); }

/* ─── Gradient text helpers ──────────────────────────────────────────────────── */
.gradient-text-hero {
  background: linear-gradient(to bottom, var(--fg) 0%, var(--fg) 55%, rgba(248, 250, 252, 0.1) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gradient-text-brand {
  background: linear-gradient(to bottom, var(--fg) 0%, var(--fg) 50%, rgba(248, 250, 252, 0.6) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gradient-text-results {
  background: linear-gradient(to bottom, var(--fg) 0%, var(--fg) 55%, rgba(248, 250, 252, 0.1) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ─── WhatWeDo pillar badge states ───────────────────────────────────────────── */
.badge-active {
  border-color: rgb(59 130 246 / 0.3);
  background-color: rgb(59 130 246 / 0.15);
  color: rgb(147 197 253);
}
.badge-inactive {
  border-color: var(--border);
  background-color: var(--surface);
  color: var(--muted);
}

/* ─── Results section in-view transitions ────────────────────────────────────── */
/* Remove blur from the transition — blur animating on a large region is
   expensive (full-surface repaint each frame). Replaced with opacity+transform
   which are compositor-only operations. */
.results-content {
  transition: transform 700ms ease-out, opacity 700ms ease-out;
  transform: translateY(24px);
  opacity: 0;
}
.results-content.in-view {
  transform: translateY(0);
  opacity: 1;
}
.results-accent-line {
  display: block;
  height: 1px;
  background: linear-gradient(to right, transparent, #3b82f6, transparent);
  transition: width 1s ease-out, opacity 1s ease-out;
  width: 0;
  opacity: 0;
  margin-top: 2rem;
}
.results-accent-line.in-view {
  width: 12rem;
  opacity: 1;
}
@media (min-width: 640px) {
  .results-accent-line.in-view {
    width: 16rem;
  }
}

/* ─── Bounce keyframe (EngineCard loading dots) ──────────────────────────────── */
@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

/* ─── Booking drawer ───────────────────────────────────────────────────────── */
#booking-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: block !important;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}
#booking-modal-backdrop.hidden {
  display: none !important;
}
#booking-modal-backdrop.booking-open {
  opacity: 1;
  pointer-events: auto;
}
#booking-modal {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  z-index: 2147483001 !important;
  display: flex !important;
  width: min(92vw, 440px) !important;
  max-width: 440px !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 !important;
  overflow-x: hidden;
  background: rgba(7, 7, 10, 0.92) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateX(100%) !important;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
#booking-modal > header {
  background: rgba(5, 5, 7, 0.88) !important;
}
#booking-modal.hidden {
  display: none !important;
}
#booking-modal.booking-open {
  transform: translateX(0) !important;
}
#booking-date-tabs {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  overflow: visible !important;
}
.booking-date-tab,
.booking-date-placeholder {
  min-width: 0;
  min-height: 3.75rem;
  border-radius: 0.875rem;
}
.booking-date-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-geist);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.booking-date-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.55);
  background: var(--surface-strong);
}
.booking-date-tab.is-active {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.35);
}
.booking-date-tab-day {
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.82;
}
.booking-date-tab-date {
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 700;
}
.booking-date-placeholder {
  display: block;
  border: 1px solid transparent;
  background: transparent;
}
.booking-skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-strong) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: bookingShimmer 1.4s ease-in-out infinite;
}
@keyframes bookingShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes bookingSuccessPop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.booking-success-pop {
  animation: bookingSuccessPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.booking-slot-btn {
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.booking-slot-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
.booking-slot-btn.is-selected {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
}
.booking-modal-meta-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
#booking-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
#booking-form > div > label {
  margin-bottom: 0.5rem;
}
.booking-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
}
#booking-submit-btn {
  min-height: 3rem;
  width: auto;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.35);
}
#booking-submit-btn:not(:disabled):hover .booking-submit-btn-icon {
  transform: translateX(2px);
}
.booking-submit-btn-icon,
.booking-submit-btn-spinner {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.booking-submit-btn-icon {
  transition: transform 0.15s ease;
}
.booking-submit-btn-spinner {
  animation: bookingSubmitSpin 0.75s linear infinite;
}
@keyframes bookingSubmitSpin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 640px) {
  #booking-modal {
    width: min(100vw, 420px) !important;
    max-width: 420px !important;
  }
  #booking-date-tabs {
    gap: 0.375rem;
  }
  .booking-date-tab,
  .booking-date-placeholder {
    min-height: 3.25rem;
  }
}

/* ─── prefers-reduced-motion: disable all decorative animations ──────────────── */
/* ─── About page layout (spacing not in compiled Tailwind) ─────────────────── */
.about-page main > section + section {
  margin-top: 5rem;
}
.about-page main > footer {
  margin-top: 5rem;
}
@media (min-width: 768px) {
  .about-page main > section + section {
    margin-top: 7rem;
  }
  .about-page main > footer {
    margin-top: 7rem;
  }
}
@media (min-width: 1024px) {
  .about-page main > section + section {
    margin-top: 8rem;
  }
  .about-page main > footer {
    margin-top: 8rem;
  }
}

.about-page #about-hero {
  padding-bottom: 2.5rem;
}
.about-page .about-hero-logos {
  margin-top: 4.5rem;
}
@media (min-width: 768px) {
  .about-page #about-hero {
    padding-bottom: 3.5rem;
  }
  .about-page .about-hero-logos {
    margin-top: 5.5rem;
  }
}

.about-page #about-intro .about-intro-inner {
  padding-top: 3.5rem;
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) {
  .about-page #about-intro .about-intro-inner {
    padding-top: 4.5rem;
  }
}

.about-page .about-section-header {
  margin-bottom: 3rem;
}
@media (min-width: 768px) {
  .about-page .about-section-header {
    margin-bottom: 3.5rem;
  }
}

.about-page .about-philosophy-intro {
  margin-bottom: 3rem;
}
@media (min-width: 768px) {
  .about-page .about-philosophy-intro {
    margin-bottom: 3.5rem;
  }
}

.about-page .about-approach-header {
  margin-bottom: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) {
  .about-page .about-approach-header {
    margin-bottom: 3.5rem;
    padding-top: 3.5rem;
  }
}

.about-page .about-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 768px) {
  .about-page .about-cards-grid {
    gap: 1.25rem;
  }
}

.about-page .about-mission-panel {
  padding-top: 4rem;
  padding-bottom: 4rem;
  padding-left: 2rem;
  padding-right: 2rem;
}
@media (min-width: 768px) {
  .about-page .about-mission-panel {
    padding-top: 5.5rem;
    padding-bottom: 5.5rem;
    padding-left: 3.5rem;
    padding-right: 3.5rem;
  }
}

.about-page #about-mission .about-mission-panel h2 {
  margin-bottom: 2rem;
}
@media (min-width: 768px) {
  .about-page #about-mission .about-mission-panel h2 {
    margin-bottom: 2.5rem;
  }
}

.about-page .about-cta-panel {
  padding-top: 4.5rem;
  padding-bottom: 4.5rem;
  padding-left: 2rem;
  padding-right: 2rem;
}
@media (min-width: 768px) {
  .about-page .about-cta-panel {
    padding-top: 6rem;
    padding-bottom: 6rem;
    padding-left: 3.5rem;
    padding-right: 3.5rem;
  }
}

.about-page #about-cta {
  padding-bottom: 1.5rem;
}

.about-page #about-cta .about-btn-demo {
  margin-top: 30px;
  margin-bottom: 30px;
}

/* Match footer Subscribe button sizing (py-2.5 px-4 ≈ 40px tall) */
.about-page .about-btn-demo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  min-height: 2.5rem;
  box-sizing: border-box;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .animate-beam-path { display: none; }
  .unicorn-background-layer { display: none; }

  .k-word {
    opacity: 1 !important;
    color: var(--fg) !important;
    text-shadow: none;
  }

  .results-content {
    transform: none !important;
    opacity: 1 !important;
  }
}
