/* ============================================================
   DÊLHA · ENCOMENDAS
   Paleta ancorada na identidade real da Dêlha:
   - off-white quente (papel/caixa)   #FBF8F3
   - tinta suave (logo)               #3B3A36
   - verde-sálvia (eucalipto do pack)  #8A9B84 / #6E8168
   - lilás (fitinha)                   #B9A6C8  (acento raro)
   Display: Fraunces (editorial, com italic pro toque à mão)
   Corpo:   Jost (geométrica leve, respira elegante)
   ============================================================ */

:root {
  --paper:      #FBF8F3;
  --paper-warm: #F3EDE3;
  --ink:        #3B3A36;
  --ink-soft:   #6B6862;
  --sage:       #6E8168;
  --sage-light: #8A9B84;
  --lilac:      #B9A6C8;
  --line:       #E4DCCF;
  --shadow:     rgba(59, 58, 54, 0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Jost', sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- HEADER ---------- */
/* Sticky + hide-on-scroll-down: o carrinho precisa estar a um toque
   de distância mesmo no fim do catálogo. A classe .recolhido é
   alternada pelo script conforme a direção do scroll. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--paper);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 28px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0.24, 1);
  will-change: transform;
}
.site-header.recolhido { transform: translateY(-100%); }
.wordmark { display: flex; align-items: baseline; gap: 10px; }
.wordmark-name {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--ink);
}
.wordmark-sub {
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.header-tagline {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--sage);
}
.header-acoes { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }

/* botão do carrinho + badge */
.btn-carrinho {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.btn-carrinho:hover { border-color: var(--sage-light); background: var(--paper-warm); }
.icone-sacola { width: 19px; height: 19px; flex: none; }

.badge {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 21px; height: 21px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--paper);
  background: var(--sage);
  border-radius: 100px;
}
.badge[hidden] { display: none; }
.badge.pulsa { animation: pulso 0.45s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes pulso {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.32); }
  100% { transform: scale(1); }
}

/* ---------- INTRO ---------- */
.intro {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 88px) clamp(20px, 5vw, 32px) clamp(32px, 5vw, 56px);
  text-align: center;
}
.intro-title {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: clamp(38px, 7vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.intro-title::after {
  content: '';
  display: block;
  width: 46px;
  height: 2px;
  background: var(--sage-light);
  margin: 24px auto 0;
}
.intro-lead {
  margin-top: 24px;
  font-size: clamp(15px, 2vw, 17px);
  color: var(--ink-soft);
  line-height: 1.7;
}

/* ---------- GRADE ---------- */
.grade {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px) clamp(60px, 8vw, 100px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(28px, 4vw, 52px) clamp(24px, 3vw, 40px);
}

.card {
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  /* reveal no scroll — .revelado é aplicado pelo IntersectionObserver */
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.card.revelado { opacity: 1; transform: none; }
.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--paper-warm);
  border-radius: 2px;
}
.card-media img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;  /* a altura vem da PRÓPRIA imagem, não do pai:      */
  height: auto;         /* no Safari/iOS a caixa do card colapsava para 0   */
  object-fit: cover;    /* quando o height:100% dependia do aspect-ratio do */
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); /* container.   */
}
.card:hover .card-media img,
.card:focus-visible .card-media img { transform: scale(1.045); }

