/* ==========================================================================
   Otoni's Chips · Seção de avaliações
   Referência: More Nutrition (curated.design #2136), adaptada à marca.
   ========================================================================== */

/* ---------- Fontes (self-hosted, Archivo variável: wdth 62–125, wght 100–900) */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../assets/fonts/archivo-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../assets/fonts/archivo-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Titan One (display): gorda e arredondada, alternativa livre (OFL) à FlameSans da peça
   de referência, que é proprietária. Um único peso (400): nunca sintetizar negrito.
   Usada só em títulos; o texto corrido segue em Archivo. */
@font-face {
  font-family: "Titan One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/titan-one-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Titan One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/titan-one-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Medido no navegador: Titan One ocupa 97% da largura da Arial Black;
   ascent 0.97em, descent 0.18em (overrides = métrica ÷ size-adjust). */
@font-face {
  font-family: "Titan Fallback";
  src: local("Arial Black"), local("Arial-BoldMT"), local("Arial Bold");
  size-adjust: 97%;
  ascent-override: 100%;
  descent-override: 18.6%;
  line-gap-override: 0%;
}
/* Fallbacks métricos: reduzem o salto de layout enquanto a Archivo carrega.
   Medido no navegador: largura de um parágrafo em Archivo (wdth 100, wght 400) × Arial.
   Archivo: ascent 0.88em, descent 0.21em (overrides = métrica ÷ size-adjust). */
@font-face {
  font-family: "Archivo Fallback";
  src: local("Arial"), local("ArialMT"), local("Helvetica");
  size-adjust: 97.3%;
  ascent-override: 90.4%;
  descent-override: 21.6%;
  line-gap-override: 0%;
}

/* ---------- Tokens */
:root {
  /* Paleta viva, tirada da peça "Faça seu pedido" (PSD): vermelho #9E0909, amarelo #FFCC00
     e fundo #E6E6D7. O vinho segue como cor de texto; o papel, como superfície clara. */
  --otoni-red:   #9E0909;
  --otoni-wine:  #5E0B0C;
  --otoni-cream: #FFCC00; /* amarelo de destaque */
  --otoni-paper: #FFFDF2;
  --otoni-ink:   #1A0A0A;

  --av-font-display: "Titan One", "Titan Fallback", "Arial Black", sans-serif;
  --av-font-body: "Archivo", "Archivo Fallback", Arial, sans-serif;
  --av-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Seção */
.av {
  /* largura do card e gap por breakpoint (≥1024 é o padrão) */
  --card-w: 30vw;
  --gap: max(10px, 1.5vw);

  position: relative;
  isolation: isolate;
  overflow: clip;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vw * 1113 / 1440);
  padding: clamp(40px, 4.4vw, 72px) 0 clamp(40px, 4.4vw, 72px);
  color: var(--otoni-paper);
  background: var(--otoni-wine);
  font-family: var(--av-font-body);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}
.av[hidden] { display: none; }

/* Fundo: base radial vermelho→vinho + faixas de luz dura na diagonal (~-35°) */
.av-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 55% at 50% 40%, #B8100E 0%, var(--otoni-red) 45%, var(--otoni-wine) 100%);
}
.av-luz {
  position: absolute;
  inset: -20%;
  /* faixa clara com bordas suaves; cada instância muda posição e intensidade */
  background: linear-gradient(-35deg,
    transparent calc(var(--p) - var(--w) / 2 - 3%),
    rgba(255, 214, 80, var(--a)) calc(var(--p) - var(--w) / 2),
    rgba(255, 214, 80, var(--a)) calc(var(--p) + var(--w) / 2),
    transparent calc(var(--p) + var(--w) / 2 + 3%));
}
.av-luz--1 { --p: 34%; --w: 9%;  --a: .10; }
.av-luz--2 { --p: 50%; --w: 13%; --a: .18; } /* passa por trás da tigela */
.av-luz--3 { --p: 66%; --w: 6%;  --a: .12; }
/* Base escurecida para dar contraste aos cards (vinho 0 → 70%) */
.av-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 48%;
  background: linear-gradient(to bottom, rgba(94, 11, 12, 0), rgba(94, 11, 12, .7));
}

