:root {
  --accent: 99 102 241; /* indigo-500 */
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children reveal */
.reveal .stagger-1 { transition-delay: 0.05s; }
.reveal .stagger-2 { transition-delay: 0.1s; }
.reveal .stagger-3 { transition-delay: 0.15s; }

/* Timeline connector */
.experience-timeline {
  position: relative;
  padding-left: 0.5rem;
}
.experience-timeline::before {
  content: '';
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0.75rem;
  width: 2px;
  background: linear-gradient(180deg, rgba(99,102,241,0.6), rgba(99,102,241,0.1));
}
@media (min-width: 640px) {
  .experience-timeline {
    padding-left: 0;
  }
  .experience-timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #0f172a;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Selection */
::selection {
  background: rgba(99, 102, 241, 0.3);
}

/* Skill chips shimmer */
.skill-chip {
  position: relative;
  overflow: hidden;
}
.skill-chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transition: left 0.5s ease;
}
.skill-chip:hover::before {
  left: 125%;
}

/* Section dots navigation */
.section-dots .dot {
  position: relative;
  z-index: 10;
}
.section-dots .dot.active {
  transform: scale(1.25);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}
.section-dots .dot span {
  transform: translateX(4px);
}
.section-dots .dot:hover span {
  transform: translateX(0);
}
@media (max-width: 639px) {
  .section-dots {
    display: none;
  }
}

/* Mobile helpers */
@media (max-width: 639px) {
  #backToTop {
    bottom: 1rem;
    right: 1rem;
  }
  .experience-timeline .timeline-item {
    padding-left: 2.25rem;
  }
  .experience-timeline .timeline-item > span {
    left: 0.75rem;
  }
  .experience-timeline .timeline-item > div {
    word-break: break-word;
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
  }
  h2 {
    font-size: 1.125rem !important;
  }
}

body.menu-open {
  overflow: hidden;
}

/* Focus visible */
a:focus-visible,
button:focus-visible {
  outline: 2px solid rgb(var(--accent));
  outline-offset: 2px;
}

/* Light mode overrides (default remains dark) */
html.light-mode {
  color-scheme: light;
}
html.light-mode body {
  background-color: #f8fafc;
  color: #1e293b;
}
html.light-mode ::selection {
  background: rgba(99, 102, 241, 0.25);
}
html.light-mode ::-webkit-scrollbar-track {
  background: #e2e8f0;
}
html.light-mode ::-webkit-scrollbar-thumb {
  background: #94a3b8;
}
html.light-mode ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}
html.light-mode .bg-slate-950 {
  background-color: #f1f5f9;
}
html.light-mode .bg-slate-900,
html.light-mode .bg-slate-900\/50,
html.light-mode .bg-slate-900\/60,
html.light-mode .bg-slate-900\/80 {
  background-color: #ffffff;
}
html.light-mode .bg-slate-800,
html.light-mode .bg-slate-800\/30,
html.light-mode .bg-slate-800\/50,
html.light-mode .bg-slate-800\/60 {
  background-color: #f1f5f9;
}
html.light-mode .bg-slate-950\/50 {
  background-color: rgba(248, 250, 252, 0.8);
}
html.light-mode .text-slate-200,
html.light-mode .text-slate-300 {
  color: #334155;
}
html.light-mode .text-slate-400 {
  color: #64748b;
}
html.light-mode .text-slate-500 {
  color: #94a3b8;
}
html.light-mode .border-slate-700,
html.light-mode .border-slate-800,
html.light-mode .border-slate-700\/40,
html.light-mode .border-slate-500\/30,
html.light-mode .border-slate-600,
html.light-mode .border-indigo-500\/40 {
  border-color: #e2e8f0;
}
html.light-mode .skill-chip {
  background-color: #f1f5f9;
  color: #334155;
  border-color: #e2e8f0;
}
html.light-mode .skill-chip::before {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.06), transparent);
}
html.light-mode #langToggle,
html.light-mode #mobileMenuBtn,
html.light-mode #themeToggle,
html.light-mode .bg-slate-900\/50 {
  background-color: #ffffff;
}
html.light-mode #themeToggle {
  border-color: #e2e8f0;
}
html.light-mode #langToggle {
  color: #334155;
}
html.light-mode #mobileMenuBtn {
  color: #475569;
}
html.light-mode #themeToggle {
  color: #f59e0b;
}
html.light-mode .section-dots .dot {
  background-color: #cbd5e1;
}
html.light-mode .section-dots .dot.active {
  background-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
html.light-mode #mobileMenu {
  background-color: #ffffff;
  border-color: #e2e8f0;
}
html.light-mode #mobileMenu a {
  color: #334155;
}
html.light-mode .experience-timeline::before {
  background: linear-gradient(180deg, rgba(99,102,241,0.4), rgba(99,102,241,0.1));
}
html.light-mode .text-indigo-400,
html.light-mode .text-indigo-300 {
  color: #4f46e5;
}
html.light-mode .hover\:bg-indigo-600:hover,
html.light-mode .bg-indigo-600 {
  background-color: #4f46e5;
  color: #ffffff;
}
html.light-mode .hover\:border-indigo-500:hover,
html.light-mode .border-indigo-500 {
  border-color: #6366f1;
}
html.light-mode .hover\:text-indigo-400:hover,
html.light-mode .text-indigo-500 {
  color: #4f46e5;
}

