/* =========================================================
   TUDANCA · Castellón de la Plana
   base.css — común a todas las páginas (web, /carta/, legales, 404)
   Estilo: periódico editorial, papel crema + tinta verde
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  --paper:      #E4DDCB;
  --paper-2:    #DBD3BE;
  --paper-3:    #EDE8DA;
  --ink:        #2D4E54;
  --ink-deep:   #1E3A3F;
  --ink-soft:   #4F6B70;
  --line:       rgba(45, 78, 84, .55);
  --line-soft:  rgba(45, 78, 84, .22);

  --f-display: "Gelasio", Georgia, "Times New Roman", serif;
  --f-body:    "Lora", Georgia, serif;

  --wrap: 1120px;
  --gutter: clamp(18px, 4vw, 40px);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-io:  cubic-bezier(.65, 0, .35, 1);

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .18  0 0 0 0 .2  0 0 0 0 .16  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image: var(--grain);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
h1, h2, h3, h4, p, dl, dd, ul, figure, blockquote { margin: 0; }
ul { padding: 0; list-style: none; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.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; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; }
.skip:focus { left: 8px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- 3. Tipografía y piezas editoriales ---------- */
.folio {
  display: flex; justify-content: space-between; gap: 16px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 7px 0 6px;
  font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft);
}

.kicker {
  font-size: 11px; letter-spacing: .32em; text-transform: uppercase;
  text-align: center; color: var(--ink-soft);
}
.kicker--left { text-align: left; }
.kicker--light { color: rgba(237, 232, 218, .72); }

.display {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(34px, 5.6vw, 64px); line-height: 1.08;
  letter-spacing: -.005em; text-align: center; color: var(--ink);
  text-wrap: balance;
}
.display--md { font-size: clamp(30px, 4.2vw, 48px); }
.display--lg { font-size: clamp(52px, 10vw, 118px); letter-spacing: .01em; text-transform: uppercase; line-height: 1; }
.display--left { text-align: left; }
.display--light { color: var(--paper-3); }

.deck { font-size: clamp(16px, 1.6vw, 19px); font-style: italic; color: var(--ink-soft); max-width: 34em; }

.rule { height: 1px; background: var(--ink); }
.rule--double { height: 4px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); background: none; }
.rule--x {
  height: 14px; border: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14'><path d='M1 1 L13 13 M13 1 L1 13' stroke='%232D4E54' stroke-width='1' opacity='.7'/></svg>") repeat-x center / 14px 14px;
}

.head { text-align: center; margin: clamp(36px, 6vw, 64px) 0 clamp(32px, 5vw, 56px); }
.head .display { margin-bottom: 14px; }
.head .kicker { padding: 7px 0; }

.note { font-size: 13.5px; font-style: italic; color: var(--ink-soft); }

/* ---------- 4. Botones ---------- */
.btn {
  --b: var(--ink); --t: var(--paper-3);
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 48px; padding: 12px 26px;
  background: var(--b); color: var(--t);
  border: 1px solid var(--b); border-radius: 0;
  font-family: var(--f-body); font-size: 12.5px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  transition: background .35s var(--ease-out), color .35s var(--ease-out), transform .35s var(--ease-out);
}
.btn:hover { background: var(--ink-deep); transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper-3); }
.btn--small { min-height: 38px; padding: 8px 18px; font-size: 11px; }
.btn--light { --b: var(--paper-3); --t: var(--ink-deep); }
.btn--light:hover { background: #fff; }
.btn--outline-light { background: transparent; color: var(--paper-3); border-color: rgba(237,232,218,.6); }
.btn--outline-light:hover { background: var(--paper-3); color: var(--ink-deep); }

/* ---------- 5. Carta (común a la web y a /carta/) ---------- */
.panel { margin-bottom: clamp(40px, 6vw, 64px); }
.panel__title { font-family: var(--f-display); font-weight: 700; font-size: clamp(34px, 5vw, 54px); text-transform: uppercase; letter-spacing: .02em; text-align: center; line-height: 1.05; margin-bottom: clamp(24px, 4vw, 40px); }
.panel__title small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 11px; letter-spacing: .32em; color: var(--ink-soft); margin-top: 10px; }

