/* Carta en vídeo (modo scroll) · demo de Kloop. Motor compartido con web/charo-bakehouse (app.js, styles.css).
   Paleta y tipografía sacadas de su carta impresa: terracota, papel crema,
   display fino de alto contraste y sans geométrica. */
:root {
  --terracotta: #b46948;      /* su color de marca: grandes titulares y detalles */
  --terracotta-dark: #8a4a2f; /* fondos con texto pequeño encima (AA con --ink-soft) */
  --terracotta-deep: #7e4029;
  --terracotta-ink: #3a1a0e;
  --cream: #f6ede4;
  --paper: #fbf7f2;
  --ink: #fff8f1;
  --ink-soft: rgba(255, 248, 241, .78);
  --glass: rgba(58, 26, 14, .5);
  --glass-line: rgba(255, 248, 241, .22);

  --font-display: 'Italiana', 'Didot', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;

  --text-xs: .6875rem;
  --text-sm: .8125rem;
  --text-base: .9375rem;
  --text-name: clamp(2.6rem, 1.6rem + 7vw, 4.4rem);
  --text-price: clamp(2rem, 1.5rem + 2.4vw, 2.6rem);
  --text-hero: min(26vw, 8.5rem); /* solo vw: con zoom de texto no se sale de la columna */

  --gutter: 20px;
  --column: 520px;
  --top-h: 112px;
  --dur: 300ms;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--terracotta-ink); color: var(--ink);
  font: 300 var(--text-base)/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; border-radius: 6px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 20;
  max-width: var(--column); margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(to bottom, rgba(40, 17, 8, .7), rgba(40, 17, 8, 0));
}
.topbar-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter) 4px;
}
.wordmark { display: grid; justify-items: center; text-decoration: none; line-height: 1; }
.wordmark-name { font: 400 1.55rem/1 var(--font-display); letter-spacing: .08em; }
.wordmark-sub { font: 500 .45rem/1 var(--font-body); letter-spacing: .42em; margin-top: 3px; padding-left: .42em; color: var(--ink-soft); }

.lang { display: flex; padding: 2px; border: 1px solid var(--glass-line); border-radius: 999px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.lang button { border: 0; background: none; padding: 5px 11px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em; color: var(--ink-soft); transition: background var(--dur), color var(--dur); }
.lang button[aria-pressed="true"] { background: var(--cream); color: var(--terracotta-deep); }

.cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 10px var(--gutter) 8px; }
.cats::-webkit-scrollbar { display: none; }
.cats button {
  flex: none; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--glass-line); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: var(--text-xs); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.cats button:active { transform: scale(.96); }
.cats button[aria-current="true"] { background: var(--cream); border-color: var(--cream); color: var(--terracotta-deep); }

/* Progreso tipo "stories": un segmento por pantalla */
.ticks { display: flex; gap: 3px; list-style: none; margin: 0; padding: 0 var(--gutter); }
.ticks li { flex: 1; height: 2px; border-radius: 2px; background: var(--glass-line); overflow: hidden; }
.ticks li::after { content: ''; display: block; height: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform var(--dur) var(--ease); }
.ticks li.is-done::after { transform: scaleX(1); }

/* ---------- Feed ---------- */
.feed {
  max-width: var(--column); margin: 0 auto;
  height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.noscript { margin: 0; padding: calc(var(--top-h) + 24px) var(--gutter) 24px; text-align: center; line-height: 1.6; }

/* min-height (no height): con zoom de texto al 200 % la pantalla crece en vez de cortar */
.slide {
  position: relative; min-height: 100dvh; overflow: hidden;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--terracotta-deep);
  isolation: isolate;
}
.slide-media { position: absolute; inset: 0; z-index: 0; }
.slide-media img, .slide-media video { width: 100%; height: 100%; object-fit: cover; }

/* Fotos fijas: zoom lento (Ken Burns) mientras la pantalla está activa */
.slide-media img.kb { transform: scale(1.02); }
.slide.is-active .slide-media img.kb { animation: kenburns 14s cubic-bezier(.25, .1, .25, 1) forwards; }
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.12); } }
.slide-media::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(to top, rgba(40, 17, 8, .94) 0%, rgba(40, 17, 8, .62) 34%, rgba(40, 17, 8, 0) 62%),
    linear-gradient(to bottom, rgba(40, 17, 8, .35), rgba(40, 17, 8, 0) 22%);
}

.slide-content {
  position: relative; z-index: 1;
  padding: 0 var(--gutter) calc(28px + env(safe-area-inset-bottom));
}

/* Entrada del texto al llegar a la pantalla */
.slide-content > * { opacity: 0; transform: translateY(14px); transition: opacity 500ms var(--ease), transform 700ms var(--ease); }
.slide.is-active .slide-content > * { opacity: 1; transform: none; }
.slide.is-active .slide-content > :nth-child(2) { transition-delay: 60ms; }
.slide.is-active .slide-content > :nth-child(3) { transition-delay: 120ms; }
.slide.is-active .slide-content > :nth-child(4) { transition-delay: 180ms; }
.slide.is-active .slide-content > :nth-child(5) { transition-delay: 240ms; }

