/* =========================================================
       ✅ Critérios de aceite (resumo)
       - Grid responsivo: 4/linha (desktop), 3 (médias), 2 (pequenas), 1 (muito pequenas)
       - Cada item é quadrado; capa 50% opacidade inicial; título central visível
       - Hover/focus: zoom suave na imagem; título some (opacity:0)
       - Clique abre lightbox com fundo preto 70%; foco aprisionado; ESC fecha
       - Carrossel com setas / teclado; imagem principal central
       - Miniaturas horizontais com lazy load e indicação de overflow
       - Capas locais: /img/capas/{slug}.jpg
       - Galeria via Cloudinary (JSON) por tag, com fallback/erro amigável e retry
       - Sem libs externas; tudo neste arquivo (<style> + <script>)
       - Acessibilidade (alt, roles, aria-*, prefers-reduced-motion)
       ========================================================= */

:root {
    --gap: 16px;
    --tile-radius: 16px;
    --tile-overlay-bg: rgba(0, 0, 0, 1);
    --overlay-bg: rgba(0, 0, 0, .7);
    --accent: #e11d48;
    /* rosa-avermelhado para foco/realces */
    --text: #111;
    --muted: #666;
    --thumb-size: 88px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: #fff;
    line-height: 1.45;
}

.container {
    /* max-width: 1200px; */
    margin: 64px auto 0;
    padding: 24px 80px 80px;
}

h1 {
    margin: 8px 0 24px;
    font-size: 3em;
}

/* ===============================
       GRID DE CAPAS (responsivo)
       =============================== */
.grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width:1100px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width:800px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width:520px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Item quadrado com aspect-ratio e fallback */
.tile {
    position: relative;
    border-radius: var(--tile-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #ddd;
    outline: none;
    cursor: pointer;
    user-select: none;
    /* Mantém quadrado nos browsers modernos */
    aspect-ratio: 1 / 1;
    /* Fallback (ativado via .no-aspect-ratio em <html> se necessário) */
}

.no-aspect-ratio .tile {
    height: 0;
    padding-top: 100%;
}

.tile__inner {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.tile__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .5;
    /* estado inicial esmaecido */
    transform: scale(1);
    transition: transform .35s ease, opacity .25s ease;
    will-change: transform, opacity;
}

.tile__title {
    position: relative;
    z-index: 1;
    color: #fff;
    text-align: center;
    padding: 10px 12px;
    background: var(--tile-overlay-bg);
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: .2px;
    transition: opacity .25s ease, transform .25s ease;
}

.tile:hover .tile__img,
.tile:focus-visible .tile__img {
    opacity: 1;
    transform: scale(1.05);
    /* zoom suave */
}

.tile:hover .tile__title,
.tile:focus-visible .tile__title {
    opacity: 0;
    transform: translateY(6px);
}

.tile:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    border: 0;
    padding: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
    white-space: nowrap;
}

/* ===============================
       LIGHTBOX / DIALOG
       =============================== */
.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    /* aberto via .is-open */
    align-items: center;
    justify-content: center;
    background: var(--overlay-bg);
    z-index: 1000;
}

.lightbox.is-open {
    display: flex;
}

.lightbox__dialog {
    background: #111;
    color: #fff;
    width: min(100vw - 24px, 1100px);
    max-height: calc(100vh - 24px);
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    outline: none;
}

.lightbox__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    gap: 8px;
}

.lightbox__title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox__actions {
    display: flex;
    gap: 6px;
}

.btn {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .18);
    background: transparent;
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.btn:hover {
    background: rgba(255, 255, 255, .08);
}

.btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.lightbox__main {
    position: relative;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 8px;
    padding: 10px;
}

.nav {
    display: grid;
    place-items: center;
}

.nav__btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .04);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

.nav__btn:hover {
    background: rgba(255, 255, 255, .12);
}

.nav__btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 50vh;
}

