/* Modern Typography & Icons */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700;800;900&family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap");

/* Material Symbols Default Config */
.material-symbols-outlined {
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
  display: inline-block;
  vertical-align: middle;
}

/* Custom Utilities */
.vertical-lr {
  writing-mode: vertical-lr;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Animation Reveal Helpers - Initial states are managed by GSAP for reliability */
.reveal-text,
.reveal-scale,
.reveal-border {
  transition: none; /* Let GSAP handle transitions */
}

/* Custom Scrollbar for modern look */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #0d1c32;
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: #00164e;
}

/* Dark Mode Overrides */
.dark body {
  background-color: #0d1c32;
}

.dark ::-webkit-scrollbar-track {
  background: #0d1c32;
}

/* Architectural Background Patterns */
.bg-grid-dots {
  background-image: radial-gradient(#0d1c32 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.05;
}

.bg-noise {
  background: url("https://grainy-gradients.vercel.app/noise.svg");
  opacity: 0.03;
  pointer-events: none;
}

/* Typographic Outline Utility */
.outline-text {
  -webkit-text-stroke: 1px #0d1c32;
  color: transparent;
}

.dark .outline-text {
  -webkit-text-stroke: 1px #ffffff;
}

/* Premium Project Card Styles */
.project-card {
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-card:hover {
  z-index: 10;
}

/* Subtle Floating Animation for "Premium" feel */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

.float-ui {
  animation: float 6s ease-in-out infinite;
}

/* Glassmorphism Variants */
.glass-terminal {
  background: rgba(10, 18, 30, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom Cursor for Terminal */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: #98c379;
  margin-left: 4px;
  animation: blink 1s step-end infinite;
}
/* Terminal Cursor Animation (Dark for Light Theme) */
.terminal-cursor-dark {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background-color: #0d1c32;
  margin-left: 2px;
  vertical-align: middle;
  animation: blink-dark 1s step-end infinite;
}

@keyframes blink-dark {
  from,
  to {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

/* Mobile Nav Refinements */
.mobile-nav-link {
  transition: all 0.3s ease;
}

.mobile-nav-link:hover {
  letter-spacing: 2px;
  opacity: 0.7;
}

/* Burger spans transition */
#menu-toggle span {
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

/* Mobile menu slide transition */
#mobile-menu {
  transition: transform 0.5s ease-in-out;
}

/* iPhone/notched device: prevent gap above fixed header caused by safe-area-inset.
   The header uses fixed positioning — on iOS Safari with dynamic toolbar,
   the body starts below the safe area but fixed elements don't account for it,
   creating a gap. We pad the header to fill it. Desktop unaffected. */
@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 767px) {
    header.fixed {
      padding-top: max(0.75rem, env(safe-area-inset-top)) !important;
      padding-bottom: 0.75rem !important;
    }
    /* Also ensure the body top padding accounts for the taller header */
    body {
      padding-top: env(safe-area-inset-top);
    }
  }
}

/* Hero Text Mobile Fixes */
@media (max-width: 768px) {
  #hero-text-parallax {
    transform: none !important;
  }

  .outline-text {
    -webkit-text-stroke: 1px #0d1c32;
    color: #0d1c32 !important;
  }
}

/* Fix for anchor links jumping beneath fixed header */
html,
body {
  scroll-behavior: smooth;
}

h2[id],
h3[id] {
  scroll-margin-top: 160px;
}

.service-body h2,
.service-body h3 {
  scroll-margin-top: 160px;
}

/* ============================================================
   MOBILE-ONLY FIXES (max-width: 767px)
   Desktop view is NOT touched — all rules scoped to mobile
   ============================================================ */

@media (max-width: 767px) {
  /* --- 1. MOBILE NAV: Reduce link size & fix spacing --- */
  #mobile-menu .nav-link-mobile {
    font-size: 1.4rem !important;
    letter-spacing: 0.1em !important;
    line-height: 1.2 !important;
  }

  #mobile-menu nav {
    gap: 0.85rem !important;
    padding-top: 0.5rem !important;
    justify-content: center !important;
  }

  #mobile-menu {
    overflow-y: auto !important;
    padding-bottom: 4rem !important;
  }

  /* --- 2. HERO H1: Reduce size so less vertical space is consumed,
     giving the image pane more room to show the full image --- */
  .mobile-h1 {
    font-size: 2rem !important;
    line-height: 0.95 !important;
    margin-bottom: 1rem !important;
  }

  /* --- 3. HERO SECTION: Remove 100vh height on mobile (inner pages only).
     On iPhone the 100vh is very tall, creating huge whitespace above content.
     Let the section be auto-height so content determines the size. --- */
  .mobile-hero-section {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  /* Inner flex container: also auto height */
  .mobile-hero-section > div {
    height: auto !important;
  }

  /* Left text pane: remove h-full stretch, tighten padding */
  .mobile-hero-section
    .w-full.lg\:w-1\/2.flex.items-center.justify-center.px-6.py-8 {
    height: auto !important;
    padding-top: 2rem !important;
    padding-bottom: 1rem !important;
  }

  /* --- 4. HERO IMAGE CONTAINER: Increase height so image isn't cropped --- */
  .mobile-hero-img-wrap {
    height: 60vw !important;
    min-height: 240px !important;
    max-height: 340px !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
  }

  /* Services page: slightly larger image container */
  .mobile-hero-img-wrap.services-img {
    height: 85vw !important;
    min-height: 320px !important;
    max-height: 440px !important;
  }

  /* Services image: same size, just shifted down so legs crop at bottom */
  .mobile-hero-img-wrap.services-img .mobile-hero-img {
    transform: translateY(5%) !important;
  }

  /* Education page: larger container, image shifted down to crop legs */
  .mobile-hero-img-wrap.education-img {
    height: 130vw !important;
    min-height: 480px !important;
    max-height: 600px !important;
    overflow: hidden !important;
  }

  .mobile-hero-img-wrap.education-img .mobile-hero-img {
    height: 140% !important;
    transform: translateY(10%) !important;
  }

  .mobile-hero-img {
    height: 115% !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
    object-fit: contain !important;
    object-position: center top !important;
  }

  /* --- 4. SERVICES: Show chalkboard text on mobile properly ---
     Keep it visible but scale down to fit the smaller container --- */
  .mobile-chalkboard {
    display: flex !important;
    top: 18% !important;
    left: 3% !important;
    width: 62% !important;
    height: 55% !important;
  }

  .mobile-chalkboard h3 {
    font-size: 0.75rem !important;
    margin-bottom: 0.2rem !important;
    padding-bottom: 4px !important;
    white-space: nowrap !important;
    overflow: visible !important;
  }

  .mobile-chalkboard #chalk-text {
    font-size: 0.7rem !important;
    line-height: 1.4 !important;
    padding: 0 2px !important;
    white-space: pre-wrap !important;
  }

  .mobile-duster {
    width: 2rem !important;
    height: 1.25rem !important;
  }

  /* --- 5. EXPERIENCE PAGE: Fix date/title overlap in timeline --- */
  .experience-card h3 {
    font-size: 1.3rem !important;
    line-height: 1.2 !important;
  }

  /* --- 6. HOME PAGE: Experience & education — fix overlap and white space --- */

  /* Remove top offset that causes overlap on mobile */
  #experience .relative,
  #education .relative {
    top: auto !important;
  }

  /* Reduce section top padding to remove big white space */
  #experience,
  #education {
    padding-top: 2rem !important;
  }
}
