/* Vovó Amélia Amigurumis - Folha de Estilos Principal
  Versão: 1.0
  Otimizada e Validada
*/

/* --- Variáveis Globais e Reset --- */
:root {
  --primary-color: #e46791;
  --secondary-color: #8a69a0;
  --light-gray: #f8f8f8;
  --dark-gray: #333;
  --text-gray: #555;
  --white-color: #fff;
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-dark: rgba(0, 0, 0, 0.1);
}

html {
  scroll-behavior: smooth;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--light-gray);
  color: var(--dark-gray);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Cabeçalho e Navegação --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 5%;
  background-color: var(--white-color);
  box-shadow: 0 2px 5px var(--shadow-light);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo {
  max-height: 120px; /* Altura ajustada para melhor visual com menu fixo */
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav a {
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-gray);
  padding-bottom: 5px;
  transition: color 0.3s ease-in-out;
}

nav a:hover {
  color: var(--secondary-color);
}

nav li.active a {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

/* --- Estrutura Principal e Seções --- */
main {
  padding: 2rem 5%;
}

#amigurumis, #contato {
  scroll-margin-top: 100px; /* Espaço para o header fixo */
}

.about-section,
.contact-info {
  text-align: center;
  padding: 2rem;
  background-color: var(--white-color);
  border-radius: 8px;
  box-shadow: 0 4px 8px var(--shadow-light);
  margin-bottom: 2rem;
}

.about-section h2,
.contact-info h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

.about-section p,
.contact-info p {
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto 0.5rem auto;
}

.contact-info a {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.contact-info a:hover {
  color: var(--primary-color);
}

/* --- Grade e Cards de Produto --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.product-card {
  background-color: var(--white-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px var(--shadow-dark);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.product-info {
  padding: 1rem;
  text-align: center;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-info h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.product-info p {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary-color);
}

.btn-details {
  background-color: var(--secondary-color);
  color: var(--white-color);
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 1rem;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.btn-details:hover {
  background-color: #715186;
}

/* --- Carrossel (Principal e Modal) --- */
.carousel-container {
  position: relative;
  width: 100%;
  height: 250px; /* Altura fixa para todos os cards */
  background-color: #fdfdfd; /* Fundo sutil para espaços vazios */
}

.carousel-container img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Garante que a imagem apareça inteira, sem cortar */
  display: none;
  animation: fadeIn 0.5s;
}

.carousel-container img.active {
  display: block;
}

/* Estilos comuns para todos os botões de carrossel */
.carousel-btn,
.modal-carousel-prev,
.modal-carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.8);
  border: none;
  color: var(--dark-gray);
  font-size: 1.5rem;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.carousel-btn {
    opacity: 0.7; /* Define uma opacidade padrão para as setas */
    transition: opacity 0.3s ease; /* Mantém a transição para um efeito sutil no hover */
}

.carousel-btn:hover {
    opacity: 1; /* Aumenta a opacidade no hover para destacar */
}

.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }

@keyframes fadeIn {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* --- Janela Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--white-color);
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #888;
  z-index: 2010;
}

.modal-body {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.modal-image-carousel-container {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.modal-image-carousel {
  width: 100%;
  height: 400px; /* Altura fixa para a imagem no modal */
  overflow: hidden;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image-carousel img {
  display: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* Garante que a imagem apareça inteira, sem cortar */
}

.modal-image-carousel img.active {
  display: block;
}

.modal-carousel-prev,
.modal-carousel-next {
  opacity: 0.7; /* Define uma opacidade padrão para as setas do modal */
  transition: opacity 0.3s ease;
}

.modal-carousel-prev:hover,
.modal-carousel-next:hover {
  opacity: 1; /* Aumenta a opacidade no hover */
}

.modal-carousel-prev { left: 10px; }
.modal-carousel-next { right: 10px; }

.modal-details {
  flex: 1;
}

#modal-product-name { color: var(--primary-color); margin-bottom: 1rem; }
#modal-product-price { font-size: 1.5rem; font-weight: bold; color: var(--dark-gray); margin-bottom: 1.5rem; }
#modal-product-description { font-size: 1rem; color: var(--text-gray); }

/* --- Rodapé --- */
footer {
  background-color: var(--secondary-color);
  color: var(--white-color);
  padding: 2rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.social-media a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--white-color);
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.social-media a:hover { opacity: 0.8; }
.social-media img { height: 24px; }

/* --- Design Responsivo --- */
@media (max-width: 992px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .modal-body {
    flex-direction: column;
  }
  .modal-image-carousel-container {
    max-width: 100%;
    margin-bottom: 1rem;
  }
}

@media (max-width: 600px) {
  header {
    flex-direction: column;
    gap: 1rem;
  }
  .product-grid {
    grid-template-columns: 1fr;
  }
  footer {
    flex-direction: column;
    text-align: center;
  }
  .about-section,
  .contact-info {
    padding: 1.5rem;
  }
  .about-section p,
  .contact-info p {
    font-size: 1rem;
  }
  #amigurumis, #contato {
    scroll-margin-top: 130px;
  }
}
/* --- OTIMIZAÇÃO DO MODAL PARA DISPOSITIVOS MÓVEIS --- */
@media (max-width: 768px) {
  .modal-overlay {
    /* Alinha o modal ao topo da tela em vez de ao centro, garantindo que o topo seja sempre visível */
    align-items: flex-start;
    /* Adiciona um padding para que o modal não cole nas bordas */
    padding: 1rem 0.5rem;
  }

  .modal-content {
    /* Define uma altura máxima para o modal (ex: 85% da altura da tela) */
    max-height: 85vh;
    /* A MÁGICA ACONTECE AQUI: Adiciona uma barra de rolagem vertical APENAS se o conteúdo for maior que a altura máxima */
    overflow-y: auto;
    /* Reduz o padding em telas menores */
    padding: 1.5rem;
  }

  .modal-body {
    /* Já tínhamos isso, mas é importante garantir que continue aqui */
    flex-direction: column;
  }

  .modal-image-carousel {
    /* Reduz a altura do carrossel em telas menores para dar mais espaço ao texto */
    height: 300px;
  }

  #modal-product-description {
    /* Garante que a descrição não fique muito pequena */
    font-size: 0.95rem;
  }
}