/* Garrafeira Pepe – Catálogo Flipbook (estilo alinhado com garrafeirapepe.pt) */
.gp-flipbook {
  --gp-cor: #8b1e24;
  --gp-cor-escura: #6f171c;
  --gp-fundo: #f5f5f5;
  --gp-texto: #2b2b2b;
  --gp-suave: #6b6b6b;
  position: relative;
  width: 100%;
  margin: 0 auto var(--gp-espaco, 40px);
  padding: 28px 16px 0;
  z-index: 2;
  clear: both;
  border-radius: 6px;
  background: var(--gp-fundo);
  color: var(--gp-texto);
  font-family: inherit;
  box-sizing: border-box;
}
.gp-flipbook *, .gp-flipbook *::before, .gp-flipbook *::after { box-sizing: border-box; }

.gp-flipbook__stage { position: relative; margin: 0 auto; width: 100%; max-width: 100%; min-height: 240px; }
.gp-flipbook__book { margin: 0 auto; filter: drop-shadow(0 10px 22px rgba(0,0,0,.14)) drop-shadow(0 2px 4px rgba(0,0,0,.08)); }

.gp-page { background: #fff; overflow: hidden; }
.gp-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #f1f1f1 30%, #fafafa 50%, #f1f1f1 70%);
  background-size: 300% 100%;
  animation: gp-shimmer 1.4s linear infinite;
}
.gp-page.is-ready::before { display: none; }
.gp-page__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: fill; user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.gp-page__links { position: absolute; inset: 0; }
.gp-link {
  position: absolute; display: block; border-radius: 3px; cursor: pointer;
  transition: background-color .2s, box-shadow .2s;
  -webkit-tap-highlight-color: rgba(139, 30, 36, .18);
}
.gp-link:hover, .gp-link:focus-visible {
  background: rgba(139, 30, 36, .08);
  box-shadow: 0 0 0 2px rgba(139, 30, 36, .55);
  outline: none;
}

/* Carregamento */
.gp-flipbook__loading {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; font-size: 15px; text-align: center; color: var(--gp-suave);
}
.gp-flipbook__loading[hidden] { display: none; }
.gp-flipbook__loading a { color: var(--gp-cor); }
.gp-flipbook__spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(139, 30, 36, .15);
  border-top-color: var(--gp-cor);
  border-radius: 50%;
  animation: gp-spin .9s linear infinite;
}
.gp-flipbook__loading.is-error .gp-flipbook__spinner { display: none; }

