/* Enhanced Mobile Styles for Łukasz Śreniawski Portfolio */

/* Touch-friendly improvements */
@media (max-width: 768px) {
  /* Improve touch targets */
  .btn {
    min-height: 48px; /* Increased from 44px */
    min-width: 48px;
    padding: 14px 24px; /* Increased padding */
    font-size: 16px; /* Slightly larger */
  }

  /* Increase tap targets for cards */
  .tl-card,
  .project-card {
    min-height: 120px; /* Ensure adequate tap target */
    padding: 20px !important; /* More padding for easier tapping */
  }

  /* Better hamburger menu touch target */
  .hamburger {
    padding: 12px;
    min-height: 48px;
    min-width: 48px;
  }

  /* Improve hero section on mobile */
  .hero {
    padding: 0; /* let video touch edges on mobile too */
    min-height: 100svh; /* Use small viewport height for mobile browsers */
  }

  .hero-card {
    padding: clamp(24px, 6vw, 32px);
    max-width: 95vw;
  }

  .hero-title {
    font-size: clamp(32px, 8vw, 42px);
    line-height: 1.1;
    margin-bottom: 8px;
  }

  .hero-actions {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
    display: flex;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
  }

  /* Timeline mobile improvements */
  .timeline-grid {
    margin-top: 20px;
  }

  .tl-row {
    grid-template-columns: 32px 1fr;
    grid-template-areas:
      "center left"
      "center right";
    gap: 12px;
    margin: clamp(16px, 8vw, 24px) 0;
  }

  .tl-center {
    min-height: 80px;
  }

  .tl-center::after {
    font-size: 0.7rem;
    top: -14px;
    transform: translate(-50%, -100%);
  }

  .tl-card {
    padding: clamp(16px, 4vw, 20px);
    margin: 0;
  }

  .tl-title {
    font-size: clamp(18px, 4vw, 20px);
    line-height: 1.3;
  }

  .tl-note {
    font-size: clamp(14px, 3.5vw, 15px);
    line-height: 1.4;
  }

  /* Projects grid mobile optimization */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: clamp(16px, 4vw, 20px);
  }

  .project-card {
    padding: clamp(16px, 4vw, 20px);
  }

  .project-media img,
  .project-thumb {
    height: clamp(200px, 50vw, 260px);
  }

  .project-title {
    font-size: clamp(16px, 4vw, 18px);
  }

  .project-description {
    font-size: clamp(14px, 3.5vw, 15px);
    line-height: 1.4;
  }

  /* Contact section mobile improvements */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .contact-form .field {
    margin: 12px 0;
  }

  .contact-form input,
  .contact-form textarea {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px 16px;
  }

  .contact-form textarea {
    min-height: 120px;
  }

  .contact-details ul {
    gap: 16px;
  }

  .contact-details li {
    font-size: clamp(14px, 3.5vw, 15px);
  }

  /* Navigation improvements - follow centered pill overlay */
  .side-panel ul {
    padding-top: 16px;
  }
  .side-panel li a {
    display: block;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .section {
    padding: clamp(32px, 8vw, 48px) 12px;
  }

  .container {
    width: 96vw;
  }

  .hero-title {
    font-size: clamp(28px, 8vw, 36px);
  }

  .tl-row {
    grid-template-columns: 24px 1fr;
    gap: 8px;
  }

  .tl-center {
    min-height: 60px;
  }

  .timeline-marker {
    width: 12px;
    height: 12px;
  }

  .tl-card {
    padding: clamp(12px, 4vw, 16px);
  }

  .project-media img,
  .project-thumb {
    height: clamp(160px, 45vw, 200px);
  }
}

/* Landscape mobile orientation */
@media (max-width: 926px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
    padding: 0; /* remove landscape padding so video reaches top */
  }

  .hero-card {
    padding: 20px;
  }

  .hero-title {
    font-size: clamp(24px, 6vw, 32px);
  }

  .hero-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .hero-actions .btn {
    width: auto;
    min-width: 140px;
  }
}

/* High-density displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero-bg {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Safe area support for notched devices */
@supports (padding: max(0px)) {
  .hero {
    /* Only respect safe-area, do not add extra gap */
    padding-top: max(0px, env(safe-area-inset-top));
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  .side-panel.open {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
  /* Larger focus indicators on mobile */
  :focus-visible {
    outline-width: 3px;
    outline-offset: 3px;
  }

  /* Better button focus on mobile */
  .btn:focus-visible {
    box-shadow: 0 0 0 4px
        color-mix(in oklab, var(--accent, #4fd1c5) 30%, transparent),
      0 0 16px color-mix(in oklab, var(--accent, #4fd1c5) 50%, transparent);
  }

  /* Ensure text remains readable when zoomed */
  .hero-tagline,
  .hero-about,
  .section-subtitle {
    max-width: none;
    text-align: center;
  }
}

/* Reduce motion on mobile if preferred */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .hero-card,
  .tl-card,
  .project-card,
  .btn {
    transform: none !important;
    transition: none !important;
  }

  .timeline-axis--progress {
    transform: translateX(-50%) scaleY(1) !important;
  }
}
