/* ==========================================================================
   AngoraTech - Modern Web & Automation Studio Stylesheet
   Apple-like Light UI Design System & GSAP/Lenis Animation Engine
   ========================================================================== */

:root {
  /* Brand Primary Tokens (Light Theme First) */
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.12);
  --primary-border: rgba(79, 70, 229, 0.25);

  /* Accent Tokens */
  --accent-lime: #84cc16;
  --accent-lime-hover: #65a30d;
  --accent-lime-light: #ecfccb;
  --accent-lime-glow: rgba(132, 204, 22, 0.18);

  --accent-cyan: #06b6d4;
  --accent-cyan-light: #cffafe;
  --accent-cyan-glow: rgba(6, 182, 212, 0.15);

  --accent-emerald: #10b981;
  --accent-emerald-light: #d1fae5;

  /* Surfaces & Backgrounds */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-surface-elevated: #ffffff;
  --material-glass: rgba(248, 250, 252, 0.88);
  --material-glass-scrolled: rgba(255, 255, 255, 0.96);

  /* Borders & Focus Rings (Apple Standard) */
  --border-subtle: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #4f46e5;
  --focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.25), 0 0 0 1px #4f46e5;

  /* Text & Labels */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Shadows & Elevations (Apple Subtle Diffusion) */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-hover: 0 20px 40px -12px rgba(79, 70, 229, 0.1), 0 8px 16px -4px rgba(15, 23, 42, 0.03);
  --shadow-glow: 0 0 30px rgba(79, 70, 229, 0.2);

  /* Physics / Timing Curves (Apple HIG Native Response) */
  --apple-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --apple-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Lenis Smooth Scroll Core Rules
   ========================================================================== */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* Background Grid Pattern */
.bg-grid-pattern {
  background-image: radial-gradient(rgba(79, 70, 229, 0.07) 1.2px, transparent 1.2px);
  background-size: 28px 28px;
}

/* Glassmorphism Navigation Bar */
.navbar-glass {
  background-color: var(--material-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.3s var(--apple-ease), box-shadow 0.3s var(--apple-ease), border-color 0.3s var(--apple-ease);
}

@supports not (backdrop-filter: blur(16px)) {
  .navbar-glass {
    background-color: rgba(255, 255, 255, 0.98);
  }
}

.navbar-glass.scrolled {
  background-color: var(--material-glass-scrolled);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
  border-bottom-color: rgba(226, 232, 240, 0.9);
}

/* Language Switcher Segmented Pill */
.lang-switcher-pill {
  display: inline-flex;
  align-items: center;
  background-color: #f1f5f9;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 9999px;
  padding: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.lang-switcher-pill a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  line-height: 1.2;
}

.lang-switcher-pill a:hover {
  color: #0f172a;
}

.lang-switcher-pill a.active {
  background-color: #ffffff;
  color: #4f46e5;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  font-weight: 800;
}


/* ==========================================================================
   SplitType & Typography Scrub Narratives
   ========================================================================== */
.split-line {
  overflow: hidden;
  display: block;
}

.split-word {
  display: inline-block;
  will-change: opacity, transform;
}

.split-char {
  display: inline-block;
  will-change: opacity, transform;
}

.text-scrub {
  display: inline;
}

.text-scrub-word {
  display: inline-block;
  opacity: 0.25;
  transition: opacity 0.25s var(--apple-ease), color 0.25s var(--apple-ease);
  will-change: opacity, color;
}

.text-scrub-word.active {
  opacity: 1;
}

/* Live Numbers & Counters */
.live-counter {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  display: inline-block;
}

/* ==========================================================================
   Bento Grid Architecture & Spotlight Lighting (Light UI)
   ========================================================================== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Bento Card Base Surface */
.bento-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.35s var(--apple-ease), box-shadow 0.35s var(--apple-ease), border-color 0.35s var(--apple-ease);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(79, 70, 229, 0.35);
}

.bento-card:active {
  transform: scale(0.99);
}

/* Spotlight Glowing Overlay (Tracks cursor position via --mouse-x, --mouse-y) */
.bento-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(79, 70, 229, 0.07),
    transparent 65%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--apple-ease);
  z-index: 1;
}

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

/* Bento Card Accent Variations */
.bento-card-highlight {
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  border-color: rgba(79, 70, 229, 0.2);
}

.bento-card-highlight::before {
  background: radial-gradient(
    550px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(79, 70, 229, 0.1),
    transparent 70%
  );
}

/* Bento Span Modifiers */
.bento-col-span-2 {
  grid-column: span 1;
}

@media (min-width: 768px) {
  .bento-col-span-2 {
    grid-column: span 2;
  }
}

.bento-col-span-3 {
  grid-column: span 1;
}

