/* Erica Patisserie · cardápio digital */

:root {
  --paper: #f7f3ee;
  --paper-card: #fffcf8;
  --ink: #2e221c;
  --ink-soft: #6b5a50;      /* 5.9:1 sobre o papel */
  --gold: #a98247;          /* só decoração (3.2:1) */
  --gold-text: #86652f;     /* dourado para texto (4.8:1) */
  --gold-line: rgba(169, 130, 71, 0.38);
  --blush: #f3d3d6;
  --price: #7f5246;         /* 4.7:1 sobre o rosa */
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --max: 760px;
  --gutter: 18px;
  --radius: 14px;
  --bar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.4;
  font-variant-numeric: lining-nums;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 50;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ---------- ornamentos ---------- */

.flourish {
  position: relative;
  display: block;
  width: min(220px, 62%);
  height: 1px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold) 22%, var(--gold) 78%, transparent);
}
.flourish::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 6px; height: 6px;
  background: var(--paper);
  border: 1px solid var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
}

.ornament { display: block; width: 34px; margin: 0 auto 6px; }
.ornament img { width: 100%; height: auto; }

/* Pincelada rosa atrás do preço */
.price {
  display: inline-block;
  flex: none;
  padding: 0.02em 0.55em 0.08em;
  color: var(--price);
  font-weight: 600;
  font-size: 1.02rem;
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 32' preserveAspectRatio='none'%3E%3Cpath fill='%23f3d3d6' d='M4 7c18-3 46-5 70-4 15 0 30 0 43 2 2 5 2 13 1 19-1 3-3 4-6 4-26 1-58 2-87 1-8 0-14 0-21-2-2-6-2-12 0-17 0-1 0-2 0-3z'/%3E%3Cpath fill='%23ecc3c7' opacity='.55' d='M9 25c25 1 62 0 103-2 2 0 3 1 1 2-34 3-72 4-104 2-2 0-2-2 0-2z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* ---------- topo ---------- */

.masthead {
  padding: calc(26px + env(safe-area-inset-top)) var(--gutter) 18px;
  text-align: center;
}
.masthead__logo { width: auto; height: 64px; margin: 0 auto 8px; }
.masthead__name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.05rem;
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.masthead__tagline {
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.masthead__tagline::after {
  content: "";
  display: block;
  width: min(220px, 62%);
  height: 1px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold) 22%, var(--gold) 78%, transparent);
}

/* ---------- barra fixa de categorias e busca ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: 0 max(4px, calc((100% - var(--max)) / 2));
  background: var(--paper);
  border-bottom: 1px solid var(--gold-line);
}

.bar__nav {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent);
}
.bar__nav::-webkit-scrollbar { display: none; }

.chips {
  display: flex;
  width: max-content;
  padding: 0 14px 0 8px;
}

.chip {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 13px;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 999px;
  transition: color 0.2s ease;
}
.chip::before {
  content: "";
  position: absolute;
  inset: 8px 2px;
  z-index: -1;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.chip[aria-current="true"] { color: var(--paper); }
.chip[aria-current="true"]::before { background: var(--ink); }
.chip:focus-visible { outline-offset: -4px; }
.chips li { position: relative; z-index: 0; }

.bar__search-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.bar.is-searching .bar__nav,
.bar.is-searching .bar__search-toggle { display: none; }

.search {
  flex: 1;
  padding: 8px 10px 6px;
}
.search__form {
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--paper-card);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
}
.search__form:focus-within { border-color: var(--gold-text); }
.search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 4px 0 18px;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1rem;  /* >=16px evita zoom no iOS */
  outline: none;
}
.search__input::placeholder { color: var(--ink-soft); opacity: 0.85; font-style: italic; }
.search__input::-webkit-search-cancel-button { display: none; }
.search__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.search__status {
  min-height: 1.2em;
  padding: 4px 18px 0;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.search__status:empty { display: none; }

/* ---------- conteúdo ---------- */

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  outline: none;
}

.category {
  padding-top: 40px;
  scroll-margin-top: var(--bar-h);
}
.category__head { text-align: center; margin-bottom: 22px; }
.category__title {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1.15;
  text-wrap: balance;
  letter-spacing: 0.03em;
}
.category__subtitle {
  max-width: 34ch;
  text-wrap: balance;
  margin: 6px auto 0;
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-soft);
}

