/* ============================================================
   PlatoHub — "Carta" · Preview minimalista editorial (de cero)
   Concepto ganador del panel de diseño (MISE x Mesa).
   Editorial big-type + galería aireada · acento terracota.
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Work+Sans:wght@400;500;600&display=swap");

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #16150f;
  --ink-soft: #6f6b60;
  --ink-mute: #9a968b;
  --line: #e4e0d6;
  --line-strong: #d6d1c4;
  --accent: #C45031;
  --accent-press: #A83F23;
  --accent-soft: #F8E6DC;
  --danger: #b91c1c;
  --skeleton: #eeebe5;

  --r-media: 14px;
  --r-sm: 8px;

  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --gutter: clamp(16px, 4vw, 56px);

  --topbar-h: 64px;
  --tabbar-h: 50px;
  --maxw: 1600px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Work Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* "clip" recorta el desbordamiento horizontal SIN convertir el body en
     contenedor de scroll. Con "hidden" sí lo hacía, y entonces el topbar/tabbar
     sticky se anclaban al body mientras el scroll real ocurría en el viewport:
     el navegador los recolocaba en cada frame → los "botes" al scrollear en
     móvil. Se deja "hidden" antes como reserva para navegadores sin "clip". */
  overflow-x: hidden;
  overflow-x: clip;
}

h1, h2, h3, .font-display { font-family: "Outfit", sans-serif; font-weight: 600; letter-spacing: -0.02em; margin: 0; }

a { color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

.eyebrow {
  font: 600 11px/1 "Work Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

[data-lucide] { width: 1em; height: 1em; stroke-width: 1.5; display: inline-block; vertical-align: middle; }

/* Indicador de valoración: un TENEDOR que se rellena de abajo a arriba según la
   nota (sustituye a la estrella). --fill lo fija phForkRating()/PH.forkRating()
   inline (p.ej. 4/5 → --fill:80%). El número de la nota va siempre al lado. */
/* Valoración con el icono "utensils" de Lucide (tenedor + cuchillo — el mismo
   de "Ver plato"): las LÍNEAS del icono se pintan de dorado de abajo arriba
   según --fill; el tramo no alcanzado queda en gris neutro.
   ::before = icono completo con trazo gris · ::after = mismo icono con trazo
   dorado, recortado con una máscara-degradado a la altura de la nota. */
.fork-rate {
  --fill: 100%;
  --_utensils-grey: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a968b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2'/%3E%3Cpath d='M7 2v20'/%3E%3Cpath d='M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7'/%3E%3C/svg%3E");
  --_utensils-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4b740' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2'/%3E%3Cpath d='M7 2v20'/%3E%3Cpath d='M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7'/%3E%3C/svg%3E");
  position: relative;
  display: inline-block; flex: 0 0 auto;
  width: 1.25em; height: 1.25em; vertical-align: -0.22em;
}
.fork-rate::before {
  content: ""; position: absolute; inset: 0;
  background: var(--_utensils-grey) center / contain no-repeat;
}
.fork-rate::after {
  content: ""; position: absolute; inset: 0;
  background: var(--_utensils-gold) center / contain no-repeat;
  /* Solo se ve el dorado por DEBAJO del nivel de la nota. */
  -webkit-mask: linear-gradient(to top, #000 var(--fill), transparent var(--fill));
  mask: linear-gradient(to top, #000 var(--fill), transparent var(--fill));
}

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--ink); color: #fff; padding: 8px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 16px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ──────────────────────────────────────────
   TOPBAR
────────────────────────────────────────── */
/* En escritorio el envoltorio no genera caja: topbar y tabbar siguen siendo
   hijos directos de <body> con su sticky propio, igual que siempre. */
.chrome-stack { display: contents; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s5); height: 100%;
  padding-inline: var(--gutter);
  max-width: var(--maxw); margin-inline: auto;
}

/* ──────────────────────────────────────────
   TABBAR (full-width, vistas del feed)
────────────────────────────────────────── */
.tabbar {
  position: sticky; top: var(--topbar-h); z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.tabbar-inner {
  display: flex; align-items: stretch; gap: var(--s5);
  max-width: var(--maxw); margin-inline: auto;
  padding-inline: var(--gutter);
  overflow-x: auto; scrollbar-width: none;
}
.tabbar-inner::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 15px 2px; white-space: nowrap; cursor: pointer; text-decoration: none;
  border: 0; background: none;
  font: 500 14px "Work Sans", sans-serif; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.tab [data-lucide] { width: 16px; height: 16px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.brand {
  display: inline-flex; align-items: center; gap: 3px;
  text-decoration: none; color: var(--ink);
  flex-shrink: 0;
}
.brand img { height: 28px; width: auto; display: block; }
.brand-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); align-self: flex-end; margin-bottom: 4px; }

.search {
  display: flex; align-items: center; gap: var(--s2);
  flex: 1; max-width: 460px;
  border: 0; border-bottom: 1px solid var(--line);
  padding: 8px 2px;
  transition: border-color 0.2s ease;
}
.search:focus-within { border-bottom: 2px solid var(--ink); padding-bottom: 7px; }
.search [data-lucide] { color: var(--ink-soft); width: 18px; height: 18px; flex-shrink: 0; }
.search input {
  flex: 1; border: 0; background: none; outline: none;
  font: 400 15px "Work Sans", sans-serif; color: var(--ink); min-width: 0;
}
.search input::placeholder { color: var(--ink-soft); }
.search-type {
  border: 0; background: none; outline: none; cursor: pointer;
  font: 600 11px "Work Sans", sans-serif; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-soft); padding-right: 4px;
}

/* El tipo de búsqueda también usa el dropdown custom (.ph-select): el trigger
   va sin caja porque la pastilla del buscador ya la pone .search. */
.search .ph-select { width: auto; flex: 0 0 auto; }
.search .ph-select-trigger {
  height: auto; width: auto; padding: 0 4px 0 0; gap: 4px;
  border: 0; background: none; box-shadow: none;
  font: 600 11px "Work Sans", sans-serif; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft);
}
.search .ph-select-trigger:hover { border: 0; box-shadow: none; color: var(--ink); }
/* Igual que en la batalla: el trigger no lleva caja ni al abrirse (el aro del
   estado .open del componente se veía como un óvalo suelto en el buscador). */
.search .ph-select.open .ph-select-trigger,
.search .ph-select-trigger:focus-visible { border: 0; box-shadow: none; }
.search .ph-select-chevron { width: 13px; height: 13px; }
.search .ph-select-panel { left: -10px; min-width: 190px; }

