/* ============================================
   BAR ESTARELLAS — Responsive
   ============================================ */

@media (max-width: 1024px) {
  :root { --section-padding: 80px; }

  .hero .container {
    flex-direction: column;
    text-align: center;
  }
  .hero__content { max-width: 600px; margin-inline: auto; }
  .hero__actions { justify-content: center; }
  .hero__badges { justify-content: center; }
  .hero__rating { justify-content: center; }
  .hero__image-col { max-width: 480px; margin-inline: auto; margin-top: 3rem; }

  .about-split {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }
  .about-split__image { max-width: 500px; margin-inline: auto; }
  .about-split__text .decor-line { margin-inline: auto; }
  .about-split__text p { margin-inline: auto; }

  .menu-grid { grid-template-columns: repeat(2, 1fr); }

  .menu-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0.6rem 1rem;
    margin-inline: -1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(90deg, transparent, black 1rem, black calc(100% - 1rem), transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, black 1rem, black calc(100% - 1rem), transparent);
  }
  .menu-filter::-webkit-scrollbar { display: none; }
  .menu-filter__btn { flex-shrink: 0; }

  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid > :last-child {
    grid-column: span 2;
    max-width: 450px;
    margin-inline: auto;
  }

  .gallery {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 200px;
  }

  .reviews-grid { grid-template-columns: repeat(2, 1fr); }

  .contact-grid { grid-template-columns: 1fr; }

  .offers-week { grid-template-columns: repeat(4, 1fr); }

  .footer__grid { grid-template-columns: repeat(2, 1fr); }
  .footer__grid > :first-child { grid-column: span 2; }
}