/* ---------- Producto ---------- */
.code {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
  font-size: var(--text-xs); font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft);
}
.code::before { content: ''; width: 22px; height: 1px; background: currentColor; }

.name {
  margin: 0; font: 400 var(--text-name)/.95 var(--font-display);
  text-transform: uppercase; letter-spacing: .01em; text-wrap: balance;
}
.desc { margin: 12px 0 0; max-width: 34ch; color: var(--ink-soft); }
.extra { margin: 4px 0 0; font-size: var(--text-sm); color: var(--ink-soft); }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 14px; }
.pill {
  display: inline-block; padding: 4px 10px 3px; border-radius: 6px;
  background: var(--cream); color: var(--terracotta-deep);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
}
.pill-outline { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--glass-line); }
.allergens { margin: 0; font-size: var(--text-xs); letter-spacing: .06em; color: var(--ink-soft); }

.price-row {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--glass-line);
}
.price { font: 400 var(--text-price)/1 var(--font-display); }
.price small { font: 400 var(--text-sm)/1 var(--font-body); color: var(--ink-soft); margin-left: 2px; }
.price-alt { font-size: var(--text-sm); color: var(--ink-soft); text-align: right; }
.price-alt strong { display: block; font: 400 1.35rem/1.1 var(--font-display); color: var(--ink); }

/* Botón de vídeo: sirve para pausar y para quien tiene "reducir movimiento" */
.vid-toggle {
  position: absolute; z-index: 2; right: var(--gutter); top: calc(var(--top-h) + env(safe-area-inset-top) + 8px);
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--glass-line); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center; opacity: .8;
}
.vid-toggle svg { width: 12px; height: 12px; fill: var(--ink); }

/* ---------- Portada ---------- */
.cover .slide-media::after {
  background:
    linear-gradient(to top, rgba(58, 26, 14, .92) 0%, rgba(126, 64, 41, .55) 48%, rgba(126, 64, 41, .2) 100%);
}
.cover .slide-content { text-align: center; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.cover-place { margin: 0; font-size: var(--text-xs); font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--ink-soft); }
.cover-title { margin: 10px 0 0; line-height: .82; }
.cover-title span { display: block; font: 400 var(--text-hero)/.82 var(--font-display); letter-spacing: .04em; }
.cover-title small { display: block; margin-top: 12px; font: 500 .8rem/1 var(--font-body); letter-spacing: .62em; padding-left: .62em; }
.cover-tagline { margin: 20px auto 0; max-width: 26ch; font-size: 1.05rem; color: var(--ink-soft); }
.cover-pills { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.cover-hours { margin: 14px 0 0; font-size: var(--text-sm); letter-spacing: .04em; color: var(--ink-soft); }
.swipe {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 26px;
  font-size: var(--text-xs); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft);
}
.swipe svg { animation: nudge 1.8s var(--ease) infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); opacity: .6; } 50% { transform: translateY(6px); opacity: 1; } }

