/* ============================================================================
   styles.css — M&M Gourmet Foods
   ----------------------------------------------------------------------------
   Organização:
     1. Tokens de design (variáveis) + temas light/dark
     2. Reset e base
     3. Textura / atmosfera
     4. Header + controles (idioma, tema)
     5. Hero
     6. Cardápio (categorias, grid, cards)
     7. Rodapé
     8. Microinterações (reveal)
     9. Responsividade
   ========================================================================== */

/* ============================================================
   1. TOKENS DE DESIGN + TEMAS
   ============================================================ */
:root {
  /* Tipografia */
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Montserrat", system-ui, sans-serif;

  /* Espaçamento e medidas */
  --maxw: 1180px;
  --radius: 14px;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  /* Transição global de tema */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --theme-transition: background-color 0.5s var(--ease), color 0.5s var(--ease),
    border-color 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

/* ----- Tema CLARO (ivory cálido + dourado) ----- */
:root,
[data-theme="light"] {
  --bg: #faf7f0; /* marfim cálido */
  --bg-elev: #ffffff; /* superfícies/cards */
  --bg-hero: #f0ebe0;
  --text: #20201d; /* grafite quase preto */
  --text-soft: #6c6760; /* texto secundário */
  --text-faint: #9a948b; /* legendas */
  --line: #e6ded0; /* divisórias */
  --gold: #b08d57; /* dourado refinado */
  --gold-soft: #c9a96a;
  --shadow: 0 18px 40px -24px rgba(60, 45, 20, 0.35);
  --grain-opacity: 0.035;
  --grain-blend: multiply;
}

/* ----- Tema ESCURO (grafite profundo, sem preto puro) ----- */
[data-theme="dark"] {
  --bg: #16181d; /* grafite/azul muito escuro */
  --bg-elev: #1e2128; /* superfícies/cards */
  --bg-hero: #14161a;
  --text: #f3efe6; /* off-white cálido */
  --text-soft: #b6b1a6;
  --text-faint: #8a857a;
  --line: #2c2f38;
  --gold: #d4af74; /* dourado mais luminoso no escuro */
  --gold-soft: #e2c489;
  --shadow: 0 24px 50px -28px rgba(0, 0, 0, 0.75);
  --grain-opacity: 0.05;
  --grain-blend: screen;
}

/* ============================================================
   2. RESET + BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: var(--theme-transition);
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--gold);
  color: var(--bg);
}

/* ============================================================
   3. TEXTURA / ATMOSFERA
   ============================================================ */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  transition: opacity 0.5s var(--ease);
}

/* ============================================================
   4. HEADER + CONTROLES
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: var(--theme-transition), padding 0.35s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 10px 30px -22px rgba(0, 0, 0, 0.4);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.1rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: padding 0.35s var(--ease);
}
.site-header.is-scrolled .header-inner {
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.brand-logo {
  height: 46px;
  width: auto;
  transition: height 0.35s var(--ease), filter 0.5s var(--ease);
}
.site-header.is-scrolled .brand-logo {
  height: 38px;
}
/* Logo agora é um SVG inline (dourado fixo): idêntico nos temas claro e
   escuro, sem necessidade de filtro de cor. */

.controls {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

/* ----- Chaveador de idioma ----- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}
.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--text-soft);
  padding: 0.25rem 0.2rem;
  letter-spacing: 0.12em;
  font-weight: 500;
  position: relative;
  transition: color 0.3s var(--ease);
}
.lang-btn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s var(--ease);
}
.lang-btn:hover {
  color: var(--text);
}
.lang-btn.is-active {
  color: var(--gold);
}
.lang-btn.is-active::after {
  transform: scaleX(1);
}
.lang-sep {
  color: var(--line);
}

/* ----- Chaveador de tema (pill switch) ----- */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 0;
}
.theme-toggle-track {
  display: inline-flex;
  align-items: center;
  width: 56px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 3px;
  transition: var(--theme-transition);
}
.theme-toggle-thumb {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  transform: translateX(0);
  transition: transform 0.4s var(--ease), background 0.4s var(--ease);
}
[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(28px);
}
.theme-toggle-thumb .icon-moon {
  display: none;
}
[data-theme="dark"] .theme-toggle-thumb .icon-sun {
  display: none;
}
[data-theme="dark"] .theme-toggle-thumb .icon-moon {
  display: block;
}

/* ============================================================
   5. HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: clamp(380px, 64vh, 620px);
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
  background: var(--bg-hero);
  transition: var(--theme-transition);
}
.hero-media {
  position: absolute;
  inset: 0;
}
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.55; /* padrão (dark mode): foto discreta e atmosférica */
  transform: scale(1.04);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
      120% 90% at 50% 30%,
      transparent 0%,
      color-mix(in srgb, var(--bg) 65%, transparent) 70%,
      var(--bg) 100%
    );
  transition: var(--theme-transition);
}

/* ----- Hero no tema CLARO -----
   Foto nítida (sem véu). O overlay agora é só uma vinheta leve que funde as
   bordas no fundo creme — sem glow atrás do texto. O texto do hero fica claro
   (off-white) para contrastar sobre a imagem. */
