/* =====================================================================
   Carta pública — Cafetería Daoiz
   Paleta del logo: crema, azul marino, dorado y azul de las olas (solo foco / activo).
   Tipografías: Playfair Display (títulos, como «DAOIZ»), Yellowtail (la letra
   manuscrita de «Desayunos · Tapas y Marisco») y la del sistema para leer.
   ===================================================================== */

@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-latin.woff2") format("woff2");
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Yellowtail";
  src: url("../fonts/yellowtail-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --cal: #fbf8f1;
  --paper: #fffdf8;
  --ink: #1e2433;
  --muted: #5c6070;
  --brand: #1b2a44;
  --brand-soft: #e8edf4;
  --gold: #c49a55;
  --gold-ink: #8a6424;
  --sea: #2c5d8f;
  --line: #e9e1d2;
  --dots: #d3c3a3;
  --price-w: 4.6rem;
  --gutter: 16px;
  --bar-h: 3rem;
  --display: "Playfair Display", "Didot", "Bodoni MT", "Georgia", serif;
  --script: "Yellowtail", "Brush Script MT", cursive;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background: var(--cal);
}
img { max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sea); outline-offset: 2px; border-radius: 4px; }
abbr[title] { text-decoration: none; cursor: help; }

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

/* ---------- Cabecera ---------- */
.masthead {
  position: relative;
  padding: 44px var(--gutter) 20px;
  background: var(--paper);
  text-align: center;
}
.masthead-logo { margin: 0; line-height: 0; }
/* Vale para un logo redondo (el actual) o apaisado (uno subido desde el back office). */
.masthead-logo img {
  width: auto;
  max-width: min(320px, 76vw);
  height: auto;
  max-height: min(230px, 60vw);
}
.lang-switch {
  position: absolute;
  top: 10px;
  right: var(--gutter);
  padding: 6px 12px;
  font-size: .875rem;
  text-decoration: none;
  color: var(--brand);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.lang-switch:hover { border-color: var(--brand); }
.notice {
  max-width: 40ch;
  margin: 16px auto 0;
  font-size: .875rem;
  color: var(--muted);
}

/* ---------- Navegación de secciones ----------
   Índice con todas las secciones bajo la cabecera, barra fija de altura constante
   («estás en…» + botón «Secciones») y hoja con todas las secciones y subsecciones. */
.toc {
  padding: 4px var(--gutter) 18px;
  background: var(--paper);
}
.toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr));
  gap: 8px;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.toc-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 48px;
  padding: 8px 4px;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  color: var(--brand);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.toc-tile span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.toc-tile:hover { border-color: var(--brand); }
.toc-tile[aria-current="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.toc-group { max-width: 46rem; margin: 16px auto 0; }
.toc-group-title {
  margin: 0 0 6px;
  font-size: .8125rem;
  color: var(--muted);
}
.toc-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.toc-sub {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  font-size: .9375rem;
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.toc-sub:hover { border-color: var(--brand); color: var(--brand); }
.toc-sub[aria-current="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}
.toc-extra {
  max-width: 46rem;
  margin: 12px auto 0;
  font-size: .875rem;
  text-align: center;
}
.toc-allergens { color: var(--muted); text-underline-offset: 3px; }
.toc-allergens:hover { color: var(--brand); }
@media (min-width: 640px) {
  .toc-grid { display: flex; flex-wrap: wrap; justify-content: center; }
  .toc-tile {
    min-height: 40px;
    max-width: 100%;
    padding: 7px 16px;
    font-size: 1rem;
    border-radius: 999px;
  }
}

.jump-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--bar-h);
  background: rgba(255, 253, 248, .96);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(6px)) {
  .jump-bar { background: rgba(255, 253, 248, .85); backdrop-filter: blur(6px); }
}
.jump-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 46rem;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  font: inherit;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
}
.jump-btn[hidden] { display: none; }
.jump-btn:focus-visible { outline-offset: -3px; }
.jump-current {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-family: var(--display);
  font-size: 1.1875rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--brand);
}
.jump-label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-size: .875rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.jump-btn:hover .jump-label { border-color: var(--brand); color: var(--brand); }
.jump-ico { width: 14px; height: 14px; fill: currentColor; }

