/* ÍNDICE (procure pelo número do bloco com Ctrl+F):
    1. fontes e variáveis de cor/tamanho (tokens do site)
    2. reset básico
    3. acessibilidade (link de pular conteúdo, foco do teclado)
    4. botões
    5. barra de aviso + cabeçalho / menu
    6. hero da home (index.html)
    7. título de seção genérico
    8. cards de produto (usado na home E na loja)
    9. loja: barra de filtros
    10. loja: estados de "carregando" e "nenhum produto"
    11. loja: paginação
    12. loja: cabeçalho da página (hero da loja)
    13. rodapé
    14. responsivo (celular/tablet)
    15. acessibilidade: menos animação */

/* 1. TOKENS: mude uma cor/fonte aqui e ela muda no site inteiro */
:root {
  /* cores */
  --cream: #FBF6EF; /* fundo principal do site */
  --cream-deep: #F1E4D2; /* fundo dos cards de produto */
  --maroon: #5C2130; /* cor da marca: botões, links, preços */
  --maroon-deep: #3D1620; /* maroon mais escuro, usado em hover */
  --clay: #BE7B4E; /* cor de destaque decorativa (linhas, foco) */
  --ink: #2A211D; /* cor do texto principal */
  --taupe: #6B5D54; /* cor do texto secundário (parágrafos) */
  --line: #E6D6C2;  /* cor das bordas finas / divisórias */

  /* formas */
  --radius-lg: 20px;
  --radius-md: 14px;

  --shadow-soft: 0 20px 45px -25px rgba(42, 33, 29, 0.35);
  --container-w: 1180px; /* largura máxima do conteúdo */

  /* fontes (importadas via <link> no <head> de cada página) */
  --font-display: "Fraunces", "Iowan Old Style", serif; /* títulos */
  --font-body: "Outfit", "Segoe UI", sans-serif; /* textos */
}

/* 2. RESET BÁSICO */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden; /* evita barra de rolagem horizontal por causa da foto que "vaza" no hero */
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* largura de conteúdo centralizada, toda seção do site usa essa classe */
.container {
  max-width: var(--container-w);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* 3. ACESSIBILIDADE */
:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 3px;
}

/* link invisível que só aparece quando alguém navega pelo teclado (tecla Tab) */
/* deixa pular direto pro conteúdo, pulando o menu */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--maroon);
  color: var(--cream);
  padding: .75rem 1.25rem;
  border-radius: 0 0 8px 0;
  z-index: 300;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* 4. BOTÕES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .9rem 2rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .01em;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.btn-primary {
  background: var(--maroon);
  color: var(--cream);
  box-shadow: var(--shadow-soft);
}
.btn-primary:hover { background: var(--maroon-deep); transform: translateY(-2px); }

/* 5. BARRA DE AVISO + CABEÇALHO / MENU */
.announcement {
  background: var(--maroon);
  color: var(--cream);
  text-align: center;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .05em;
  margin: 0;
  padding: .6rem 1rem;
}

.site-header {
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  position: relative; /* âncora para o menu mobile, que abre "flutuando" por cima */
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.15rem;
  position: relative;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--maroon);
}
.site-nav {
  display: flex;
  gap: 2rem;
  font-size: .95rem;
  font-weight: 500;
}
.site-nav a {
  position: relative;
  padding-block: .3rem;
  transition: color .2s ease;
}
/* linha animada que "cresce" embaixo do link ao passar o mouse */
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .25s ease;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--maroon); }
.site-nav a:hover::after, .site-nav a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* menu mobile (sanduíche) */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-burger {
  display: none; /* só aparece no celular, ver bloco 14 (responsivo) */
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: .5rem;
  margin: -.5rem;
}
.nav-burger span {
  width: 24px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .25s ease, opacity .25s ease;
}

/* 6. HERO DA HOME */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding-block: clamp(3rem, 6vw, 6rem);
}
.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .78rem;
  font-weight: 600;
  color: var(--maroon);
  margin: 0 0 1rem;
}
.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 1.4rem + 3vw, 3.6rem);
  line-height: 1.08;
  font-weight: 500;
  margin: 0 0 1.25rem;
}
.hero-copy h1 em { font-style: italic; color: var(--maroon); }
.hero-copy .lead {
  font-size: 1.05rem;
  color: var(--taupe);
  max-width: 38ch;
  margin: 0;
}

