/* theme.css - Ultra-Creative Premium Edition */

/*
 * SCROLL PERFORMANCE
 * Smooth scroll configuration.
 */
/* 
 * SCROLL PERFORMANCE
 * Smooth scroll behavior has been removed globally to prevent extreme lag 
 * and glitchiness when using a trackpad or mouse wheel. Add it selectively
 * to interactive anchor links via javascript if needed.
 */

:root {
  /* --- 4-Mode Color System --- */

  /* Light Mode (Base) */
  --light-canvas: #FAFBFC;
  --light-glass: rgba(255, 255, 255, 0.7);
  --light-glow: rgba(26, 43, 95, 0.08);

  /* Dusk Mode (Transition) */
  --dusk-canvas: #E8EAF6;
  --dusk-glass: rgba(232, 234, 246, 0.85);
  --dusk-glow: rgba(26, 43, 95, 0.15);

  /* Navy Mode (Deep) */
  --navy-canvas: #0F1D34;
  --navy-glass: rgba(26, 43, 95, 0.6);
  --navy-glow: rgba(91, 123, 201, 0.2);
  --navy-800: #0A1628;
  --navy-900: #050b16;

  /* Gradient Mode (Feature) */
  --gradient-start: #667eea;
  --gradient-mid: #764ba2;
  --gradient-end: #f093fb;

  /* Accents */
  --color-coral: #FF6B6B;
  --color-mint: #4ECDC4;
  --color-sunshine: #FFE66D;
  --color-lavender: #B4A7D6;
  --color-ocean: #0EA5E9;

  /* Typography */
  --ff-head: "Poppins", sans-serif;
  --ff-body: "Inter", sans-serif;

  /* Spacing */
  --container: 1280px;
  --section-pad: 120px;

  /* Layering — modals above chat; chat above nav */
  --lm-z-nav: 9000;
  --lm-z-chat: 9500;
  --lm-z-modal: 10000020;
  --lm-z-modal-top: 10000030;
}

/* Default Theme State (Light) */
html {
  /* Disable overscroll bounce — eliminates the rubber-band stutter at top/bottom */
  overscroll-behavior: none;
  /* Never use CSS smooth-scroll globally — it conflicts with native compositor */
  scroll-behavior: auto;
}

body {
  font-family: var(--ff-body);
  background: var(--light-canvas);
  color: var(--navy-900);
  margin: 0;
  overflow-x: clip;
  position: relative;
  overscroll-behavior: none;
  /* GPU text rendering — prevents font-hinting recalc during scroll */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}

body[data-theme="navy"] {
  background: var(--navy-canvas);
  color: #fff;
}

body[data-theme="dusk"] {
  background: var(--dusk-canvas);
  color: var(--navy-900);
}

body[data-theme="gradient"] {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 100%);
  color: #fff;
}

/* Typography Defaults */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--ff-head);
  font-weight: 700;
  line-height: 1.1;
  margin-top: 0;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.container {
  width: 90%;
  max-width: var(--container);
  margin: 0 auto;
}

@media (max-width: 768px) {
  .container {
    width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.section {
  padding: var(--section-pad) 0;
  position: relative;
}

/* --- Utilities --- */
.text-gradient {
  background: linear-gradient(135deg, var(--color-ocean) 0%, var(--color-coral) 50%, var(--color-lavender) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* --- Navigation --- */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  padding: 20px 0;
  /* Only transition background/border — NOT transform/all
     which causes full-page composite layer updates on each scroll section change */
  transition: background-color 0.4s ease, border-color 0.4s ease, padding 0.4s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--navy-900);
}

[data-theme="dusk"] .navbar {
  background: rgba(232, 234, 246, 0.8);
  color: var(--navy-900);
}

[data-theme="navy"] .navbar {
  background: rgba(15, 29, 52, 0.8);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
  font-weight: 500;
  font-size: 15px;
  position: relative;
  padding: 5px 0;
  margin: 0 15px;
}

.nav-link::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-ocean);
  transition: width 0.3s ease;
}

.nav-link:hover::before {
  width: 100%;
}

/* --- Cursor --- */
.custom-cursor {
  width: 40px;
  height: 40px;
  border: 1px solid var(--navy-800);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  /* JS sets transform via translate3d() — no CSS transition on transform
     to avoid double-animation (JS lerp + CSS transition fighting each other) */
  will-change: transform;
  /* Only transition visual appearance, NOT transform (that's JS-driven) */
  transition: background-color 0.2s ease, border-color 0.2s ease, width 0.2s ease, height 0.2s ease;
}

[data-theme="navy"] .custom-cursor {
  border-color: rgba(255, 255, 255, 0.7);
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--navy-800);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
}

[data-theme="navy"] .cursor-dot {
  background: rgba(255, 255, 255, 0.9);
}

.cursor-hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
  width: 56px;
  height: 56px;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 16px 36px;
  border-radius: 99px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--navy-900);
  color: #fff;
  border: none;
}

[data-theme="navy"] .btn-primary {
  background: #fff;
  color: var(--navy-900);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* --- Footer --- */
.fat-footer {
  background: var(--navy-900);
  color: #fff;
  padding: 80px 0 40px;
  clip-path: ellipse(150% 100% at 50% 100%);
}

/* --- About Timeline --- */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 0;
}

#story-timeline::before {
  display: none;
}

.timeline-item {
  position: relative;
  margin: 40px 0;
  width: 50%;
  padding: 0 40px;
  z-index: 2;
}

#story-timeline .timeline-item:nth-child(2n) {
  left: 0;
  text-align: right;
}

#story-timeline .timeline-item:nth-child(2n+1) {
  left: 50%;
  text-align: left;
}

