/* 
  Averix Solutions — Modern Dark Theme
  Primary: Electric Blue (#3b82f6) & Violet (#8b5cf6)
  Accent: Pink (#ec4899)
  Fonts: Poppins + Inter
*/

/* Font Awesome Icon Fix */
.fa, .fas, .far, .fal, .fad, .fab, [class^="fa-"], [class*=" fa-"] {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  display: inline-block !important;
  font-style: normal !important;
  font-variant: normal;
  text-rendering: auto;
  line-height: 1;
}

.fa-brands, .fab, .fa-github, .fa-linkedin {
  font-family: "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
}

.fa-solid, .fa-phone {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
}

/* CSS Variables */
:root {
  --bg: #0b0f19;
  --bg-soft: #0e1426;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e5e7eb;
  --muted: #9aa3b2;
  --primary: #3b82f6;
  --violet: #8b5cf6;
  --accent: #ec4899;
  --success: #10b981;
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 12px;
  --container: 1200px;
  --gradient: linear-gradient(135deg, var(--primary), var(--violet) 50%, var(--accent));
  --glass: saturate(140%) blur(10px);
  --header-h: 72px;
}

/* Light theme overrides */
body.light {
  --bg: #f7f8fb;
  --bg-soft: #ffffff;
  --surface: rgba(0, 0, 0, 0.04);
  --surface-strong: rgba(0, 0, 0, 0.06);
  --border: rgba(0, 0, 0, 0.12);
  --text: #0f172a;
  --muted: #475569;
  --shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* Mobile overflow fixes */
html, body {
  max-width: 100%;
  overflow-x: clip;
}
img, svg, video, canvas { max-width: 100%; height: auto; }
:where(h1, h2, h3, h4, p, .badge, .btn, .card-info, .team-bio) { overflow-wrap: anywhere; }
:where(.about-grid, .team-grid, .services-grid, .projects-grid, .blog-grid, .contact-grid, .tech-grid) > * { min-width: 0; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji';
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% 10%, #11182f, transparent 60%),
              radial-gradient(900px 600px at 80% 0%, #1b1033, transparent 60%),
              var(--bg);
  line-height: 1.6;
}

/* Remove dark spots in light mode */
body.light {
  background: linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%) !important;
}

/* Typography */
h1, h2, h3, h4 { font-family: 'Poppins', 'Inter', sans-serif; margin: 0 0 10px; }
h1 { font-size: 48px; line-height: 1.1; }
h2 { font-size: 36px; }
h3 { font-size: 22px; }
p { margin: 0 0 16px; color: var(--muted); }

@media (max-width: 768px) {
  h1 { font-size: 36px; }
  h2 { font-size: 28px; }
}

/* Layout */
.container {
  width: 96%;
  max-width: var(--container);
  margin: 0 auto;
}
.section {
  padding-block: clamp(72px, 8vw, 110px);
  position: relative;
}
section[id] { scroll-margin-top: calc(var(--header-h) + 12px); }

.section.alt-bg {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
}
body.light .section.alt-bg {
  background: linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0.02));
}

.section-head { text-align: center; margin-bottom: 40px; }
.section-subhead { text-align: center; margin: 60px 0 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px 22px; border-radius: 999px; border: 1px solid transparent;
  color: #fff; text-decoration: none; cursor: pointer; transition: all .25s ease;
  font-weight: 600; letter-spacing: .2px; box-shadow: var(--shadow);
}
.btn-small { padding: 10px 14px; font-size: 14px; }
.btn-gradient {
  background-image: var(--gradient);
  background-size: 200% 200%;
  animation: gradientShift 10s ease infinite;
}
.btn-outline {
  background: transparent; border-color: var(--border); color: var(--text);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(59,130,246,.35); }
