/* Tablets and below (768px) */
@media (max-width: 768px) {
  /* General mobile header adjustments */
  .Virsraksti {
    padding-top: 5px; /* Smaller initial padding */
  }
  .logo {
    width: 70px; /* Smaller initial logo */
  }
  .Virsraksti h1 {
    font-size: 26px; /* Smaller initial H1 */
  }
  .Virsraksti p {
    display: none; /* Hide slogan by default on mobile */
  }
  .header-row {
    grid-template-columns: 1fr; /* Stack header elements */
    gap: 10px;
  }
  nav {
    flex-wrap: nowrap; /* Force navigation items into a single row */
    gap: 8px; /* Reduce space between nav items */
    overflow-x: auto; /* Allow horizontal scrolling if content is too wide, though reduced size should prevent it */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }
  nav a {
    font-size: 14px; /* Smaller font size for nav links */
    padding: 2px 2px; /* Reduce padding for nav links */
  }

  /* Scrolled state for mobile */
  .main-header-container.scrolled .Virsraksti {
    padding-top: 0; /* Even smaller padding when scrolled */
    height: auto; /* Allow header-row to shrink based on content */
    min-height: 0; /* Ensure no minimum height is enforced on header-row */
    gap: 0; /* Remove gap to collapse white space fully */
  }
  .main-header-container.scrolled .logo {
    width: 50px; /* Even smaller logo when scrolled */
  }
  .main-header-container.scrolled .Virsraksti h1 {
    font-size: 18px; /* Even smaller H1 when scrolled */
  }
  /* .Virsraksti p is already display: none, so no change needed for scrolled state */

  /* Ensure the header-row itself collapses smoothly */
  .main-header-container.scrolled .header-spacer {
    display: none; /* Hide empty spacer on scroll to save height */
  }

  .main-header-container.scrolled .lang-wrapper {
    opacity: 0;
    visibility: hidden;
    max-height: 0;    /* Collapse height smoothly */
    height: 0;        /* Ensure height collapses */
    min-height: 0;    /* Prevent min-height from holding space */
    margin: 0;        /* Remove margins smoothly */
    padding: 0;       /* Remove padding smoothly */
    pointer-events: none; /* Prevent interaction during/after fade */
  }
  /* Existing rules */
  .pamatteksts {
    flex-direction: column;
    align-items: center;
  }
  .review {
    width: 300px; /* Make review cards a bit smaller */
  }
  .contact-info {
    text-align: center;
  }
  /* Ensure Pakalpojumi cards stack in 1 column and match other card widths */
  .services-grid {
    grid-template-columns: 1fr !important;
    justify-items: center;
  }
  .service-card {
    max-width: 305px; /* Matches the max-width of .pamatteksts cards for consistency */
    width: 100%;
  }
}

/* Small tablets and large phones (600px) */
@media (max-width: 600px) {
  .cookie-banner {
    flex-direction: column; /* Stack text and button vertically on small screens */
    padding: 15px 10px;
  }
}

/* Small phones (480px) */
@media (max-width: 480px) {
  /* Further reduce header elements for very small screens */
  .logo {
    width: 60px; /* Smaller logo */
  }
  .Virsraksti h1 {
    font-size: 22px; /* Smaller H1 */
  }
}