/* Mobile-optimized custom styles */

/* Base */
html, body {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 70rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Accessibility focus outline */
:focus {
  outline: 2px solid rgba(251, 146, 60, 0.35);
  outline-offset: 2px;
}

/* ============================================
   Mobile-Optimized Typography
   ============================================ */
@media (max-width: 640px) {
  body {
    font-size: 16px; /* Prevent iOS zoom on input focus */
  }

  p {
    line-height: 1.6;
  }
}

/* ============================================
   Mobile Navigation Optimizations
   ============================================ */
@media (max-width: 768px) {
  /* Reduce header padding on mobile */
  .site-header .max-w-7xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Logo size optimization */
  .site-header img {
    width: 3rem;
    height: 3rem;
  }

  /* Hide tagline on very small screens, show it wrapped on medium */
  @media (max-width: 500px) {
    .site-header > div > div:nth-child(2) {
      display: none;
    }
  }

  /* Navigation link spacing */
  nav {
    gap: 0.75rem;
  }

  /* Dropdown menu positioning for mobile */
  nav .absolute {
    /* Default position for stacking */
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    width: auto !important;
    margin: auto;
    max-width: 280px;
    border-radius: 0 0 0.5rem 0.5rem;
  }

  /* Ensure dropdown is accessible on smaller screens */
  nav a, nav button {
    min-height: 44px; /* Touch target minimum */
    display: flex;
    align-items: center;
  }
}

/* ============================================
   Mobile Button Optimizations
   ============================================ */
@media (max-width: 640px) {
  /* Ensure buttons are touch-friendly */
  button, a[class*="bg-"], input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1rem;
  }

  /* CTA buttons full-width on mobile when stacked */
  .flex.flex-col.sm\:flex-row button,
  .flex.flex-col.sm\:flex-row > a {
    width: 100%;
  }

  /* Reduce button text size slightly on mobile */
  button.px-5, button.px-6, button.px-7, button.px-8 {
    padding-left: 1rem;
    padding-right: 1rem;
    font-size: 0.875rem;
  }
}

/* ============================================
   Mobile Form Optimizations
   ============================================ */
@media (max-width: 640px) {
  input, textarea, select {
    font-size: 16px; /* Prevents iOS zoom on focus */
    min-height: 44px;
    padding: 0.75rem;
  }

  textarea {
    min-height: 120px;
  }

  form {
    max-width: 100%;
  }

  form > div {
    margin-bottom: 1rem;
  }

  /* Full-width submit button */
  form button[type="submit"] {
    width: 100%;
  }
}

/* ============================================
   Mobile Grid & Spacing Optimizations
   ============================================ */
@media (max-width: 768px) {
  /* Reduce padding in sections */
  section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Tighten card gaps on mobile */
  [class*="gap-8"] {
    gap: 1rem;
  }

  [class*="gap-12"] {
    gap: 1.5rem;
  }

  /* Ensure cards are readable */
  [class*="p-8"] {
    padding: 1.5rem;
  }

  [class*="p-12"] {
    padding: 1.5rem;
  }
}

/* ============================================
   Mobile-Specific Link & Touch Targets
   ============================================ */
@media (max-width: 640px) {
  /* Touch-target minimums */
  a[href], button {
    min-height: 44px;
  }

  /* Buttons get flex centering for icon alignment */
  button {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ============================================
   Mobile Visibility Adjustments
   ============================================ */
@media (max-width: 768px) {
  /* Stack sections better */
  .grid {
    gap: 1.5rem;
  }

  /* Hero image spacing */
  [class*="md:block"] {
    margin-top: 1.5rem;
  }
}

/* ============================================
   Mobile Performance & Smoothness
   ============================================ */
/* Smooth scrolling for mobile */
html {
  scroll-behavior: smooth;
}

/* Transitions handled per-element via Tailwind duration-* classes */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   Mobile Dropdown Menu Enhancements
   ============================================ */
nav .absolute.group-hover\:opacity-100 {
  z-index: 50;
  transition: all 200ms ease-out;
}

@media (max-width: 768px) {
  /* Better positioning for mobile dropdown */
  nav .absolute[class*="bg-gray-900"] {
    max-height: 80vh;
    overflow-y: auto;
    position: fixed;
    top: auto;
  }
}

/* ============================================
   Mobile-Specific Service Navigation
   ============================================ */
@media (max-width: 640px) {
  .service-nav-btn {
    font-size: 0.875rem;
    padding: 0.625rem 0.75rem;
    flex: 1;
    min-height: 44px;
  }

  /* Stack buttons vertically when too many */
  [class*="flex.flex-col.sm\:flex-row.gap"] {
    flex-wrap: wrap;
  }
}

/* ============================================
   Sticky Header Mobile Adjustment
   ============================================ */
@media (max-width: 768px) {
  .sticky.top-0 {
    top: 0;
    z-index: 40;
  }

  /* Prevent header from pushing content */
  body {
    padding-top: 0;
  }
}

/* ============================================
   Image Optimization for Mobile
   ============================================ */
@media (max-width: 640px) {
  img {
    max-width: 100%;
    height: auto;
  }

  /* Logo responsive */
  .site-header img {
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* ============================================
   Dark Theme Mobile Optimization
   ============================================ */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #111827;
    color: #f3f4f6;
  }
}

/* ============================================
   Landscape Mode Adjustments
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .site-header {
    padding: 0.5rem;
  }

  .site-header img {
    width: 2rem;
    height: 2rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  section {
    padding: 1rem 0;
  }
}

/* ============================================
   Homepage Hero Animations
   ============================================ */

/* Dot-grid hero background */
.hero-dot-grid {
  background-image: radial-gradient(circle, rgba(251,146,60,0.18) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Floating illustration */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}
.anim-float {
  animation: float 5s ease-in-out infinite;
}

/* SVG node glow pulse */
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(251,146,60,0.5)); transform: scale(1); }
  50%       { filter: drop-shadow(0 0 10px rgba(251,146,60,0.9)); transform: scale(1.07); }
}
.anim-node {
  transform-origin: center;
  animation: pulse-glow 3s ease-in-out infinite;
}
.anim-node:nth-child(2) { animation-delay: 0.6s; }
.anim-node:nth-child(3) { animation-delay: 1.2s; }
.anim-node:nth-child(4) { animation-delay: 1.8s; }
.anim-node:nth-child(5) { animation-delay: 2.4s; }

/* Flowing dashed lines */
@keyframes flow {
  from { stroke-dashoffset: 200; }
  to   { stroke-dashoffset: 0; }
}
.anim-line {
  stroke-dasharray: 8 6;
  animation: flow 3s linear infinite;
}
.anim-line:nth-child(2) { animation-delay: 0.5s; }
.anim-line:nth-child(3) { animation-delay: 1s; }
.anim-line:nth-child(4) { animation-delay: 1.5s; }
.anim-line:nth-child(5) { animation-delay: 2s; }
.anim-line:nth-child(6) { animation-delay: 2.5s; }

/* ============================================
   Service Cards
   ============================================ */
.service-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.service-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.12);
}
.service-card:hover .service-icon {
  filter: drop-shadow(0 0 8px rgba(251,146,60,0.7));
}

/* ============================================
   Section Divider (diagonal clip)
   ============================================ */
.clip-diagonal {
  clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}
.clip-diagonal-alt {
  clip-path: polygon(0 15%, 100% 0, 100% 100%, 0 100%);
}
