/* =====================================================================
   NFKings · PLANTILLAS NUEVAS — piezas reutilizables
   El registro (js/plantillas.js) le pone al <body>:
     tpl              → es una plantilla nueva (los 7 estilos originales NO la llevan,
                        así que nada de este archivo los toca)
     hd-<encabezado>  → composición del encabezado
     lay-<productos>  → composición de los productos
   Cada plantilla (plantillas-temas.css) solo ajusta variables y detalles.
   El HTML del menú es el mismo para todas.
   ===================================================================== */

/* ---------- Variables que cada plantilla puede cambiar ---------- */
.tpl {
  --hw: 700;                         /* grosor de títulos (400 en fuentes de un solo grosor) */
  --case: none;                      /* mayúsculas en títulos */
  --track: normal;                   /* espaciado de letras en títulos */
  --card-bg: var(--surface);
  --card-border: 1px solid var(--line);
  --card-pad: 14px;
  --photo-r: calc(var(--radius) - 4px);
  --chip-r: 999px;
  --btn-r: 14px;
  --price: var(--ink);
  --gap: 14px;
  --cat-size: 1.6rem;
  --shadow-hover: 0 14px 30px -14px rgb(0 0 0 / .35);
  /* Textura propia (capas con posición y tamaño) + el color de fondo elegido */
  background: var(--tex, none) var(--bg);
}
/* Con la decoración temática activada, su marca de agua reemplaza la textura propia. */
.decor-on.tpl { background: var(--bg); }

.tpl :is(h1, h2, h3) { font-weight: var(--hw); text-transform: var(--case); letter-spacing: var(--track); }
.tpl :is(.hero h1, .card h3, .cat-head h2) { overflow-wrap: break-word; hyphens: auto; }
.tpl .hero-text { min-width: 0; }
/* Si el nombre no cabe junto al precio, el precio baja al siguiente renglón (nunca se parte la palabra) */
.tpl .card-title { flex-wrap: wrap; row-gap: 2px; }
.tpl .menu .grid .card.no-photo .card-title { flex-wrap: wrap; row-gap: 2px; }
.tpl .cat-head h2 { font-size: var(--cat-size); }
.tpl .card { background: var(--card-bg); border: var(--card-border); padding: var(--card-pad); }
.tpl .grid { gap: var(--gap); }
.tpl .card-photo { border-radius: var(--photo-r); }
.tpl .price { color: var(--price); }
.tpl .chip { display: inline-flex; align-items: center; min-height: 40px; border-radius: var(--chip-r); transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s; }
.tpl :is(.action, .btn, .cart-fab) { border-radius: var(--btn-r); }
.tpl .action { transition: transform .15s ease, box-shadow .15s ease; }
.tpl .cat-cover { border-radius: var(--radius); }
/* Renglones sin foto seguidos van pegados (compensa el espacio de la cuadrícula de cada plantilla) */
.tpl .menu .grid .card.no-photo + .card.no-photo { margin-top: calc(0px - var(--gap)); }
.tpl .menu .grid .card.no-photo .price { color: var(--price); }
/* Los renglones sin foto siempre ocupan todo el ancho, en cualquier composición */
.tpl .menu .grid .card.no-photo { grid-column: 1 / -1; }

/* ---------- Microinteracciones (sutiles; se apagan con "reducir movimiento") ---------- */
@keyframes tpl-in { from { opacity: 0; transform: translateY(12px); } }
.tpl .hero-inner, .tpl .cat { animation: tpl-in .5s cubic-bezier(.2, .7, .2, 1) both; }
.tpl .card-photo img { transition: transform .45s ease; }
@media (hover: hover) {
  .tpl button.card.has-photo { transition: transform .2s ease, box-shadow .2s ease; }
  .tpl button.card.has-photo:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
  .tpl button.card.has-photo:hover .card-photo img { transform: scale(1.05); }
  .tpl .menu .grid button.card.no-photo:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
  .tpl .action:hover { transform: translateY(-2px); }
  .tpl .chip:not(.on):hover { border-color: var(--brand); }
}
.tpl .add { transition: transform .15s ease; }
.tpl button.card:active .add { transform: scale(.88); }

/* =====================================================================
   COMPOSICIÓN DE PRODUCTOS (.lay-*)
   ===================================================================== */

