* {
  -webkit-tap-highlight-color: transparent;
}

:root {
  color-scheme: only light;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}
body {
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  color-scheme: only light;
  -webkit-filter: none !important;
  filter: none !important;
  forced-color-adjust: none;
}

.historia-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 50px var(--section-pad);
  background: var(--white);
}

/* Segunda metade da página (abaixo da galeria) */
.historia-page-bottom {
  padding-top: 0;
  min-height: auto;
}

.historia-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--green);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 2rem;
  transition: gap .2s;
}
.historia-back:hover { gap: 10px; }
.historia-back svg { fill: var(--green); }

/* ── Hero ── */
.historia-hero {
  width: 100%;
  height: 380px;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  border-radius: 24px;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.historia-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.historia-hero-content {
  position: relative;
  text-align: center;
  color: #fff;
  padding: 2rem;
}
.historia-hero-content h1 {
  font-family: 'Merriweather', serif;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 700;
  margin-bottom: .6rem;
}
.historia-hero-content p {
  font-size: 1rem;
  color: rgba(255,255,255,.9);
  font-style: italic;
}

/* ── Seções ── */
.historia-section { margin-bottom: 3rem; }

.historia-section h2 {
  font-family: 'Merriweather', serif;
  font-size: 1.6rem;
  color: var(--green-dark);
  margin-bottom: 1.2rem;
  padding-bottom: .6rem;
  border-bottom: 3px solid var(--green-pale);
  display: flex;
  align-items: center;
  gap: .7rem;
}
.historia-section h2 svg { fill: var(--green); flex-shrink: 0; }

.historia-section p {
  font-size: 1rem;
  color: var(--text-mid);
  line-height: 1.9;
  margin-bottom: 1rem;
}
.historia-section p:last-child { margin-bottom: 0; }

/* ── Timeline ── */
.timeline {
  position: relative;
  padding-left: 1.75rem;
  margin: 1.5rem 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--green), var(--green-pale));
  border-radius: 2px;
  transform: translateX(-50%);
}
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.75rem; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--green);
  transform: translateX(-50%) translateX(5px);
}
.timeline-ano {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: .3rem;
}
.timeline-texto {
  font-size: .95rem;
  color: var(--text-mid);
  line-height: 1.7;
}

/* ── Destaques ── */
.destaque-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}
.destaque-card {
  background: var(--white);
  border: 1px solid var(--gray-mid);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.destaque-card:hover {
  border-color: var(--green);
  box-shadow: 0 4px 16px rgba(45,140,110,.12);
}
.destaque-numero {
  font-family: 'Merriweather', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  margin-bottom: .5rem;
}
.destaque-label {
  font-size: .85rem;
  color: var(--text-mid);
  font-weight: 600;
  line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════
   GALERIA HISTÓRICA
   3 slides visíveis no desktop | 2 no tablet | 1 no mobile
   ═══════════════════════════════════════════════════════ */

.historia-slider-section {
  background: var(--gray-light);
  border-top: 1px solid var(--gray-mid);
  border-bottom: 1px solid var(--gray-mid);
  margin: 0 0 3rem;
  padding: 40px 0 50px;
}

.historia-slider-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--section-pad);
}

/* Wrapper com espaço para os botões laterais */
.galeria-wrap {
  position: relative;
}

/* Janela de recorte — esconde os slides fora do quadro */
.galeria-viewport {
  overflow: hidden;
  border-radius: 12px;
  padding-bottom: 8px;
  margin-bottom: -8px; 
  touch-action: pan-y;
}

/* Trilho: todos os slides em linha */
.galeria-track {
  display: flex;
  gap: 16px;
  /* largura definida por JS */
  will-change: transform;
  touch-action: pan-y;
}

/* Slide individual — largura calculada via CSS var(--vis) definida por JS */
.galeria-slide {
  flex: 0 0 var(--slide-w, calc((100% - 32px) / 3));
  border-radius: 12px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--gray-mid);
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  cursor: pointer;
  transition: box-shadow .25s, transform .25s;
}

/* Wrapper da imagem com overlay */
.galeria-img-wrap {
  position: relative;
  overflow: hidden;
}
.galeria-img-wrap img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.galeria-slide:hover .galeria-img-wrap img {
  transform: scale(1.05);
}

