/**
 * Neuroconnected Growth - Core Design System
 * Part 1: Design tokens and base styles
 */

:root {
  /* Background & Foreground */
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --fg: #0a0a0a;
  --fg-muted: #4b5563;
  --fg-light: #6b7280;

  /* Card & Surface */
  --card: #ffffff;
  --card-alt: #f4f4f5;
  --ring: rgba(0, 0, 0, 0.08);
  --border: rgba(0, 0, 0, 0.06);

  /* AI Palette */
  --purple: #7c3aed;
  --indigo: #4f46e5;
  --blue: #2563eb;
  --teal: #06b6d4;
  --pink: #ec4899;
  --red: #ff1f3d;
  --green: #10b981;
  --amber: #f59e0b;

  /* Gradients */
  --rainbow-gradient: linear-gradient(
    90deg,
    var(--purple),
    var(--indigo),
    var(--blue),
    var(--teal),
    var(--pink)
  );
  --rainbow-gradient-cold: linear-gradient(
    90deg,
    var(--purple),
    var(--indigo),
    var(--blue),
    var(--teal)
  );

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-hero: clamp(4rem, 10vw, 12rem);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-reveal: 700ms;

  /* Layout */
  --max-w: 1180px;
  --nav-height: 72px;

  /* Z-Index */
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal: 50;
  --z-toast: 60;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
  padding: 0;
}
html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: none;
}
a {
  color: inherit;
  text-decoration: none;
}
ul,
ol {
  list-style: none;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
}

::selection {
  background: color-mix(
    in oklab,
    var(--accent, var(--indigo)),
    transparent 70%
  );
}
:focus-visible {
  outline: 2px solid var(--accent, var(--indigo));
  outline-offset: 2px;
}

/* Typography */
.title {
  font-family: var(--font-display);
  font-weight: 950;
  font-size: var(--text-hero);
  letter-spacing: -0.03em;
  line-height: 0.92;
  margin: 0 0 var(--space-lg);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  background-image: linear-gradient(
    180deg,
    color-mix(in oklab, var(--accent, var(--indigo)), #ffffff 6%),
    color-mix(in oklab, var(--accent, var(--indigo)), #000000 12%)
  );
  animation: titleFlow 10s ease-in-out infinite alternate;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.8s var(--ease-out);
}

.panel.in-view .title,
.in-view .title {
  transform: translateY(0) scale(1);
}

@keyframes titleFlow {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

.title-sm {
  font-size: clamp(2rem, 5vw, 4rem);
}
.title-md {
  font-size: clamp(3rem, 7vw, 6rem);
}

.eyebrow {
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: var(--space-md);
}

.lede {
  font-size: clamp(1.02rem, 1.6vw, 1.25rem);
  font-weight: 500;
  color: var(--fg-muted);
  max-width: 70ch;
}

.rule {
  height: 4px;
  width: 96px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    var(--accent, var(--indigo)),
    color-mix(in oklab, var(--accent, var(--indigo)), #fff 25%)
  );
  margin: var(--space-md) 0 var(--space-xl);
}

.rule.center {
  margin-left: auto;
  margin-right: auto;
}

/* Layout */
.wrap {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 56px) 20px;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(12, 1fr);
  margin-top: clamp(24px, 4vw, 44px);
}

.col-3 {
  grid-column: span 3;
}
.col-4 {
  grid-column: span 4;
}
.col-6 {
  grid-column: span 6;
}
.col-12 {
  grid-column: span 12;
}

@media (max-width: 960px) {
  .col-4,
  .col-6 {
    grid-column: span 12;
  }
}

.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-sm {
  gap: var(--space-sm);
}
.gap-md {
  gap: var(--space-md);
}
.gap-lg {
  gap: var(--space-lg);
}
.spacer {
  flex: 1;
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sections */
section.panel {
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: clip;
  opacity: 0;
  transform: translateY(36px);
  transition: opacity var(--duration-reveal) ease,
    transform var(--duration-reveal) var(--ease-out);
}

section.panel.in-view {
  opacity: 1;
  transform: translateY(0);
}
.panel-auto {
  min-height: auto;
  padding: var(--space-4xl) 0;
}

.hero {
  display: grid;
  align-items: center;
  min-height: 100svh;
  position: relative; /* Needed for scroll-indicator positioning */
}
.hero .wrap {
  padding-top: 5svh;
  padding-bottom: 5svh;
}
.hero .title {
  font-size: clamp(2.8rem, 7vw, 7rem);
  line-height: 1.1;
}

/* Accent colors */
.accent-violet {
  --accent: var(--purple);
}
.accent-purple {
  --accent: var(--purple);
}
.accent-indigo {
  --accent: var(--indigo);
}
.accent-blue {
  --accent: var(--blue);
}
.accent-teal {
  --accent: var(--teal);
}
.accent-pink {
  --accent: var(--pink);
}
.accent-red {
  --accent: var(--red);
}

.icon-accent {
  color: var(--accent, var(--indigo));
}
.border-accent {
  border-color: color-mix(in oklab, var(--accent, var(--indigo)), #000 15%);
}
.bg-accent {
  background: var(--accent, var(--indigo));
  color: white;
}

/* Dark panels */
.panel-dark {
  color: #fff;
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--accent, var(--purple)), #000000 6%),
    color-mix(in oklab, var(--accent, var(--purple)), #000000 16%)
  );
}
.panel-dark .lede {
  color: rgba(255, 255, 255, 0.9);
}
.panel-dark .title {
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(255, 255, 255, 0.86)
  );
}
.panel-dark .chip,
.panel-dark .cta {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.panel-dark .rule {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.6)
  );
}

/* Cards inside panel-dark - reset CTA to visible colors */
.panel-dark .card .cta {
  background: var(--card);
  color: var(--accent, var(--indigo));
  border-color: var(--ring);
}

.panel-dark .card .cta:hover {
  border-color: var(--accent, var(--indigo));
}

/* But solid cards in panel-dark keep white text */
.panel-dark .card.solid .cta {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

/* Progress bar */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0;
  z-index: var(--z-toast);
  background: var(--rainbow-gradient);
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ring);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: all 0.25s ease;
  color: var(--indigo);
  z-index: var(--z-fixed);
}
.back-to-top.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.back-to-top:hover {
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--indigo), #000 10%),
    var(--shadow-lg);
}