/* Barra de controlos */
.gp-flipbook__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; row-gap: 10px;
  max-width: 1120px; margin: 0 auto; padding: 20px 0;
}
.gp-flipbook__spacer { flex: 1; }
.gp-flipbook__count {
  min-width: 74px; text-align: center; font-size: 15px; font-weight: 600;
  color: var(--gp-texto); font-variant-numeric: tabular-nums;
}
.gp-flipbook__btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 14px;
  border: 1.5px solid var(--gp-cor);
  border-radius: 4px;
  background: #fff;
  color: var(--gp-cor);
  font: inherit; font-size: 22px; line-height: 1; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.gp-flipbook__btn:hover { background: var(--gp-cor); color: #fff; }
.gp-flipbook__btn:focus-visible { outline: 2px solid var(--gp-cor); outline-offset: 2px; }
.gp-flipbook__btn--text { font-size: 15px; }
.gp-flipbook__btn--text[download] { background: var(--gp-cor); color: #fff; }
.gp-flipbook__btn--text[download]:hover { background: var(--gp-cor-escura); border-color: var(--gp-cor-escura); }

/* Ecrã inteiro (também funciona no iPhone) */
.gp-flipbook.is-full {
  position: fixed; inset: 0; z-index: 999999; margin: 0; border-radius: 0;
  display: flex; flex-direction: column; justify-content: center; padding-top: 12px;
}
html.gp-noscroll, html.gp-noscroll body { overflow: hidden; }

.gp-flipbook-erro { padding: 12px; border: 1px solid #c00; background: #fff4f4; color: #900; }

@media (max-width: 600px) {
  .gp-flipbook { padding: 16px 8px 0; }
  .gp-flipbook__bar { padding: 14px 4px; gap: 6px; }
  .gp-flipbook__btn--text span { display: none; }
  .gp-flipbook__btn--text { font-size: 18px; padding: 0 12px; }
}

@keyframes gp-spin { to { transform: rotate(360deg); } }
@keyframes gp-shimmer { to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  .gp-page::before, .gp-flipbook__spinner { animation: none; }
  .gp-flipbook__btn, .gp-link { transition: none; }
}

/* Ligação de recurso: aparece se o catálogo demorar mais de 10 s (funciona mesmo sem JavaScript) */
.gp-flipbook__fallback {
  opacity: 0; visibility: hidden;
  font-size: 14px; color: var(--gp-cor); text-decoration: underline;
  animation: gp-show 0s linear 10s forwards;
}
@keyframes gp-show { to { opacity: 1; visibility: visible; } }

/* Proteção: o bloco que contém o catálogo cresce com ele (anula alturas fixas de construtores de páginas) */
.elementor-widget-shortcode:has(.gp-flipbook),
.elementor-widget-shortcode:has(.gp-flipbook) .elementor-widget-container,
.elementor-shortcode:has(.gp-flipbook),
.e-con:has(.gp-flipbook),
.elementor-section:has(.gp-flipbook),
.elementor-column:has(.gp-flipbook),
.elementor-widget-wrap:has(.gp-flipbook),
.wp-block-shortcode:has(.gp-flipbook) {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

/* Lupa */
.gp-lens {
  position: absolute; left: 0; top: 0; z-index: 20;
  width: 190px; height: 190px; border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1.5px var(--gp-cor), 0 10px 28px rgba(0,0,0,.28);
  background-color: #fff; background-repeat: no-repeat;
  pointer-events: none; opacity: 0; transition: opacity .12s;
  will-change: transform;
}
.gp-lens.is-visible { opacity: 1; }
.gp-lens-shield { position: absolute; inset: 0; z-index: 15; display: none; }
.gp-flipbook.is-lens .gp-lens-shield { display: block; cursor: zoom-in; }
@media (pointer: fine) { .gp-flipbook.is-lens .gp-lens-shield { cursor: none; } }
.gp-flipbook.is-lens.is-touch .gp-lens-shield { touch-action: none; }
.gp-flipbook__btn[aria-pressed="true"] { background: var(--gp-cor); color: #fff; }
.gp-flipbook__btn svg { display: block; }
@media (max-width: 600px) {
  .gp-lens { width: 150px; height: 150px; }
  .gp-flipbook__bar { gap: 4px; }
  .gp-flipbook__btn, .gp-flipbook__btn--text { min-width: 40px; height: 42px; padding: 0 8px; }
  .gp-flipbook__count { min-width: 52px; font-size: 14px; }
}
@media (max-width: 340px) {
  .gp-flipbook { padding-left: 4px; padding-right: 4px; }
  .gp-flipbook__btn, .gp-flipbook__btn--text { min-width: 36px; padding: 0 6px; }
  .gp-flipbook__count { min-width: 46px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .gp-lens { transition: none; } }

/* Zoom */
.gp-flipbook__zoom { display: inline-flex; align-items: stretch; }
.gp-flipbook__zoom .gp-flipbook__btn:first-child { border-radius: 4px 0 0 4px; }
.gp-flipbook__zoom .gp-flipbook__btn:last-child { border-radius: 0 4px 4px 0; }
.gp-flipbook__level {
  width: 64px; height: 44px; margin: 0 -1.5px; padding: 0 4px;
  border: 1.5px solid var(--gp-cor); border-radius: 0; background: #fff; color: var(--gp-cor);
  font: inherit; font-size: 14px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums;
  cursor: text; position: relative; z-index: 1; box-shadow: none; -webkit-appearance: none; appearance: none;
}
.gp-flipbook__level:hover { background: #fbf4f4; }
.gp-flipbook__level:focus { outline: none; box-shadow: inset 0 0 0 2px var(--gp-cor); background: #fff; }
.gp-flipbook__btn:disabled { opacity: .4; cursor: default; background: #fff; color: var(--gp-cor); }
.gp-zoom {
  position: absolute; inset: 0; z-index: 12; display: none;
  overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--gp-fundo); cursor: grab; border-radius: 2px;
}
.gp-zoom.is-dragging { cursor: grabbing; }
.gp-zoom.is-dragging .gp-link { pointer-events: none; }
.gp-zoom:focus-visible { outline: 2px solid var(--gp-cor); outline-offset: 2px; }
.gp-flipbook.is-zoomed .gp-zoom { display: block; }
.gp-flipbook.is-zoomed .gp-flipbook__book { visibility: hidden; }
.gp-zoom__inner { display: flex; width: max-content; margin: 0 auto; }
.gp-zoom__page { position: relative; flex: none; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.08); }

/* Ecrãs estreitos: navegação numa linha, ferramentas noutra */
@media (max-width: 600px) {
  .gp-flipbook__bar { justify-content: center; row-gap: 8px; }
  .gp-flipbook__spacer { flex-basis: 100%; height: 0; }
  .gp-flipbook__level { width: 58px; height: 42px; }
}


/* Ecrãs médios (tablets): navegação numa linha e ferramentas centradas noutra */
@media (min-width: 601px) and (max-width: 1060px) {
  .gp-flipbook__bar { justify-content: center; }
  .gp-flipbook__spacer { flex-basis: 100%; height: 0; }
}
@media (max-width: 340px) { .gp-flipbook__level { width: 52px; } }

/* Ecrãs baixos (telemóvel deitado): barra numa só linha e compacta */
@media (max-height: 520px) {
  .gp-flipbook { padding-top: 10px; }
  .gp-flipbook__bar { flex-wrap: nowrap; justify-content: center; padding: 8px 0; gap: 4px; }
  .gp-flipbook__spacer { flex: 1 1 auto; flex-basis: auto; height: auto; }
  .gp-flipbook__zoom { flex-basis: auto; }
  .gp-flipbook__btn, .gp-flipbook__btn--text { min-width: 38px; height: 38px; padding: 0 8px; }
  .gp-flipbook__btn--text span { display: none; }
  .gp-flipbook__level { width: 54px; height: 38px; }
}