.stage__img {
    max-width: 100%;
    max-height: 68vh;
    object-fit: contain;
    border-radius: 8px;
    background: #000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
}

/* Skeleton enquanto carrega a imagem principal */
.skeleton {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: linear-gradient(90deg, #222 25%, #2b2b2b 37%, #222 63%);
    background-size: 400% 100%;
    animation: shimmer 1.1s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

.lightbox__thumbs-wrap {
    position: relative;
    margin: 6px 10px 12px;
}

.thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 36px;
    /* espaço para setas laterais */
    scroll-behavior: smooth;
}

.thumb {
    flex: 0 0 auto;
    width: var(--thumb-size);
    height: var(--thumb-size);
    border-radius: 10px;
    background: #222;
    position: relative;
    border: 2px solid transparent;
    cursor: pointer;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.thumb.is-active {
    border-color: var(--accent);
}

/* Seta/indicação de overflow nas extremidades */
.thumbs-edge {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    display: grid;
    place-items: center;
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
}

.thumbs-edge--left {
    left: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, .35), transparent);
}

.thumbs-edge--right {
    right: 0;
    background: linear-gradient(-90deg, rgba(0, 0, 0, .35), transparent);
}

.thumbs.has-left+.thumbs-edge--left,
.thumbs.has-right+.thumbs-edge--right {
    opacity: 1;
}

/* Mensagem de erro */
.error {
    color: #ffd1d9;
    background: #3b0a12;
    border: 1px solid #e11d48;
    padding: 10px 12px;
    border-radius: 10px;
    margin: 12px;
    display: none;
}

.error.is-visible {
    display: block;
}

/* Respeitar prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .tile__img {
        transition: none;
    }

    .tile__title {
        transition: none;
    }

    .thumbs {
        scroll-behavior: auto;
    }
}

/* ================ FOOTER ===================== */

.footer {
  background-color: #2a2a2a;
  color: #f0f0f0;
  padding: 80px 20px;
}

.footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 0 80px;
}

.footer-logo {
  max-width: 240px;
}

.footer-center {
  padding: 0 80px;
  text-align: justify;
}

.footer-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 40px;
}

.footer-item .icon {
  margin-right: 15px;
}

.footer-item .icon i {
  color: #fff;
  font-size: 32px;
}

.footer-text h4 {
  color: #fff;
  margin: 0 0 5px;
  font-size: 1.7em;
}

.footer-text p, .footer-text a {
  margin: 0;
  color: #ccc;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s;
}

.footer-text a:hover {
  color: #ff6b6b;
}

.footer hr {
  border-color: #171717;
  margin: 80px 0;
}

.footer-bottom {
  text-align: center;
  font-size: 16px;
  color: #dfdcdc;
}

.footer-bottom a {
  text-decoration: none;
  color: #ccc;
  transition: color 0.3s;
}

.footer-bottom a:hover {
  color: #ff6b6b;
}

/* MOBILE */
@media (max-width: 1080px) {

  /* Logo no canto superior esquerdo */
  .logo {
    width: 200px;
    bottom: 0;
  }

  .associacao {
    font-size: 24px;
    bottom: 20px;
    right: 140px;
    left: 20px;
    z-index: 1;
  }

  .split-section,
  .split-section.reverse {
    flex-direction: column;
  }

  .split-section .image,
  .split-section.reverse .image {
    height: 300px;
  }

  .split-section .text {
    padding: 30px;
  }

  .goals {
    margin: 20px;
    padding: 15px;
  }

  .goals h2 {
    font-size: 1.6rem;
  }

  .goals ul li {
    font-size: 1rem;
  }

  .formulario-contato,
  .localizacao {
    flex: 0 0 100%;
  }

  .localizacao iframe {
    height: 300px;
  }

  .footer-container {
    flex-direction: column;
    align-items: center;
  }

  .footer-left{
    padding-bottom: 80px;
  }
}