.section-sheet {
  width: 100%;
  max-width: 100%;
  max-height: 85dvh;
  margin: auto 0 0;
  padding: 0;
  color: var(--ink);
  background: var(--cal);
  border: 0;
  border-radius: 16px 16px 0 0;
}
.section-sheet::backdrop { background: rgba(12, 18, 32, .55); }
.sheet-inner { padding: 6px var(--gutter) calc(20px + env(safe-area-inset-bottom)); }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  margin-bottom: 8px;
}
.sheet-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand);
}
.sheet-close {
  padding: 8px 14px;
  font: inherit;
  font-size: .875rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.sheet-close:hover { border-color: var(--brand); color: var(--brand); }
.section-sheet .toc-extra { margin-top: 18px; }
@media (min-width: 640px) {
  .section-sheet { max-width: 34rem; margin: auto; border-radius: 16px; }
  .section-sheet .toc-grid { display: grid; }
  .section-sheet .toc-tile { min-height: 48px; border-radius: 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .section-sheet[open] { animation: sheet-up .18s ease-out; }
}
@keyframes sheet-up {
  from { transform: translateY(16px); opacity: 0; }
}
/* Con un diálogo abierto (hoja de secciones o visor de fotos) la página no se desplaza. */
html { scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }

/* ---------- Carta ---------- */
.menu, .empty {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 var(--gutter) 56px;
}
.empty { padding-top: 48px; text-align: center; color: var(--muted); }

.menu-section { padding-top: 40px; scroll-margin-top: var(--bar-h); }
.menu-subsection { padding-top: 28px; scroll-margin-top: var(--bar-h); }
.section-title:focus:not(:focus-visible) { outline: none; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
}
/* Doble filete azul marino y dorado, como los anillos del logo. */
.section-head--l2 {
  border-bottom: 3px solid var(--brand);
  box-shadow: 0 4px 0 -1px var(--cal), 0 6px 0 -1px var(--gold);
}
.section-head--l3 { border-bottom: 1px solid var(--gold); }

.section-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  color: var(--brand);
  line-height: 1;
}
.section-head--l2 .section-title { font-size: clamp(2.125rem, 9vw, 3rem); font-weight: 800; letter-spacing: -.005em; }
.section-head--l3 .section-title {
  font-family: var(--script);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.1;
}

.price-heads { display: flex; flex: 0 0 auto; }
.price-heads span {
  width: var(--price-w);
  font-size: .75rem;
  line-height: 1.2;
  text-align: right;
  color: var(--muted);
}
.section-note { margin: 8px 0 0; font-size: .9375rem; color: var(--muted); }

.dishes { margin: 0; padding: 0; list-style: none; }
.dish {
  padding: 13px 0 12px;
  border-bottom: 1px solid var(--line);
}
.dish:last-child { border-bottom: 0; }

.dish-line {
  display: flex;
  align-items: baseline;
  margin: 0;
}
.dish-name {
  flex: 0 1 auto;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
}
.leader {
  flex: 1 1 1rem;
  min-width: 1rem;
  height: .5em;
  margin: 0 6px;
  border-bottom: 2px dotted var(--dots);
}
.price {
  flex: 0 0 var(--price-w);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  color: var(--brand);
}
.price--market, .price--pending { font-size: .875rem; font-weight: 600; }
/* Columna vacía: la línea de puntos continúa hasta el precio siguiente. */
.price--empty {
  height: .5em;
  margin-left: -6px;
  border-bottom: 2px dotted var(--dots);
}
.price--pending { color: var(--muted); }

.dish-desc {
  margin: 3px 0 0;
  max-width: 54ch;
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--muted);
}
.dish-ask { margin: 4px 0 0; font-size: .8125rem; color: var(--muted); }

.dish-allergens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.al-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .8125rem;
  line-height: 1.2;
  color: var(--muted);
}
.al-chip small { font-size: inherit; }

/* Iconos de alérgenos: disco del color del alérgeno y pictograma blanco.
   «Trazas»: disco blanco con anillo y pictograma del color del alérgeno. */
