/* ==========================================================================
   Alpina Eucaliptos — galeria por categorias (usa os tokens e componentes de style.css)
   ========================================================================== */

/* ---------- Menu sobre o fundo creme (mesmo visual da barra fixa da home) ---------- */
.site-nav--page {
  position: relative;
  top: auto; left: auto; right: auto;
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--line);
}
.site-nav--page .site-nav__logo img { filter: none; }
.site-nav--page .nav-pill { color: var(--ink); background: transparent; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.site-nav--page .nav-pill:hover,
.site-nav--page .nav-item:focus-within > .nav-pill,
.site-nav--page .nav-pill[aria-current="page"] { background: rgba(20, 33, 20, 0.06); }
.site-nav--page .nav-toggle { background: rgba(20, 33, 20, 0.06); }
.site-nav--page .nav-cta { background: var(--forest-900); color: #fff; }
.site-nav--page .nav-cta:hover { background: var(--ink); }

/* ---------- Título ---------- */
.gal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  align-items: start;
  gap: 24px 64px;
  padding: clamp(36px, 4.5vw, 64px) 0 clamp(32px, 4vw, 48px);
}
.gal-head__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.4rem, 8.4vw, 7.25rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  color: var(--ink);
}
.gal-head__text { color: var(--ink-2); font-size: 16.5px; padding-bottom: 8px; }
.gal-head__text p + .arrow-link { margin-top: 14px; }

/* ---------- Mosaico (as fotos mantêm a proporção original) ---------- */
.gallery-page { padding-bottom: clamp(80px, 10vw, 128px); }
.gal-masonry { columns: 4 240px; column-gap: 16px; }
.gal-photo,
.gal-cover { display: block; break-inside: avoid; }
.gal-photo,
.gal-cover__img {
  position: relative;
  display: block;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #e4e1d8;
}
.gal-photo { margin-bottom: 16px; cursor: zoom-in; }
.gal-photo img,
.gal-cover__img img { width: 100%; height: auto; transition: transform 1s var(--ease); }
.gal-photo:hover img,
.gal-cover:hover .gal-cover__img img { transform: scale(1.035); }
.gal-photo:focus-visible,
.gal-cover:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: var(--r-md); }

/* Resumo: uma foto por categoria, com nome e quantidade embaixo */
.gal-cover { margin-bottom: 28px; }
.gal-cover__meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 12px; }
.gal-cover__name { font-family: var(--font-display); font-size: clamp(1.1rem, 1.5vw, 1.3rem); letter-spacing: -0.02em; color: var(--ink); }

/* Galeria de uma categoria */
.gal-cat__head { margin-bottom: clamp(28px, 4vw, 44px); }
.gal-back {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 20px;
  font-size: 14.5px; color: var(--muted);
  transition: color .25s ease;
}
.gal-back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease); }
.gal-back:hover { color: var(--ink); }
.gal-back:hover svg { transform: translateX(-3px); }

/* Com JS: "Todas" mostra o resumo; cada categoria abre sozinha */
.js .gal-cat { display: none; }
.js .gal-cat.is-active { display: block; }
.js .gallery-page:not(.is-all) .gal-overview { display: none; }
.gal-cat + .gal-cat { margin-top: 96px; }
.js .gal-cat + .gal-cat { margin-top: 0; }

/* ---------- Visualizador em tela cheia ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  background: rgba(8, 14, 8, 0.94);
  opacity: 0;
  transition: opacity .3s ease;
  overflow: hidden;
  touch-action: none;   /* pinça e arraste ficam com o zoom da foto, não com a página */
}
.lightbox.is-open { opacity: 1; }
.lightbox__figure { display: grid; justify-items: center; gap: 14px; max-width: calc(100vw - 144px); }
.lightbox__img {
  max-width: calc(100vw - 144px); max-height: calc(100svh - 140px);
  width: auto; height: auto;
  border-radius: var(--r-sm);
  transition: opacity .25s ease;
  cursor: zoom-in;
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
  will-change: transform;
}
.lightbox__img.is-anim { transition: opacity .25s ease, transform .3s var(--ease); }
.lightbox__img.is-loading { opacity: 0.25; }
.lightbox.is-zoomed .lightbox__img { cursor: grab; border-radius: 0; }
.lightbox.is-dragging .lightbox__img { cursor: grabbing; }
.lightbox__cap { font-size: 14px; color: rgba(255, 255, 255, 0.7); font-variant-numeric: tabular-nums; transition: opacity .2s ease; }
.lightbox.is-zoomed .lightbox__cap { opacity: 0; }
.lightbox__btn {
  position: absolute;
  z-index: 2;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: background-color .25s ease;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .gal-masonry { columns: 3; }
}
@media (max-width: 767px) {
  .site-nav--page { padding: 16px 0 14px; }
  .gal-head { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .gal-head__text { padding-bottom: 0; }
  .gal-masonry { columns: 2; column-gap: 8px; }
  .gal-photo { margin-bottom: 8px; border-radius: var(--r-sm); }
  .gal-cover__img { border-radius: var(--r-sm); }
  .gal-cover { margin-bottom: 20px; }
  .gal-cover__meta { flex-direction: column; gap: 2px; margin-top: 8px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 18px; transform: none; }
  .lightbox__prev { left: calc(50% - 60px); }
  .lightbox__next { right: calc(50% - 60px); }
  /* em pé: foto de ponta a ponta, como na galeria do celular */
  .lightbox__figure { max-width: 100vw; }
  .lightbox__img { max-width: 100vw; max-height: calc(100svh - 190px); border-radius: 0; }
}
/* celular deitado (tela baixa): a foto usa quase toda a altura e as setas vão para as laterais */
@media (max-height: 560px) and (orientation: landscape) {
  .lightbox__figure { gap: 6px; max-width: none; }
  .lightbox__img { max-width: calc(100vw - 136px); max-height: calc(100svh - 36px); border-radius: var(--r-sm); }
  .lightbox__cap { font-size: 13px; }
  .lightbox__btn { width: 44px; height: 44px; }
  .lightbox__close { top: 10px; right: 12px; }
  .lightbox__prev, .lightbox__next { top: 50%; bottom: auto; transform: translateY(-50%); }
  .lightbox__prev { left: 12px; }
  .lightbox__next { right: 12px; }
  .gal-head { padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .gal-photo img, .gal-cover__img img, .lightbox, .lightbox__img { transition: none; }
}