[data-theme="light"] .hero-img {
  opacity: 0.92;
}
[data-theme="light"] .hero-overlay {
  background: radial-gradient(
    130% 105% at 50% 30%,
    transparent 50%,
    color-mix(in srgb, var(--bg) 22%, transparent) 80%,
    var(--bg) 100%
  );
}
[data-theme="light"] .hero-content {
  /* leve sombra para garantir legibilidade do texto claro sobre a foto */
  text-shadow: 0 1px 16px rgba(28, 20, 10, 0.45);
}
[data-theme="light"] .hero-title,
[data-theme="light"] .hero-cta {
  color: #faf7f0;
}
[data-theme="light"] .hero-subtitle {
  color: rgba(250, 247, 240, 0.92);
}
/* Selo de qualidade no tema claro: quase branco, como os demais textos
   do hero, para não se fundir com o fundo claro da foto. */
[data-theme="light"] .hero-quality {
  color: rgba(250, 247, 240, 0.96);
  border-color: var(--gold-soft);
}
/* Botão do hero no tema claro: fundo translúcido escuro (glass) para o
   texto off-white permanecer legível sobre qualquer área da foto. */
[data-theme="light"] .hero-cta {
  background: rgba(28, 20, 10, 0.5);
  border-color: var(--gold-soft);
  backdrop-filter: blur(3px) saturate(120%);
  -webkit-backdrop-filter: blur(3px) saturate(120%);
  box-shadow: 0 6px 18px -8px rgba(20, 14, 6, 0.6);
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 3rem var(--gutter);
  max-width: 720px;
  animation: heroIn 1.1s var(--ease) both;
}
@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hero-eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gold);
  margin-bottom: 1.1rem;
  padding-left: 0.42em; /* compensa o tracking */
}
.hero-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.8rem, 8vw, 5.2rem);
  line-height: 1.02;
  letter-spacing: 0.01em;
}
.hero-subtitle {
  margin: 1.3rem auto 0;
  max-width: 30em;
  color: var(--text-soft);
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  font-weight: 300;
}
.hero-quality {
  margin: 1.5rem auto 0;
  max-width: 34em;
  padding: 1rem 1.4rem;
  border-top: 1px solid rgba(176, 141, 87, 0.4);
  border-bottom: 1px solid rgba(176, 141, 87, 0.4);
  border-top: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  color: var(--text);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.5;
  letter-spacing: 0.01em;
}
.hero-cta {
  display: inline-block;
  margin-top: 2.2rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
  padding: 0.9rem 2.2rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  transition: background 0.4s var(--ease), color 0.4s var(--ease),
    transform 0.4s var(--ease);
}
.hero-cta:hover {
  background: var(--gold);
  color: var(--bg);
  transform: translateY(-2px);
}

/* ============================================================
   6. CARDÁPIO
   ============================================================ */
.menu {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6.5rem) var(--gutter) 1rem;
}

.category {
  margin-bottom: clamp(3rem, 7vw, 5.5rem);
}

/* Cabeçalho de categoria com filete dourado decorativo */
.category-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2.2rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.category-head.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.category-rule {
  height: 1px;
  flex: 1;
  max-width: 130px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.category-rule:last-child {
  background: linear-gradient(90deg, var(--gold), transparent);
}
.category-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  white-space: nowrap;
  color: var(--text);
}

/* Grid responsivo (Mobile First: 1 -> 2 -> 3 colunas) */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 3vw, 2.4rem);
}

/* ----- Card ----- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease),
    border-color 0.45s var(--ease), background-color 0.5s var(--ease);
  /* estado inicial do reveal */
  opacity: 0;
  transform: translateY(24px);
}
.card.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--gold) 45%, var(--line));
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-hero);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.card:hover .card-media img {
  transform: scale(1.06);
}

.card-body {
  padding: 1.4rem 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}
.item-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1.15;
  color: var(--text);
}
.item-weight {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
}
.item-desc {
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 300;
  flex: 1;
  margin-bottom: 1.1rem;
}

/* Preço único */
.card-price {
  margin-top: auto;
}
.item-price {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  color: var(--gold);
  letter-spacing: 0.01em;
}

/* Tabela de tamanhos (tortas) */
.size-list {
  list-style: none;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}
.size-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.32rem 0;
}
.size-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
}
.size-dots {
  flex: 1;
  border-bottom: 1px dotted var(--line);
  transform: translateY(-3px);
}
.size-price {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--gold);
}

/* Aviso de preços */
.price-note {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ============================================================
   7. RODAPÉ
   ============================================================ */
.site-footer {
  background: var(--bg-hero);
  border-top: 1px solid var(--line);
  transition: var(--theme-transition);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5rem) var(--gutter);
  text-align: center;
}
.footer-brand {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 1.4rem;
}
.whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.6rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease),
    color 0.4s var(--ease);
}
.whatsapp:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-2px);
}
.whatsapp-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.footer-text {
  max-width: 36em;
  margin: 1.4rem auto 0;
  color: var(--text-soft);
  font-weight: 300;
  font-size: 0.92rem;
}
.footer-quality {
  margin-top: 2.6rem;
  padding-top: 2.4rem;
  border-top: 1px solid var(--line);
}
.footer-quality-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--gold);
}

/* ============================================================
   8. RESPONSIVIDADE (Mobile First — breakpoints crescentes)
   ============================================================ */

/* Tablets: 2 colunas */
@media (min-width: 620px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 3 colunas */
@media (min-width: 980px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Telas muito pequenas: empilha cabeçalho do card */
@media (max-width: 380px) {
  .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

/* Acessibilidade: respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card,
  .category-head {
    opacity: 1 !important;
    transform: none !important;
  }
}