.card-media::after {
  content: 'ver detalhes';
  position: absolute;
  left: 50%; bottom: 14px;
  transform: translateX(-50%) translateY(8px);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  padding: 8px 16px;
  border-radius: 100px;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
.card:hover .card-media::after,
.card:focus-visible .card-media::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.card-body { padding: 16px 4px 0; }
.card-nome {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  color: var(--ink);
}
.card-porcao {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.card-linha {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;                 /* preço e tag lado a lado quando cabem;   */
  align-items: baseline;           /* quando a coluna aperta, a tag desce     */
  justify-content: space-between;  /* para a linha de baixo em vez de encostar */
  gap: 7px 12px;                   /* 12px mín. na horizontal · 7px ao empilhar */
}
.card-preco {
  font-family: 'Fraunces', serif;
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
}
.card-tag {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--sage);
  font-style: italic;
  font-family: 'Fraunces', serif;
}

/* ---------- FOOTER ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px clamp(20px, 5vw, 64px) 56px;
  text-align: center;
}
.footer-brand {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--ink);
}
.footer-note {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ink-soft);
  text-transform: uppercase;
}

/* ---------- MODAL ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.aberto { display: flex; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(45, 44, 40, 0.5);
  backdrop-filter: blur(3px);
  animation: fade 0.3s ease;
}
.modal-painel {
  position: relative;
  z-index: 2;
  background: var(--paper);
  width: min(880px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  box-shadow: 0 30px 80px rgba(45, 44, 40, 0.3);
  animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.modal-fechar {
  position: absolute;
  top: 12px; right: 14px;
  z-index: 3;
  width: 40px; height: 40px;
  border: none;
  background: var(--paper);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.2s ease;
}
.modal-fechar:hover { transform: rotate(90deg); }

.modal-media {
  background: var(--paper-warm);
  overflow: hidden;
}
.modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 320px;
}

.modal-corpo {
  padding: clamp(28px, 4vw, 44px);
  display: flex;
  flex-direction: column;
}
.modal-nome {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.1;
  color: var(--ink);
}
.modal-porcao {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--sage);
}
.modal-descricao {
  margin-top: 16px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.65;
}
.modal-preco {
  margin-top: 18px;
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 500;
  color: var(--ink);
}
.modal-preco::before { content: 'a partir de '; font-family: 'Jost', sans-serif; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); display: block; margin-bottom: 2px; font-weight: 300; }

/* campos */
.campo-grupo { margin-top: 8px; }
.campo { margin-top: 22px; }
.campo > label {
  display: block;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 10px;
}
.campo-aviso {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--sage);
  font-style: italic;
  font-family: 'Fraunces', serif;
}

.escolha-opcoes { display: flex; flex-wrap: wrap; gap: 8px; }
.escolha-btn {
  font-family: inherit;
  font-size: 13px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.escolha-btn:hover { border-color: var(--sage-light); }
.escolha-btn.ativo {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--paper);
}
.consulta-nota {
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  font-family: 'Fraunces', serif;
  padding: 12px 14px;
  background: var(--paper-warm);
  border-radius: 4px;
  border-left: 2px solid var(--lilac);
}

input[type="date"],
input[type="number"] {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  width: 100%;
}
input[type="date"]:focus,
input[type="number"]:focus { outline: 2px solid var(--sage-light); outline-offset: 1px; }

