/* BrainPal Global Stylesheet */

/*
  This stylesheet complements Tailwind utilities by defining
  reusable tokens, base styles, and bespoke components that appear
  across imported static pages.
*/

:root {
  /* Brand palette */
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-secondary: #8b5cf6;
  --color-accent: #06b6d4;
  --color-error: #df3f40;

  /* Extended neutrals */
  --color-white: #ffffff;
  --color-black: #0b1020;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;

  /* Typography */
  --font-sans: "Inter", "system-ui", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-size-base: 1rem;
  --font-line-height: 1.6;

  /* Spacing & radii */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.5rem;

  /* Shadows */
  --shadow-sm: 0 10px 25px rgba(99, 102, 241, 0.12);
  --shadow-md: 0 20px 45px rgba(139, 92, 246, 0.18);
  --shadow-glow: 0 0 40px rgba(115, 93, 232, 0.15);

  /* Transitions */
  --transition-base: 160ms ease;
  --transition-slow: 260ms ease;
}

/* Base --------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--font-line-height);
  color: var(--color-gray-800);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scrollbar-width: none;
}

body::-webkit-scrollbar {
  display: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-base);
}

/* Prevent visited links from becoming invisible - but exclude buttons */
a:visited:not([class*="bg-"]):not(.btn):not(.text-white) {
  color: inherit;
}

/* Only apply hover color to text links, not buttons or styled elements */
a:hover:not(.btn):not([class*="bg-"]):not([class*="border-"]),
a:focus:not(.btn):not([class*="bg-"]):not([class*="border-"]) {
  color: var(--color-primary);
}

button,
.btn,
.badge {
  font-family: inherit;
}

section {
  position: relative;
}

::-moz-selection {
  background: rgba(99, 102, 241, 0.18);
  color: var(--color-primary-dark);
}

::selection {
  background: rgba(99, 102, 241, 0.18);
  color: var(--color-primary-dark);
}

/* Utilities ---------------------------------------------------- */

.container-default {
  width: min(90vw, 1200px);
  margin-inline: auto;
}

.gradient-text {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.surface {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.surface-muted {
  background: var(--color-gray-50);
  border-radius: var(--radius-md);
}

.text-balance {
  text-wrap: balance;
}

.section-heading {
  font-size: clamp(2.25rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--color-gray-900);
  letter-spacing: -0.02em;
}

.section-subtitle {
  color: var(--color-gray-500);
  font-size: clamp(1.125rem, 2.5vw, 1.35rem);
  max-width: 48rem;
  margin-inline: auto;
}

.shadow-glow {
  box-shadow: var(--shadow-glow);
}

.shadow-glow:hover {
  box-shadow: var(--shadow-md);
}

/* Aliases for legacy shadow utility names */
.shadow-gentle-glow {
  box-shadow: var(--shadow-glow);
}

.shadow-gentle-glow:hover {
  box-shadow: var(--shadow-md);
}

/* Utility helpers ------------------------------------------------ */

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.progress-width-100 {
  width: 100%;
}

.progress-width-95 {
  width: 95%;
}

.progress-width-99 {
  width: 99%;
}

.progress-width-92 {
  width: 92%;
}

.progress-width-89 {
  width: 89%;
}

.progress-width-88 {
  width: 88%;
}

.progress-width-87 {
  width: 87%;
}

.progress-width-75 {
  width: 75%;
}

.progress-width-50 {
  width: 50%;
}

.progress-width-25 {
  width: 25%;
}

.progress-width-999 {
  width: 99.9%;
}

.order-initial-1 {
  order: 1;
}

.order-initial-2 {
  order: 2;
}

.order-initial-3 {
  order: 3;
}

.animation-delay-3s {
  animation-delay: 3s;
}

.animation-delay-neg-3s {
  animation-delay: -3s;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: transform var(--transition-base), box-shadow var(--transition-slow),
    background-color var(--transition-base), color var(--transition-base);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.35);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-primary);
  border-color: rgba(99, 102, 241, 0.25);
  background-clip: padding-box;
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.65);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* CTA Buttons - Refactored v3 --------------------------------- */

/*
  Purpose: Dedicated CTA button styles for header and hero sections
  Version: 3.0 - Added !important to color properties to override link inheritance
  Usage: Apply .btn-cta-header or .btn-cta-hero to <a> elements
  Note: !important is necessary to override the base <a> color: inherit rule
*/

/* Header CTA Button - Compact variant for navigation bar */
.btn-cta-header {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: var(--color-primary);
  color: var(--color-white) !important;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color var(--transition-base), 
              box-shadow var(--transition-base),
              transform var(--transition-base);
  white-space: nowrap;
}