/* ---------- Chips voando (decoração) */
.av-voando {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  will-change: transform;
  transform: translate3d(0, var(--py, 0px), 0) rotate(var(--pr, 0deg));
}
.av-voando img { display: block; width: 100%; height: auto; }
.av-voando--esq { top: 3%;  left: -2.5vw; width: 18vw; }
.av-voando--esq img { transform: rotate(-18deg); }
.av-voando--dir { top: 14%; right: -1.5vw; width: 12vw; }
.av-voando--dir img { transform: rotate(32deg) scaleX(-1); }

/* ---------- Título gigante */
.av-titulo {
  position: relative;
  z-index: 4; /* por cima do topo da tigela */
  margin: 0;
  padding: 0 4vw;
  text-align: center;
  font-family: var(--av-font-display);
  font-weight: 400;
  font-synthesis: none;
  font-size: clamp(48px, 7.6vw, 120px); /* "Crocante. Artesanal." mede 11,1em */
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  color: var(--otoni-paper);
  /* halo vinho: garante leitura onde a 2ª linha encosta nas batatas */
  text-shadow: 0 0 .02em var(--otoni-wine), 0 .03em .18em rgba(94, 11, 12, .55);
}
.av-linha { display: block; white-space: nowrap; }
.av-palavra { display: inline; }

/* ---------- Produto */
.av-produto {
  position: relative;
  z-index: 3;
  width: min(36vw, 640px);
  margin-top: calc(-1 * clamp(32px, 6vw, 96px)); /* o título sobrepõe o topo da tigela */
  will-change: transform;
  transform: translate3d(0, var(--py, 0px), 0);
}
/* Sombra longa da tigela, inclinada para baixo-direita */
.av-produto::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 36%;
  bottom: 4%;
  width: 96%;
  height: 26%;
  border-radius: 50%;
  background: rgba(30, 4, 4, .55);
  filter: blur(40px);
  transform: rotate(18deg) skewX(-28deg);
  transform-origin: left center;
}
.av-tigela {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Subtítulo */
.av-sub {
  position: relative;
  z-index: 4;
  margin: clamp(16px, 2.2vw, 32px) 0 0;
  text-align: center;
  font-family: var(--av-font-display);
  font-weight: 400;
  font-synthesis: none;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--otoni-paper);
}

