/* =========================
   VARIÁVEIS
========================= */
:root {
  --verde: #2E7D32;
  --verde-dark: #1B5E20;
  --verde-light: #A5D6A7;

  --bg-claro: #E8F5E9;
  --bg-card: #FFFFFF;

  --texto: #1b1b1b;
  --texto-soft: #4f4f4f;

  --borda: rgba(0,0,0,0.08);
}

/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

html, body {
  height: 100%;
}

/* =========================
   BODY
========================= */
body {
  background: radial-gradient(circle at 20% 0%, #ffffff, var(--bg-claro) 60%);
  color: var(--texto);
  padding: 40px;
}

/* =========================
   TÍTULO
========================= */
h1 {
  text-align: center;
  margin-bottom: 40px;
  color: var(--verde);
  letter-spacing: 1px;
}

/* =========================
   GRID
========================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 25px;
  max-width: 1000px;
  margin: auto;
}

/* =========================
   CARD
========================= */
.item {
  position: relative;
  z-index: 1; /* 🔥 importante */
  overflow: hidden;
  background: var(--bg-card);
  padding: 20px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
  border: 1px solid var(--borda);

  box-shadow:
    0 4px 12px rgba(0,0,0,0.05),
    0 10px 25px rgba(0,0,0,0.08);
}

/* FUNDO DESFOCADO */
.item::before {
  content: "";
  position: absolute;
  inset: 0;

  background-image: inherit;
  background-size: cover;
  background-position: center;

  filter: blur(60px) saturate(120%);
  opacity: 0.25;

  transform: scale(1.2);
  z-index: 0; /* 🔥 corrigido */
}

/* OVERLAY */
.item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.4);
  z-index: 0; /* 🔥 corrigido */
}

/* IMG */
.item img {
  position: relative;
  z-index: 2;
  max-height: 60px;
  filter: grayscale(100%);
  transition: 0.3s;
}

/* =========================
   HOVER
========================= */
.item:hover {
  transform: scale(1.06);
  box-shadow: 
    0 0 20px rgba(46,125,50,0.25),
    0 15px 35px rgba(46,125,50,0.2);
}

.item:hover img {
  filter: grayscale(0%);
}

/* =========================
   MODAL
========================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85); /* 🔥 fundo corrigido */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999; /* 🔥 ESSENCIAL */
}

.modal.active {
  display: flex;
}

.modal img {
  position: relative;
  z-index: 100000;
  max-width: 90%;
  max-height: 80vh;
  border-radius: 12px;
  border: 2px solid var(--verde);
  box-shadow: 0 0 30px rgba(0,0,0,0.6);
  animation: zoom 0.3s ease;
  background: white; /* 🔥 evita transparência */
}

/* ANIMAÇÃO */
@keyframes zoom {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* CLOSE */
.close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 32px;
  color: white;
  cursor: pointer;
  transition: 0.2s;
  z-index: 100001;
}

.close:hover {
  color: var(--verde);
  transform: scale(1.2);
}

/* =========================
   BOTÃO
========================= */
.back-container {
  display: flex;
  justify-content: center;
  margin-top: 60px;
}

.btn-back {
  text-decoration: none;
  color: white;
  background: linear-gradient(135deg, var(--verde), var(--verde-dark));
  padding: 12px 28px;
  border-radius: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  transition: 0.3s;
}

.btn-back:hover {
  background: linear-gradient(135deg, var(--verde-dark), #0f3d13);
  box-shadow: 0 8px 20px rgba(46,125,50,0.4);
  transform: translateY(-3px);
}

/* =========================
   RESPONSIVO
========================= */
@media (max-width: 500px) {
  .item img {
    max-height: 40px;
  }
}