.topbar-actions { display: flex; align-items: center; gap: var(--s2); flex-shrink: 0; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--ink-soft); cursor: pointer; position: relative;
  transition: color 0.18s ease, background 0.18s ease;
}
.icon-btn:hover { color: var(--ink); background: rgba(22, 21, 15, 0.04); }
.icon-btn [data-lucide] { width: 20px; height: 20px; }
.icon-btn .avatar { width: 32px; height: 32px; }

.notif-dot {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--accent); color: #fff;
  font: 700 10px/1 "Work Sans", sans-serif; font-variant-numeric: tabular-nums;
  border: 2px solid var(--bg);
}

.avatar { border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.avatar-fallback {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--ink); color: var(--surface);
  font: 600 13px "Outfit", sans-serif;
}

.btn-solid {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-sm);
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none;
  font: 600 14px "Outfit", sans-serif;
  transition: background 0.2s ease, transform 0.2s ease;
}
.btn-solid:hover { background: var(--accent-press); transform: translateY(-1px); }
.btn-solid [data-lucide] { width: 17px; height: 17px; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
  font: 500 14px "Outfit", sans-serif;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.btn-ghost:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.menu-btn { display: none; }
.search-toggle { display: none; }

/* ──────────────────────────────────────────
   SHELL
────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr) minmax(280px, 320px);
  grid-template-areas: "nav feed rail";
  /* width:100% es CLAVE: .shell es un flex item dentro de <div class="flex">; sin un
     ancho explícito se encoge a su contenido (shrink-to-fit) y, cuando el feed queda
     vacío, las 3 columnas se ven más pequeñas. Con width:100% siempre llena (cap maxw). */
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  align-items: start;
}
.rail-left { grid-area: nav; }
.feed { grid-area: feed; }
.rail-right { grid-area: rail; }

.rail-left {
  position: sticky; top: calc(var(--topbar-h) + var(--tabbar-h) + 24px); align-self: start;
  border-right: 1px solid var(--line);
  padding: var(--s7) var(--s5);
  min-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h));
}
.rail-right {
  position: sticky; top: calc(var(--topbar-h) + var(--tabbar-h) + 24px); align-self: start;
  border-left: 1px solid var(--line);
  padding: var(--s7) var(--s5);
  /* Nunca más alto que la pantalla: si sugerencias + mapa no caben, scrollea por
     dentro en vez de cortar el mapa al fondo de un rail sticky demasiado alto. */
  max-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 24px);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.feed { padding: var(--s7) var(--gutter); min-width: 0; container-type: inline-size; container-name: feed; }

/* ──────────────────────────────────────────
   NAV (índice editorial)
────────────────────────────────────────── */
.nav-profile { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s6); }
.nav-profile .avatar, .nav-profile .avatar-fallback { width: 40px; height: 40px; flex-shrink: 0; }
.nav-profile-info { min-width: 0; }
.nav-profile-info strong { display: block; font: 600 16px "Outfit", sans-serif; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-profile-info span { font: 600 11px "Work Sans", sans-serif; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-soft); }