.al {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: #fff;
  overflow: visible;
}
.al--traces { fill: #fff; stroke: currentColor; }
.al-gluten      { color: #a86d05; }
.al-crustaceans { color: #c0392b; }
.al-eggs        { color: #c8611a; }
.al-fish        { color: #1f4e9c; }
.al-peanuts     { color: #7a4a25; }
.al-soybeans    { color: #3d7a2a; }
.al-milk        { color: #2f78ad; }
.al-nuts        { color: #9a5530; }
.al-celery      { color: #4c8a22; }
.al-mustard     { color: #8f7400; }
.al-sesame      { color: #826a48; }
.al-sulphites   { color: #7b3f8c; }
.al-lupin       { color: #b0377e; }
.al-molluscs    { color: #157a80; }

/* Platos con foto */
.dish--photo {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: start;
}
.dish-photo { display: block; line-height: 0; border-radius: 10px; }
.dish-photo img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--brand-soft);
}
@media (min-width: 640px) {
  :root { --price-w: 5.25rem; }
  .dish--photo { grid-template-columns: 112px 1fr; gap: 16px; }
  .dish-photo img { width: 112px; height: 112px; }
}

/* Visor de fotos */
.photo-viewer {
  max-width: min(92vw, 900px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #000;
}
.photo-viewer::backdrop { background: rgba(12, 18, 32, .8); }
.photo-viewer img { display: block; width: 100%; height: auto; max-height: 82vh; object-fit: contain; }
.photo-viewer form { position: absolute; top: 8px; right: 8px; }
.photo-viewer-close {
  padding: 8px 14px;
  font: inherit;
  font-size: .875rem;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

/* ---------- Pie ---------- */
.colophon {
  padding: 36px var(--gutter) 48px;
  background: var(--brand);
  border-top: 4px solid var(--gold);
  color: #fff;
}
.colophon > * { max-width: 46rem; margin-left: auto; margin-right: auto; }
.legend-title {
  margin: 0 auto 14px;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  scroll-margin-top: calc(var(--bar-h) + 36px);
}
.legend-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .9375rem;
}
.legend-list li, .legend-traces {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* En el pie azul marino los iconos llevan un anillo blanco para separarse del fondo. */
.colophon .al { width: 26px; height: 26px; }
.legend-list li .al { border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.legend-traces { margin: 18px 0 0; font-size: .875rem; }
.legend-traces .al { color: var(--brand); box-shadow: 0 0 0 2px #fff; border-radius: 50%; }
@media (min-width: 640px) {
  .legend-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Reseña en Google y redes sociales */
.footer-links {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(196, 154, 85, .45);
  text-align: center;
}
.review-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  max-width: 24rem;
  min-height: 48px;
  padding: 12px 20px 12px 16px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  color: var(--brand);
  background: var(--cal);
  border: 2px solid var(--gold);
  border-radius: 16px;
}
.review-link:hover { background: #fff; }
.review-link .so-ico { width: 28px; height: 28px; }
.review-text { display: grid; gap: 2px; }
.review-stars { color: var(--gold-ink); letter-spacing: .12em; font-size: 1.0625rem; }
.social-title {
  margin: 22px 0 10px;
  font-family: var(--script);
  font-size: 1.75rem;
  line-height: 1;
}
.social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.social-link {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
}
.social-link:hover { color: var(--brand); background: var(--gold); border-color: var(--gold); }
.so-ico { width: 22px; height: 22px; fill: currentColor; }
.colophon .review-link:focus-visible, .colophon .social-link:focus-visible { outline-color: #fff; outline-offset: 3px; }

.footer-note { margin-top: 24px; font-size: .875rem; opacity: .85; }

/* Nota de privacidad (estadísticas anónimas), plegada en el pie azul marino. */
.privacy { margin-top: 20px; font-size: .875rem; }
.privacy summary {
  display: inline-block;
  padding: 6px 0;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  list-style: none;
}
.privacy summary::-webkit-details-marker { display: none; }
.privacy summary::before { content: "\25B8\00A0"; display: inline-block; text-decoration: none; }
.privacy[open] summary::before { content: "\25BE\00A0"; }
.privacy summary:hover { text-decoration-thickness: 2px; }
.privacy summary:focus-visible { outline-color: #fff; }
.privacy p { max-width: 62ch; margin: 6px 0 0; line-height: 1.5; color: #fff; opacity: .9; }

/* ---------- Páginas de error ---------- */
.error-page { max-width: 40rem; margin: 0 auto; padding: 48px var(--gutter); text-align: center; }
.error-page .site-logo { display: block; width: auto; max-width: min(280px, 70vw); height: auto; max-height: 200px; margin: 0 auto 28px; }
.error-page h1 { font-family: var(--display); color: var(--brand); }
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}
.debug {
  text-align: left;
  white-space: pre-wrap;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 12px;
  overflow: auto;
}

/* ---------- Impresión ---------- */
@media print {
  :root { --price-w: 4.5rem; }
  body { background: #fff; font-size: 10.5pt; }
  .toc, .jump-bar, .section-sheet, .lang-switch, .photo-viewer, .dish-photo, .privacy, .footer-links { display: none !important; }
  .masthead { padding: 0 0 8pt; }
  .masthead-logo img { max-width: 200px; max-height: 140px; }
  .menu { max-width: none; padding: 0; }
  .menu-section { padding-top: 14pt; break-inside: auto; }
  .section-head { break-after: avoid; }
  .dish { padding: 4pt 0; break-inside: avoid; }
  .dish--photo { display: block; }
  .colophon { background: none; color: #000; padding: 16pt 0 0; break-inside: avoid; }
  .legend-list li .al, .legend-traces .al { box-shadow: none; }
}