.category__cover {
  aspect-ratio: 16 / 9;
  margin-bottom: 8px;
}

.group + .group { margin-top: 30px; }
.group__title {
  margin-bottom: 10px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.group__title::after {
  content: "";
  display: block;
  width: 36px;
  height: 1px;
  margin-top: 7px;
  background: var(--gold);
}

.group__photo { aspect-ratio: 16 / 9; margin-bottom: 6px; }
/* Foto de origem em retrato: corte menos agressivo */
.group__photo--portrait { aspect-ratio: 4 / 3; }
.group__photo--portrait .zoom__img { object-position: center 40%; }
/* Foto panorâmica (ex.: soda italiana): mantém a proporção original, sem cortar */
.group__photo--wide { aspect-ratio: 896 / 377; }

.gallery {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 8px;
  height: clamp(170px, 48vw, 300px);
  margin-bottom: 6px;
}
.gallery .zoom { height: 100%; }

/* Foto clicável (abre ampliada) */
.zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #ece4da;
  border-radius: var(--radius);
  cursor: zoom-in;
}
.zoom__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.note {
  margin-top: 10px;
  font-style: italic;
  font-size: 0.98rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

/* ---------- lista: nome ...... preço ---------- */

.list > li + li { border-top: 1px solid rgba(169, 130, 71, 0.16); }
.grid + .list { margin-top: 10px; }

.row { padding: 11px 0; }
.row--thumb {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
}
.row__thumb { width: 64px; aspect-ratio: 1; border-radius: 10px; }

.row__line,
.variant {
  display: flex;
  align-items: baseline;
  align-items: last baseline;
  gap: 0;
}
.row__name {
  flex: 0 1 auto;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.2;
}
.leader {
  flex: 1 1 18px;
  min-width: 18px;
  margin: 0 6px;
  border-bottom: 1px dotted var(--gold);
  transform: translateY(-0.28em);
}
.row .desc { margin-top: 3px; }

.desc {
  font-size: 0.98rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.flavors {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.flavors li {
  padding: 1px 9px 2px;
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--ink);
  background: rgba(243, 211, 214, 0.45);
  border-radius: 999px;
}

.variants { margin-top: 6px; }
.variant { padding: 3px 0; }
.variant__name { font-size: 1rem; }

/* ---------- cards com foto ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--paper-card);
  border: 1px solid rgba(169, 130, 71, 0.18);
  border-radius: var(--radius);
  overflow: hidden;
}
.card__media {
  aspect-ratio: 4 / 3;
  border-radius: 0;
}
.grid--tall .card__media { aspect-ratio: 4 / 5; }

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 10px 11px 12px;
}
.card__name {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.15;
}
.card__body .desc { margin-top: 4px; font-size: 0.95rem; }
.card__body .flavors li { font-size: 0.85rem; }
.card__body .desc { font-size: 0.93rem; }
/* Variações no card estreito: sem pontilhado; o preço quebra para a linha de baixo se faltar espaço */
.card .variant { flex-wrap: wrap; column-gap: 6px; }
.card .variant .leader { display: none; }
.card .variant__name { flex: 1 0 auto; font-size: 0.98rem; }
.card .variant .price { margin-left: auto; }
.card__price { margin-top: auto; padding-top: 8px; }

/* Ímpar no fim do grid: centraliza o último card */
.grid > .card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc(50% - 6px);
}

/* Card lateral: foto à esquerda, texto à direita */
.list--side > li + li { border-top: 0; }
.list--side > .row { border-top: 1px solid rgba(169, 130, 71, 0.16); }
.list--side > .card + .card { margin-top: 12px; }
.list--side > .card {
  flex-direction: row;
  align-items: stretch;
}
.list--side > .card + .row { margin-top: 6px; border-top: 0; }
.list--side .card__media {
  flex: none;
  width: 38%;
  aspect-ratio: auto;
  min-height: 118px;
}
.list--side .card__body { padding: 10px 12px 12px; }

/* ---------- busca ativa ---------- */

body.is-searching .category__cover,
body.is-searching .group__photo,
body.is-searching .gallery { display: none; }
body.is-searching .category { padding-top: 26px; }

.empty {
  padding: 56px 12px 24px;
  text-align: center;
  font-size: 1.25rem;
  font-style: italic;
}
.empty span { display: inline-block; margin-top: 6px; font-size: 1rem; color: var(--ink-soft); }

.notice, .noscript { padding: 40px 0; text-align: center; font-style: italic; }

/* ---------- rodapé ---------- */

.footer {
  margin-top: 48px;
  padding: 0 var(--gutter) calc(48px + env(safe-area-inset-bottom));
  text-align: center;
}
.footer > .flourish { margin: 0 auto 26px; }
.footer__logo { width: auto; height: 52px; margin: 0 auto 8px; }
.footer__name { font-size: 1.35rem; font-weight: 500; }
.footer__copy {
  margin-top: 18px;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.contact {
  display: grid;
  gap: 14px;
  max-width: 420px;
  margin: 20px auto 0;
  font-size: 1.05rem;
}
.contact li { display: grid; gap: 2px; }
.contact__label {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.contact a {
  display: inline-block;
  min-height: 44px;
  padding: 10px 0;
  color: var(--ink);
  text-underline-offset: 3px;
  text-decoration-color: var(--gold);
}

/* ---------- voltar ao topo ---------- */

.to-top {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 15;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 252, 248, 0.94);
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(46, 34, 28, 0.12);
  cursor: pointer;
}

/* ---------- foto ampliada ---------- */

.lightbox {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: calc(56px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
  border: 0;
  background: rgba(28, 20, 16, 0.96);
  color: var(--paper);
}
.lightbox[open] {
  display: grid;
  place-items: center;
  animation: fade 0.2s ease;
}
.lightbox::backdrop { background: transparent; }
.lightbox__figure { margin: 0; max-width: 960px; }
.lightbox__img {
  width: 100%;
  max-width: 100%;
  max-height: 74vh;
  max-height: 74dvh;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 10px;
}
.lightbox__caption {
  margin-top: 14px;
  text-align: center;
  font-size: 1.3rem;
  font-style: italic;
}
.lightbox__close {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  right: 8px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(247, 243, 238, 0.12);
  color: var(--paper);
  cursor: pointer;
}
.lightbox :focus-visible { outline-color: var(--paper); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- telas maiores ---------- */

@media (min-width: 600px) {
  :root { --gutter: 28px; }
  .masthead__logo { height: 72px; }
  .masthead__name { font-size: 2.5rem; }
  .category { padding-top: 56px; }
  .category__title { font-size: 2rem; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 16px; }
  .grid > .card:last-child:nth-child(odd) { grid-column: auto; width: auto; justify-self: stretch; }
  .list--side .card__media { width: 34%; min-height: 150px; }
  /* Grupo com foto: foto à esquerda, lista à direita (evita ampliar demais fotos pequenas) */
  .group--media {
    display: grid;
    grid-template-columns: 38% minmax(0, 1fr);
    column-gap: 28px;
    align-items: start;
  }
  .group--media > * { grid-column: 2; }
  .group--media > .group__title { grid-column: 1 / -1; }
  .group--media > .zoom,
  .group--media > .gallery { grid-column: 1; grid-row: 2 / span 3; margin: 0; }
  .group--media > .group__photo,
  .group--media > .group__photo--portrait { aspect-ratio: 4 / 5; }
  .group--media > .gallery { grid-template-columns: 1fr; height: auto; }
  .group--media > .gallery .zoom { aspect-ratio: 4 / 3; }
  /* Panorâmica não cabe na coluna lateral: vai inteira acima da lista */
  .group--media:has(> .group__photo--wide) { display: block; }
  .group--media > .group__photo--wide { aspect-ratio: 896 / 377; margin-bottom: 6px; }
  .group--media > .note:first-of-type { margin-top: 0; }
  body.is-searching .group--media { display: block; }
}

@media (hover: hover) {
  .chip:hover { color: var(--ink); }
  .chip[aria-current="true"]:hover { color: var(--paper); }
  .zoom__img { transition: transform 0.4s ease; }
  .zoom:hover .zoom__img { transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
