/* ==========================================================================
   MESHi v9 - jídelní lístek jako ležatá kniha.
   Washi papír, pečeť kategorie v rumělce, vlnky seigaiha na okraji listu.
   Sekce je přišpendlená, rolování otáčí list přes hřbet. Uvnitř strany se
   nikdy neroluje. Třídy mají předponu mi-, aby se nebily se styles.css.
   ========================================================================== */

.page-menu { background: var(--canvas); }

/* ---------- 1. Záhlaví s videem ----------------------------------------- */
.menu-head {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 52svh; display: flex; align-items: flex-end;
  background: var(--dark-2);
  padding-block: clamp(6rem, 9vw, 8rem) clamp(2rem, 3.5vw, 3rem);
}
.menu-head .wrap { position: relative; z-index: 3; width: 100%; }
.menu-head .hero-media video {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(.62) contrast(1.06) saturate(1.02);
}
.mh-veil { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.mh-veil.v1 { background: linear-gradient(180deg, rgba(20,13,9,.82) 0%, rgba(26,18,13,.5) 40%, rgba(20,13,9,.92) 100%); }
.mh-veil.v2 { background: linear-gradient(90deg, rgba(18,12,8,.76) 0%, rgba(18,12,8,.3) 58%, rgba(18,12,8,.08) 100%); }
.menu-head::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2.4rem; z-index: 2;
  pointer-events: none;
}
.menu-head .kanji-bg { z-index: 1; color: #ffe4cd; opacity: .07; }

.back {
  display: inline-flex; align-items: center; gap: .45rem; margin-bottom: 1.1rem;
  font-size: .76rem; font-weight: 600; color: rgba(248,242,231,.72);
  transition: color .3s var(--ease);
}
.back svg { width: 14px; height: 14px; transition: transform .3s var(--ease); }
.back:hover { color: #fff; }
.back:hover svg { transform: translateX(-3px); }

.menu-head-grid {
  display: grid; grid-template-columns: minmax(0, 34rem) minmax(0, 19rem);
  justify-content: space-between; gap: clamp(1.5rem, 4vw, 3rem); align-items: end;
}
.menu-head .eyebrow { color: #e9a57c; }
.menu-head .eyebrow .jp { color: #ffd9bd; }
.menu-head h1 {
  margin-top: .55rem; color: #fff;
  font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1.1;
  text-shadow: 0 2px 24px rgba(16,10,6,.35);
}
.menu-head .lead { margin-top: .7rem; max-width: 42ch; color: rgba(248,242,231,.8); }
.menu-head-cta { margin-top: 1.3rem; display: flex; flex-wrap: wrap; gap: .7rem; }

.menu-note {
  padding: 1rem 1.15rem; border-radius: var(--r-md);
  background: rgba(28,19,13,.42); border: 1px solid rgba(255,249,238,.18);
  backdrop-filter: blur(14px) saturate(1.2);
}
.menu-note p { font-size: .76rem; line-height: 1.65; color: rgba(248,242,231,.72); }
.menu-note b { display: block; color: #fff; font-weight: 600; margin-bottom: .15rem; }
.menu-note .legend {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem;
  padding-top: .8rem; border-top: 1px solid rgba(255,249,238,.16);
}

/* Nad knihou hlavička uhne, ať má lístek celou obrazovku.
   Vrátí se, jakmile kurzor zajede k hornímu okraji. */
/* Jen tam, kde je myš. Na dotyku není čím hlavičku vrátit. */
@media (hover: hover) and (pointer: fine) {
  body.book-on .header {
    transform: translateY(-150%);
    transition: transform .45s var(--ease);
    pointer-events: none;
  }
  body.book-on.peek .header { transform: none; pointer-events: auto; }
}

/* ---------- 2. Kniha: stoh listů, ne stoh dvoustran --------------------
   Každý list má přední stranu (vpravo) a rub (vlevo po otočení). Otáčí se
   kolem hřbetu. Stín má jen kniha jako celek, ne každá strana zvlášť,
   jinak se desítky stínů sečtou do tmavých kruhů.                        */
.book-sec { position: relative; background: var(--canvas); }
.book-stage {
  position: relative; height: 100svh; min-height: 540px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(.5rem, 1vw, .9rem);
  padding: clamp(1rem, 2.5vw, 2rem) clamp(.8rem, 2.2vw, 1.8rem) clamp(.8rem, 1.4vw, 1.1rem);
}
.book {
  position: relative; width: min(92rem, 100%);
  flex: 1; min-height: 0; max-height: 54rem;
  display: grid; grid-template-columns: 1fr 1fr;
  perspective: 3200px;
  border-radius: var(--r-lg);
  box-shadow: 0 40px 80px -48px rgba(42,26,18,.55), 0 8px 24px -16px rgba(42,26,18,.25);
}
.spine {
  position: absolute; left: 50%; top: 3%; bottom: 3%; width: 14px;
  translate: -50% 0; z-index: 60; pointer-events: none;
  background: repeating-linear-gradient(180deg, transparent 0 15px, rgba(124,74,45,.2) 15px 25px);
}

/* Statické desky: vlevo titul, vpravo zadní deska pod stohem. */
.half { position: relative; overflow: hidden; background: var(--surface-2); }
.cover-l { grid-column: 1; border-radius: var(--r-lg) 0 0 var(--r-lg); }
.cover-r { grid-column: 2; border-radius: 0 var(--r-lg) var(--r-lg) 0; }
.cover-in {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .8rem; text-align: center;
  padding: 2rem;
  background:
    radial-gradient(110% 80% at 50% 0%, rgba(255,255,255,.6), transparent 60%),
    var(--surface);
}
.cover-in .hanko { width: 2.6rem; height: 2.6rem; font-size: 1.2rem; }
.cover-in h3 { font-size: clamp(1.3rem, 2vw, 1.8rem); }
.cover-in p { font-size: .78rem; color: var(--muted); max-width: 26ch; line-height: 1.7; }
.cover-in .jp-v {
  font-family: var(--jp); font-size: 1rem; color: var(--muted-2);
  writing-mode: vertical-rl; letter-spacing: .3em; margin-top: .4rem;
}

/* Stoh listů leží nad pravou polovinou. */
.sheets { grid-column: 2; position: relative; }
.sheet {
  position: absolute; inset: 0;
  transform-origin: left center; transform-style: preserve-3d;
}
.face {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden;
  display: flex; flex-direction: column;
  padding: clamp(.9rem, 1.7vw, 1.5rem) clamp(1rem, 1.9vw, 1.7rem) clamp(.6rem, 1.1vw, .9rem);
  background:
    radial-gradient(130% 90% at 50% 0%, rgba(255,255,255,.72), transparent 62%),
    var(--elevated-warm);
  /* Vnější hrana je u obou tváří vpravo v jejich vlastních souřadnicích. */
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  box-shadow: inset 18px 0 30px -26px rgba(42,26,18,.75);
}
.face.back { transform: rotateY(180deg); }
/* Vlnky seigaiha na vnější hraně listu. */
.face::before {
  content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 26px; z-index: 0;
  opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20' viewBox='0 0 40 20'%3E%3Cg fill='none' stroke='%23b85d38' stroke-opacity='.3'%3E%3Ccircle cx='20' cy='20' r='18'/%3E%3Ccircle cx='20' cy='20' r='12'/%3E%3Ccircle cx='20' cy='20' r='6'/%3E%3Ccircle cx='0' cy='20' r='18'/%3E%3Ccircle cx='40' cy='20' r='18'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 26px 13px;
}
/* Stín, který přejede po papíře během otáčení. */
.turn-shade {
  position: absolute; inset: 0; z-index: 5; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(42,26,18,.5) 0%, rgba(42,26,18,.1) 45%, transparent 72%);
}

/* ---------- 3. Ovládání knihy -------------------------------------------- */
.book-bar {
  flex: none; display: flex; align-items: center; gap: .5rem;
  padding: .3rem; border-radius: var(--pill);
  background: rgba(255,255,255,.72); border: 1px solid var(--line-soft);
  backdrop-filter: blur(10px); box-shadow: var(--sh-1);
}
.turn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--surface-2); color: var(--primary);
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.turn svg { width: 14px; height: 14px; }
.turn:hover { background: var(--primary); color: #fff; }
.turn:disabled { opacity: .3; cursor: default; background: var(--surface-2); color: var(--primary); }
.toc-btn {
  display: inline-flex; align-items: center; gap: .6rem; cursor: pointer;
  padding: .35rem 1rem; border-radius: var(--pill); border: 0; background: none;
  font-size: .78rem; color: var(--body);
}
.toc-btn:hover { background: var(--surface-2); }
.toc-btn .jp { font-family: var(--jp); color: #b5422f; font-size: .85rem; }
.pager b { font-family: var(--serif); font-size: .92rem; color: var(--ink); font-weight: 500; }

.toc {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(26,18,13,.55); backdrop-filter: blur(6px); padding: 1.5rem;
}
.toc[hidden] { display: none; }
.toc-in {
  width: min(46rem, 100%); max-height: 80svh; overflow: auto;
  padding: clamp(1.4rem, 3vw, 2.2rem); border-radius: var(--r-lg);
  background: var(--elevated-warm); box-shadow: var(--sh-float);
}
.toc-in h3 { display: flex; align-items: center; gap: .6rem; font-size: 1.3rem; margin-bottom: 1.1rem; }
.toc-in h3 .jp { font-family: var(--jp); color: #b5422f; font-size: 1rem; }
.toc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: .2rem 1.6rem; margin-bottom: 1.2rem;
}
.toc-grid button {
  display: flex; align-items: baseline; gap: .5rem; width: 100%;
  padding: .5rem .3rem; border: 0; background: none; cursor: pointer; text-align: left;
  border-bottom: 1px dotted var(--line);
  font-family: var(--serif); font-size: 1rem; color: var(--ink);
}
.toc-grid button:hover { color: #b5422f; }
.toc-grid button .jp { font-family: var(--jp); font-size: .78rem; color: var(--muted-2); }
.toc-grid button .n { margin-left: auto; font-size: .78rem; color: var(--muted-2); font-family: var(--sans); }

.search {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem; border-radius: var(--pill);
  background: var(--canvas); border: 1px solid var(--line);
}
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3.5px rgba(200,150,80,.18); }
.search > svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: .85rem; color: var(--ink); }
.search input::placeholder { color: var(--muted-2); }
.search input::-webkit-search-cancel-button { display: none; }
.search button {
  border: 0; background: var(--surface-2); cursor: pointer; flex: none;
  width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; color: var(--muted);
}
.search button svg { width: 11px; height: 11px; }

.no-hit {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; color: var(--muted); font-size: .9rem; z-index: 9;
}
.no-hit[hidden] { display: none; }
.no-hit em { color: #b5422f; font-style: italic; }

/* ---------- 4. Štítky ----------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center;
  padding: .06rem .4rem; border-radius: 3px;
  font-family: var(--sans); font-size: .55rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; border: 1px solid transparent;
}
.tag-rec { background: #f7ddd2; border-color: #eec2b1; color: #a63d28; }
.tag-veg { background: #e8efe0; border-color: #d4e2c6; color: #4e6b36; }
.tag-hot { background: var(--gold-soft); border-color: #eed9b4; color: #8a5a16; }
.menu-note .tag { background: rgba(255,249,238,.14); border-color: rgba(255,249,238,.22); color: #ffd9bd; }

/* ---------- 5. Pata stránky ----------------------------------------------- */
.menu-foot {
  padding-block: clamp(2.2rem, 4vw, 3.4rem);
  background: var(--surface); border-top: 1px solid var(--line-soft);
}
.mf-band { display: flex; align-items: center; justify-content: space-between; gap: clamp(1.2rem, 3vw, 3rem); flex-wrap: wrap; }
.mf-band h3 { font-size: clamp(1.2rem, 1.9vw, 1.55rem); }
.mf-band p { margin-top: .4rem; max-width: 46ch; font-size: .8rem; line-height: 1.65; color: var(--muted); }
.mf-act { display: flex; flex-wrap: wrap; gap: .7rem; }

/* ---------- 6. Responzivita ----------------------------------------------- */
@media (max-width: 1000px) {
  .menu-head-grid { grid-template-columns: 1fr; align-items: start; }
  .menu-note { max-width: 32rem; }
  .mf-band { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 860px) {
  /* Úzký displej knihu nerozkládá: jedna strana, listuje se stejně. */
  .spread { grid-template-columns: 1fr; }
  .spread::after { display: none; }
  .pg.left { border-radius: var(--r-lg); box-shadow: var(--sh-2); }
  .pg.right { display: none; }
  .menu-head { min-height: 58svh; }
}
@media (max-width: 520px) {
  .pg-grid { grid-template-columns: 1fr; grid-template-rows: repeat(2, 1fr); }
  .mi:nth-child(n+3) { display: none; }
}
