/* ====================================
   DLR Consultora - Responsive Styles
   Mobile-First Approach
   ==================================== */

/* ====================================
   Base Mobile Styles (< 480px)
   ==================================== */

/* Already defined in main.css with mobile-first approach */

/* ====================================
   Small Tablets (480px and up)
   ==================================== */
@media screen and (min-width: 480px) {
  :root {
    --container-padding: 1.5rem;
  }

  .hero__buttons {
    flex-direction: row;
  }

  .contact__content {
    grid-template-columns: 1fr;
  }
}

/* ====================================
   Tablets (768px and up)
   ==================================== */
@media screen and (max-width: 768px) {
  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  /* Reset service card grid-column centering trick (only valid for 3-col layout) */
  .service-card:last-child:nth-child(3n + 1) {
    grid-column: auto;
  }

  /* Navigation - Mobile Menu */
  .nav__menu {
    position: fixed;
    top: var(--header-height);
    left: -100%;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background: var(--color-white);
    padding: var(--spacing-xl) var(--container-padding);
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }

  .nav__menu.active {
    left: 0;
  }

  .nav__list {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-lg);
  }

  .nav__link {
    font-size: 1.25rem;
    width: 100%;
    padding: var(--spacing-sm) 0;
  }

  .nav__link--cta {
    display: inline-block;
    width: auto;
    padding: 0.75rem 2rem;
    margin-top: var(--spacing-md);
  }

  .nav__toggle {
    display: flex;
  }

  /* Hero adjustments */
  .hero {
    min-height: 100vh;
  }

  .hero__title {
    font-size: 2rem;
  }

  .hero__subtitle {
    font-size: 1.125rem;
  }

  .hero__buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero__buttons .btn {
    width: 100%;
  }

  /* Section spacing */
  .section {
    padding: var(--spacing-xxl) 0;
  }

  /* Services grid */
  .services__grid {
    grid-template-columns: 1fr;
  }

  /* Team grid */
  .team__grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  /* Clients grid */
  .clients__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Contact */
  .contact__content {
    grid-template-columns: 1fr;
  }

  /* Footer */
  .footer__content {
    grid-template-columns: 1fr;
  }

  .footer__bottom {
    flex-direction: column;
    text-align: center;
  }

  .footer__legal {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
}

@media screen and (min-width: 769px) {
  .nav__toggle {
    display: none;
  }

  .about__content {
    grid-template-columns: 1fr;
  }

  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .team__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .clients__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .contact__content {
    grid-template-columns: 1fr 1fr;
  }
}

/* ====================================
   Desktop (1024px and up)
   ==================================== */
@media screen and (min-width: 1024px) {
  :root {
    --container-padding: 2rem;
  }

  .services__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .team__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .clients__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .footer__content {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }

  /* Hero parallax effect */
  .hero__background {
    background-attachment: fixed;
  }
}

/* ====================================
   Large Desktop (1200px and up)
   ==================================== */
@media screen and (min-width: 1200px) {
  .services__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .team__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .clients__grid {
    grid-template-columns: repeat(5, 1fr);
  }

  /* Larger spacing for big screens */
  .section {
    padding: var(--spacing-xxxl) 0;
  }
}

/* ====================================
   Extra Large Desktop (1440px and up)
   ==================================== */
@media screen and (min-width: 1440px) {
  :root {
    --container-width: 1320px;
  }
}

/* ====================================
   Mobile Menu Active State
   ==================================== */
.nav__toggle.active .nav__toggle-icon {
  background: transparent;
}

.nav__toggle.active .nav__toggle-icon::before {
  transform: rotate(45deg);
  top: 0;
}

.nav__toggle.active .nav__toggle-icon::after {
  transform: rotate(-45deg);
  bottom: 0;
}

/* ====================================
   Mobile-specific improvements
   ==================================== */