@media (max-width: 768px) {
  :root { --section-padding: 64px; --gap: 1.5rem; }

  .navbar__nav {
    display: none;
    position: fixed;
    top: 0; left: 0;
    /* Size with explicit width/height (NOT right/bottom): when the navbar is
       .scrolled it has backdrop-filter, which makes it the containing block for
       this fixed child — right/bottom would then resolve to the navbar's 66px box
       and the overlay would collapse, letting the page show through. */
    width: 100%;
    height: 100vh;
    height: 100dvh;
    /* Fully opaque so page content can never show through (a full-screen
       backdrop-blur can't fully hide high-contrast text and costs GPU on scroll) */
    background: var(--color-bg);
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    gap: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 5.5rem 1.5rem 2.5rem;
    z-index: 999;
  }
  .navbar__nav.active { display: flex; }
  .navbar__links { flex-direction: column; gap: 1.5rem; align-items: center; }
  .navbar__link { font-size: 1.3rem; color: var(--color-text) !important; }
  .navbar__toggle { display: flex; }

  .navbar__toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
  .navbar__toggle.active span:nth-child(2) { opacity: 0; }
  .navbar__toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

  .lang-switch { margin-top: 1rem; border-color: var(--color-border) !important; }
  .navbar__nav .lang-switch__btn { color: var(--color-text-light) !important; }
  .navbar__nav .lang-switch__btn.active { color: #fff !important; }

  .hero { min-height: auto; padding: 120px 0 60px; }
  .hero__gallery-preview { display: none; }

  .menu-grid { grid-template-columns: 1fr; }
  .menu-grid--compact { grid-template-columns: 1fr; }

  /* Paged: one column per page on phones, so a page fits the screen */
  .menu-page__grid { grid-template-columns: 1fr; }
  .menu-page__title { font-size: 1.05rem; }
  .menu-pages__nav { gap: 0.75rem; }

  .menu-grid--editorial { padding: 2rem 1.1rem; }
  .menu-grid--editorial::before, .menu-grid--editorial::after { width: 18px; height: 18px; }
  .menu-card--editorial .menu-card__name { white-space: normal; font-size: 0.95rem; line-height: 1.3; }
  .menu-card--editorial .menu-card__desc { font-size: 0.8rem; margin-left: 1.7rem; }
  .menu-card--editorial .menu-card__badge { margin-left: 1.7rem; }
  .menu-card--editorial .menu-card__number { width: 22px; height: 22px; }
  /* Orphaned leader dots collapse to a stub when names wrap — cleaner to drop them */
  .menu-card--editorial .menu-card__dots { display: none; }
  .menu-card--editorial .menu-card__price { margin-left: auto; }

  .menu-card--has-image { display: grid; grid-template-columns: 100px 1fr; }
  .menu-card--has-image .menu-card__image { height: 100%; border-radius: 14px 0 0 14px; }
  .menu-card--has-image .menu-card__image::after { display: none; }

  /* Booking modal — compact so it fits on a phone without scrolling.
     Paired fields stay side-by-side (stacking them is what forced the scroll). */
  .modal-overlay { padding: 0.6rem; }
  .modal { max-height: 94vh; border-radius: 22px; }
  /* Compact header on phones: keep just the title (icon + subtitle hidden to save space) */
  .modal__header { padding: 0.85rem 1.25rem 0.6rem; }
  .modal__icon { display: none; }
  .modal__subtitle { display: none; }
  .modal__title { font-size: 1.2rem; margin-bottom: 0; }
  .modal__divider { margin: 0 1.25rem; }
  .modal__close { top: 0.7rem; right: 0.7rem; width: 30px; height: 30px; border-radius: 9px; }
  .modal__body { padding: 0.7rem 1.25rem 1.1rem; }
  .form-group { margin-bottom: 0.55rem; }
  .form-group__label { font-size: 0.7rem; margin-bottom: 0.22rem; gap: 0.3rem; letter-spacing: 0.03em; }
  .form-group__icon { width: 14px; height: 14px; }
  .form-group__input { padding: 0.58rem 0.8rem; border-radius: 10px; }
  .form-group__input--select { background-position: right 0.8rem center; padding-right: 2.1rem; }
  textarea.form-group__input { min-height: 40px; }
  .form-group__row { grid-template-columns: 1fr 1fr; gap: 0.55rem; }
  .table-selection__options { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 0.45rem; }
  .table-selection__option { padding: 0.45rem 0.6rem; column-gap: 0.5rem; border-radius: 11px; }
  .table-selection__option-name { font-size: 0.82rem; }
  .table-selection__option-avail { font-size: 0.66rem; }
  .table-selection__option-dot { width: 13px; height: 13px; }
  .table-selection__option-icon { font-size: 1.05rem; }
  .table-selection__duration { margin-top: 0.3rem; font-size: 0.7rem; }
  .modal__submit { padding: 0.72rem 1rem; font-size: 0.9rem; border-radius: 12px; margin-top: 0.15rem; }
  .modal__submit svg { width: 16px; height: 16px; }
  .modal__phone-alt { margin-top: 0.5rem; padding-top: 0.5rem; font-size: 0.78rem; }

  .info-grid { grid-template-columns: 1fr; }
  .info-grid > :last-child { grid-column: span 1; }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 180px;
  }
  .gallery__item--wide { grid-column: span 1; }
  .gallery__item--tall { grid-row: span 1; }

  .reviews-grid { grid-template-columns: 1fr; }

  /* Week offers become a swipeable snap carousel — one row instead of a long stack */
  .offers-week {
    display: flex;
    grid-template-columns: none;
    gap: 0.9rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 1rem;
    /* faint edge fade hints there is more to swipe */
    mask-image: linear-gradient(90deg, transparent 0, black 3%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, black 3%, black 92%, transparent 100%);
  }
  .offers-week::-webkit-scrollbar { display: none; }
  .offer-card {
    scroll-snap-align: start;
    flex: 0 0 82%;
  }
  .offer-card:hover { transform: none; }

  .offer-today { flex-direction: column; text-align: center; padding: 2rem 1.5rem; }
  .offer-today__price { align-self: center; }

  /* ---- Sticky category bar: switch categories anytime while browsing ---- */
  .menu-filter {
    position: sticky;
    top: 62px;                 /* just under the fixed navbar (~67px when scrolled) */
    z-index: 40;
    gap: 0.5rem;
    justify-content: flex-start;
    /* bleed edge-to-edge so it reads as a real toolbar when stuck */
    margin: 0 -4vw 1.75rem;
    padding: 0.65rem 4vw;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 4vw;
    background: rgba(250, 247, 243, 0.9);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    box-shadow: inset 0 -1px 0 var(--color-border);
    /* the desktop edge-fade mask would also fade the solid bar bg — drop it */
    -webkit-mask-image: none;
    mask-image: none;
  }
  .menu-filter__btn {
    scroll-snap-align: start;
    padding: 0.5rem 0.95rem 0.5rem 0.85rem;
    font-size: 0.8rem;
    min-height: 40px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  }
  .menu-filter__icon { font-size: 1rem; }
  .menu-filter__icon svg { width: 17px; height: 17px; }
  .menu-filter__count { width: 21px; height: 21px; font-size: 0.66rem; }

  .menu-card__name { font-size: 0.88rem; }
  .menu-card__desc { font-size: 0.72rem; }

  .footer__grid { grid-template-columns: 1fr; }
  .footer__grid > :first-child { grid-column: span 1; }
  .footer__bottom { flex-direction: column; gap: 0.8rem; text-align: center; }
}