@media (min-width: 1024px) {
  .bento-col-span-3 {
    grid-column: span 3;
  }
}

/* Bento Interactive Visual Modules */
.bento-visual-preview {
  position: relative;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 1.25rem;
  overflow: hidden;
  transition: border-color 0.25s var(--apple-ease);
}

.bento-card:hover .bento-visual-preview {
  border-color: rgba(79, 70, 229, 0.2);
}

/* Node flow line animations */
.flow-pulse {
  animation: pulseLine 2.5s infinite ease-in-out;
}

@keyframes pulseLine {
  0%, 100% {
    opacity: 0.3;
    transform: scaleX(0.96);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

/* Rive Vector Canvas Container */
.rive-container {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#rive-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Standard Studio Card (Legacy & Page Compatibility) */
.card-studio {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s var(--apple-ease), box-shadow 0.25s var(--apple-ease), border-color 0.25s var(--apple-ease);
  position: relative;
  overflow: hidden;
}

.card-studio::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    450px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(79, 70, 229, 0.06),
    transparent 65%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--apple-ease);
  z-index: 1;
}

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

.card-studio:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(79, 70, 229, 0.3);
}

.card-studio:active {
  transform: scale(0.99);
}

.card-studio-dark {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.3);
  position: relative;
}

/* ==========================================================================
   Buttons (Apple Tactile Feel & WCAG AA Sizing)
   ========================================================================== */
.btn-studio-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 0.875rem;
  transition: all 0.2s var(--apple-ease);
  box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.32);
}

.btn-studio-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.42);
}

.btn-studio-primary:active {
  transform: scale(0.97);
}

.btn-studio-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  background-color: var(--accent-lime);
  color: #14532d;
  font-weight: 700;
  padding: 0.75rem 1.75rem;
  border-radius: 0.875rem;
  transition: all 0.2s var(--apple-ease);
  box-shadow: 0 4px 14px rgba(132, 204, 22, 0.28);
}

.btn-studio-accent:hover {
  background-color: #a3e635;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(132, 204, 22, 0.38);
}

.btn-studio-accent:active {
  transform: scale(0.97);
}

.btn-studio-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 0.875rem;
  transition: all 0.2s var(--apple-ease);
  box-shadow: var(--shadow-sm);
}

.btn-studio-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.btn-studio-outline:active {
  transform: scale(0.97);
}

/* Accessible Hit Targets */
.touch-target-44 {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Badges */
.badge-indigo {
  background-color: #e0e7ff;
  color: #4338ca;
  font-weight: 600;
}

.badge-emerald {
  background-color: #d1fae5;
  color: #065f46;
  font-weight: 600;
}

.badge-amber {
  background-color: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

.badge-cyan {
  background-color: #cffafe;
  color: #155e75;
  font-weight: 600;
}

.badge-violet {
  background-color: #ede9fe;
  color: #5b21b6;
  font-weight: 600;
}

.badge-rose {
  background-color: #ffe4e6;
  color: #9f1239;
  font-weight: 600;
}

/* Studio Form Inputs */
.form-input-studio,
.form-select-studio,
.form-textarea-studio {
  width: 100%;
  background-color: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: var(--text-main);
  transition: border-color 0.2s var(--apple-ease), box-shadow 0.2s var(--apple-ease), background-color 0.2s var(--apple-ease);
}

.form-input-studio:focus,
.form-select-studio:focus,
.form-textarea-studio:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
  background-color: #ffffff;
}

/* ==========================================================================
   Anime.js Interactive Engine Components
   ========================================================================== */
/* 3D Tilt Card Base */
.card-studio,
.card-studio-dark {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.15s ease-out, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* FAQ Accordion Component */
.faq-card {
  transition: all 0.3s var(--apple-ease);
}

.faq-card.active {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.08);
}

.faq-card .faq-icon {
  transition: transform 0.3s var(--apple-ease), background-color 0.3s var(--apple-ease);
}

.faq-card.active .faq-icon {
  transform: rotate(180deg);
  background-color: #e0e7ff;
  color: var(--primary);
}

/* Accessible Focus Rings */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Toast Messages */
.toast-container {
  position: fixed;
  top: 5.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
}

.toast-item {
  animation: slideInRight 0.3s var(--apple-ease);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   Accessibility: Respect Reduced Motion (Apple HIG Compliance)
   ========================================================================== */
@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;
  }

  .toast-item {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .bento-card:hover,
  .card-studio:hover,
  .btn-studio-primary:hover,
  .btn-studio-accent:hover,
  .btn-studio-outline:hover {
    transform: none !important;
  }

  .text-scrub-word {
    opacity: 1 !important;
  }

  .bento-card::before {
    display: none !important;
  }
}