@media screen and (max-width: 480px) {
  /* Reduce spacing on very small screens */
  :root {
    --spacing-xs: 0.375rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;
    --spacing-xxxl: 4rem;
    --container-padding: 1rem;
  }

  .hero {
    min-height: 100vh;
  }

  .hero__title {
    font-size: 1.75rem;
  }

  .hero__subtitle {
    font-size: 1rem;
  }

  .hero__content {
    padding: var(--spacing-xl) var(--container-padding);
  }

  .section__title {
    font-size: 1.75rem;
  }

  .section__subtitle {
    font-size: 1rem;
  }

  /* Reduce padding in cards */
  .service-card,
  .value-card {
    padding: var(--spacing-lg);
  }

  .contact__form-wrapper {
    padding: var(--spacing-lg);
  }

  /* Smaller buttons on mobile */
  .btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
  }

  /* Footer adjustments */
  .footer {
    padding: var(--spacing-xl) 0 var(--spacing-md);
  }

  /* Clients grid - single column on very small screens */
  .clients__grid {
    grid-template-columns: 1fr;
  }

  /* FAQ adjustments */
  .faq-item__question {
    padding: var(--spacing-md);
    font-size: 1rem;
  }

  .faq-item__answer p {
    padding: 0 var(--spacing-md) var(--spacing-md);
  }

  /* Form inputs smaller */
  .form-input,
  .form-textarea {
    padding: 0.75rem;
    font-size: 0.9375rem;
  }
}

/* ====================================
   Landscape Mobile Orientation
   ==================================== */
@media screen and (max-height: 600px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: calc(var(--header-height) + var(--spacing-xl)) 0 var(--spacing-xl);
  }

  .hero__title {
    font-size: 1.75rem;
    margin-bottom: var(--spacing-md);
  }

  .hero__subtitle {
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
  }

  .hero__scroll {
    display: none;
  }

  .section {
    padding: var(--spacing-xl) 0;
  }
}

/* ====================================
   Print Styles
   ==================================== */
@media print {
  /* Hide non-essential elements */
  .nav,
  .hero__scroll,
  .footer__legal,
  .contact__form-wrapper,
  .btn {
    display: none !important;
  }

  /* Ensure content is visible */
  body {
    background: white;
    color: black;
  }

  /* Avoid page breaks inside elements */
  .service-card,
  .team-card,
  .value-card,
  .faq-item {
    page-break-inside: avoid;
  }

  /* Remove shadows and transitions */
  * {
    box-shadow: none !important;
    transition: none !important;
    animation: none !important;
  }

  /* Adjust colors for print */
  a {
    text-decoration: underline;
  }

  /* Show URLs for important links */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* ====================================
   High DPI / Retina Displays
   ==================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Enhance text rendering on retina displays */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Use higher quality images if available */
  .hero__image,
  .team-card__image img,
  .client-logo img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ====================================
   Touch Device Optimizations
   ==================================== */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets for mobile */
  .btn,
  .nav__link,
  .faq-item__question {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects on touch devices */
  .service-card:hover,
  .team-card:hover,
  .value-card:hover,
  .client-logo:hover {
    transform: none;
  }

  /* Adjust transitions for touch */
  * {
    -webkit-tap-highlight-color: rgba(147, 122, 81, 0.2);
  }

  /* Better scrolling on iOS */
  body {
    -webkit-overflow-scrolling: touch;
  }
}

/* ====================================
   Dark Mode Support (Optional)
   ==================================== */
@media (prefers-color-scheme: dark) {
  /* Uncomment to enable dark mode */
  /*
  :root {
    --color-dark: #f5f5f5;
    --color-light: #2a2a2a;
    --color-white: #1a1a1a;
    --color-gray: #cccccc;
    --color-gray-light: #333333;
  }

  body {
    background: #1a1a1a;
    color: #f5f5f5;
  }

  .header {
    background: #2a2a2a;
  }

  .service-card,
  .team-card,
  .value-card,
  .contact__form-wrapper,
  .contact-info-card,
  .faq-item {
    background: #2a2a2a;
  }

  .section--gray {
    background: #1f1f1f;
  }
  */
}

/* ====================================
   Accessibility - Larger Text
   ==================================== */
@media screen and (min-width: 1920px) {
  /* Slightly larger text on very large screens for better readability */
  html {
    font-size: 18px;
  }
}

/* ====================================
   Accessibility - Focus Styles
   ==================================== */
@media (prefers-reduced-motion: no-preference) {
  :focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
  }

  :focus:not(:focus-visible) {
    outline: none;
  }

  :focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
  }
}