.btn-cta-header:hover {
  background-color: var(--color-primary-dark);
  color: var(--color-white) !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-cta-header:active {
  transform: translateY(1px);
}

.btn-cta-header:visited {
  color: var(--color-white) !important;
}

/* Hero CTA Button - Prominent variant for hero section */
.btn-cta-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)) !important;
  color: var(--color-white) !important;
  font-weight: 600;
  font-size: 1.125rem;
  border-radius: var(--radius-md);
  position: relative;
  z-index: 1;
  text-decoration: none;
  transition: background-color var(--transition-base), 
              box-shadow var(--transition-slow),
              transform var(--transition-base);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
  cursor: pointer;
}

.btn-cta-hero:hover {
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-secondary)) !important;
  color: var(--color-white) !important;
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.4);
  transform: scale(1.05);
}

.btn-cta-hero:active {
  transform: scale(1.02);
}

.btn-cta-hero:visited {
  color: var(--color-white) !important;
}

/* Ensure hero background overlay doesn't block interactions */
#hero-section > .absolute {
  pointer-events: none;
}

/* Mobile CTA Button - Footer variant for mobile menu */
.btn-cta-mobile-footer {
  display: block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background-color: var(--color-primary);
  color: var(--color-white) !important;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  transition: background-color var(--transition-base), 
              box-shadow var(--transition-base);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.btn-cta-mobile-footer:hover {
  background-color: var(--color-primary-dark);
  color: var(--color-white) !important;
  box-shadow: 0 15px 30px rgba(99, 102, 241, 0.35);
}

.btn-cta-mobile-footer:visited {
  color: var(--color-white) !important;
}

/* Mobile CTA Button - Centered variant between logo and hamburger */
.btn-cta-mobile-center {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background-color: var(--color-primary);
  color: var(--color-white) !important;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color var(--transition-base);
  white-space: nowrap;
}

.btn-cta-mobile-center:hover {
  background-color: var(--color-primary-dark);
  color: var(--color-white) !important;
}

.btn-cta-mobile-center:visited {
  color: var(--color-white) !important;
}

/* Responsive Adjustments - Mobile First, No !important */
@media (max-width: 640px) {
  /* Hero CTA adjustments for mobile - proper specificity */
  .btn-cta-hero {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
  }
  
  /* Header CTA remains unchanged on mobile */
}

@media (min-width: 641px) and (max-width: 768px) {
  /* Tablet adjustments */
  .btn-cta-hero {
    padding: 0.875rem 1.75rem;
    font-size: 1.0625rem;
  }
}

/* Badges & Pills ---------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.badge-soft {
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-primary);
}

.badge-outline {
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: var(--color-primary);
}

/* Cards -------------------------------------------------------- */

.card {
  padding: var(--space-xl);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-slow), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.card-muted {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.card-highlight {
  border: 2px solid rgba(99, 102, 241, 0.28);
  box-shadow: var(--shadow-md);
}

/* Content Blocks --------------------------------------------- */

.prose {
  color: var(--color-gray-700);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--color-gray-900);
  font-weight: 700;
  line-height: 1.2;
}

.prose h1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
}

.prose h2 {
  font-size: clamp(2rem, 4vw, 2.75rem);
}

.prose h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.prose p + p {
  margin-top: 1.25em;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
  margin-top: 1rem;
}

.prose li + li {
  margin-top: 0.5rem;
}

.prose a {
  color: var(--color-primary);
  text-decoration: underline;
}

.prose blockquote {
  border-left: 4px solid rgba(99, 102, 241, 0.35);
  padding-left: 1.25rem;
  font-style: italic;
  color: var(--color-gray-600);
}

/* Navigation --------------------------------------------------- */

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  color: var(--color-gray-600);
  transition: color var(--transition-base);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.3rem;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition-base);
}

.nav-link:hover,
.nav-link:focus {
  color: var(--color-primary);
}

.nav-link:hover::after,
.nav-link:focus::after {
  transform: scaleX(1);
}

/* Banner ------------------------------------------------------- */

.top-banner {
  position: relative;
  overflow: hidden;
}

.top-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent 40%, rgba(255, 255, 255, 0.12));
  pointer-events: none;
}

/* Animations --------------------------------------------------- */

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.animate-fade-in {
  opacity: 0;
  animation: fade-in-up 600ms ease forwards;
}

/* Page-specific animations -------------------------------------- */

.wave-animation {
  animation: wave 2s ease-in-out infinite;
}

.wave-animation:nth-child(2) {
  animation-delay: 0.2s;
}

.wave-animation:nth-child(3) {
  animation-delay: 0.4s;
}

.wave-animation:nth-child(4) {
  animation-delay: 0.6s;
}

.wave-animation:nth-child(5) {
  animation-delay: 0.8s;
}

.typing-animation::after {
  content: "|";
  animation: blink 1s infinite;
}

.smart-list-animation {
  animation: smart-list-update 3s ease-in-out infinite;
}

.energy-pulse {
  animation: energy-pulse 2s ease-in-out infinite;
}

.priority-shift {
  animation: priority-shift 4s ease-in-out infinite;
}

.floating-element {
  animation: float 6s ease-in-out infinite;
}

.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fade-in-up 0.6s ease-out forwards;
}