/* Utilities */
.hidden {
  display: none !important;
}
.text-center {
  text-align: center;
}
.text-muted {
  color: var(--fg-muted);
}
.mt-md {
  margin-top: var(--space-md);
}
.mt-lg {
  margin-top: var(--space-lg);
}
.mb-md {
  margin-bottom: var(--space-md);
}
.mb-lg {
  margin-bottom: var(--space-lg);
}
.w-full {
  width: 100%;
}

.glass {
  background: rgba(255, 255, 255, 0.16) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
}

.parallax {
  will-change: transform;
}
.elevate {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

@media (max-width: 640px) {
  .title {
    font-size: clamp(2rem, 10vw, 4rem);
  }
  .hero .title {
    font-size: clamp(2.2rem, 11vw, 4rem);
    line-height: 1.1;
  }
  .hero .wrap {
    padding-top: 2svh;
    padding-bottom: 3svh;
  }
  .hero .lede {
    font-size: 1rem;
  }
  .sm\:hidden {
    display: none !important;
  }
}

/* ==========================================
   SCROLL INDICATOR
   Premium minimal scroll arrow for hero sections
   ========================================== */

.scroll-indicator {
  position: absolute;
  bottom: clamp(24px, 5vh, 48px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  animation: scrollIndicatorFadeIn 1s ease 1.5s forwards;
}

.scroll-indicator-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-muted);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.scroll-indicator:hover .scroll-indicator-text {
  opacity: 1;
}

.scroll-indicator-arrow {
  position: relative;
  width: 28px;
  height: 44px;
  border: 2px solid var(--ring);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.scroll-indicator:hover .scroll-indicator-arrow {
  border-color: var(--accent, var(--indigo));
  box-shadow: 0 0 20px
    color-mix(in oklab, var(--accent, var(--indigo)), transparent 80%);
}

/* The animated dot inside */
.scroll-indicator-arrow::before {
  content: '';
  position: absolute;
  top: 8px;
  width: 4px;
  height: 8px;
  background: var(--accent, var(--indigo));
  border-radius: 4px;
  animation: scrollDot 2s ease-in-out infinite;
}

/* Pulse rings on hover */
.scroll-indicator-arrow::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid var(--accent, var(--indigo));
  border-radius: 18px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-indicator:hover .scroll-indicator-arrow::after {
  opacity: 0.3;
  transform: scale(1);
  animation: scrollPulse 1.5s ease-in-out infinite;
}

/* Keyframe animations */
@keyframes scrollIndicatorFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes scrollDot {
  0%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0.4;
    transform: translateY(16px);
  }
}

@keyframes scrollPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.15;
  }
}

/* Hide scroll indicator after user scrolls */
.scroll-indicator.hidden {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

/* Dark panel variant */
.panel-dark .scroll-indicator-text {
  color: rgba(255, 255, 255, 0.7);
}

.panel-dark .scroll-indicator-arrow {
  border-color: rgba(255, 255, 255, 0.3);
}

.panel-dark .scroll-indicator:hover .scroll-indicator-arrow {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

.panel-dark .scroll-indicator-arrow::before {
  background: #fff;
}

.panel-dark .scroll-indicator-arrow::after {
  border-color: rgba(255, 255, 255, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
  .scroll-indicator {
    bottom: 20px;
  }
  .scroll-indicator-text {
    font-size: 10px;
  }
  .scroll-indicator-arrow {
    width: 24px;
    height: 38px;
  }
}
/* ==========================================
   LANGUAGE SWITCHER
   Dropdown flag selector
   ========================================== */

.lang-switcher {
  position: relative;
  margin-right: 16px;
  z-index: 50;
}

.lang-switcher-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
}

.lang-switcher-trigger:hover {
  background: var(--bg-alt);
  border-color: var(--ring);
}

.lang-flag {
  font-size: 16px;
  line-height: 1;
}

.lang-code {
  font-weight: 600;
  font-size: 12px;
  color: var(--fg-muted);
}

.lang-switcher-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 160px;
  padding: 6px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.lang-switcher:hover .lang-switcher-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
  transition: background 0.15s ease;
}

.lang-option:hover {
  background: var(--bg-alt);
}

.lang-option.active {
  background: color-mix(in oklab, var(--indigo), transparent 92%);
  color: var(--indigo);
  font-weight: 500;
}

/* Adjustments for Admin Sidebar */
.admin-sidebar .lang-switcher {
  margin: 16px;
  width: auto;
}

.admin-sidebar .lang-switcher-trigger {
  width: 100%;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.admin-sidebar .lang-switcher-dropdown {
  bottom: 100%;
  top: auto;
  left: 0;
  right: auto;
  margin-bottom: 8px;
  width: 100%;
  background: #1e1e2d; /* Admin dark theme bg */
  border-color: rgba(255, 255, 255, 0.1);
}

.admin-sidebar .lang-option {
  color: rgba(255, 255, 255, 0.8);
}

.admin-sidebar .lang-option:hover {
  background: rgba(255, 255, 255, 0.1);
}