.btn-outline:hover { border-color: var(--primary); color: #fff; background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(139,92,246,.1)); }

/* Header/Nav */
.header {
  height: var(--header-h);
  position: sticky; top: 0; z-index: 1000;
  background: rgba(12, 14, 24, 0.5);
  backdrop-filter: var(--glass);
  border-bottom: 1px solid var(--border);
  transition: transform .35s ease, background .35s ease, box-shadow .35s ease;
}
body.light .header {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.header.nav-up { transform: translateY(-100%); }
.nav-container { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { display: flex; align-items: center; text-decoration: none; color: var(--text); gap: 12px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background-image: var(--gradient); font-weight: 800; color: #fff; box-shadow: var(--shadow);
}
.brand-logo-img {
  width: 44px; 
  height: 44px; 
  object-fit: cover; 
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.1);
}
.brand-logo-img:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  border-color: var(--primary);
}
.brand-name { 
  font-weight: 700; 
  letter-spacing: .3px;
  transition: color 0.3s ease;
}
.brand:hover .brand-name {
  color: var(--primary);
}

.nav-toggle { display: none; }
.nav-menu { display: flex; align-items: center; gap: 18px; list-style: none; padding: 0; margin: 0; }
.nav-menu a { color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 10px; }
.nav-menu a:hover { background: var(--surface); }

.theme-switch { display: grid; place-items: center; padding-left: 8px; }
.toggle {
  --w: 50px; --h: 28px;
  width: var(--w); height: var(--h); border-radius: var(--h);
  background: var(--surface); border: 1px solid var(--border); position: relative; cursor: pointer;
  display: grid; grid-template-columns: 1fr 1fr; place-items: center;
}
.toggle i { font-size: 14px; opacity: .8; }
#themeToggle { display: none; }
#themeToggle + .toggle::after {
  content: ''; position: absolute; width: 22px; height: 22px; top: 3px; left: 4px;
  border-radius: 50%; background: linear-gradient(180deg, #fff, #cfd8ea);
  transition: left .25s ease; box-shadow: 0 3px 8px rgba(0,0,0,.25);
}
body.light #themeToggle + .toggle::after { left: 24px; }

/* Mobile Nav */
@media (max-width: 980px) {
  .nav-toggle {
    display: inline-flex; flex-direction: column; gap: 4px; background: transparent; border: 0; cursor: pointer;
  }
  .nav-toggle .bar { width: 20px; height: 2px; background: var(--text); display: block; transition: background 0.3s ease; }
  .nav-menu {
    position: fixed; top: var(--header-h); right: 12px; left: 12px; border: 1px solid var(--border);
    background: rgba(14, 18, 36, .85); backdrop-filter: var(--glass);
    padding: 16px; border-radius: var(--radius); transform-origin: top right; transform: scale(.98); opacity: 0; pointer-events: none;
    flex-direction: column; gap: 12px; box-shadow: var(--shadow);
    max-width: calc(100vw - 24px);
  }
  body.light .nav-menu {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  }
  .nav-menu.open { transform: scale(1); opacity: 1; pointer-events: auto; }
}

/* Hero */
.hero {
  min-height: calc(100vh - var(--header-h));
  display: grid; place-items: center; position: relative;
  background: radial-gradient(600px 300px at 20% 10%, rgba(59,130,246,.15), transparent 70%),
              radial-gradient(600px 300px at 80% 0%, rgba(139,92,246,.15), transparent 70%),
              linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  overflow: hidden;
}
body.light .hero {
  background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,0));
}
.hero-overlay {
  position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.04), transparent 30%), radial-gradient(circle at 80% 10%, rgba(255,255,255,0.05), transparent 30%);
  animation: subtlePan 30s infinite alternate ease-in-out;
}
body.light .hero-overlay {
  background: radial-gradient(circle at 20% 30%, rgba(0,0,0,0.03), transparent 30%), radial-gradient(circle at 80% 10%, rgba(0,0,0,0.03), transparent 30%);
}
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.2fr; gap: 24px; }
.hero-title { font-size: 56px; font-weight: 800; letter-spacing: -0.02em; }
.hero-subtitle { font-size: 18px; max-width: 780px; }
.hero-cta { margin-top: 16px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero-badges { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.badge { background: var(--surface); border: 1px solid var(--border); padding: 8px 12px; border-radius: 999px; color: var(--text); font-size: 13px; }
.caret { display: inline-block; width: 10px; background: transparent; border-right: 3px solid var(--accent); animation: blink 0.9s steps(1) infinite; margin-left: 4px; }

.floating-icons { position: absolute; inset: 0; pointer-events: none; }
.floating-icons i {
  position: absolute; font-size: 44px; opacity: 0.45; filter: drop-shadow(0 8px 18px rgba(0,0,0,.4));
}
.floating-icons i.float { animation: float 8s ease-in-out infinite; }
.floating-icons .delay-1 { left: 15%; top: 30%; }
.floating-icons .delay-2 { right: 20%; top: 20%; animation-delay: .8s; }
.floating-icons .delay-3 { left: 8%; bottom: 20%; animation-delay: 1.2s; }
.floating-icons .delay-4 { right: 12%; bottom: 25%; animation-delay: 1.8s; }
.floating-icons .delay-5 { left: 40%; top: 12%; animation-delay: 2.2s; }

/* About */
.about-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px;
}
.glass-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; backdrop-filter: var(--glass);
  box-shadow: var(--shadow);
}
.values { padding-left: 18px; }
.values li { margin-bottom: 8px; }

.timeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 18px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.timeline-item { background: var(--surface-strong); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.timeline .year { font-weight: 700; color: #fff; background: var(--gradient); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* SERVICES — Flip fix (isolation + backface + safari prefixes + z-fighting nudge) */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
  align-items: stretch;
}

.service-card {
  position: relative;
  perspective: 1000px;
  isolation: isolate;           /* isolate stacking per card */
  contain: layout paint;        /* prevent bleed from siblings */
  min-height: 300px;
  transform: translateZ(0);     /* new stacking context (GPU) */
}

.card-inner {
  position: relative;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d; /* Safari */
  transition: transform .6s;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  will-change: transform;
}

/* Desktop hover flip
@media (hover: hover) and (pointer: fine) {
  .service-card:hover .card-inner { transform: rotateY(180deg); }
}
/* Mobile tap flip (JS toggles .flipped on .service-card) */
/*.service-card.flipped .card-inner { transform: rotateY(180deg); } */

.card-front,
.card-back {
  position: absolute;
  inset: 0;
  height: 100%;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 12px;
  background: rgba(255,255,255,.04);
  backdrop-filter: var(--glass);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;     /* Safari critical */
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;     /* Safari */
  will-change: transform;
}

/* Nudge both faces forward 1px to avoid z-fighting */
.card-front {
  z-index: 2;
  transform: rotateY(0deg) translateZ(1px);
}
.card-front i { font-size: 32px; color: var(--primary); }

.card-back {
  z-index: 1;
  background: rgba(255,255,255,.06);
  transform: rotateY(180deg) translateZ(1px);
}

/* Responsive columns (unchanged) */
@media (max-width: 900px) { .services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .services-grid { grid-template-columns: 1fr; } }

/* Technologies */
.parallax { background-attachment: fixed; }
.tech-grid { 
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 18px; align-items: stretch;
}
.tech-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: grid; place-items: center; gap: 8px; text-align: center; font-weight: 600;
  transition: transform .2s ease, box-shadow .2s ease;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}
.tech-item i { font-size: 34px; }
.tech-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.tech-item:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

/* Projects */
.filters { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.filter-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: all .2s ease;
}
.filter-btn:hover { border-color: var(--primary); }
.filter-btn.active { background: linear-gradient(135deg, rgba(59,130,246,.15), rgba(139,92,246,.15)); border-color: var(--primary); }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  overflow: visible !important;   /* allow content to expand */
  height: auto !important;        /* section auto adjusts */
  transition: all 0.4s ease;      /* smooth expansion */
}

