/* === Heraldics Gallery === */
.heraldics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.heraldic-item {
  position: relative;
  cursor: pointer;
}

.heraldic-item img {
  width: 100%;
  display: block;
}

/* Barra negra inferior */
.heraldic-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: space-between;
  padding: 15px;
}

.heraldic-btn {
  color: white;
  font-family: "Cinzel", serif;
  font-size: 14px;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
}

/* === Modals === */
/* ===== Overlay ===== */
.heraldic-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 999999;
  display: none;
}

.heraldic-modal.is-active {
  display: block;
}

/* ===== Popup ===== */
.heraldic-modal-content {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

/* Media */
.heraldic-modal-content img,
.heraldic-modal-content video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 64px);
  margin: 0 auto;
  object-fit: contain;
}

/* Close */
.heraldic-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}



/* === Heraldic Card === */

.heraldic-card {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 25px rgba(0,0,0,0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.heraldic-card:hover {
  transform: translateY(-6px);
  cursor: pointer;
  box-shadow: 0 0 40px rgba(0,255,234,0.35);
}

.heraldic-image-wrap img {
  width: 100%;
  display: block;
}

.heraldic-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.heraldic-bar .heraldic-x {
  justify-self: start;
}

.heraldic-bar .heraldic-download {
  justify-self: center;
}

.heraldic-bar .heraldic-video-trigger {
  justify-self: end;
}

/* === Bottom bar (now OUTSIDE image) === */

.heraldic-bar {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Icons */

.heraldic-bar a,
.heraldic-bar button {
    padding:3px;
  background: none;
  border: none;
  color:  rgb(134, 134, 134);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.heraldic-bar a:hover,
.heraldic-bar button:hover {
  color: #00ffea;
  transform: scale(1.15);
}


/* Desktop hover */
@media (hover: hover) and (pointer: fine) {
  .heraldic-card:hover .heraldic-bar {
    opacity: 1;
    transform: translateY(0);

  }
}

/* Mobile: always visible */
@media (hover: none) {
  .heraldic-bar {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1023px) {

  .heraldics-grid {
    grid-template-columns: 1fr;
  }

  .heraldic-modal-content {
    max-width: 100vw;
    width: 100vw;
    left: 0;
    transform: none;
    padding: 0;
  }

  .heraldic-modal-content img {
    width: 100vw;
    max-width: 100vw;
    height: auto;
  }

  .heraldic-modal-content video {
    width: 100vw;
    max-width: 100vw;
    height: auto;
  }

  .heraldic-bar {
  position: relative;
  opacity: 0.4;

}

.heraldic-close {
  position: absolute;
  top: 110%;
  right: 42%;
  z-index: 10;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgb(255, 255, 255);
  color: rgb(0, 0, 0);
  font-size: 110px;
  display: block;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.heraldic-modal-content {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  overflow:visible;
}

.heraldic-bar a,
.heraldic-bar button {
  background: none;
  border: none;
  color: rgb(134, 134, 134);
  font-size: 70px;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}


}