.nav-list { display: flex; flex-direction: column; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px; color: var(--ink-soft); text-decoration: none;
  font: 500 14px "Work Sans", sans-serif;
  border-left: 2px solid transparent; margin-left: -12px; padding-left: 22px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.nav-item [data-lucide] { width: 18px; height: 18px; }
.nav-item:hover { color: var(--ink); }
.nav-item.active { color: var(--ink); font-weight: 600; border-left-color: var(--accent); }
.nav-item-badge {
  margin-left: auto; font: 600 12px "Work Sans", sans-serif; font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.nav-section { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line); }
.nav-section .eyebrow { display: block; margin-bottom: var(--s3); }
.rank-link { display: block; text-decoration: none; padding: 7px 0; }
.rank-link strong { display: block; font: 500 13px "Work Sans", sans-serif; color: var(--ink); }
.rank-link span { font: 500 12px "Work Sans", sans-serif; color: var(--ink-soft); }
.rank-link:hover strong { color: var(--accent); }
.rank-link.is-active strong { color: var(--accent); font-weight: 700; }

.nav-footer { margin-top: var(--s7); font: 400 11px "Work Sans", sans-serif; color: var(--ink-mute); }

/* ──────────────────────────────────────────
   HERO (destacado) — BANNER horizontal: foto de fondo a poca altura + texto
   superpuesto. Ocupa mucho menos alto que el destacado editorial anterior.
────────────────────────────────────────── */
.hero {
  position: relative; display: flex; align-items: stretch;
  min-height: 190px;
  border-radius: var(--r-media); overflow: hidden;
  margin-bottom: var(--s6); isolation: isolate;
  background: var(--skeleton);
}
/* La imagen es el fondo del banner (es un <a> que abre el destacado). */
.hero-media { position: absolute; inset: 0; z-index: 0; display: block; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
/* Velo para legibilidad del texto sobre la foto (más oscuro a la izquierda). */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(22,21,15,.84) 0%, rgba(22,21,15,.58) 42%, rgba(22,21,15,.14) 74%, transparent 100%);
}
.hero-body {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; justify-content: center; min-width: 0;
  max-width: min(640px, 74%); padding: var(--s5) var(--s6);
  color: #fff;
}
.hero-kicker { display: block; color: #fff; opacity: .88; margin-bottom: var(--s2); }
.hero-title {
  font: 700 clamp(1.7rem, 2.8vw, 2.4rem)/1.06 "Outfit", sans-serif;
  letter-spacing: -0.02em; color: #fff; text-wrap: balance; margin-bottom: var(--s3);
  text-shadow: 0 1px 14px rgba(0,0,0,.4);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-facts {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0;
  font: 500 13px "Work Sans", sans-serif; color: rgba(255,255,255,.92);
  font-variant-numeric: tabular-nums; margin-bottom: var(--s4);
  text-shadow: 0 1px 8px rgba(0,0,0,.4);
}
.hero-facts > * { display: inline-flex; align-items: center; gap: 5px; }
.hero-facts > * + *::before { content: "·"; margin: 0 10px; color: rgba(255,255,255,.55); }
.hero-facts a { color: #fff; text-decoration: none; }
.hero-facts a:hover { text-decoration: underline; text-underline-offset: 3px; }
.hero-facts [data-lucide] { width: 14px; height: 14px; color: #fff; }
.hero-facts .star { color: var(--gold, #f4b740); fill: var(--gold, #f4b740); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
/* Botón fantasma sobre fondo oscuro → contorno claro. */
.hero .btn-ghost { border-color: rgba(255,255,255,.55); color: #fff; background: transparent; }
.hero .btn-ghost:hover { background: #fff; color: var(--ink); border-color: #fff; }

/* Pestaña vacía: NO es banner → bloque claro centrado (sin foto ni velo). */
.hero.is-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; min-height: 0; overflow: visible; background: none; border-radius: 0;
  padding: var(--s7) 0; margin-bottom: var(--s7); border-bottom: 1px solid var(--line);
}
.hero.is-empty::after { content: none; }
.hero.is-empty .hero-body { position: static; max-width: 52ch; padding: 0; color: var(--ink); align-items: center; }
.hero.is-empty .hero-kicker { color: var(--accent); opacity: 1; }
.hero.is-empty .hero-title { color: var(--ink); font-size: clamp(2rem, 6vw, 3.5rem); text-shadow: none; display: block; -webkit-line-clamp: unset; }
.hero.is-empty .hero-actions { justify-content: center; }

/* ──────────────────────────────────────────
   FILTERS
────────────────────────────────────────── */
.filters {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--s5);
  padding-bottom: var(--s5); margin-bottom: var(--s6);
  border-bottom: 1px solid var(--line);
}
.filter { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter .eyebrow { display: block; }
.filter-control {
  display: inline-flex; align-items: center; gap: var(--s2);
  border: 0; border-bottom: 1px solid var(--line); background: none;
  padding: 4px 2px; min-height: 28px;
  font: 500 14px "Work Sans", sans-serif; color: var(--ink); cursor: pointer;
}
select.filter-control { appearance: none; -webkit-appearance: none; padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f6b60' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center; }
input.filter-control { outline: none; }
input.filter-control::placeholder { color: var(--ink-mute); }
.filter-control [data-lucide] { width: 15px; height: 15px; color: var(--ink-soft); }

.filter-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; cursor: pointer; padding: 4px 0;
  font: 500 13px "Work Sans", sans-serif; color: var(--ink-soft);
  transition: color 0.18s ease;
}
.filter-btn:hover { color: var(--ink); }
.filter-btn [data-lucide] { width: 16px; height: 16px; }
.filter-btn::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.2s ease;
}
.filter-btn:hover::after { transform: scaleX(1); }
.filters-meta { margin-left: auto; align-self: center; }
.filters-meta .eyebrow { letter-spacing: 0.08em; }

/* ──────────────────────────────────────────
   FEED GRID + CARD
────────────────────────────────────────── */
.feed-grid {
  display: grid;
  /* El nº de columnas se decide por el ANCHO REAL del feed (container query), no por
     el del viewport: así se adapta a cuánto sitio tiene el feed (con o sin rail) y el
     tamaño de card se mantiene estable. Una sola coincidencia ocupa 1 columna, no se
     estira. Fuera de un contenedor .feed (p.ej. la rejilla del restaurante) se usa
     este auto-fill fluido como base/fallback. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 36px 28px;
}
.feed-grid .feed-empty { grid-column: 1 / -1; text-align: center; padding: 56px 20px; color: var(--ink-soft); font: 500 15px "Work Sans", sans-serif; }
.feed-grid .feed-empty a { color: var(--accent); font-weight: 600; text-decoration: none; }
.feed-grid .feed-empty a:hover { text-decoration: underline; }

/* "Cargar más" (paginación del feed) + mensaje de fin. */
.feed-more { display: flex; justify-content: center; margin-top: var(--s7); }
.feed-more-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 46px; padding: 0 28px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 14px "Work Sans", sans-serif; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.feed-more-btn:hover { background: var(--bg); border-color: var(--line-strong); transform: translateY(-1px); }
.feed-more-btn:disabled { opacity: .6; cursor: default; transform: none; }
.feed-end { margin: 0; color: var(--ink-mute); font: 500 14px "Work Sans", sans-serif; text-align: center; }
/* Pasos de columnas del feed según su propio ancho (no el del viewport).
   Umbral de 3 columnas bajo (640px) para mantener 3 platos por fila también en
   pantallas medianas/laptops; baja a 2 y luego 1 solo en móvil. */
@container feed (max-width: 419.98px) { .feed-grid { grid-template-columns: 1fr; } }
@container feed (min-width: 420px)    { .feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container feed (min-width: 640px)    { .feed-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* En feed estrecho el banner va a ancho completo, texto abajo y algo más bajo. */
@container feed (max-width: 599.98px) {
  .hero:not(.is-empty)::after { background: linear-gradient(to top, rgba(22,21,15,.9) 0%, rgba(22,21,15,.45) 55%, rgba(22,21,15,.12) 100%); }
  .hero:not(.is-empty) .hero-body { max-width: 100%; justify-content: flex-end; padding: var(--s5); }
}

.card {
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, 0.5); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  cursor: pointer; animation: card-in 0.5s ease both;
}
.card-body { padding: 0 14px 14px; }
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.14s; }
.card:nth-child(5) { animation-delay: 0.18s; }
.card:nth-child(n + 6) { animation-delay: 0.22s; }

@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card-media {
  position: relative; aspect-ratio: 4/3; border-radius: 0;
  overflow: hidden; background: var(--skeleton);
}
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@media (hover: hover) { .card:hover .card-img { transform: scale(1.03); } }

.card-save {
  position: absolute; top: 12px; right: 12px;
  display: grid; place-items: center; width: 33px; height: 33px;
  /* Círculo blanco con la misma receta que .card-rating-badge (misma foto, mismo
     lenguaje). El icono pasa a tinta: sobre el círculo, un icono blanco sería
     invisible — antes iba suelto sobre la foto y por eso era blanco.
     33px ≈ el alto de la píldora de valoración, para que hagan pareja. */
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  color: var(--ink, #16150f); cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease;
}
.card-save:hover { background: #fff; }
.card-save:active { transform: scale(0.9); }
.card-save [data-lucide] { width: 16px; height: 16px; fill: none; }
/* Guardado: marcador sólido en acento — relleno y contorno del mismo color. */
.card-save.active [data-lucide],
.card-save.is-saved [data-lucide] { fill: var(--accent); stroke: var(--accent); }

/* Footer SOBRE la imagen: restaurante (abajo-izquierda) + rating (abajo-derecha),
   con degradado inferior para legibilidad. */
.card-media-footer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 32px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.66), rgba(0,0,0,.2) 55%, transparent);
}
.card-rest {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 600 13px "Work Sans", sans-serif; color: #fff; text-decoration: none;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.card-rest:hover { text-decoration: underline; text-underline-offset: 2px; }
/* Precio: esquina inferior derecha, sobre el degradado del footer. */
.card-price-badge {
  flex-shrink: 0; font: 700 14px "Outfit", sans-serif; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
/* Valoración: badge en la esquina superior izquierda de la imagen. */
.card-rating-badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  font: 700 13px "Work Sans", sans-serif; color: var(--ink, #16150f); font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.card-rating-badge [data-lucide] { width: 14px; height: 14px; color: var(--gold, #f4b740); fill: var(--gold, #f4b740); }

.card-collab { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); }
.collab-stack { display: inline-flex; }
.collab-stack img, .collab-more {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--bg); margin-left: -8px;
}
.collab-stack img:first-child { margin-left: 0; }
.collab-more {
  display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line);
  font: 600 9px "Work Sans", sans-serif; color: var(--ink-soft);
}
.collab-text { font: 600 11px "Work Sans", sans-serif; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.collab-join {
  margin-left: auto; position: relative; text-decoration: none;
  font: 600 11px "Work Sans", sans-serif; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink);
}
.collab-join::after { content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.2s ease; }
.collab-join:hover::after { transform: scaleX(1); }
.collab-join.is-disabled { color: var(--ink-mute); }
.collab-join.is-disabled::after { display: none; }

.card-title {
  font: 600 clamp(1.2rem, 1.6vw, 1.45rem)/1.15 "Outfit", sans-serif; letter-spacing: -0.02em; color: var(--ink);
  margin: var(--s3) 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-desc {
  font: 400 14px/1.5 "Work Sans", sans-serif; color: var(--ink-soft); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  /* Reserva SIEMPRE 2 líneas (aunque la descripción falte o sea corta) → todas las
     cards quedan igual de altas; si el texto se pasa, line-clamp añade "…". */
  min-height: calc(2 * 1.5em);
}
.card-meta {
  display: flex; flex-wrap: nowrap; align-items: center; margin-top: var(--s2);
  overflow: hidden; white-space: nowrap;
  font: 600 12px "Work Sans", sans-serif; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.card-meta > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-meta > * + *::before { content: "·"; margin: 0 8px; color: var(--ink-mute); }

.card-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 8px;
  margin-top: var(--s3); padding-top: var(--s4); border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
/* Votos: control segmentado (pill) up | down — afordancia clara de "vota aquí". */
.votes {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px;
}
.vote {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; cursor: pointer;
  color: var(--ink-soft); font: 700 13px "Work Sans", sans-serif; padding: 6px 11px; border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.vote [data-lucide] { width: 16px; height: 16px; }
.vote-up:hover { background: var(--accent-soft); color: var(--accent-press); }
.vote-down:hover { background: #fbe6e4; color: var(--danger); }
/* Estado "votado" (relleno) — gana al color global con mayor especificidad. */
.votes .vote-up.active { background: var(--accent); color: #fff !important; }
.votes .vote-down.active { background: var(--danger); color: #fff !important; }
.vote-sep { width: 1px; height: 18px; background: var(--line); }

/* Comentar / compartir: botones pill a juego, claramente accionables. */
.act {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
  font: 600 13px "Work Sans", sans-serif; padding: 7px 13px; border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.act [data-lucide] { width: 16px; height: 16px; }
.act:hover { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.act-share { margin-left: auto; padding: 8px; }

/* ──────────────────────────────────────────
   RIGHT RAIL
────────────────────────────────────────── */
.panel + .panel { margin-top: var(--s7); }
.panel-eyebrow { display: block; margin-bottom: var(--s4); }

.suggest-item { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; }
.suggest-item + .suggest-item { border-top: 1px solid var(--line); }
.suggest-item .avatar, .suggest-item .avatar-fallback { width: 36px; height: 36px; flex-shrink: 0; }
.suggest-info { min-width: 0; flex: 1; text-decoration: none; }
.suggest-info strong { display: block; font: 500 14px "Outfit", sans-serif; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-info span { font: 500 12px "Work Sans", sans-serif; color: var(--ink-soft); }
.follow-btn {
  flex-shrink: 0; border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: var(--r-sm); padding: 6px 12px; cursor: pointer;
  font: 500 12px "Outfit", sans-serif; transition: background 0.18s ease, color 0.18s ease;
}
.follow-btn:hover { background: var(--accent-press); color: var(--surface); border-color: var(--accent-press); }
.follow-btn.following { color: var(--ink-soft); border-color: var(--line); }

.map-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
/* 16/10 en vez de 4/3: recorta el alto justo lo necesario para que el rail
   entero quepa sin barra de scroll tras añadir el botón del mapa completo. */
.map-canvas { aspect-ratio: 16/10; border-radius: var(--r-media); border: 1px solid var(--line); overflow: hidden; background: var(--skeleton); }
/* Acceso al mapa a pantalla grande (php/pages/map.php) */
.map-expand {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: var(--s3); min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); text-decoration: none;
  font: 600 13px "Work Sans", sans-serif;
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.map-expand:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.map-expand [data-lucide] { width: 15px; height: 15px; }

/* ---- Marcador del mapa: foto del plato + nota ----
   Lo pinta initMaps() en js/platohub.js como divIcon de Leaflet. */
.phmk-wrap { background: none; border: 0; position: relative; }
.phmk {
  display: block; width: 40px; height: 40px; border-radius: 50%;
  overflow: hidden; background: var(--skeleton, #eeebe5);
  border: 2.5px solid #fff; box-shadow: 0 3px 10px -2px rgba(22, 21, 15, 0.55);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.phmk img { width: 100%; height: 100%; object-fit: cover; display: block; }
.phmk-wrap:hover .phmk { transform: scale(1.12); }
/* Sin foto: pastilla de acento con cubierto, para no dejar el hueco vacío */
.phmk-empty { display: grid; place-items: center; background: var(--accent, #b05f44); color: #fff; }
.phmk-empty [data-lucide] { width: 18px; height: 18px; }
/* Nota anclada al borde inferior del círculo */
.phmk-rate {
  position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  background: #fff; color: var(--ink, #16150f);
  border-radius: 999px; padding: 1px 6px;
  font: 700 10.5px/1.5 "Work Sans", sans-serif; font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px -1px rgba(22, 21, 15, 0.45);
  white-space: nowrap;
}
.map-canvas .leaflet-tile-pane { filter: grayscale(0.55) contrast(0.96); }

/* ──────────────────────────────────────────
   MOBILE DRAWER
────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 200; background: rgba(22, 21, 15, 0.4);
  opacity: 0; transition: opacity 0.3s ease;
}
.scrim.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; left: 0; z-index: 210; display: none; flex-direction: column;
  width: min(84vw, 320px); height: 100dvh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: var(--s5) var(--s5) calc(var(--s5) + var(--sab));
  transform: translateX(-100%); transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 40px rgba(22, 21, 15, 0.12);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--s4); margin-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.drawer-close { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--r-sm); background: none; color: var(--ink-soft); cursor: pointer; }
body.no-scroll { overflow: hidden; }

/* ──────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────── */
/* Por debajo de 1600 el rail derecho pasa DEBAJO del feed (a 2 columnas): así el
   feed tiene ancho de sobra para 3 cards cómodas en portátiles, y el mapa se ve
   entero (ya no queda en un rail sticky lateral demasiado alto). El rail lateral
   se reserva para monitores grandes (>=1600). */
@media (max-width: 1599px) {
  .shell {
    grid-template-columns: minmax(190px, 220px) minmax(0, 1fr);
    /* El rail va DEBAJO pero solo en la columna del feed (no bajo el nav): el nav
       es sticky y, si el rail ocupara su columna, taparía las sugerencias. */
    grid-template-areas: "nav feed" ". rail";
  }
  .rail-right {
    position: static; border-left: 0; border-top: 1px solid var(--line);
    padding: var(--s7) var(--gutter);
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--s7); align-items: start;
    max-height: none; overflow: visible; /* abajo va a su alto natural */
  }
}

@media (max-width: 768px) {
  :root { --topbar-h: 56px; }
  .menu-btn { display: inline-grid; }
  .search-toggle { display: inline-grid; }
  .hide-sm { display: none !important; }
  /* targets táctiles cómodos en móvil (≥44px) */
  .icon-btn { width: 44px; height: 44px; }
  .card-save { width: 44px; height: 44px; }
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas: "feed" "rail";
  }
  .rail-left { display: none; }
  .drawer { display: flex; }
  .feed { padding: var(--s6) var(--gutter); }
  .search { display: none; }
  /* buscador desplegable: fixed para no romper el sticky del topbar */
  .search.mobile-open { display: flex; position: fixed; top: var(--topbar-h); left: 0; right: 0; max-width: none; margin: 0; padding: 12px var(--gutter); background: var(--bg); border-bottom: 1px solid var(--line); z-index: 60; }
  .rail-right { grid-template-columns: 1fr; gap: var(--s7); }
  .filters { gap: var(--s5); overflow-x: auto; flex-wrap: nowrap; scroll-snap-type: none; padding-bottom: var(--s5); }
  .filter, .filter-btn { flex-shrink: 0; }
  .filters-meta { display: none; }
}

@media (max-width: 600px) {
  .hero.is-empty .hero-title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .card { animation: none; }
  .card:hover .card-img { transform: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   MÓVIL · EXPERIENCIA DE APP
   Barra inferior fija, cabecera simplificada y paneles como hojas
   inferiores. Todo vive dentro de @media (max-width:768px): en escritorio
   NADA de esto se aplica. Ninguna función se pierde — solo se reubica a
   donde llega el pulgar.
   ══════════════════════════════════════════════════════════════════════ */
:root {
  --mnav-h: 58px;
  /* Safe-areas con reserva 0px (sin ella, calc() se invalida donde no hay soporte) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
.mobile-nav { display: none; }   /* en escritorio manda el rail/topbar */

@media (max-width: 768px) {
  /* ---------- Barra de navegación inferior ---------- */
  .mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 220;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    height: calc(var(--mnav-h) + var(--sab));
    padding-bottom: var(--sab);
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 18px rgba(22, 21, 15, 0.07);
  }
  .mnav-item {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    height: 100%; text-decoration: none; color: var(--ink-mute);
    font: 600 10px/1 "Work Sans", sans-serif;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, transform 0.12s ease;
  }
  .mnav-item [data-lucide] { width: 22px; height: 22px; }
  .mnav-item.active { color: var(--accent); }
  .mnav-item:active { transform: scale(0.9); }
  /* Botón central: la acción estrella (publicar) elevada sobre la barra */
  .mnav-fab {
    justify-self: center; display: grid; place-items: center;
    width: 54px; height: 54px; margin-top: -20px;
    border-radius: 50%; border: 4px solid var(--surface);
    background: var(--accent); color: #fff; text-decoration: none;
    box-shadow: 0 8px 20px -5px rgba(176, 95, 68, 0.65);
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.12s ease;
  }
  .mnav-fab [data-lucide] { width: 27px; height: 27px; }
  .mnav-fab:active { transform: scale(0.93); background: var(--accent-press); }
  .mnav-badge {
    position: absolute; top: 5px; left: calc(50% + 5px);
    min-width: 17px; height: 17px; padding: 0 4px;
    display: grid; place-items: center; border-radius: 999px;
    background: var(--accent); color: #fff;
    font: 700 9px/1 "Work Sans", sans-serif; font-variant-numeric: tabular-nums;
    border: 2px solid var(--surface);
  }
  /* Hueco para que la barra no tape el final del contenido */
  body { padding-bottom: calc(var(--mnav-h) + var(--sab)); }
  .ph-toast { bottom: calc(var(--mnav-h) + var(--sab) + 18px); }
  .ph-sandbox-banner { bottom: calc(var(--mnav-h) + var(--sab) + 14px); }
  /* El FAB del perfil sería redundante con el "+" de la barra */
  .pf-fab { display: none !important; }

  /* ---------- Cabecera simplificada (menú · logo · buscar) ---------- */
  .tb-desk-only { display: none !important; }
  /* --sat centraliza el safe-area superior CON reserva 0px: sin ella, un
     navegador sin soporte invalida el calc() entero (altura/anclaje perdidos).
     Al derivar los tres valores de la misma variable, la altura del topbar y el
     anclaje del tabbar no pueden descuadrarse entre sí durante el scroll. */
  /* UN SOLO sticky para topbar+tabbar. Con dos sticky apilados, el redondeo a
     píxeles del dispositivo (DPR 2.6/3 + scroll con inercia en posiciones
     fraccionarias) dejaba costuras finas por las que se veía pasar el contenido.
     Fusionados en una sola caja con fondo continuo, no hay nada que redondear
     entre medias. Los hijos dejan de posicionarse por su cuenta. */
  .chrome-stack {
    display: block;
    position: sticky; top: 0; z-index: 50;
    background: var(--bg);
    /* OJO: el padding del safe-area superior NO va aquí (ver más abajo). En una
       pestaña normal ese valor puede variar cuando el navegador colapsa su barra
       de URL, y eso cambiaría la ALTURA de la cabecera a mitad de scroll → salto. */
    /* Sombra SÓLIDA (sin desenfoque) que prolonga el fondo 4px por encima del
       elemento. Al quedar fijado en top:0, el redondeo a píxeles del dispositivo
       puede dejar una rendija de <1px justo en el borde superior por la que se
       ve pasar el contenido. La sombra viaja con el elemento y la tapa, sin
       alterar el layout (a diferencia de un padding o un top negativo). */
    box-shadow: 0 -4px 0 var(--bg);
  }
  .topbar, .tabbar { position: static; z-index: auto; }
  .topbar { height: var(--topbar-h); padding-top: 0; }
  .search.mobile-open { top: calc(var(--topbar-h) + var(--sat)); }
  .topbar-inner { gap: var(--s3); }
  /* Logo CENTRADO en el topbar móvil. Va en posición absoluta (no con
     margin:auto) para que el centro sea el del topbar y no dependa de que los
     elementos laterales —menú y lupa— midan exactamente lo mismo. */
  .topbar-inner { position: relative; }
  .brand { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; }

  /* Tabs del feed: carrusel con inercia, sin barra de scroll (como app) */
  /* Sin scroll-snap ni -webkit-overflow-scrolling: un contenedor con snap dentro
     de la cabecera fija obliga al navegador a recalcular puntos de anclaje
     durante el scroll vertical, y ese trabajo extra se ve como micro-saltos.
     El carrusel de pestañas funciona igual de bien sin snap. */
  .tabbar-inner { scroll-snap-type: none; }
  .tab { padding-inline: 2px; }
  /* Fuera del feed no aportan y roban altura: se ocultan (siguen en Inicio) */
  .tabbar-nofeed { display: none; }

  /* ---------- Paneles laterales → HOJAS INFERIORES ----------
     Comentarios, detalle de aporte y notificaciones dejan de entrar desde la
     derecha (patrón de escritorio) y suben desde abajo con asa de arrastre.
     OJO al prefijo html.light: .ph-cpanel vive en platohub-ui.css, .cd-panel en
     platohub-dish.css y .np-panel en un <style> inline de notif_modal.php —
     todos cargan DESPUÉS de esta hoja. Ganar por ESPECIFICIDAD (0,2,1) evita
     depender del orden de carga y mantiene el CSS móvil en un único sitio. */
  html.light .ph-cpanel,
  html.light .cd-panel,
  html.light .np-panel {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; max-width: none;
    height: min(86dvh, 100dvh - 48px);
    border-left: 0; border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -16px 48px -20px rgba(22, 21, 15, 0.45);
  }
  html.light .ph-cpanel.open,
  html.light .cd-panel.open,
  html.light .np-panel.open { transform: translateY(0); }
  /* Asa de arrastre */
  html.light .ph-cpanel-head,
  html.light .cd-panel-head,
  html.light .np-head { position: relative; padding-top: 22px; }
  html.light .ph-cpanel-head::before,
  html.light .cd-panel-head::before,
  html.light .np-head::before {
    content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong);
  }
  /* El formulario de comentar no debe quedar bajo el borde inferior del móvil */
  html.light .ph-cpanel-form { padding-bottom: calc(14px + var(--sab)); }
  html.light .np-body,
  html.light .ph-cpanel-body,
  html.light .cd-panel-body { padding-bottom: calc(16px + var(--sab)); }

  /* Modales (seguidores/siguiendo, valoración) → también hoja inferior */
  html.light .ph-modal-overlay { align-items: flex-end; padding: 0; }
  html.light .ph-modal {
    width: 100%; max-width: none; border-radius: 22px 22px 0 0;
    max-height: 88dvh; animation: ph-sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  html.light .ph-modal-foot { padding-bottom: calc(16px + var(--sab)); }
  @keyframes ph-sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

  /* ---------- Formularios: sin auto-zoom en iOS + dedo cómodo ----------
     Cualquier control con font-size <16px hace que Safari haga zoom al
     enfocarlo y descoloque la página. */
  input, select, textarea { font-size: 16px !important; }
  .search input { font-size: 16px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select, textarea { min-height: 46px; }
  textarea { min-height: 92px; }
  /* Botones y enlaces de acción: área táctil mínima cómoda */
  button, .btn-solid, .btn-ghost, .ph-select-trigger { min-height: 44px; }

  /* Buscador desplegable: compacto. El <select> del tipo de búsqueda NO necesita
     los 16px anti-zoom (abre el picker nativo de iOS, no hace zoom como un campo
     de texto), así que recupera su tamaño pequeño y le deja el ancho al texto.
     Se usan los id (1,0,0) para ganar a las reglas generales de arriba. */
  .search.mobile-open { padding: 10px var(--s4); gap: 8px; }
  #ph-search-type {
    font-size: 11px !important; min-height: 0; flex: 0 0 auto;
    padding-right: 2px; max-width: 34vw;
  }
  /* Mismo trato para el trigger del dropdown que sustituye a ese select */
  .search .ph-select-trigger { font-size: 11px; min-height: 0; padding-right: 2px; }
  .search .ph-select-value { max-width: 26vw; overflow: hidden; text-overflow: ellipsis; }
  .search .ph-select-panel { left: 0; min-width: 170px; }
  #ph-search-input { min-height: 40px; min-width: 0; }

  /* ---------- Densidad y ritmo tipográfico ---------- */
  .feed { padding-inline: var(--s4); }
  .feed-grid { gap: 22px 14px; }
  .drawer { padding-bottom: calc(var(--s5) + var(--sab)); }
}

/* Instalada como app (standalone) SÍ hay muesca real y el valor es estable:
   ahí el safe-area superior se respeta sin riesgo de cambiar durante el scroll. */
@media (max-width: 768px) and (display-mode: standalone) {
  .chrome-stack { padding-top: var(--sat); }
}

/* Móviles estrechos: la barra inferior aprieta un poco */
@media (max-width: 380px) {
  .mnav-item { font-size: 9px; }
  .mnav-item [data-lucide] { width: 21px; height: 21px; }
}

/* Voto BLOQUEADO por aporte: el voto queda fijado por el estado del aporte
   (positivo→up, negativo→down) y solo cambia editando el aporte. El botón
   contrario se atenúa; cubre la card del feed (.vote) y el héroe del detalle. */
.vote.is-disabled,
[data-ph-votes].is-locked .is-disabled { opacity: .38; cursor: not-allowed; }
.vote.is-locked-vote { cursor: default; }
.votes .vote-lock { display: inline-flex; align-items: center; margin-left: 2px; color: var(--dark-secondary, #697586); }
.votes .vote-lock [data-lucide] { width: 13px; height: 13px; }

/* ══════════════════════════════════════════════════════════════════════
   MÓVIL · TRES VISTAS DE TARJETA (conmutables desde el topbar)
   El markup de la card es SIEMPRE el mismo (php/inc/feed_list.php): las tres
   vistas son puro CSS colgando de html[data-feedview], que pone el botón de la
   topbar y restaura platohub.js desde localStorage antes de pintar. Así ningún
   selector del JS (.card[data-dish-id], .vote, .card-save, .act…) cambia y la
   búsqueda en vivo, que reinyecta este mismo HTML, funciona en las tres.
     · web     → tarjeta 4:3 de la web (por defecto, idéntica a escritorio)
     · overlay → foto completa 4:5 con el contenido encima
     · fila    → fila compacta con miniatura de 84px
   ══════════════════════════════════════════════════════════════════════ */

/* Restaurante + precio como línea de texto. En la vista 4:3 y en escritorio esa
   información ya va sobre la foto (.card-media-footer), así que aquí sobra. */
.card-sub { display: none; }

@media (max-width: 768px) {

  /* ─────────── Vista «foto completa» (4:5, contenido sobre la imagen) ─────────── */
  html[data-feedview="overlay"] .feed-grid { grid-template-columns: 1fr; gap: 18px; }
  html[data-feedview="overlay"] .card {
    position: relative; display: block; aspect-ratio: 4/5;
    border: 0; border-radius: 20px; overflow: hidden; background: var(--skeleton);
  }
  html[data-feedview="overlay"] .card-media { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0; }
  /* Degradado propio: sin él, el texto blanco se pierde sobre fotos claras. */
  html[data-feedview="overlay"] .card-media::after {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(to top, rgba(22,21,15,.92) 0%, rgba(22,21,15,.35) 45%, transparent 72%);
  }
  html[data-feedview="overlay"] .card-media-footer { display: none; }
  html[data-feedview="overlay"] .card-sub { display: flex; }
  html[data-feedview="overlay"] .card-rating-badge { top: 14px; left: 14px; z-index: 3; }
  html[data-feedview="overlay"] .card-save { top: 14px; right: 14px; width: 44px; height: 44px; z-index: 3; }
  html[data-feedview="overlay"] .card-body {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 18px 16px 16px; color: #fff;
  }
  html[data-feedview="overlay"] .card-collab { margin-top: 0; margin-bottom: 8px; }
  html[data-feedview="overlay"] .collab-stack img,
  html[data-feedview="overlay"] .collab-more { width: 22px; height: 22px; border-color: rgba(255,255,255,.9); }
  html[data-feedview="overlay"] .collab-more { background: rgba(255,255,255,.2); color: #fff; }
  html[data-feedview="overlay"] .collab-text { color: rgba(255,255,255,.85); font-size: 10px; letter-spacing: .1em; }
  html[data-feedview="overlay"] .collab-join { color: #fff; }
  html[data-feedview="overlay"] .collab-join.is-disabled { color: rgba(255,255,255,.6); }
  html[data-feedview="overlay"] .card-title { margin: 0 0 4px; font-size: 1.5rem; color: #fff; }
  html[data-feedview="overlay"] .card-desc { display: none; }
  html[data-feedview="overlay"] .card-meta { margin-top: 3px; color: rgba(255,255,255,.7); }
  html[data-feedview="overlay"] .card-meta > * + *::before { color: rgba(255,255,255,.45); }
  html[data-feedview="overlay"] .card-foot { margin-top: 14px; padding-top: 0; border-top: 0; }
  /* Píldoras de cristal: mismo control, legible sobre la foto. */
  html[data-feedview="overlay"] .votes,
  html[data-feedview="overlay"] .act {
    background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.24); color: #fff;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
  html[data-feedview="overlay"] .vote { color: rgba(255,255,255,.9); }
  html[data-feedview="overlay"] .vote-sep { background: rgba(255,255,255,.28); }

  /* ─────────── Vista «fila» (lista compacta con miniatura) ─────────── */
  html[data-feedview="fila"] .feed-grid { display: block; }
  html[data-feedview="fila"] .card {
    position: relative;
    display: grid; grid-template-columns: 84px minmax(0, 1fr); column-gap: 13px; align-items: center;
    padding: 13px 0; background: none; border: 0; border-bottom: 1px solid var(--line);
    border-radius: 0; overflow: visible;
  }
  /* position:static a propósito: así el bloque contenedor de la chapa de nota y
     del botón de guardar pasa a ser .card, y el botón puede irse al extremo
     derecho de la fila (dentro de la miniatura no cabría). El recorte redondeado
     de la foto lo asume .card-img, que ya la rellena entera. */
  html[data-feedview="fila"] .card-media {
    position: static; width: 84px; height: 84px; aspect-ratio: auto;
    border-radius: 14px; overflow: visible;
  }
  html[data-feedview="fila"] .card-img { border-radius: 14px; }
  html[data-feedview="fila"] .card-media-footer { display: none; }
  html[data-feedview="fila"] .card-rating-badge {
    top: 18px; left: 5px; padding: 2px 7px; gap: 3px; font-size: 11px;
  }
  html[data-feedview="fila"] .card-rating-badge [data-lucide] { width: 11px; height: 11px; }
  html[data-feedview="fila"] .card-save {
    top: 50%; right: 0; transform: translateY(-50%);
    width: 44px; height: 44px; background: none; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  html[data-feedview="fila"] .card-save:active { transform: translateY(-50%) scale(.9); }
  html[data-feedview="fila"] .card-save [data-lucide] { width: 18px; height: 18px; }
  html[data-feedview="fila"] .card-body {
    grid-column: 2; display: flex; flex-direction: column; justify-content: center;
    padding: 0 46px 0 0;   /* hueco del botón de guardar */
  }
  html[data-feedview="fila"] .card-collab,
  html[data-feedview="fila"] .card-desc,
  html[data-feedview="fila"] .act-share { display: none; }
  html[data-feedview="fila"] .card-meta {
    order: -1; margin: 0 0 3px; font-size: 10px; letter-spacing: .1em; color: var(--ink-mute);
  }
  html[data-feedview="fila"] .card-title { margin: 0; font-size: 1.06rem; }
  html[data-feedview="fila"] .card-sub {
    display: flex; align-items: baseline; gap: 6px; margin-top: 2px;
    font: 400 13px "Work Sans", sans-serif; color: var(--ink-soft);
    white-space: nowrap; overflow: hidden;
  }
  html[data-feedview="fila"] .card-sub-rest { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: inherit; text-decoration: none; }
  html[data-feedview="fila"] .card-sub-price::before { content: "·"; margin-right: 6px; color: var(--ink-mute); }
  html[data-feedview="fila"] .card-foot {
    margin-top: 6px; padding-top: 0; border-top: 0; gap: 14px; flex-wrap: nowrap;
  }
  /* Los controles pierden la cápsula: en una fila mandan las cifras, no el botón. */
  html[data-feedview="fila"] .votes { background: none; border: 0; padding: 0; gap: 10px; }
  html[data-feedview="fila"] .vote { padding: 0; font-size: 12.5px; gap: 4px; }
  html[data-feedview="fila"] .vote-sep { display: none; }
  html[data-feedview="fila"] .votes .vote-up.active { background: none; color: var(--accent) !important; }
  html[data-feedview="fila"] .votes .vote-down.active { background: none; color: var(--danger) !important; }
  html[data-feedview="fila"] .act { border: 0; background: none; padding: 0; font-size: 12.5px; gap: 4px; }
  html[data-feedview="fila"] .vote [data-lucide],
  html[data-feedview="fila"] .act [data-lucide] { width: 13px; height: 13px; }
}

/* ══════════════════════════════════════════════════════════════════════
   MÓVIL · CHROME Y HERO SEGÚN EL DISEÑO DE LA APP
   Cabecera: menú · logo centrado · [vista] [buscar] [campana].
   Barra inferior: Inicio · Buscar · (+) · Rankings · Perfil.
   ══════════════════════════════════════════════════════════════════════ */

/* Contrapartida de .tb-desk-only: esto vive SOLO en la cabecera móvil. */
.tb-mob-only { display: none !important; }

/* Los tres iconos del botón de vista viajan en el HTML y el CSS enseña el que
   toca. Sin JS de por medio, el botón ya sale bien en el primer frame. */
.fv-ic { display: none; }
html[data-feedview="web"] .fv-ic[data-fv="web"],
html[data-feedview="overlay"] .fv-ic[data-fv="overlay"],
html[data-feedview="fila"] .fv-ic[data-fv="fila"] { display: grid; place-items: center; }
/* Sin data-feedview (JS/localStorage bloqueados) el botón no se quedaría mudo. */
html:not([data-feedview]) .fv-ic[data-fv="web"] { display: grid; place-items: center; }
.feedview-btn.is-popping { animation: fv-pop .32s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes fv-pop { 0% { transform: scale(1); } 45% { transform: scale(.82); } 100% { transform: scale(1); } }

@media (max-width: 768px) {
  .tb-mob-only { display: inline-grid !important; }
  /* Tres acciones + menú + logo centrado caben justo en 360px si el grupo de la
     derecha aprieta: el ancho táctil de 44px se mantiene, solo cede el hueco. */
  .topbar-actions { gap: 2px; }

  /* Botón de la barra inferior: es un <button>, no un <a>, porque abre el
     buscador en la misma página. Necesita el reset que un enlace no pide. */
  button.mnav-item {
    border: 0; background: none; padding: 0;
    font-family: "Work Sans", sans-serif; -webkit-appearance: none; appearance: none;
    min-height: 0;   /* gana a la regla táctil global: la barra ya mide 58px */
  }

  /* ---------- Hero del feed: banner de app ----------
     Texto abajo sobre degradado vertical y sin botones (publicar ya está en el
     FAB). El banner entero es tocable: el cuerpo deja pasar el toque hasta
     .hero-media, que cubre toda la caja, y solo el enlace del restaurante
     vuelve a capturarlo. */
  .hero { min-height: 172px; margin-bottom: var(--s5); border-radius: 14px; }
  .hero::after {
    background: linear-gradient(to top, rgba(22,21,15,.9) 0%, rgba(22,21,15,.45) 55%, rgba(22,21,15,.12) 100%);
  }
  .hero-body {
    max-width: 100%; justify-content: flex-end; padding: var(--s5);
    pointer-events: none;
  }
  .hero-facts a { pointer-events: auto; }
  .hero-title { font-size: clamp(1.55rem, 7vw, 1.85rem); margin-bottom: var(--s2); }
  .hero-facts { margin-bottom: 0; font-size: 12.5px; }
  .hero-facts > * + *::before { margin: 0 7px; }
  .hero .hero-actions { display: none; }
  /* El hero vacío NO es un banner con foto: ahí los botones son la única salida. */
  .hero.is-empty .hero-body { pointer-events: auto; }
  .hero.is-empty .hero-actions { display: flex; }
}

@media (max-width: 380px) {
  .brand img { height: 24px; }
}

@media (max-width: 768px) {
  /* .card-sub es una línea de datos, no dos textos pegados: el punto medio lo
     pone el precio para que no aparezca cuando el plato no lo tiene. */
  html[data-feedview="overlay"] .card-sub,
  html[data-feedview="fila"] .card-sub {
    display: flex; align-items: baseline; gap: 0; white-space: nowrap; overflow: hidden;
  }
  html[data-feedview="overlay"] .card-sub-rest,
  html[data-feedview="fila"] .card-sub-rest {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; color: inherit; text-decoration: none;
  }
  html[data-feedview="overlay"] .card-sub-price,
  html[data-feedview="fila"] .card-sub-price { flex: none; }
  html[data-feedview="overlay"] .card-sub-price::before,
  html[data-feedview="fila"] .card-sub-price::before { content: "·"; margin: 0 6px; opacity: .55; }
  html[data-feedview="overlay"] .card-sub {
    margin-top: 2px; font: 500 12.5px "Work Sans", sans-serif; color: rgba(255,255,255,.85);
  }

  /* Una sola línea para la fila de colaboradores: «Ya estás unido» es largo y,
     sin esto, se salía del borde de la tarjeta. */
  html[data-feedview="overlay"] .collab-text {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  html[data-feedview="overlay"] .collab-join { flex: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   MÓVIL · PANTALLA DE BÚSQUEDA
   Al abrir la lupa, bajo el campo aparecen el tipo de búsqueda y las
   categorías reales de la taxonomía: hay dónde tocar antes de escribir
   nada. En cuanto se escribe, el panel se retira y deja ver los
   resultados, que siguen pintándose en el feed de debajo.
   ══════════════════════════════════════════════════════════════════════ */
.search-suggest { display: none; }

@media (max-width: 768px) {
  .search.mobile-open ~ .search-suggest {
    display: block;
    position: fixed; left: 0; right: 0; z-index: 59;
    top: calc(var(--topbar-h, 56px) + var(--sat, 0px) + 61px);
    max-height: calc(100dvh - var(--topbar-h, 56px) - 61px - var(--mnav-h, 58px));
    overflow-y: auto; overscroll-behavior: contain;
    padding: 16px var(--s4) calc(20px + var(--sab, 0px));
    background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 40px -22px rgba(22, 21, 15, .4);
    animation: ss-in .2s ease both;
  }
  /* Con texto escrito manda el resultado, no las sugerencias. */
  .search.mobile-open.is-typing ~ .search-suggest { display: none; }
  @keyframes ss-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

  .ss-block + .ss-block { margin-top: 18px; }
  .ss-label {
    display: block; margin-bottom: 9px;
    font: 600 10px/1 "Work Sans", sans-serif; text-transform: uppercase;
    letter-spacing: .14em; color: var(--ink-mute);
  }
  .ss-types { display: flex; gap: 7px; }
  .ss-type {
    flex: 1; min-height: 40px; padding: 0 4px; cursor: pointer;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--ink-soft);
    font: 600 12.5px "Work Sans", sans-serif;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
  }
  .ss-type.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .ss-cats { display: flex; flex-wrap: wrap; gap: 7px; }
  .ss-cat {
    display: inline-flex; align-items: center; min-height: 38px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--ink-soft); text-decoration: none;
    font: 500 12.5px "Work Sans", sans-serif;
  }
  .ss-cat:active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-press); }
}