/* View More button styling */
.view-more-container {
  text-align: center;
  margin-top: 24px;
}

#viewMoreBtn {
  padding: 12px 26px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

#viewMoreBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

/* Animation for reveal */
.project-card {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s ease;
}

.project-card[style*="display: block"] {
  opacity: 1;
  transform: translateY(0);
}

/* Ensure parent sections resize naturally */
#projects,
#projects .container,
.section {
  overflow: visible !important;
  height: auto !important;
}


.project-card {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg-soft); cursor: pointer;
  transform: translateY(0); transition: transform .25s ease, box-shadow .25s ease;
  display: grid; grid-template-rows: 180px auto;
}
.project-card img { width: 100%; height: 180px; object-fit: cover; }
.project-card .card-info { padding: 16px; }
.project-card .tag { font-size: 13px; opacity: .8; }
.project-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,.35); }

/* Modal */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 2000; }
.modal.open { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
body.light .modal-overlay { background: rgba(0,0,0,.4); }
.modal-content {
  position: relative; z-index: 1; width: min(980px, 96vw); border-radius: var(--radius); padding: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  transition: all 0.2s ease;
}
.modal-close:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.modal-body { display: grid; grid-template-columns: 1.2fr 1fr; gap: 0; }
.modal-media img { width: 100%; height: 100%; object-fit: cover; border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.modal-details { 
  padding: 22px;
  background: var(--bg-soft);
  color: var(--text);
}
.modal-details h3 {
  color: var(--text);
  margin-bottom: 16px;
}
.modal-details p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.modal-details p strong {
  color: var(--text);
  font-weight: 600;
}
.modal-details span {
  color: var(--text);
}

@media (max-width: 900px) {
  .parallax { background-attachment: scroll !important; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-media img { border-radius: var(--radius) var(--radius) 0 0; height: 220px; }
  
  /* Fix modal positioning for mobile */
  .modal-content {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    margin: 20px auto;
  }
  
  .modal {
    padding: 20px 12px;
    overflow-y: auto;
  }
  
  .modal-details {
    padding: 20px;
    max-height: none;
  }
  
  .modal-close {
    position: sticky;
    top: 12px;
    z-index: 10;
  }
}

/* Testimonials */
.testimonial-slider { 
  position: relative; 
  overflow: hidden; /* viewport clipping lives on the container */
}

.slider-track {
  display: flex;             /* was: grid */
  flex-wrap: nowrap;
  width: 100%;
  transition: transform .6s ease;  /* animate slide */
  will-change: transform;
  /* remove: grid-auto-flow, grid-auto-columns, overflow from here */
}

.testimonial { 
  flex: 0 0 100%;            /* one slide = 100% width */
  box-sizing: border-box;
  padding: 22px; 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  background: var(--surface); 
  margin: 0 4px; 
  display: grid; 
  gap: 16px; 
  align-content: start;
}

.testimonial blockquote { font-size: 18px; color: #fff; margin: 0; }
.testimonial figcaption { display: flex; align-items: center; gap: 14px; }
.testimonial img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.stars { color: #ffcc66; letter-spacing: 2px; }

.slider-controls { 
  position: absolute; 
  top: 50%; 
  transform: translateY(-50%); 
  width: 100%; 
  display: flex; 
  justify-content: space-between; 
  pointer-events: none; 
}
.slider-btn { 
  pointer-events: auto; 
  background:blueviolet; 
  border: 1px solid var(--border); 
  width: 36px; 
  height: 36px; 
  border-radius: 999px; 
  color: var(--text); 
}

.slider-dots { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.slider-dots button { width: 8px; height: 8px; border-radius: 50%; border: 0; background: var(--surface-strong); cursor: pointer; }
.slider-dots button.active { background: var(--primary); }

/* Blog */
.blog-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.blog-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); transition: transform .25s ease, box-shadow .25s ease; }
.blog-card img { width: 100%; height: 160px; object-fit: cover; }
.blog-content { padding: 16px; }
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; }
.contact-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: grid; gap: 8px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 12px 14px; background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 12px; color: var(--text);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}
.error { color: var(--danger); min-height: 18px; }
.form-success { margin-top: 10px; color: var(--success); }

.contact-info .glass-panel { height: 100%; }
.contact-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.contact-list li { display: flex; align-items: center; gap: 10px; }
/* Floating contact button group */
.float-btn-group {
  position: fixed;
  right: 18px;
  bottom: 54px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 1200;
}

/* Individual buttons */
.float-btn {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 30px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  background-color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.2);
}

.float-btn.whatsapp {
  background-color: #fff;
  border-color: #25d366;
}

.float-btn.email {
  background-color: #fff;
  border-color: #EA4335;
}

/* Hover animation */
.float-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Icon styling */
.float-btn i {
  pointer-events: none;
  transition: transform 0.3s ease;
}

.float-btn.whatsapp i {
  color: #25d366;
}

.float-btn.email i {
  color: #EA4335;
}

.float-btn:hover i {
  transform: scale(1.15);
}

.float-btn:hover.whatsapp {
  background: #25d366;
  border-color: #25d366;
}

.float-btn:hover.whatsapp i {
  color: #fff;
}

.float-btn:hover.email {
  background: #EA4335;
  border-color: #EA4335;
}

.float-btn:hover.email i {
  color: #fff;
}

/* Tooltip text */
.float-btn .tooltip {
  position: absolute;
  right: 65px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Tooltip hover effect */
.float-btn:hover .tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(-6px);
}

/* Optional light-mode tweak */
body.light .float-btn .tooltip {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}


/* Footer */
.footer { padding: 60px 0 18px; background: rgba(0,0,0,.2); border-top: 1px solid var(--border); }
body.light .footer { background: #f7f8fb; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 20px; }
.footer-col .social { display: flex; gap: 10px; margin-top: 12px; }
.footer-col .social a { 
  width: 44px; 
  height: 44px; 
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border); 
  border-radius: 10px; 
  color: var(--text);
  font-size: 20px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}
.footer-col .social a i {
  display: inline-block !important;
  line-height: 1;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  width: 20px;
  height: 20px;
  text-align: center;
}
/* Fallback if Font Awesome doesn't load */
.footer-col .social a i::before {
  display: inline-block;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}
.footer-col .social a:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-links a { color: var(--text); text-decoration: none; opacity: .9; }
.newsletter { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.newsletter input { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--text); }
.newsletter button { 
  white-space: nowrap; 
  min-width: fit-content;
  padding: 10px 18px;
}
.newsletter-msg { display: block; margin-top: 6px; font-size: 13px; color: var(--success); }
.footer-bottom { display: grid; place-items: center; margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 14px; }

/* ========== AI CHAT WIDGET ========== */
.chat-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
}

