*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: #fff;
  color: #111;
}

/* ─── Header ─────────────────────────────────────────── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

header h1 {
  font-size: 0.93rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #111;
  white-space: nowrap;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  text-decoration: none;
  transition: color 0.15s;
}

.social-links a:hover {
  color: #111;
}

/* ─── Filtros ─────────────────────────────────────────── */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 22px;
}

.filter-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  color: #888;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

.filter-btn:hover { color: #333; }

.filter-btn.active {
  color: #111;
  font-weight: 500;
}

/* ─── Dropdowns ───────────────────────────────────────── */

.dropdown {
  position: relative;
}

.dropdown-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  color: #888;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
  white-space: nowrap;
}

.dropdown-btn:hover { color: #333; }

.dropdown-btn.has-active {
  color: #111;
  font-weight: 500;
}

.dropdown-btn .chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.dropdown.open .chevron { transform: rotate(180deg); }

.dropdown-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #FFE600;
  color: #111;
  font-size: 0.68rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  min-width: 150px;
  z-index: 100;
  overflow: hidden;
}

.dropdown.open .dropdown-menu { display: block; }

.dropdown-item {
  padding: 9px 16px;
  font-size: 0.8rem;
  color: #555;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.dropdown-item:hover { background: #f5f5f5; color: #111; }

.dropdown-item.active {
  color: #111;
  font-weight: 500;
  background: #fffde6;
}

.dropdown-item.active::before {
  content: '✓ ';
  color: #b8a800;
}

/* ─── Setas da galeria ────────────────────────────────── */

.gallery-nav {
  position: fixed;
  top: calc(57px + (100vh - 57px) / 2);
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 16px;
  color: #111;
  z-index: 50;
  opacity: 1;
}

.gallery-nav:hover { opacity: 0.5; }

.gallery-prev { left: 24px; }
.gallery-next { right: 24px; }

.gallery-nav.hidden { opacity: 0; pointer-events: none; }

/* ─── Galeria ─────────────────────────────────────────── */

main {
  overflow-x: scroll;
  overflow-y: hidden;
  height: calc(100vh - 57px);
  padding: 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.gallery {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0;
  height: 100%;
  width: max-content;
}

.gallery-item {
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100vw;
  padding-bottom: 28px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.gallery-item img {
  height: calc((100vh + 335px) / 2);
  width: auto;
  display: block;
  border-radius: 0;
  transition: opacity 0.2s;
  -webkit-user-drag: none;
  user-select: none;
}

.photo-wrapper {
  position: relative;
  display: block;
  line-height: 0;
}

/* Escudo transparente sobre as imagens */
.img-shield {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
  -webkit-user-drag: none;
}

/* Escudo no visualizador — posicionado sobre a foto */
.viewer-img-shield {
  position: absolute;
  cursor: default;
  pointer-events: all;
}


.gallery-item-caption { display: none; }

.empty {
  text-align: center;
  color: #aaa;
  padding: 100px 20px;
  font-size: 0.85rem;
  line-height: 1.8;
  grid-column: 1 / -1;
}

.empty code {
  font-family: monospace;
  background: #f4f4f4;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.82rem;
}

/* ─── Visualizador ────────────────────────────────────── */

.viewer {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer[hidden] {
  display: none;
}

/* Topo */
.viewer-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  z-index: 10;
}

.viewer-counter {
  font-size: 0.75rem;
  color: #555;
  letter-spacing: 0.04em;
}

.viewer-controls {
  display: flex;
  gap: 4px;
}

.viewer-controls button {
  background: none;
  border: 1px solid #ddd;
  color: #888;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}

.viewer-controls button:hover {
  border-color: #aaa;
  color: #111;
}

/* Conteúdo */
.viewer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  padding-top: 50px;
  padding-bottom: 10px;
}

.viewer-img {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  display: block;
}

/* Info da foto */
.viewer-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 0.73rem;
  color: #888;
  letter-spacing: 0.03em;
  text-align: center;
}

.viewer-info .info-filename {
  color: #111;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Setas de navegação */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #ccc;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  z-index: 10;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.nav-btn:disabled {
  opacity: 0.2;
  cursor: default;
}

.nav-btn.prev { left: 18px; }
.nav-btn.next { right: 18px; }

/* ─── Responsivo ──────────────────────────────────────── */

@media (max-width: 768px) {
  /* Header — centralizado no mobile */
  header {
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 14px;
    gap: 10px;
  }

  .header-left {
    display: contents;
  }

  header h1 {
    order: 1;
    font-size: calc(0.93rem * 1.4);
  }

  .social-links {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
  }

  .social-links a {
    color: #666;
  }

  .admin-link {
    display: none;
  }

  .filters {
    order: 3;
    justify-content: center;
    gap: 0 16px;
  }


  /* Esconder navegação desktop */
  .gallery-nav { display: none; }

  /* Main - scroll vertical */
  main {
    overflow-x: hidden;
    overflow-y: scroll;
    height: calc(100vh - 90px);
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
  }

  /* Gallery - coluna */
  .gallery {
    flex-direction: column;
    width: 100%;
    height: auto;
    padding: 0;
    gap: 0;
    align-items: center;
  }

  /* Item = tela inteira */
  .gallery-item {
    width: 100vw;
    height: calc(100vh - 90px);
    padding: 0 0 32px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  /* Foto */
  .photo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .gallery-item img {
    height: auto;
    max-height: 62vh;
    max-width: 88vw;
    width: auto;
  }

  /* Viewer */
  .viewer-content { max-width: calc(100vw - 40px); }
}