/* ---------- Carrossel */
.av-carrossel {
  position: relative;
  z-index: 5;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.av-setas {
  display: flex;
  gap: 8px;
  margin: clamp(16px, 1.8vw, 28px) 0 clamp(28px, 3.4vw, 52px);
}
.av-carrossel[data-estatico] .av-setas { display: none; }

.av-seta {
  display: grid;
  place-items: center;
  width: clamp(44px, 3.6vw, 52px);
  height: clamp(44px, 3.6vw, 52px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--otoni-paper);
  color: var(--otoni-wine);
  cursor: pointer;
  transition: background-color .25s ease, transform .25s var(--av-ease);
}
.av-seta:hover,
.av-seta:focus-visible { background: var(--otoni-cream); }
.av-seta:active { transform: scale(.94); }
.av-seta:focus-visible {
  outline: 3px solid var(--otoni-cream);
  outline-offset: 3px;
}

.av-janela {
  width: 100%;
  overflow: hidden;
  touch-action: pan-y;
}
.av-trilho {
  display: flex;
  gap: var(--gap);
  width: max-content;
  will-change: transform;
}
.av-trilho.is-animando { transition: transform 600ms var(--av-ease); }
.av-carrossel[data-arrastando] .av-trilho { cursor: grabbing; }

/* Poucos itens (< 3): sem loop, sem setas, centralizados */
.av-carrossel[data-estatico] .av-trilho {
  width: 100%;
  justify-content: center;
  transform: none !important;
}

/* Modo rolagem (< 640px): scroll-snap nativo */
.av-carrossel[data-modo="rolagem"] .av-janela {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: auto;
}
.av-carrossel[data-modo="rolagem"] .av-janela::-webkit-scrollbar { display: none; }
.av-carrossel[data-modo="rolagem"] .av-trilho {
  width: max-content;
  justify-content: flex-start;
  /* card alinhado a 4vw da borda; o vizinho espia ~8vw à direita */
  padding-inline: 4vw calc(100vw - var(--card-w) - 4vw);
  transform: none !important;
}
.av-carrossel[data-modo="rolagem"] .av-janela { scroll-padding-inline: 4vw; }
.av-carrossel[data-modo="rolagem"] .av-card { scroll-snap-align: start; }

/* ---------- Card */
.av-card {
  --pad: calc(var(--card-w) * .09);
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: var(--pad);
  border-radius: 6px;
  border: 1px solid rgba(255, 204, 0, .3);
  background-color: rgba(94, 11, 12, .55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--otoni-paper);
  scroll-snap-align: center;
  user-select: none;
  transition: background-color 400ms ease, border-color 400ms ease, color 400ms ease;
}
.av-card > * { transition: color 400ms ease; }
.av-card:focus-visible {
  outline: 3px solid var(--otoni-cream);
  outline-offset: 3px;
}

.av-estrelas {
  display: flex;
  gap: 4px;
  margin-bottom: clamp(14px, 1.4vw, 22px);
  color: var(--otoni-cream);
  transition: color 400ms ease;
}
.av-estrelas svg { width: clamp(14px, 1.1vw, 17px); height: auto; display: block; }

.av-card-titulo {
  margin: 0 0 .5em;
  font-weight: 600;
  font-size: clamp(1.25rem, 1.6vw, 1.6rem);
  line-height: 1.12;
  letter-spacing: -.01em;
  color: var(--otoni-paper);
}
.av-card-texto {
  margin: 0;
  flex: 1;
  font-weight: 400;
  font-size: clamp(1rem, 1.1vw, 1.1rem);
  line-height: 1.45;
  color: var(--otoni-paper);
}
.av-card hr {
  width: 100%;
  margin: clamp(18px, 1.8vw, 28px) 0 clamp(12px, 1.1vw, 16px);
  border: 0;
  border-top: 1px solid currentColor;
  opacity: .28;
}
.av-card-rodape {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.av-card-nome {
  font-weight: 600;
  font-size: 1rem;
  color: var(--otoni-paper);
  transition: color 400ms ease;
}
.av-selo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--otoni-cream);
  transition: color 400ms ease;
}
.av-selo svg { width: 14px; height: 14px; flex: none; }

/* Card ativo (central) e cards em modo estático: fundo claro + cor da marca */
.av-card.is-ativo,
.av-carrossel[data-estatico] .av-card {
  background-color: var(--otoni-paper);
  border-color: var(--otoni-paper);
  color: var(--otoni-red);
}
.av-card.is-ativo .av-estrelas,
.av-card.is-ativo .av-card-titulo,
.av-card.is-ativo .av-card-texto,
.av-card.is-ativo .av-selo,
.av-carrossel[data-estatico] .av-card .av-estrelas,
.av-carrossel[data-estatico] .av-card .av-card-titulo,
.av-carrossel[data-estatico] .av-card .av-card-texto,
.av-carrossel[data-estatico] .av-card .av-selo { color: var(--otoni-red); }
.av-card.is-ativo .av-card-nome,
.av-carrossel[data-estatico] .av-card .av-card-nome { color: var(--otoni-ink); }
.av-card.is-ativo:focus-visible,
.av-carrossel[data-estatico] .av-card:focus-visible { outline-color: var(--otoni-red); }

/* Texto só para leitores de tela */
.av-sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Entrada (o JS adiciona .is-in uma única vez) */
.av.js-anima .av-linha,
.av.js-anima .av-tigela,
.av.js-anima .av-sub,
.av.js-anima .av-setas,
.av.js-anima .av-card {
  opacity: 0;
}
.av.js-anima .av-linha { transform: translateY(24px); }
.av.js-anima .av-tigela { transform: translateY(32px) scale(.96); }
.av.js-anima .av-card { translate: 0 24px; }