.chat-toggle:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 6px 30px rgba(59, 130, 246, 0.5);
}

.chat-panel {
  position: fixed;
  bottom: 95px;
  left: 20px;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 550px;
  max-height: calc(100vh - 120px);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 999;
}

.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.chat-header {
  padding: 18px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.chat-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chat-close:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.5;
}

.bot-message .message-content {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px 12px 12px 4px;
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  background: var(--primary);
  color: #fff;
  border-radius: 12px 12px 4px 12px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.chat-input-wrapper {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0 0 16px 16px;
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface-strong);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.chat-send-btn:hover {
  background: var(--violet);
  transform: scale(1.05);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Mobile responsive */
@media (max-width: 600px) {
  .chat-panel {
    width: calc(100vw - 20px);
    height: 480px;
    max-height: calc(100vh - 180px);
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%) translateY(20px) scale(0.95);
  }
  
  .chat-panel.open {
    transform: translate(-50%, -50%) translateY(0) scale(1);
  }
  
  .chat-toggle {
    bottom: 15px;
    left: 15px;
    width: 55px;
    height: 55px;
    z-index: 1001;
  }
  
  .chat-messages {
    padding: 15px;
    max-height: 350px;
  }
  
  .chat-input-wrapper {
    padding: 12px;
  }
  
  .chat-send-btn {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
  
  .chat-input {
    font-size: 14px;
    padding: 10px 12px;
  }
  
  /* Ensure floating buttons don't overlap */
  .float-btn-group {
    right: 15px;
    bottom: 15px;
    z-index: 999;
  }
}

/* Preloader */
#preloader {
  position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 3000;
}
#preloader .loader { text-align: center; }
.spinner {
  width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.12); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px;
}