.timeline-dot {
  position: absolute;
  top: 0;
  width: 16px;
  height: 16px;
  background: var(--color-ocean);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.55);
  z-index: 10;
  transform-origin: center center;
}

#story-timeline .timeline-item:nth-child(2n) .timeline-dot {
  right: -8px;
}

#story-timeline .timeline-item:nth-child(2n+1) .timeline-dot {
  left: -8px;
}

/* --- Timeline Mobile Optimization --- */
@media (max-width: 768px) {
  #story-timeline {
    max-width: 100%;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
    overflow: visible;
  }

  #story-timeline .timeline-line {
    left: 20px;
    transform: none;
  }

  .timeline-item,
  #story-timeline .timeline-item {
    position: relative;
    left: 0 !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    padding-left: 3rem;
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    margin: 30px 0;
    box-sizing: border-box;
    text-align: left !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #story-timeline .timeline-item:nth-child(odd),
  #story-timeline .timeline-item:nth-child(even),
  #story-timeline .timeline-item:nth-child(2n),
  #story-timeline .timeline-item:nth-child(2n+1) {
    left: 0 !important;
    right: auto !important;
    text-align: left !important;
    width: 100% !important;
  }

  #story-timeline .timeline-item:nth-child(odd) .timeline-dot,
  #story-timeline .timeline-item:nth-child(even) .timeline-dot,
  #story-timeline .timeline-item:nth-child(2n) .timeline-dot,
  #story-timeline .timeline-item:nth-child(2n+1) .timeline-dot {
    left: 12px;
    right: auto;
  }

  #story-timeline .timeline-item p,
  #story-timeline .timeline-item h3 {
    max-width: 100%;
  }
}

/* --- Bento Grid (Services) --- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  padding: 20px 0;
}

.bento-card {
  background: var(--light-glass);
  padding: 40px;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
}

[data-theme="navy"] .bento-card {
  background: var(--navy-glass);
  border-color: rgba(255, 255, 255, 0.1);
}

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

.bento-card h3 {
  font-size: 24px;
  margin-bottom: 15px;
}

.bento-card p {
  opacity: 0.8;
  font-size: 15px;
  line-height: 1.6;
}

.bento-icon {
  font-size: 40px;
  margin-bottom: 25px;
  display: inline-block;
}

/* Large card span */
@media (min-width: 992px) {
  .bento-card.large {
    grid-column: span 2;
  }
}

/* --- Testimonials --- */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.testimonial-card {
  background: #fff;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
}

.testimonial-card:hover {
  transform: translateY(-5px);
}

.stars {
  color: var(--color-sunshine);
  margin-bottom: 10px;
}

/* --- CTA Section --- */
.cta-section {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 100%);
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(78, 205, 196, 0.1), transparent 70%);
}

/* --- Section Specific (Placeholders for Home) --- */
.hero {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.bg-canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
}

/* --- Masonry Layout --- */
.masonry-grid {
  column-count: 1;
  column-gap: 30px;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 30px;
}

@media (min-width: 768px) {
  .masonry-grid {
    column-count: 2;
  }
}

@media (min-width: 1200px) {
  .masonry-grid {
    column-count: 2;
    /* Keep 2 columns for better readability of text heavy testimonials */
  }
}

/* --- Toast Notifications --- */
#toast-container {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 15px;
  pointer-events: none;
  /* Allow clicking through container */
  max-width: calc(100vw - 40px);
}

@media (max-width: 600px) {
  #toast-container {
    top: 80px;
    right: 12px;
    left: 12px;
    max-width: 100%;
  }

  .toast {
    min-width: unset;
    max-width: 100%;
    width: 100%;
  }
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 450px;
  padding: 16px 24px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.05);
  /* Deep shadow */
  display: flex;
  align-items: flex-start;
  gap: 15px;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.2, 1, 0.3, 1);
  /* Apple-like easing */
  border-left: 4px solid transparent;
  position: relative;
  overflow: hidden;
}

.toast-active {
  transform: translateX(0%);
  opacity: 1;
}

.toast-success {
  border-left-color: #10b981;
}

/* Emerald */
.toast-error {
  border-left-color: #f43f5e;
}

/* Rose */
.toast-info {
  border-left-color: #3b82f6;
}

/* Blue */

.toast-icon {
  font-size: 20px;
  margin-top: 2px;
}

.toast-success .toast-icon {
  color: #10b981;
}

.toast-error .toast-icon {
  color: #f43f5e;
}

.toast-info .toast-icon {
  color: #3b82f6;
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.toast-message {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.toast-close {
  cursor: pointer;
  font-size: 16px;
  color: #cbd5e1;
  transition: color 0.2s;
  margin-top: 2px;
}

.toast-close:hover {
  color: #475569;
}

/* ── Canvas performance: force GPU compositing for WebGL/2D canvases ── */
canvas {
  will-change: transform;
  transform: translateZ(0);
  /* Force GPU layer */
}

/* ── Hero section: isolate layout so canvas animations don't trigger
      full-page layout recalcs ── */
.hero-section,
#hero-section {
  isolation: isolate;
  contain: layout;
}

/* ── Smooth scroll only for anchor navigation, not page scroll ── */
a[href^="#"] {
  scroll-behavior: smooth;
}

/* ── Reduced motion: disable ALL decorative animations for accessibility
      and mandatory for users who have enabled it (reduces CPU load too) ── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Modal vs chat layering (all breakpoints) ── */
body.lm-any-modal-open .lm-chat {
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

#jobApplyModal,
.industry-modal,
#feature-modal,
#seoAuditModal {
  z-index: var(--lm-z-modal) !important;
}

.global-contact-modal-backdrop.active {
  z-index: var(--lm-z-modal) !important;
}