.stepper { display: flex; align-items: center; gap: 0; width: fit-content; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.stepper button {
  width: 42px; height: 44px;
  border: none;
  background: var(--paper-warm);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.stepper button:hover { background: var(--line); }
.stepper input {
  width: 56px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  height: 44px;
  padding: 0;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.btn-whatsapp {
  margin-top: 28px;
  font-family: 'Jost', sans-serif;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--sage);
  border: none;
  padding: 16px 24px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.1s ease;
}
.btn-whatsapp:hover { background: #5c6e57; }
.btn-whatsapp:active { transform: translateY(1px); }
.btn-whatsapp:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-rodape {
  margin-top: 14px;
  font-size: 11px;
  color: var(--ink-soft);
  text-align: center;
  letter-spacing: 0.3px;
}

/* ---------- DRAWER DO CARRINHO ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  visibility: hidden;
  pointer-events: none;
}
.drawer.aberto { visibility: visible; pointer-events: auto; }

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(45, 44, 40, 0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.drawer.aberto .drawer-overlay { opacity: 1; }

.drawer-painel {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(45, 44, 40, 0.22);
  transform: translateX(100%);
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0.24, 1);
}
.drawer.aberto .drawer-painel { transform: none; }

.drawer-topo {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px clamp(18px, 4vw, 26px);
  border-bottom: 1px solid var(--line);
}
.drawer-titulo {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 22px;
  line-height: 1.2;
  color: var(--ink);
}
.drawer-fechar {
  width: 44px; height: 44px;
  flex: none;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.drawer-fechar:hover { background: var(--paper-warm); transform: rotate(90deg); }

.drawer-itens {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px clamp(18px, 4vw, 26px);
}
.drawer-vazio {
  padding: 48px 8px;
  text-align: center;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-soft);
  font-family: 'Fraunces', serif;
  font-style: italic;
}

/* linha do item */
.linha-item {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.linha-item:last-child { border-bottom: none; }
.linha-media {
  overflow: hidden;
  border-radius: 2px;
  background: var(--paper-warm);
}
.linha-media img { display: block; width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: cover; }
.linha-nome {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.25;
  color: var(--ink);
}
.linha-porcao {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.linha-opcao {
  margin-top: 6px;
  font-size: 12px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  color: var(--sage);
  line-height: 1.4;
}
.linha-controles {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.linha-subtotal {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.linha-remover {
  width: 44px; height: 44px;
  margin: -10px -10px 0 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.linha-remover:hover { color: var(--ink); background: var(--paper-warm); }

.stepper-mini button { width: 40px; height: 40px; font-size: 18px; }
.stepper-valor {
  min-width: 46px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* rodapé do drawer */
.drawer-rodape {
  flex: none;
  padding: 18px clamp(18px, 4vw, 26px) clamp(20px, 4vw, 26px);
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.drawer-rodape[hidden] { display: none; }
.drawer-rodape .campo { margin-top: 0; }
.drawer-total {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.drawer-total-rotulo {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.drawer-total-valor {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 500;
  color: var(--ink);
}
.drawer-rodape .btn-whatsapp { width: 100%; margin-top: 18px; }
.campo-aviso.erro { color: #A8574B; font-style: normal; font-family: 'Jost', sans-serif; }

/* ---------- RESPONSIVO ---------- */
@media (max-width: 720px) {
  .modal-painel { grid-template-columns: 1fr; }
  .modal-media img { min-height: 240px; max-height: 300px; }
}

@media (max-width: 480px) {
  .site-header {
    padding: 16px 18px;
    gap: 12px;
  }
  .wordmark { gap: 8px; }
  .wordmark-name { font-size: 21px; letter-spacing: 2px; }
  .wordmark-sub { font-size: 9px; letter-spacing: 2.5px; }
  /* a tagline sai para o botão do carrinho respirar */
  .header-tagline { display: none; }
  .btn-carrinho { padding: 8px 12px; gap: 7px; }
  .btn-carrinho-texto { display: none; }

  .intro { padding-top: 40px; }
  .grade { grid-template-columns: 1fr; gap: 34px; }

  /* modal ocupa a tela toda, com o corpo rolando */
  .modal { padding: 0; }
  .modal-painel {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    grid-template-rows: auto 1fr;
  }
  .modal-media img { min-height: 200px; max-height: 32dvh; }
  .modal-corpo { padding: 24px 20px 32px; }
  .modal-fechar { width: 44px; height: 44px; top: 10px; right: 10px; }

  /* drawer full-screen */
  .drawer-painel { width: 100%; box-shadow: none; }
  .drawer-topo { padding: 16px 18px; }
  .drawer-itens { padding: 4px 18px; }
  .drawer-rodape { padding: 16px 18px 22px; }
  .linha-item { grid-template-columns: 62px 1fr auto; gap: 12px; }

  /* alvos de toque */
  .stepper button { width: 44px; height: 44px; }
  .stepper input { height: 44px; }
  .stepper-mini button { width: 44px; height: 44px; }
  .stepper-valor { height: 44px; min-width: 48px; }
  .escolha-btn { padding: 12px 18px; min-height: 44px; }
  input[type="date"] { min-height: 44px; }
}

/* ---------- ACESSIBILIDADE / MOTION ---------- */
:focus-visible { outline: 2px solid var(--sage); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
  /* sem transição, o card ficaria preso no estado inicial do reveal
     enquanto o observer não dispara — entrega tudo já visível. */
  .card { opacity: 1; transform: none; }
  .drawer-overlay { opacity: 1; }
  .modal-fechar:hover, .drawer-fechar:hover { transform: none; }
}