.fade-in-up:nth-child(1) {
  animation-delay: 0.1s;
}

.fade-in-up:nth-child(2) {
  animation-delay: 0.2s;
}

.fade-in-up:nth-child(3) {
  animation-delay: 0.3s;
}

.fade-in-up:nth-child(4) {
  animation-delay: 0.4s;
}

.hover-lift {
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* FAQ disclosure icon rotation */

.faq-item[open] summary i,
.faq-trigger--open {
  transform: rotate(180deg);
}

@keyframes wave {
  0%,
  100% {
    height: 8px;
  }

  50% {
    height: 32px;
  }
}

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

  51%,
  100% {
    opacity: 0;
  }
}

@keyframes smart-list-update {
  0%,
  100% {
    transform: translateY(0);
    opacity: 1;
  }

  50% {
    transform: translateY(-5px);
    opacity: 0.8;
  }
}

@keyframes energy-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes priority-shift {
  0%,
  100% {
    order: 1;
  }

  25% {
    order: 2;
  }

  50% {
    order: 3;
  }

  75% {
    order: 2;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-20px);
  }
}

/* Forms -------------------------------------------------------- */

input[type="text"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-gray-200);
  background: var(--color-white);
  color: var(--color-gray-700);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
  outline: none;
}

/* Blog: ensure search input text sits to the right of the leading icon */
#searchInput {
  padding-left: 5rem; /* extra clearance for icon width across render modes */
}

/* Mobile Menu -------------------------------------------------- */

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
  overflow: hidden;
}

/* Mobile menu open state */
#mobile-menu.menu-open {
  transform: translateX(0);
}

/* Backdrop visible state */
#mobile-menu-backdrop.backdrop-visible {
  opacity: 1;
}

/* Mobile menu link active state */
#mobile-menu a.active {
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--color-primary);
}

/* Footer ------------------------------------------------------- */

.footer-links a {
  color: rgba(255, 255, 255, 0.72);
  transition: color var(--transition-base);
}

.footer-links a:hover {
  color: var(--color-white);
}

.footer-divider {
  border-color: rgba(255, 255, 255, 0.08);
}

/* Fixed Header (Desktop Only) -------------------------------- */

@media (min-width: 1024px) {
  /* Fixed positioning for banner and header */
  #top-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
  }

  #top-banner.header-hidden {
    transform: translateY(-100%);
  }

  #header {
    position: fixed;
    top: var(--banner-height, 52px);
    left: 0;
    right: 0;
    z-index: 99;
    transition: transform 0.3s ease-in-out, top 0.3s ease-in-out;
  }

  #header.header-hidden {
    transform: translateY(-100%);
    top: 0;
  }

  /* Add padding to body to prevent content overlap */
  body {
    padding-top: var(--total-header-height, 125px);
  }

  body.header-hidden {
    padding-top: 0;
  }
}

/* Responsive Tweaks ------------------------------------------- */

/* Mobile optimization for better conversions */
/* REFACTORED v2: CTA button rules moved to dedicated classes above */
/* Remaining rules use proper specificity instead of !important */
@media (max-width: 640px) {
  /* Reduce hero section vertical padding */
  #hero-section {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }

  /* Reduce hero container min-height */
  #hero-section .min-h-\[600px\] {
    min-height: auto;
  }

  /* Optimize hero headline for mobile */
  #hero-section h1 {
    font-size: 2rem;
    line-height: 1.2;
  }

  /* Reduce spacing in hero section */
  #hero-section .space-y-8 {
    gap: 1rem;
  }

  /* Optimize hero description text */
  #hero-section p.text-xl {
    font-size: 1rem;
    line-height: 1.5;
  }

  /* DEPRECATED: CTA button padding now handled by .btn-cta-hero class */
  /* #hero-section .px-8 {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }

  #hero-section .py-4 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  } */

  /* Optimize announcement banner */
  #top-banner {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  #top-banner p {
    font-size: 0.8125rem;
    line-height: 1.3;
  }

  /* Reduce badge/pill size */
  #hero-section .badge,
  #hero-section .inline-flex.items-center.space-x-2 {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  /* Optimize social proof section */
  #hero-section .flex.items-center.space-x-8 {
    gap: 1rem;
    flex-wrap: wrap;
  }

  #hero-section .flex.items-center.space-x-8 .text-sm {
    font-size: 0.75rem;
  }

  /* Hide decorative gradient bar on mobile to save space */
  #hero-section .w-24.h-1 {
    display: none;
  }

  /* Optimize demo card on mobile */
  #hero-section .bg-white.rounded-2xl {
    padding: 1rem;
    margin-top: 1rem;
  }
}

/* Tablet optimization */
@media (max-width: 768px) {
  .card {
    padding: var(--space-lg);
  }

  .btn {
    width: 100%;
  }

  /* Moderate hero headline reduction for tablets */
  #hero-section h1 {
    font-size: 2.5rem;
    line-height: 1.15;
  }
}

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