.menu-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(32px, 6vw, 80px); }
.group-title {
  display: flex; align-items: center; gap: 14px; margin: 6px 0 12px;
  font-family: var(--f-display); font-weight: 700; font-size: 12.5px; letter-spacing: .26em; text-transform: uppercase;
}
.group-title::before, .group-title::after { content: ""; flex: 1; height: 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.menu + .group-title { margin-top: 30px; }
.menu li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; column-gap: 8px;
  padding: 7px 0; border-bottom: 1px dotted var(--line-soft);
}
.menu .dish { font-size: 14px; letter-spacing: .07em; text-transform: uppercase; }
.menu li::after { content: ""; grid-column: 2; grid-row: 1; border-bottom: 1px dotted var(--line); transform: translateY(-4px); }
.menu .price { grid-column: 3; grid-row: 1; font-family: var(--f-display); font-weight: 700; font-size: 15px; white-space: nowrap; }
.menu em { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink-soft); line-height: 1.4; padding-top: 1px; }
.menu li.is-star .dish::after { content: " ✦"; font-size: .8em; }
.menu li { transition: padding-left .3s var(--ease-out); }
.menu li:hover { padding-left: 6px; }
.menu-group .note { margin-top: 16px; }
.aside-note { margin-top: 22px; padding: 16px 18px; border-left: 2px solid var(--ink); font-style: italic; font-size: 15px; color: var(--ink-soft); background: rgba(237,232,218,.5); }

/* Alérgenos por plato (se rellenan desde datos/menu.json → "alergenos") */
.al { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; padding-top: 5px; }
.al span, .platos .al span {
  display: inline-block; padding: 1px 7px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; line-height: 1.6;
  color: var(--ink-soft); background: rgba(237,232,218,.55);
}

.carta__foot { text-align: center; border-top: 2px solid var(--ink); padding-top: 26px; display: grid; justify-items: center; gap: 14px; }
.carta__foot p:first-child { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; }
.allergens { font-size: 13.5px; font-style: italic; color: var(--ink-soft); max-width: 46em; }

/* ---------- 6. Pie ---------- */
.footer { padding: 40px 0 120px; text-align: center; }
.footer__logo { width: 190px; height: auto; margin: 34px auto 14px; color: var(--ink); }
.footer__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; margin: 26px 0 18px; }
.footer__links a { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; }
.footer__links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.footer__small { font-size: 12px; color: var(--ink-soft); }

/* ---------- 7. Páginas sencillas (aviso legal, privacidad, 404) ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 40px var(--gutter) 90px; }
.legal h1 { font-family: var(--f-display); font-size: clamp(30px, 5vw, 44px); margin: 34px 0 18px; }
.legal h2 { font-family: var(--f-display); font-size: 20px; margin: 30px 0 8px; }
.legal p, .legal li { margin-bottom: .7em; }
.legal ul { list-style: disc; padding-left: 1.2em; }
.legal .back { display: inline-block; margin-top: 34px; }

.notfound { min-height: 100svh; display: flex; flex-direction: column; text-align: center; padding: clamp(14px, 3vw, 28px) var(--gutter) 60px; max-width: 760px; margin: 0 auto; }
.notfound__logo { width: min(300px, 70vw); margin: clamp(40px, 8vw, 80px) auto 18px; color: var(--ink); }
.notfound__code { font-family: var(--f-display); font-weight: 700; font-size: clamp(64px, 16vw, 130px); line-height: 1; letter-spacing: .04em; margin: 24px 0 8px; }
.notfound .deck { margin: 14px auto 30px; }
.notfound__cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ---------- 8. Responsive común ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .folio span:last-child { display: none; }
  .folio { justify-content: center; }
  .menu-cols { grid-template-columns: 1fr; }
  .menu-group + .menu-group { margin-top: 30px; }
  .menu .dish { font-size: 13px; }
  .notfound__cta .btn { flex: 1 1 100%; }
}

/* Solo efectos intrusivos se desactivan (Windows trae reduced-motion activado) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  body { background: #fff; }
}
