/* ==========================================================
   Mobile / responsive — overrides shared across all pages
   ========================================================== */

/* Hamburger — hidden on desktop */
.nav-burger {
  display: none;
  width: 44px; height: 44px;
  position: relative;
  background: transparent;
  border: 0;
  padding: 0;
  z-index: 60;
  cursor: pointer;
  /* Sem isto o browser espera para ver se o toque é um arrastar ou um
     duplo-toque para ampliar, antes de disparar o clique. Era esse o atraso
     que fazia o menu parecer que não respondia. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
  transition: background .12s var(--ease);
}
/* Num telemóvel não há :hover — o sinal de que o toque foi registado é este. */
.nav-burger:active {
  background: color-mix(in oklab, var(--ink) 14%, transparent);
}
/* As barras não devem ser alvo próprio: um toque na barra é um toque no botão. */
.nav-burger span {
  pointer-events: none;
  position: absolute;
  left: 10px; right: 10px;
  height: 1.5px;
  background: var(--ink);
  transition: transform .3s var(--ease), opacity .2s var(--ease), top .3s var(--ease);
}
.nav-burger span:nth-child(1) { top: 15px; }
.nav-burger span:nth-child(2) { top: 21px; }
.nav-burger span:nth-child(3) { top: 27px; }
body.is-nav-open .nav-burger span:nth-child(1) { top: 21px; transform: rotate(45deg); }
body.is-nav-open .nav-burger span:nth-child(2) { opacity: 0; }
body.is-nav-open .nav-burger span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* ==========================================================
   ≤ 720px — tablet / large phone
   ========================================================== */
@media (max-width: 720px) {
  .nav-burger { display: block; }

  /* Painel do menu.
     Fechado é display:none — não existe: não é desenhado, não ocupa caixa,
     não apanha toques, não é lido por leitores de ecrã nem alcançado pelo
     teclado. Uma propriedade faz tudo isso.
     Antes eram três (opacity + visibility + pointer-events) para poder
     desvanecer, porque o display não se anima. Trocou-se a transição pela
     simplicidade: num menu que se abre e fecha em segundos, os 200ms não
     estavam a ganhar nada — e era a animação de uma superfície do tamanho
     do ecrã por cima de uma página com 23 fotografias. */
  .nav { display: none; }
  body.is-nav-open .nav {
    display: flex;
    position: fixed;
    inset: 0;
    background: var(--bg);
    flex-direction: column;
    justify-content: center;
    /* stretch, não center: cada item ocupa a linha toda e fica tocável em
       qualquer ponto dela. Antes só o texto respondia — entre 66 e 112px
       de 390 de ecrã. */
    align-items: stretch;
    gap: 20px;
    padding: 80px 24px 40px;
    z-index: 55;
    overflow-y: auto;
  }
  body.is-nav-open { overflow: hidden; }
  .nav a {
    font-family: var(--serif);
    font-size: 28px;
    color: var(--ink);
    padding: 8px 0;
    /* alvo de toque de 44px no menu mobile */
    display: flex;
    align-items: center;
    min-height: 44px;
    /* Texto ao centro, mas o alvo é a linha inteira — o align-items:stretch
       da .nav dá-lhe a largura toda. */
    justify-content: center;
    text-align: center;
    /* manipulation diz ao browser que aqui não há duplo-toque para ampliar
       nem arrastar: o toque dispara já, em vez de esperar para ver. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    border-radius: 10px;
    transition: background .12s var(--ease), transform .12s var(--ease);
  }
  /* Num telemóvel não existe :hover — o retorno ao toque é o :active.
     Sem isto, tocar num item não dava sinal nenhum até a página mudar. */
  .nav a:active {
    background: color-mix(in oklab, var(--ink) 12%, transparent);
    transform: scale(0.98);
  }
  .nav a.is-active::after { display: none; }
  .lang-toggle { margin-top: 16px; align-self: center; }

  /* Hero / sections — reduce padding (covers all page hero variants) */
  .hero,
  .menu-hero,
  .loc-hero,
  .gallery-hero,
  .galeria-hero,
  .res-hero { padding: 120px var(--gutter) 48px !important; gap: 32px !important; }
  .section,
  .menu-body,
  .loc-contact,
  .loc-hours { padding-top: 60px !important; padding-bottom: 60px !important; }

  /* Hero scroll indicator — hide vertical text on mobile */
  .hero-scroll-indicator { display: none !important; }

  /* Footer — single column */
  /* a .row passou a flex: empilhar é mudar a direção, não as colunas da grelha.
     Sem isto, as três colunas ficavam lado a lado e a página rolava de lado. */
  .site-footer .row { flex-direction: column !important; flex-wrap: nowrap !important; gap: 32px; }
  .site-footer .row > div,
  .site-footer .row > div:first-child { flex: 0 0 auto !important; max-width: none !important; }
  /* Sem gap nas listas: aqui em baixo cada link recebe min-height: 44px para o
     dedo acertar, e todos os itens do rodapé passam a ter 42-44px de altura
     (Navegar 5x44, Seguir 2x44, Contacto 42+42+44). A caixa já é a separação —
     o gap de 8px do styles.css vinha a somar por cima e dava 52px de passo para
     14px de letra, quase o dobro do ritmo do computador. */
  .site-footer .row ul { gap: 0; }
  /* Os créditos ficam ao centro. São o fecho do rodapé, abaixo de um filete
     e separados das colunas — não competem com o alinhamento delas.
     No desktop não estão centrados: a .legal é uma linha com
     justify-content: space-between, com um item em cada ponta. Empilhada
     numa coluna, o space-between deixa de ter efeito e é preciso dizer
     onde os pôr. */
  .site-footer .legal { flex-direction: column; gap: 8px; align-items: center; text-align: center; }
  .site-footer .legal a { display: inline-flex; align-items: center; min-height: 44px; }
  .site-footer { padding: 48px var(--gutter) 32px; margin-top: 64px; }

  /* Menu page — single column for grids */
  .menu-grid,
  .menu-cards,
  .cards-grid { grid-template-columns: 1fr !important; }

  /* Gallery — 2 cols at most */
  .gallery-grid,
  .grid-gallery { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }

  /* Reservas modal — single column */
  .res-form-wrap,
  .res-modal .res-form-wrap { grid-template-columns: 1fr !important; gap: 16px !important; }
  .res-modal { padding: 24px !important; }

  /* Time picker / day picker — guarantee 44px touch targets */
  .tp-slot { min-height: 44px; padding: 12px 8px !important; }
  .dp-day { min-height: 44px; }
  .party button { min-width: 44px; min-height: 44px; }

  /* Reservas stepper — keep everything within the viewport */
  .res-body { padding-left: var(--gutter); padding-right: var(--gutter); }
  [data-reservation-mode="stepper"] .res-form-wrap { max-width: 100%; }
  [data-reservation-mode="stepper"] .res-block.step-1.is-current .datepicker,
  [data-reservation-mode="stepper"] .res-block.step-1.is-current .tp-slots {
    max-width: 100% !important;
  }
  .datepicker { padding: 10px !important; }
  .tp-slots { grid-template-columns: repeat(4, 1fr) !important; }

  /* Step indicator — compact so 3 steps fit narrow screens */
  .step-indicator { gap: 0; margin-bottom: 32px; }
  .step-line { width: auto; flex: 1; min-width: 12px; margin: 0 8px; }
  .step-dot span:not(.num) { display: none; }
  .step-dot.is-active span:not(.num) { display: inline; }

  /* Touch targets ≥ 44px — language toggle + footer links */
  .lang-toggle button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
  }
  .site-footer a,
  .visit-block a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .site-footer .legal a { min-height: 44px; }

  /* Filter chips — comfortable tap height */
  .filter,
  .gf-filter {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Facade slider — show nav buttons always (no hover on touch) */
  .facade-slider .fs-nav,
  .fs-nav { opacity: 1 !important; }

  /* Map overlay — more breathable */
  .loc-map-overlay { padding: 16px !important; }
  .loc-map-overlay h3 { font-size: 20px !important; }

  /* Lightbox — smaller buttons, ensure within viewport */
  .lb-close, .lb-prev, .lb-next { width: 44px !important; height: 44px !important; }

  /* Generic safety: prevent horizontal overflow */
  body { overflow-x: hidden; }
  img, iframe, video { max-width: 100%; height: auto; }
}

/* ==========================================================
   ≤ 480px — small phones (iPhone SE etc.)
   ========================================================== */
@media (max-width: 480px) {
  :root { --gutter: 18px; }

  .hero { padding: 90px 18px 48px !important; }
  .hero h1 { font-size: clamp(40px, 11vw, 56px) !important; line-height: 1.05 !important; }
  .hero-aside p { font-size: 15px !important; }

  .section { padding: 48px 18px !important; }
  .section h2,
  h2.section-title { font-size: clamp(28px, 8vw, 38px) !important; }

  /* Even tighter cards */
  .gallery-grid,
  .grid-gallery { grid-template-columns: 1fr !important; }

  /* Brand: drop to icon + small name (com alvo de toque de 44px) */
  .brand { font-size: 15px; gap: 8px; min-height: 44px; }
  .brand-mark { width: 24px; height: 24px; font-size: 14px; }

  /* Lang toggle smaller — mas nunca abaixo dos 44px de alvo de toque */
  .lang-toggle button {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 44px;
    min-height: 44px;
  }

  /* Reservas inputs — full width, comfortable height */
  .res-form input,
  .res-form select,
  .res-form textarea {
    font-size: 16px !important;  /* prevents iOS zoom on focus */
    min-height: 44px;
  }

  /* Site footer tighter */
  .site-footer .tagline { font-size: 22px; }

  /* Buttons: ensure tap height */
  .btn { min-height: 44px; padding: 12px 22px; }
}

/* ==========================================================
   Ecrãs muito estreitos (iPhone SE, 320px)
   ========================================================== */
@media (max-width: 360px) {
  /* O número de telefone é uma unidade: partido em "+351 939 735" / "148"
     lê-se mal e chega a parecer outro número. A 320px faltava-lhe 1px
     (219 precisos, 218 disponíveis), por causa dos 32px de padding lateral
     do cartão. Menos padding devolve-lhe a linha inteira com folga. */
  .loc-contact-card { padding: 28px 22px 24px; }
}

/* ==========================================================
   Touch devices — disable hover-only reveals
   ========================================================== */
@media (hover: none) {
  .facade-slider .fs-nav,
  .fs-nav { opacity: 1 !important; }
  /* Keep custom cursor hidden (already in styles.css) */
}