/* ---------- Foto grande arriba (stack) ---------- */
.lay-stack .grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .lay-stack .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lay-stack .card.has-photo { flex-direction: column-reverse; gap: 0; padding: 0; overflow: hidden; }
.lay-stack .card.has-photo .card-photo { width: 100%; aspect-ratio: 16 / 10; border-radius: 0; align-self: stretch; }
.lay-stack .card.has-photo .card-body { padding: 14px 16px 16px; }
.lay-stack .card.has-photo .card-title { flex-direction: row; align-items: baseline; gap: 10px; }
.lay-stack .card.has-photo .card-title .price { margin-left: auto; flex: none; }

/* ---------- Cuadrícula de 2 columnas (tiles) ---------- */
.lay-tiles .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .lay-tiles .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lay-tiles .card.has-photo { flex-direction: column-reverse; gap: 0; padding: 0; overflow: hidden; }
.lay-tiles .card.has-photo .card-photo { width: 100%; aspect-ratio: 1; border-radius: 0; align-self: stretch; }
.lay-tiles .card.has-photo .card-body { padding: 10px 11px 12px; }
.lay-tiles .card.has-photo .card-title { gap: 4px; }
.lay-tiles .card.has-photo h3 { font-size: 1.02rem; }
.lay-tiles .card.has-photo .card-desc { font-size: .82rem; -webkit-line-clamp: 2; }
.lay-tiles .card.has-photo .card-foot { padding-top: 8px; }
.lay-tiles .card.has-photo .add-label { display: none; }
.lay-tiles .menu .grid .card.no-photo { grid-column: 1 / -1; }

/* ---------- Foto a la izquierda (media-left) ---------- */
.lay-media-left .card.has-photo { flex-direction: row-reverse; align-items: center; gap: 14px; }
.lay-media-left .card.has-photo .card-photo { width: 104px; }
@media (min-width: 640px) { .lay-media-left .grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Lista con miniaturas (list) ---------- */
.lay-list .grid { grid-template-columns: minmax(0, 1fr); --gap: 0px; }
@media (min-width: 640px) { .lay-list .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; } }
.lay-list .card { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 16px 0; }
.lay-list .card.has-photo { flex-direction: row-reverse; align-items: center; gap: 14px; }
.lay-list .card.has-photo .card-photo { width: 68px; }
.lay-list .card.has-photo .card-title { flex-direction: row; align-items: baseline; gap: 10px; }
.lay-list .card.has-photo .card-title .price { margin-left: auto; flex: none; }
.lay-list .card.has-photo .card-foot { padding-top: 6px; }
.lay-list .card.has-photo .add { width: 30px; height: 30px; font-size: 1.1rem; }
@media (hover: hover) { .tpl.lay-list button.card.has-photo:hover { transform: none; box-shadow: none; background: color-mix(in srgb, var(--ink) 4%, transparent); } }

/* ---------- Carta con precios punteados (leaders) ---------- */
.lay-leaders .grid { grid-template-columns: minmax(0, 1fr); --gap: 0px; }
@media (min-width: 640px) { .lay-leaders .grid { grid-template-columns: minmax(0, 1fr); } }
.lay-leaders .card { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 18px 0; }
.lay-leaders .card.has-photo { flex-direction: row-reverse; align-items: flex-start; gap: 16px; }
.lay-leaders .card.has-photo .card-photo { width: 70px; align-self: flex-start; }
.lay-leaders .card.has-photo .card-title { flex-direction: row; align-items: baseline; gap: 8px; }
.lay-leaders .card.has-photo .leader { display: block; }
.lay-leaders .leader { border-bottom: 1.5px dotted color-mix(in srgb, var(--ink) 35%, transparent); transform: translateY(-5px); }
.lay-leaders .card.has-photo .card-title .price { margin-left: 0; }
.lay-leaders .card.has-photo .card-foot { padding-top: 6px; }
@media (hover: hover) { .tpl.lay-leaders button.card.has-photo:hover { transform: none; box-shadow: none; } }