/* Scroll progress */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; background-image: var(--gradient); z-index: 2000;
}

/* Reveal animations */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity .8s ease, transform .8s ease; }
.reveal.show { opacity: 1; transform: none; }
.reveal.slide-left { transform: translateX(-40px); }
.reveal.slide-right { transform: translateX(40px); }
.reveal.zoom { transform: scale(.96); }

/* Accessibility */
.skip-link {
  position: absolute; top: -44px; left: 12px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 8px;
  transition: top .2s ease; z-index: 4000; text-decoration: none;
}
.skip-link:focus { top: 10px; }

/* Animations */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes blink {
  50% { border-color: transparent; }
}
@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
  100% { transform: translateY(0); }
}
@keyframes subtlePan {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

/* Responsive */
@media (max-width: 1200px) {
  .tech-grid { grid-template-columns: repeat(6, 1fr); }
  .blog-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }
  
  /* Hero title for tablets */
  .hero-title {
    font-size: 44px;
    line-height: 1.15;
  }
  
  .hero-subtitle {
    font-size: 17px;
  }
}

@media (max-width: 600px) {
  .tech-grid { grid-template-columns: repeat(3, 1fr); }
  
  /* Technology items mobile text fix */
  .tech-item {
    padding: 12px 8px;
    font-size: 13px;
    min-height: 80px;
  }
  
  .tech-item i {
    font-size: 28px;
  }
  
  .tech-item span {
    font-size: 12px;
    line-height: 1.2;
    max-width: 100%;
  }
  .blog-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .contact-form .form-row { grid-template-columns: 1fr; }
  
  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }
  
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  /* Hero section mobile fixes */
  .hero-title {
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  
  .hero-subtitle {
    font-size: 16px;
    line-height: 1.6;
  }
  
  .hero-cta {
    flex-direction: column;
    gap: 12px;
  }
  
  .hero-cta .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Footer mobile fix */
  .footer-grid { 
    grid-template-columns: 1fr; 
    gap: 30px;
  }
  .footer { 
    padding: 40px 20px 18px;
    overflow-x: hidden;
  }
  .footer-col {
    max-width: 100%;
    overflow-wrap: break-word;
  }
  .footer-col h4 {
    font-size: 18px;
  }
  .newsletter {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .newsletter input {
    width: 100%;
  }
  .newsletter button {
    width: 100%;
  }
  .footer-col .social {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* --- Fix for View More section overlapping below sections --- */

/* Ensure all sections flow naturally */
section,
.section,
#projects,
#projects .container {
  position: static !important;   /* removes any isolated stacking */
  overflow: visible !important;  /* allows natural expansion */
  height: auto !important;       /* auto adjust height */
}

/* Allow body to grow naturally */
html, body {
  overflow-y: auto !important;
  height: auto !important;
}

/* Fix potential 3D transform isolation from other reveal animations */
.reveal {
  transform: none !important;    /* prevents layout isolation */
  will-change: auto !important;
}