@media (max-width: 480px) {
  :root { --section-padding: 48px; }

  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.8rem; }

  .hero__actions { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; padding: 0.85rem 1.6rem; }

  .card-3d { padding: 1.5rem; border-radius: 14px; }

  .gallery { grid-template-columns: 1fr; grid-auto-rows: 220px; }

  .offer-card { flex-basis: 86%; }

  .float-shapes { display: none; }
}

/* ============================================
   Mobile UX polish — touch targets, contrast,
   iOS zoom guard, safe-area insets
   ============================================ */
@media (max-width: 768px) {
  /* Hamburger: real 44px tap target + guaranteed contrast over the hero photo.
     (Only shown at <=768px, so these are scoped here, not to the tablet navbar.) */
  .navbar__toggle {
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: background 0.3s ease;
  }
  .navbar:not(.scrolled) .navbar__toggle {
    background: rgba(20, 12, 8, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  .navbar__toggle.active {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Mobile nav overlay: space the CTA out from the links + comfortable tap targets */
  .navbar__nav { gap: 1.5rem; }
  .navbar__links { gap: 1.75rem; }
  .navbar__cta {
    padding: 0.9rem 2rem;
    font-size: 1rem;
  }
  .lang-switch__btn { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
}

@media (max-width: 768px) {
  /* Prevent iOS from zooming when focusing form fields (needs >=16px) */
  .form-group__input,
  .form-group__input--select,
  textarea.form-group__input {
    font-size: 16px;
  }

  /* Back-to-top: keep clear of the iOS home indicator, sit above content */
  .back-to-top {
    right: 1.1rem;
    bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
    width: 46px;
    height: 46px;
    z-index: 950;
  }

  /* Comfortable minimum tap target for nav links */
  .navbar__link { padding: 0.35rem 0.5rem; }

  /* Honor the notch/safe areas on the sides */
  .container { padding-inline: max(0px, env(safe-area-inset-left)) max(0px, env(safe-area-inset-right)); }
}

/* Very short viewports (small phones, landscape) — trim the booking modal
   a little more so it still fits without scrolling. */
@media (max-width: 768px) and (max-height: 720px) {
  .modal-overlay { padding: 0.4rem; }
  .modal { max-height: 98vh; }
  .modal__subtitle { display: none; }
  .modal__header { padding: 0.75rem 1.25rem 0.45rem; }
  .modal__icon { width: 32px; height: 32px; margin-bottom: 0.25rem; }
  .modal__icon svg { width: 19px; height: 19px; }
  .modal__title { font-size: 1.12rem; }
  .modal__body { padding: 0.55rem 1.1rem 0.7rem; }
  .form-group { margin-bottom: 0.34rem; }
  .form-group__label { margin-bottom: 0.16rem; font-size: 0.68rem; }
  .form-group__input { padding: 0.48rem 0.75rem; }
  textarea.form-group__input { min-height: 30px; }
  .table-selection__option { padding: 0.42rem 0.5rem; column-gap: 0.45rem; }
  .table-selection__option-dot { width: 12px; height: 12px; }
  .table-selection__option-name { font-size: 0.78rem; }
  .table-selection__option-avail { font-size: 0.64rem; }
  .table-selection__duration { margin-top: 0.2rem; font-size: 0.66rem; }
  .modal__submit { padding: 0.6rem 1rem; font-size: 0.86rem; }
  .modal__phone-alt { margin-top: 0.35rem; padding-top: 0.35rem; font-size: 0.74rem; }
}

/* Users who prefer reduced motion get a calmer experience */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal--left, .reveal--right { opacity: 1 !important; transform: none !important; }
}