/* ---------- Texto sobre la foto (overlay) y portada de "platillo estrella" (feature) ---------- */
.lay-overlay .grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .lay-overlay .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lay-overlay .card.has-photo,
.lay-feature .grid > .card.has-photo:first-child {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch;
  min-height: 240px; padding: 0; overflow: hidden; border: 0; background: #1a1a1a; color: #fff;
}
.lay-overlay .card.has-photo .card-photo,
.lay-feature .grid > .card.has-photo:first-child .card-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; border: 0; transform: none;
}
/* Velo oscuro: el texto blanco siempre se lee, sea cual sea la foto */
.lay-overlay .card.has-photo::after,
.lay-feature .grid > .card.has-photo:first-child::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, var(--veil, rgb(0 0 0 / .88)) 0%, color-mix(in srgb, var(--veil, rgb(0 0 0 / .88)) 60%, transparent) 45%, transparent 78%);
}
.lay-overlay .card.has-photo .card-body,
.lay-feature .grid > .card.has-photo:first-child .card-body { position: relative; z-index: 1; flex: none; padding: 70px 16px 16px; }
.lay-overlay .card.has-photo :is(h3, .price, .add-label),
.lay-feature .grid > .card.has-photo:first-child :is(h3, .price, .add-label) { color: #fff; }
.lay-overlay .card.has-photo .card-desc,
.lay-feature .grid > .card.has-photo:first-child .card-desc { color: rgb(255 255 255 / .9); -webkit-line-clamp: 2; }
.lay-overlay .card.has-photo .card-title,
.lay-feature .grid > .card.has-photo:first-child .card-title { flex-direction: row; align-items: baseline; gap: 10px; }
.lay-overlay .card.has-photo .card-title .price,
.lay-feature .grid > .card.has-photo:first-child .card-title .price { margin-left: auto; flex: none; }
.lay-overlay .card.has-photo h3,
.lay-feature .grid > .card.has-photo:first-child h3 { text-shadow: 0 1px 10px rgb(0 0 0 / .45); }

/* ---------- Platillo estrella + lista (feature) ---------- */
.lay-feature .grid { grid-template-columns: minmax(0, 1fr); --gap: 0px; }
@media (min-width: 640px) { .lay-feature .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 30px; } }
.lay-feature .grid > .card.has-photo:first-child { grid-column: 1 / -1; min-height: 300px; margin-bottom: 10px; border-radius: var(--radius); }
.lay-feature .card { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 16px 0; }
.lay-feature .card.has-photo { flex-direction: row-reverse; align-items: center; gap: 14px; }
.lay-feature .card.has-photo .card-photo { width: 84px; }
.lay-feature .card.has-photo .card-title { flex-direction: row; align-items: baseline; gap: 10px; }
.lay-feature .card.has-photo .card-title .price { margin-left: auto; flex: none; }
@media (hover: hover) { .tpl.lay-feature .grid > button.card.has-photo:not(:first-child):hover { transform: none; box-shadow: none; } }

/* ---------- Mosaico de tarjetas (bento) ---------- */
.lay-bento .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lay-bento .card.has-photo { flex-direction: column-reverse; gap: 0; padding: 0; overflow: hidden; }
.lay-bento .card.has-photo .card-photo { width: 100%; aspect-ratio: 4 / 3; border-radius: 0; align-self: stretch; }
.lay-bento .card.has-photo .card-body { padding: 11px 12px 13px; }
.lay-bento .card.has-photo h3 { font-size: 1.02rem; }
.lay-bento .card.has-photo .card-desc { font-size: .84rem; -webkit-line-clamp: 2; }
.lay-bento .card.has-photo .add-label { display: none; }
/* La primera tarjeta con foto de cada categoría ocupa todo el ancho */
.lay-bento .grid > .card.has-photo:first-child { grid-column: 1 / -1; }
.lay-bento .grid > .card.has-photo:first-child .card-photo { aspect-ratio: 16 / 9; }
.lay-bento .grid > .card.has-photo:first-child .card-title { flex-direction: row; align-items: baseline; gap: 10px; }
.lay-bento .grid > .card.has-photo:first-child .card-title .price { margin-left: auto; flex: none; }
.lay-bento .grid > .card.has-photo:first-child h3 { font-size: 1.2rem; }
.lay-bento .menu .grid .card.no-photo { grid-column: 1 / -1; }
/* Si una tarjeta queda sola en su fila (impar), ocupa todo el ancho en vez de dejar un hueco */
.lay-bento .grid > .card.has-photo:nth-child(even):is(:last-child, :has(+ .card.no-photo)) { grid-column: 1 / -1; }
.lay-bento .grid > .card.has-photo:nth-child(even):is(:last-child, :has(+ .card.no-photo)) .card-photo { aspect-ratio: 16 / 9; }