.av.js-anima.is-in .av-linha,
.av.js-anima.is-in .av-tigela,
.av.js-anima.is-in .av-sub,
.av.js-anima.is-in .av-setas,
.av.js-anima.is-in .av-card {
  opacity: 1;
  transform: none;
  translate: 0 0;
}
.av.js-anima.is-in .av-linha {
  transition: opacity .7s var(--av-ease), transform .9s var(--av-ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.av.js-anima.is-in .av-tigela {
  transition: opacity .9s var(--av-ease), transform 1.1s var(--av-ease);
  transition-delay: 120ms;
}
.av.js-anima.is-in .av-sub,
.av.js-anima.is-in .av-setas {
  transition: opacity .7s var(--av-ease) 280ms;
}
.av.js-anima.is-in .av-card {
  transition: opacity .6s var(--av-ease), translate .8s var(--av-ease),
              background-color 400ms ease, border-color 400ms ease, color 400ms ease;
  transition-delay: calc(360ms + var(--i, 0) * 60ms), calc(360ms + var(--i, 0) * 60ms), 0s, 0s, 0s;
}
/* Depois da entrada, a transição do card volta a ser só o crossfade */
.av.is-pronta .av-card {
  transition: background-color 400ms ease, border-color 400ms ease, color 400ms ease;
}

/* ---------- 640–1023px */
@media (max-width: 1023px) {
  .av { --card-w: 60vw; --gap: 2vw; }
  .av-titulo { font-size: clamp(44px, 7.6vw, 80px); }
  .av-produto { width: 55vw; margin-top: calc(-1 * 5vw); }
  .av-voando--esq { width: 24vw; top: 2%; }
  .av-voando--dir { width: 16vw; top: 12%; }
  .av-sub { font-size: clamp(24px, 3.6vw, 36px); }
  .av-card-titulo { font-size: clamp(1.25rem, 2.6vw, 1.5rem); }
  .av-card-texto { font-size: clamp(1rem, 1.9vw, 1.1rem); }
}

/* ---------- < 640px */
@media (max-width: 639px) {
  .av {
    --card-w: 84vw;
    --gap: 4vw;
    min-height: 0; /* altura automática */
    padding: 48px 0 40px;
  }
  /* 62% de largura: "Sem conservante." cabe numa linha a partir de 360px com 56px */
  /* "Sem conservante." mede 9,7em: 9,2vw cabe numa linha a partir de 360px */
  .av-titulo { font-size: clamp(32px, 9.2vw, 56px); padding: 0 4vw; }
  .av-palavra { display: block; } /* 3 linhas */
  .av-produto { width: 70vw; margin-top: -7vw; }
  .av-produto::before { filter: blur(24px); }
  .av-voando--esq { width: 34vw; top: 1%; left: -10vw; opacity: .9; }
  .av-voando--dir { display: none; }
  .av-sub { margin-top: 20px; font-size: clamp(24px, 7vw, 32px); }
  .av-carrossel { margin-top: 28px; }
  .av-setas { order: 2; margin: 24px 0 0; }
  .av-card { --pad: 24px; }
  .av-card-titulo { font-size: 1.3rem; }
}

/* ---------- Movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  .av-trilho.is-animando { transition: none; }
  .av-voando, .av-produto { transform: none !important; }
  .av.js-anima .av-linha,
  .av.js-anima .av-tigela,
  .av.js-anima .av-card { transform: none; translate: 0 0; }
  .av.js-anima.is-in .av-linha,
  .av.js-anima.is-in .av-tigela,
  .av.js-anima.is-in .av-sub,
  .av.js-anima.is-in .av-setas,
  .av.js-anima.is-in .av-card {
    transition: opacity .3s linear;
    transition-delay: 0s;
  }
  .av-seta:active { transform: none; }
  .av-carrossel[data-modo="rolagem"] .av-janela { scroll-behavior: auto; }
}