/* Light mode text-white must become dark on light surfaces */
html.light-mode .text-white {
  color: #0f172a;
}
html.light-mode .hover\:text-white:hover {
  color: #0f172a;
}
html.light-mode #home .text-white {
  color: #0f172a;
}

/* Keep white text on accent/dark buttons in light mode */
html.light-mode .bg-indigo-600 .text-white,
html.light-mode .bg-indigo-500 .text-white,
html.light-mode .bg-indigo-600.text-white,
html.light-mode .bg-indigo-500.text-white,
html.light-mode #backToTop.text-white,
html.light-mode a[href*="Firas-KOUBAA-Resume-Archi.pdf"].text-white,
html.light-mode button[aria-label="Back to top"].text-white,
html.light-mode a[href^="tel:"].text-white,
html.light-mode a[href^="mailto:"].text-white {
  color: #ffffff;
}

/* Nav link overrides */
html.light-mode .nav-link:hover,
html.light-mode #mobileMenu a:hover {
  background-color: #e2e8f0;
}
html.light-mode .nav-link {
  color: #475569;
}
html.light-mode .nav-link:hover {
  color: #0f172a;
}

/* Section dot tooltips */
html.light-mode .section-dots .group span {
  background-color: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Roles/summary/experience/education/cert cards */
html.light-mode .rounded-xl,
html.light-mode .rounded-2xl {
  border-color: #e2e8f0;
}

/* Home section blobs */
html.light-mode #home .bg-indigo-600\/20 {
  background-color: rgba(99, 102, 241, 0.12);
}
html.light-mode #home .bg-violet-600\/10 {
  background-color: rgba(139, 92, 246, 0.08);
}

/* Experience timeline card inner stack */
html.light-mode .experience-timeline .bg-slate-950\/50 {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}
html.light-mode .experience-timeline .text-slate-500 {
  color: #64748b;
}
html.light-mode .experience-timeline .text-slate-400 {
  color: #475569;
}
html.light-mode .experience-timeline .text-slate-300 {
  color: #334155;
}

/* Ensure all headings and body text in cards are dark in light mode */
html.light-mode h1,
html.light-mode h2,
html.light-mode h3,
html.light-mode .section-heading,
html.light-mode h5,
html.light-mode h6 {
  color: #0f172a;
}
html.light-mode p,
html.light-mode li {
  color: #334155;
}
html.light-mode .text-slate-300,
html.light-mode .text-slate-400,
html.light-mode .text-slate-500 {
  color: #475569;
}
html.light-mode #experience .section-heading {
  color: #0f172a;
}
html.light-mode #home .text-white,
html.light-mode #home .text-slate-200,
html.light-mode #home .text-slate-300,
html.light-mode #home .text-slate-400,
html.light-mode #experience .text-slate-200,
html.light-mode #experience .text-slate-300,
html.light-mode #experience .text-slate-400 {
  color: #334155;
}

/* Keep accent colored text */
html.light-mode .text-indigo-400,
html.light-mode .text-indigo-300,
html.light-mode .text-indigo-500 {
  color: #4f46e5;
}

/* Back-to-top button */
html.light-mode #backToTop {
  background-color: #4f46e5;
  color: #ffffff;
}
html.light-mode #backToTop:hover {
  background-color: #4338ca;
}

/* Footer */
html.light-mode footer {
  background-color: #ffffff;
  border-top-color: #e2e8f0;
}
html.light-mode footer .text-white,
html.light-mode footer .text-slate-300,
html.light-mode footer .text-slate-400 {
  color: #475569;
}

/* Photo border */
html.light-mode #home img {
  border-color: #ffffff;
}

/* CV download buttons */
html.light-mode a[href*="Firas-KOUBAA-Resume-Archi.pdf"] {
  background-color: #4f46e5;
  color: #ffffff !important;
}
html.light-mode a[href*="Firas-KOUBAA-Resume-Archi.pdf"] span {
  color: #ffffff !important;
}
html.light-mode a[href*="Firas-KOUBAA-Resume-Archi.pdf"]:hover {
  background-color: #4338ca;
}
html.light-mode a[href*="Firas-KOUBAA-Resume-Archi.docx"] {
  background-color: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}
html.light-mode a[href*="Firas-KOUBAA-Resume-Archi.docx"]:hover {
  background-color: #e2e8f0;
}