/* ---------- Cierre ---------- */
.end { background: var(--terracotta-dark); justify-content: center; }
.end .slide-content { padding-top: calc(var(--top-h) + env(safe-area-inset-top) + 8px); }
.end-photo { margin: 0; }
.end-photo img {
  width: min(52%, 24dvh); height: auto; margin: 0 auto;
  aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px;
  box-shadow: 0 24px 48px -18px rgba(40, 17, 8, .6);
  transform: rotate(-2.5deg);
}
/* Etiqueta bajo la foto, con la línea de sus ilustraciones */
.end-photo figcaption {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px;
  font-size: var(--text-xs); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft);
}
.end-photo figcaption::before, .end-photo figcaption::after { content: ''; width: 18px; height: 1px; background: currentColor; }
.end-title { margin: 22px 0 0; text-align: center; font: 400 clamp(2rem, 1.4rem + 3vw, 2.6rem)/1.05 var(--font-display); text-wrap: balance; }
.end-text { margin: 10px auto 0; max-width: 30ch; text-align: center; color: var(--ink-soft); }
.end-actions { display: grid; gap: 10px; margin: 26px auto 0; max-width: 340px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  font-size: var(--text-sm); font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  transition: transform var(--dur) var(--ease), background var(--dur);
}
.btn:active { transform: scale(.97); }
.btn-primary { border: 0; background: var(--cream); color: var(--terracotta-deep); box-shadow: 0 10px 24px -12px rgba(40, 17, 8, .7); }
.btn-ghost { border: 1px solid var(--glass-line); background: none; color: var(--ink); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.end-foot { margin: 20px 0 0; text-align: center; font-size: var(--text-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }

/* Móviles bajos (iPhone SE y similares): el cierre tiene que caber sin cortar */
@media (max-height: 720px) {
  .end-photo img { width: min(40%, 20dvh); }
  .end-photo figcaption { margin-top: 12px; }
  .end-title { margin-top: 14px; }
  .end-text { display: none; }
  .end-actions { margin-top: 18px; }
  .end-foot { margin-top: 14px; }
}

/* Móviles estrechos (320 px): "CÓMO LLEGAR" e "INSTAGRAM" caben en una línea */
@media (max-width: 359px) {
  .btn { padding: 0 12px; letter-spacing: .06em; }
}

/* ---------- Hoja: carta completa ----------
   Texto en terracota oscura (AA sobre papel); la terracota de marca solo en titulares grandes. */
.sheet {
  width: 100%; max-width: var(--column); max-height: 92dvh; margin: auto auto 0;
  padding: 0; border: 0; border-radius: 22px 22px 0 0;
  background: var(--paper); color: var(--terracotta-deep);
}
.sheet :focus-visible { outline-color: var(--terracotta-deep); }
.sheet::backdrop { background: rgba(40, 17, 8, .55); backdrop-filter: blur(3px); }
.sheet[open] { animation: rise 420ms var(--ease); }
@keyframes rise { from { transform: translateY(100%); } }
.sheet-inner { display: flex; flex-direction: column; max-height: 92dvh; }
.sheet-head { position: relative; padding: 22px 64px 14px var(--gutter); border-bottom: 1px solid rgba(180, 105, 72, .25); }
.sheet-kicker { margin: 0; font-size: var(--text-xs); font-weight: 500; letter-spacing: .2em; }
.sheet-title { margin: 6px 0 0; font: 400 2rem/1 var(--font-display); text-transform: uppercase; color: var(--terracotta); }
.sheet-close {
  position: absolute; right: 14px; top: 16px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(180, 105, 72, .35); background: none; color: var(--terracotta-deep);
  font-size: 1.4rem; line-height: 1;
}
.sheet-body { overflow-y: auto; padding: 6px var(--gutter) calc(30px + env(safe-area-inset-bottom)); }
.menu-sec { padding: 20px 0 16px; border-bottom: 1px solid rgba(180, 105, 72, .25); }
.menu-sec:last-child { border-bottom: 0; }
.menu-code { margin: 0; font-size: var(--text-xs); letter-spacing: .16em; }
.menu-title { margin: 4px 0 10px; font: 400 1.6rem/1 var(--font-display); text-transform: uppercase; color: var(--terracotta); }
.menu-note { margin: -4px 0 10px; font-size: var(--text-sm); font-style: italic; }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; }
.menu-list .n { font-size: var(--text-sm); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.menu-list .dots { flex: 1; border-bottom: 1px dotted rgba(180, 105, 72, .4); transform: translateY(-4px); }
.menu-list .p { font-variant-numeric: tabular-nums; }
.menu-list .sub { display: block; font-size: var(--text-xs); font-weight: 300; letter-spacing: 0; text-transform: none; font-style: italic; }
.menu-legal { margin: 18px 0 0; font-size: var(--text-xs); }

/* ---------- Diseño partido (versión fotos): foto arriba, ficha terracota abajo ----------
   Las fotos de Instagram son 3:4; a pantalla completa el producto quedaba bajo el texto.
   La foto empieza debajo de la barra superior para que no tape caras ni detalles. */
.layout-split .slide[data-id] {
  background: var(--terracotta-deep);
  padding-top: calc(var(--top-h) + env(safe-area-inset-top));
}
.layout-split .slide[data-id] .slide-media {
  position: relative; inset: auto; flex: 1 1 0; min-height: 0; overflow: hidden;
}
.layout-split .slide[data-id] .slide-media::after {
  background: linear-gradient(to top, var(--terracotta-deep), rgba(126, 64, 41, 0) 16%);
}
.layout-split .slide[data-id] .slide-content { padding-top: 18px; }
.layout-split .name { font-size: clamp(2.2rem, 1.5rem + 5vw, 3.4rem); }
.layout-split .desc { margin-top: 10px; }
.layout-split .price-row { margin-top: 16px; padding-top: 12px; }

/* Pantallas muy bajas (iPhone SE 1.ª gen.): menos texto para que la foto no quede en una franja */
@media (max-height: 600px) {
  .layout-split .code { display: none; }
  .layout-split .name { font-size: 2rem; }
  .layout-split .desc { margin-top: 6px; font-size: var(--text-sm); line-height: 1.45; }
  .layout-split .meta { margin-top: 10px; }
  .layout-split .price-row { margin-top: 10px; padding-top: 8px; }
  .layout-split .slide[data-id] .slide-content { padding-top: 12px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}

/* ---------- Escritorio: columna de móvil sobre fondo de marca ---------- */
@media (min-width: 640px) {
  body { background: var(--terracotta-ink) radial-gradient(circle at 50% 0, var(--terracotta-deep), var(--terracotta-ink) 70%); }
  .feed { box-shadow: 0 0 0 1px rgba(255, 248, 241, .06), 0 30px 80px rgba(0, 0, 0, .45); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
  .slide-content > * { opacity: 1; transform: none; }
}