.hero-media { position: relative; }
.hero-media__main {
  width: 100%;
  aspect-ratio: 612 / 600;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.hero-media__accent {
  position: absolute;
  width: 44%;
  left: -8%;
  bottom: -9%;
  aspect-ratio: 328 / 437;
  object-fit: cover;
  border: 8px solid var(--cream);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  transform: rotate(-4deg);
}

/* pequena animação de entrada, só na primeira vez que a home carrega */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-copy .eyebrow { animation: fadeInUp .6s ease both; }
.hero-copy h1 { animation: fadeInUp .6s .08s ease both; }
.hero-copy .lead { animation: fadeInUp .6s .16s ease both; }
.hero-media { animation: fadeInUp .7s .1s ease both; }

/* 7. TÍTULO DE SEÇÃO (ex: "Os Favoritos da Semana") */
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 500;
  text-align: center;
  margin: 0 0 2.5rem;
}

/* 8. CARDS DE PRODUTO
  Usado em dois lugares:
   - index.html: cards fixos, escritos à mão no HTML
   - loja.html: cards criados pelo app.js */
.favorites { padding-block: clamp(3rem, 5vw, 5rem); }
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}
/* o card é um <a> (link) inteiro, clicar em qualquer parte dele abre o link de afiliado numa aba nova */
.product-card {
  display: block;
  background: var(--cream-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: transform .25s ease, box-shadow .25s ease;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-soft); }
.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.product-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0 0 .4rem;
}
.product-card .price {
  font-weight: 700;
  color: var(--maroon);
  margin: 0;
  font-size: 1.05rem;
}
.favorites__cta { text-align: center; margin-top: 2.75rem; }

.shop-grid .product-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
.shop-grid .product-card { padding: .75rem; }
.shop-grid .product-card img { margin-bottom: .75rem; }
.shop-grid .product-card h3 { font-size: 1rem; }
.shop-grid .product-card .price { font-size: .95rem; }

/* 9. LOJA: BARRA DE FILTROS */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}
.filter-pill {
  padding: .55rem 1.4rem;
  border-radius: 999px;
  border: 1.5px solid var(--maroon);
  background: transparent;
  color: var(--maroon);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.filter-pill:hover { background: var(--cream-deep); }
.filter-pill.is-active { background: var(--maroon); color: var(--cream); }

/* 10. LOJA: ESTADOS DE "CARREGANDO" E "NENHUM PRODUTO" */
.empty-state,
.loading-state {
  display: none;
  text-align: center;
  color: var(--taupe);
  padding: 3rem 1rem;
  font-size: 1.05rem;
}
.empty-state.is-visible,
.loading-state.is-visible { display: block; }

/* 11. LOJA: PAGINAÇÃO ( ‹ 1 2 3 › ) */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  margin-top: 3rem;
}
.page-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--cream-deep);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.page-arrow:hover:not(:disabled) { background: var(--maroon); color: var(--cream); border-color: var(--maroon); }
.page-arrow:disabled { opacity: .35; cursor: not-allowed; } /* usado quando já está na 1ª/última página */

.page-numbers {
  display: flex;
  gap: .4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.page-number-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.page-number-btn:hover { background: var(--cream-deep); }
.page-number-btn.is-active { background: var(--maroon); color: var(--cream); }

/* 12. LOJA: CABEÇALHO DA PÁGINA (título "Todos os achadinhos...") */
.shop-hero {
  padding-block: clamp(2.5rem, 5vw, 4rem);
  text-align: center;
  max-width: 60ch;
  margin-inline: auto;
}
.shop-hero .eyebrow { display: flex; justify-content: center; }
.shop-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 500;
  margin: 0 0 1rem;
}
.shop-hero h1 em { font-style: italic; color: var(--maroon); }
.shop-hero .lead { color: var(--taupe); margin-inline: auto; }
.shop-grid { padding-block: 0 clamp(3rem, 5vw, 5rem); }

/* 13. RODAPÉ */
.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; }
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding-block: 2.5rem;
  text-align: center;
  color: var(--taupe);
  font-size: .9rem;
}
.logo--footer { font-family: var(--font-display); color: var(--maroon); font-size: 1.2rem; }

/* 14. RESPONSIVO */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: left; }
  .hero-media { max-width: 420px; margin-inline: auto; margin-top: 1rem; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1080px) {
  .shop-grid .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .shop-grid .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .shop-grid .product-grid { grid-template-columns: repeat(1, 1fr); }
}

@media (max-width: 720px) {
  /* abaixo de 720px o menu vira sanduíche (ver bloco 5) */
  .nav-burger { display: flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--cream);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
  }
  .site-nav a { padding: 1rem 1.5rem; border-top: 1px solid var(--line); }
  .site-nav a::after { display: none; }
  /* quando o checkbox #nav-toggle é marcado, o menu "desce" e o ícone de sanduíche vira um X */
  .nav-toggle:checked ~ .site-nav { max-height: 220px; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

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

/* 15. ACESSIBILIDADE: respeita quem desativou animações no sistema */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