/* ---------- Foto redonda tipo plato (plate) ---------- */
.lay-plate .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .lay-plate .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lay-plate .card.has-photo { flex-direction: column-reverse; justify-content: flex-end; align-items: center; gap: 12px; padding: 18px 12px 14px; text-align: center; }
.lay-plate .card.has-photo .card-photo { width: min(124px, 82%); aspect-ratio: 1; border-radius: 50%; align-self: center; }
.lay-plate .card.has-photo .card-body { width: 100%; align-items: center; }
.lay-plate .card.has-photo .card-title { align-items: center; gap: 6px; }
.lay-plate .card.has-photo h3 { font-size: 1.05rem; }
.lay-plate .card.has-photo .card-desc { font-size: .84rem; -webkit-line-clamp: 2; }
.lay-plate .card.has-photo .card-foot { justify-content: center; }
.lay-plate .card.has-photo .add-label { display: none; }
.lay-plate .menu .grid .card.no-photo { grid-column: 1 / -1; }

/* ---------- Fotos instantáneas (polaroid) ---------- */
.lay-polaroid .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); --gap: 18px; }
@media (min-width: 700px) { .lay-polaroid .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lay-polaroid .card.has-photo {
  flex-direction: column-reverse; justify-content: flex-end; gap: 10px; padding: 8px 8px 12px;
  background: #fffdf8; color: #1d1d1d; border: 0; border-radius: 3px;
  box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 10px 18px -8px rgb(0 0 0 / .35); transform: rotate(-1.4deg);
}
.lay-polaroid .grid > .card.has-photo:nth-child(even) { transform: rotate(1.4deg); }
.lay-polaroid .card.has-photo .card-photo { width: 100%; aspect-ratio: 1; border-radius: 1px; align-self: stretch; }
.lay-polaroid .card.has-photo .card-body { padding: 0 4px; }
.lay-polaroid .card.has-photo .card-title { gap: 4px; }
.lay-polaroid .card.has-photo h3 { font-size: 1rem; color: #1d1d1d; }
.lay-polaroid .card.has-photo .price { color: #1d1d1d; }
.lay-polaroid .card.has-photo .card-desc { color: #555; font-size: .82rem; -webkit-line-clamp: 2; }
.lay-polaroid .card.has-photo .add-label { display: none; }
.lay-polaroid .menu .grid .card.no-photo { grid-column: 1 / -1; }
@media (hover: hover) { .tpl.lay-polaroid .grid > button.card.has-photo:hover { transform: rotate(0) translateY(-3px); } }

/* =====================================================================
   COMPOSICIÓN DEL ENCABEZADO (.hd-*)
   ===================================================================== */

/* ---------- Alineado a la izquierda ---------- */
.hd-left .hero { padding: 44px 20px 26px; }
.hd-left .hero.has-cover { padding-top: 170px; }
.hd-left .hero-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
.hd-left .hero h1 { font-size: clamp(2.2rem, 10vw, 3.4rem); line-height: 1.02; }
.hd-left .desc { max-width: 40ch; }

/* ---------- Centrado ---------- */
.hd-center .hero { text-align: center; padding: 48px 22px 28px; }
.hd-center .hero.has-cover { padding-top: 175px; }
.hd-center .hero-inner { flex-direction: column; gap: 16px; }
.hd-center .hero h1 { font-size: clamp(2.2rem, 10vw, 3.3rem); }
.hd-center .desc { max-width: 36ch; margin-inline: auto; }
.hd-center .hours { justify-content: center; }
.hd-center .actions { justify-content: center; }
.hd-center .notice { text-align: center; }
.hd-center .cat-head { text-align: center; }

/* ---------- Logo y nombre en renglón ---------- */
.hd-split .hero { padding: 38px 20px 24px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.hd-split .hero.has-cover { padding-top: 170px; }
.hd-split .hero-inner { align-items: flex-end; gap: 18px; }
.hd-split .hero h1 { font-size: clamp(1.9rem, 8.5vw, 3rem); line-height: 1.05; }
.hd-split .logo { width: 92px; height: 92px; border-radius: var(--radius); }

/* ---------- Franja de color ---------- */
.hd-band .hero {
  padding: 36px 20px 34px; margin-bottom: 18px; overflow: hidden;
  background: var(--brand); color: var(--brand-ink); border-radius: 0 0 var(--band-r, 28px) var(--band-r, 28px);
}
.hd-band .hero.has-cover { padding-top: 175px; }
.hd-band .hero-cover { -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); }
.hd-band .hero-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
.hd-band .hero h1 { color: var(--brand-ink); font-size: clamp(2.1rem, 9.5vw, 3.2rem); }
.hd-band .hero :is(.eyebrow, .desc, .hours) { color: color-mix(in srgb, var(--brand-ink) 86%, var(--brand)); }
.hd-band .logo { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-ink) 90%, transparent), 0 10px 24px rgb(0 0 0 / .25); }
.hd-band .logo-text { background: var(--brand-ink); color: var(--brand); }

/* ---------- Título enorme tipo cartel ---------- */
.hd-poster .hero { padding: 34px 18px 26px; }
.hd-poster .hero.has-cover { padding-top: 165px; }
.hd-poster .hero-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
.hd-poster .logo { width: 66px; height: 66px; }
.hd-poster .logo-text { font-size: 1.5rem; }
.hd-poster .hero h1 { font-size: clamp(2.6rem, 13vw, 4.8rem); line-height: .92; }

/* ---------- Tarjeta flotante ---------- */
.hd-card .hero { padding: 70px 16px 10px; }
.hd-card .hero.has-cover { padding-top: 150px; }
.hd-card .hero-inner {
  flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 0 18px 22px;
  background: var(--card-bg); border: var(--card-border); border-radius: calc(var(--radius) + 6px); box-shadow: var(--shadow);
}
.hd-card .logo { margin-top: -46px; }
.hd-card .hero h1 { font-size: clamp(1.9rem, 8.5vw, 2.8rem); }
.hd-card .desc { max-width: 36ch; margin-inline: auto; }
.hd-card .hours { justify-content: center; }
.hd-card .actions { justify-content: center; }
.hd-card .notice { text-align: center; }

/* ---------- Portada a todo lo ancho ---------- */
.hd-cover .hero { padding: 44px 20px 30px; overflow: hidden; }
.hd-cover .hero-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
.hd-cover .hero h1 { font-size: clamp(2.3rem, 10.5vw, 3.6rem); line-height: 1.02; }
.hd-cover .hero.has-cover { min-height: 340px; display: flex; flex-direction: column; justify-content: flex-end; padding: 130px 20px 28px; }
.hd-cover .hero.has-cover .hero-cover { inset: 0; height: 100%; z-index: 0; -webkit-mask-image: none; mask-image: none; }
.hd-cover .hero.has-cover .hero-deco {
  display: block; position: absolute; inset: 0; z-index: 1; border: 0; outline: 0; transform: none;
  background: linear-gradient(to top, rgb(0 0 0 / .86), rgb(0 0 0 / .4) 55%, rgb(0 0 0 / .12));
}
.hd-cover .hero.has-cover .hero-inner { z-index: 2; }
.hd-cover .hero.has-cover :is(h1, .eyebrow) { color: #fff; }
.hd-cover .hero.has-cover :is(.desc, .hours) { color: rgb(255 255 255 / .88); }
/* Sin foto de portada: franja de color con degradado */
.hd-cover .hero:not(.has-cover) {
  background: linear-gradient(155deg, var(--brand), color-mix(in srgb, var(--brand) 78%, #000));
  color: var(--brand-ink); border-radius: 0 0 var(--band-r, 26px) var(--band-r, 26px); margin-bottom: 18px;
}
.hd-cover .hero:not(.has-cover) h1 { color: var(--brand-ink); }
.hd-cover .hero:not(.has-cover) :is(.eyebrow, .desc, .hours) { color: color-mix(in srgb, var(--brand-ink) 86%, var(--brand)); }
