/* Responsive refinements for tablets, iPhone 10+ and Google Pixel 6+ */
@media (max-width: 1024px) {
  #velemeny .review-grid {
    grid-template-columns: 1fr;
  }
}

/* Review CTA layout on small desktops and large tablets */
@media (max-width: 900px) {
  #velemeny .review-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 16px;
    gap: 16px;
  }

  #velemeny .review-content {
    max-width: 36rem;
  }

  #velemeny .review-content p {
    margin: 0;
  }

  #velemeny .review-content .desktop-copy {
    display: none;
  }

  #velemeny .review-content .mobile-copy {
    display: inline;
  }

  #velemeny .review-qr {
    display: none;
  }

  #velemeny .logo-button {
    margin: 10px auto 0 auto !important;
  }

  #velemeny .logo-button.pill {
    display: inline-flex;
    margin: 8px auto 12px auto;
  }

  #velemeny .logo-button:not(.mobile-only) {
    display: none !important;
  }

  #velemeny .logo-button.mobile-only {
    display: inline-flex !important;
    margin: 12px auto 0 auto !important;
  }
}

/* Core layout tweaks for screens up to tablets */
@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .container {
    padding: 1.5rem 1rem;
  }

  .boxed {
    padding: 1rem;
  }

  .booking a {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
  }

  .about-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .updates-box {
    margin: 1.5rem auto;
    padding: 1.5rem;
    max-width: 360px;
    border-radius: 18px;
    border: 1px solid rgba(149, 170, 139, 0.35);
    background: linear-gradient(180deg, rgba(247, 244, 233, 0.92), rgba(236, 231, 218, 0.9));
    box-shadow: 0 12px 32px rgba(68, 88, 64, 0.12);
    text-align: left;
    position: relative;
  }

  .updates-box::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.4);
    pointer-events: none;
  }

  .updates-list {
    padding: 0.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .updates-list li {
    align-items: center;
    gap: 0.55rem;
  }

  .updates-icon {
    font-size: 1.05rem;
    min-width: 1.4rem;
    text-align: center;
    margin-top: 0;
  }

  .updates-text {
    text-align: left;
    font-size: 1.02rem;
    line-height: 1.6;
  }

  .about-text {
    text-align: justify;
  }

  .portrait-img {
    float: none;
    width: 80%;
    max-width: 280px;
    margin: 0 auto 1.5rem auto;
    display: block;
  }

  .gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .gallery img {
    width: 100%;
    height: auto;
    border-radius: 12px;
  }

  .modern-header {
    min-height: 180px;
    padding: 1.1rem 0.5rem 1rem;
  }

  .modern-header h1 {
    font-size: 2rem;
  }

  .modern-header p {
    font-size: 1rem;
  }

  .header-wrap {
    gap: 1.1rem;
    padding: clamp(0.7rem, 2.5vw, 1.2rem) clamp(1.2rem, 5vw, 1.8rem);
  }

  .header-bar {
    align-items: center;
    justify-content: center;
    gap: clamp(1.2rem, 5vw, 1.8rem);
    padding-right: 0;
  }

  .header-logo-text {
    position: relative;
    z-index: 2;
    margin-bottom: 0;
  }

  .logo-icon {
    width: 160px;
  }

  .contact {
    padding: 1.5rem 1.2rem;
  }

  .modern-footer {
    padding: 1rem 0.5rem;
    min-height: 100px;
  }

  .footer-content {
    padding: 0 1rem;
    text-align: center;
  }

  .footer-content p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    word-break: break-word;
    white-space: normal;
  }

  section.boxed ul {
    padding-left: 1.2rem !important;
    margin-left: 0 !important;
  }

  section.boxed li {
    margin-bottom: 0.6rem;
  }

  section.boxed h3 {
    font-size: 1.2rem;
    margin-top: 2rem;
  }

  table {
    font-size: 0.95rem;
  }

  thead {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .service-table th,
  .service-table td {
    font-size: 0.92rem;
    padding: 0.6rem 0.32rem;
  }

  .service-table th:first-child,
  .service-table td:first-child {
    width: 50%;
  }

  .service-table th:nth-child(2),
  .service-table td:nth-child(2),
  .service-table th:nth-child(3),
  .service-table td:nth-child(3) {
    white-space: nowrap;
    text-align: center;
  }

  .service-name-cell {
    gap: 0.55rem;
  }

  .service-name-text {
    font-size: 0.95rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
  }

  .service-info-trigger--leading {
    display: flex;
  }

  .service-info-trigger--leading .material-icons-outlined {
    font-size: 1rem;
  }

  .pay-badges {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    padding: 0.9rem 1rem;
  }

  .badge {
    padding: 0.9rem 0.85rem;
    gap: 0.6rem;
    font-size: 0.9rem;
  }

  .badge-icon {
    width: 2.6rem;
    height: 2.6rem;
    box-shadow: inset 0 0 0 1px rgba(155, 175, 148, 0.4),
      0 6px 14px rgba(63, 88, 64, 0.16);
  }

  .hours-table {
    width: 100%;
    border-collapse: collapse;
  }

  .hours-table th,
  .hours-table td {
    padding: 0.6rem 0.45rem;
    font-size: 0.92rem;
  }

  .hours-table th:first-child,
  .hours-table td:first-child {
    white-space: nowrap;
  }

  .hours-table th {
    font-size: 0.82rem;
    letter-spacing: 0.02em;
  }

  .hours-table td:last-child {
    white-space: nowrap;
  }
}

/* Narrow tablet handling for long tables and dialogs */
@media (max-width: 640px) {
  .responsive-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .service-table {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(63, 88, 64, 0.12);
    table-layout: fixed;
  }

  .service-info-dialog {
    width: 100%;
  }
}

/* Modal fine-tuning on portrait phones */
@media (max-width: 600px) {
  .service-info-dialog {
    padding: 1.5rem 1.25rem;
  }

  .service-info-close {
    top: 0.5rem;
    right: 0.5rem;
  }
}

/* Payment badges stack into two columns on very small screens */
@media (max-width: 520px) {
  .pay-badges {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Button sizing for compact devices */
@media (max-width: 480px) {
  .booking a {
    width: auto;
    min-width: 70%;
    max-width: 280px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    margin: 0 auto;
  }

  .logo-icon {
    width: 140px;
  }
}

/* Dedicated tweaks for iPhone/Pixel widths */
@media (max-width: 430px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .gallery img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }

  .portrait-img {
    width: 60% !important;
    max-width: 200px !important;
  }

  .service-table th,
  .service-table td {
    font-size: 0.86rem;
  }
}

/* Safari-specific stacking fixes for iPhone */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 430px) {
    .header-bar {
      flex-direction: column;
      gap: 0.75rem;
    }

    .nav-toggle {
      align-self: center;
    }
  }
}

/* Extra-high density displays (Pixel series, Pro iPhones) */
@media screen and (max-width: 430px) and (min-resolution: 2dppx) {
  .service-info-dialog {
    padding: 1.25rem 1rem;
  }

  .booking a {
    letter-spacing: 0.03em;
  }
}