/* Overlay de zoom */
.galeria-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .25s;
}
.galeria-overlay svg { fill: #fff; }
.galeria-slide:hover .galeria-overlay { opacity: 1; }

/* Legenda */
.galeria-legenda {
  padding: .6rem .9rem;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-light);
  background: var(--white);
  border-top: 1px solid var(--gray-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.galeria-legenda::before {
  content: '';
  width: 5px; height: 5px; min-width: 5px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* ── Botões prev / next ── */
.galeria-btn {
  position: absolute;
  top: 50%;
  /* sobe metade da altura da legenda (~28px / 2 = 14px) para centralizar na imagem */
  transform: translateY(calc(-50% - 14px));
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gray-mid);
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  transition: background .2s, border-color .2s, opacity .2s;
}
.galeria-btn:hover { background: var(--green); border-color: var(--green); }
.galeria-btn:hover svg { fill: #fff; }
.galeria-btn svg { fill: var(--green); transition: fill .2s; }
.galeria-btn:disabled { opacity: .3; cursor: default; pointer-events: none; }

.galeria-btn-prev { left: -52px; }
.galeria-btn-next { right: -52px; }

/* ── Pontos de paginação ── */
.galeria-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.galeria-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gray-mid);
  border: none; cursor: pointer; padding: 0;
  transition: background .2s, transform .2s;
}
.galeria-dot.ativo { background: var(--green); transform: scale(1.4); }

/* ════════════════════════════════════════
   LIGHTBOX / MODAL
   ════════════════════════════════════════ */
.galeria-lightbox {
  display: none;               /* oculto por padrão */
  position: fixed; inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}
.galeria-lightbox.aberto {
  display: flex;               /* ativa o modal */
  animation: lbFadeIn .2s ease both;
}

@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(860px, 88vw);
  animation: lbZoomIn .25s ease both;
}
@keyframes lbZoomIn {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@keyframes lbFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes lbZoomOut {
  from { transform: scale(1);    opacity: 1; }
  to   { transform: scale(.94);  opacity: 0; }
}

.galeria-lightbox.fechando {
  animation: lbFadeOut .2s ease forwards;
}

.galeria-lightbox.fechando .lb-content {
  animation: lbZoomOut .25s ease forwards;
}

.lb-content img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,.6);
  display: block;
  user-select: none;
}

.lb-info {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lb-legenda {
  color: rgba(255,255,255,.85);
  font-size: .88rem;
  font-weight: 500;
}
.lb-counter {
  color: rgba(255,255,255,.4);
  font-size: .78rem;
  white-space: nowrap;
}

/* Botões do lightbox */
.lb-close,
.lb-prev,
.lb-next {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}
.lb-close:hover,
.lb-prev:hover,
.lb-next:hover { background: var(--green); border-color: var(--green); }
.lb-close svg, .lb-prev svg, .lb-next svg { fill: #fff; }

.lb-close {
  position: absolute; top: 16px; right: 16px;
  width: 42px; height: 42px;
}
.lb-prev, .lb-next {
  width: 50px; height: 50px;
}

/* ─── Responsividade ────────────────────────────── */
@media (max-width: 1100px) {
  .historia-page { padding: 30px var(--section-pad); }
  .historia-hero { height: 320px; }
  .destaque-grid { gap: 1rem; }
}

@media (max-width: 1024px) {
  /* tablet: 2 slides */
  .galeria-slide { --slide-w: calc((100% - 16px) / 2); }
}

@media (max-width: 768px) {
  .historia-hero { height: 280px; }
  .historia-section h2 { font-size: 1.3rem; }
  .destaque-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .destaque-card { padding: 1rem; }
  .destaque-numero { font-size: 2rem; }
  .galeria-btn { width: 36px; height: 36px; }
  .lb-prev, .lb-next { width: 42px; height: 42px; }
}

@media (max-width: 600px) {
  .destaque-grid { grid-template-columns: 1fr; gap: .8rem; }
  .historia-hero { height: 220px; }
  .historia-hero-content h1 { font-size: 1.5rem; }
  .historia-hero-content p  { font-size: .85rem; }

  /* mobile: 1 slide, botões dentro da área */
  .galeria-wrap       { padding: 0; }
  .galeria-btn-prev   { left: 8px; }
  .galeria-btn-next   { right: 8px; }
  .galeria-btn        { width: 32px; height: 32px; z-index: 10; }
  .lb-prev, .lb-next  { display: none; }
}

@media (max-width: 480px) {
  .historia-hero { height: 200px; border-radius: 16px; }
  .historia-section h2 { font-size: 1.1rem; }
  .timeline { padding-left: 1.4rem; }
  .timeline-item::before { left: -1.4rem; width: 9px; height: 9px; }
  .timeline-ano  { font-size: .7rem; }
  .timeline-texto { font-size: .85rem; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --green: #2d8c6e;
    --green-dark: #1a5c4a;
    --green-light: #3eb489;
    --green-pale: #eaf5f0;
    --green-ultra-light: #f5faf8;
    --gray-light: #f8faf9;
    --gray-mid: #e8eeec;
    --text: #1e2e28;
    --text-mid: #4a6358;
    --text-light: #7a9e92;
    --white: #fff;
  }

  html, body {
    background-color: #fff !important;
    color: #1e2e28 !important;
  }
}