/* The header menu „Приказки“: a soft pill with a small arrow that opens the five worlds, each with a tiny motif
   from its own map. The look of the world paths (pateka.css): dusk paper in the light theme, night with a warm
   lantern glow in the dark one. Every colour is a light-dark() pair, so it follows the page's color-scheme (the
   lamp). Shared by the world pages, the story pages and За Приказко; menyu.js opens and places the list. */

.menyu {
  --menyu-tekst: light-dark(#2B2A1E, #F1E6CD);
  --menyu-gore: light-dark(#FDF6E6, #222A4C);
  --menyu-dolu: light-dark(#F6E1C9, #161C36);
  --menyu-sjai: light-dark(rgba(255, 214, 140, .45), rgba(255, 190, 100, .2));
  --menyu-senka: light-dark(rgba(80, 56, 20, .22), rgba(0, 0, 0, .5));
  --menyu-rab: light-dark(rgba(122, 90, 46, .18), rgba(255, 236, 200, .14));
  --menyu-nad: light-dark(rgba(255, 255, 255, .6), rgba(255, 236, 200, .08));
  --menyu-tuk: light-dark(rgba(242, 210, 124, .38), rgba(242, 210, 124, .13));
  --menyu-zlato: light-dark(#C2913A, #D9A84C);
  --menyu-fokus: light-dark(#2A2236, #F6D788);
  position: relative;
  font-family: "Rubik", "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
}

/* the pill, the same soft shape as „Към рафта“ */
.menyu-gumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  padding: 0 12px 0 15px;
  border: 0;
  border-radius: 22px;
  font: 500 .9375rem/1.1 "Rubik", "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
  white-space: nowrap;
  color: inherit;
  background: light-dark(rgba(255, 252, 240, .34), rgba(255, 236, 200, .07));
  box-shadow: inset 0 0 0 1px light-dark(rgba(60, 40, 20, .12), rgba(255, 236, 200, .14));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.menyu-gumb[aria-expanded="true"] {
  background: light-dark(rgba(255, 252, 240, .62), rgba(255, 236, 200, .14));
  box-shadow: inset 0 0 0 1px var(--menyu-zlato), 0 0 18px 2px var(--menyu-sjai);
}
.menyu-strelka { flex: none; width: 14px; height: 14px; }
.menyu-gumb[aria-expanded="true"] .menyu-strelka { transform: rotate(180deg); }

.menyu-gumb:focus-visible,
.menyu-vrazka:focus-visible {
  outline: 3px solid var(--menyu-fokus);
  outline-offset: 2px;
}

/* the list: a rounded card of dusk paper; menyu.js holds it under the pill, inside the screen */
.menyu-spisak {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  left: 0;
  box-sizing: border-box;
  width: min(300px, calc(100vw - 24px));
  margin: 0;
  padding: 8px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 24px;
  color: var(--menyu-tekst);
  background:
    radial-gradient(120% 70% at 50% 0%, var(--menyu-sjai), transparent 70%),
    linear-gradient(180deg, var(--menyu-gore), var(--menyu-dolu));
  box-shadow: inset 0 0 0 1px var(--menyu-rab), 0 16px 36px var(--menyu-senka), 0 0 44px 4px var(--menyu-sjai);
}
.menyu--js .menyu-spisak { position: fixed; top: 0; left: 0; }
.menyu-spisak[hidden] { display: none; }
/* with no script the list opens while the pill or a link has the focus */
.menyu:not(.menyu--js) .menyu-spisak { display: none; }
.menyu:not(.menyu--js):focus-within .menyu-spisak { display: block; }

.menyu-spisak li { margin: 0; padding: 0; }
.menyu-spisak li + li { margin-top: 2px; }

.menyu-vrazka {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 14px 6px 6px;
  border-radius: 18px;
  font: 700 1rem/1.2 "Comfortaa", "Avenir Next Rounded", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--menyu-tekst);
  text-decoration: none;
}
.menyu-vrazka:hover { background: var(--menyu-nad); }
.menyu-vrazka[aria-current] { background: var(--menyu-tuk); }

/* the round motif of each world, from its own map */
.menyu-znache {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--motiv);
  background: var(--disk);
  box-shadow: inset 0 0 0 1px var(--menyu-rab);
}
.menyu-znache svg { display: block; width: 24px; height: 24px; }
.menyu-vrazka[aria-current] .menyu-znache { box-shadow: 0 0 0 2px var(--menyu-zlato), 0 0 14px 3px var(--menyu-sjai); }

.menyu-vrazka--dino { --disk: light-dark(#ECE2C2, #33352A); --motiv: light-dark(#8A6A3E, #E2C98A); }
.menyu-vrazka--more { --disk: light-dark(#DDEBEF, #183149); --motiv: light-dark(#3D7690, #A8D0E2); }
.menyu-vrazka--dzhungla { --disk: light-dark(#DCE8CF, #173629); --motiv: light-dark(#4C7342, #A2CC8E); }
.menyu-vrazka--fei { --disk: light-dark(#F6E2EA, #3D2E40); --motiv: light-dark(#C25F82, #E9A2BE); }
.menyu-vrazka--kosmos { --disk: light-dark(#E2E0F4, #1B1F48); --motiv: light-dark(#6A62B4, #F6DE9A); }
.menyu-sreda { fill: light-dark(#F0C860, #E2B65E); }
.menyu-zhilka { stroke: var(--disk); }

/* ---------- in the headers ---------- */

/* wide: the pill sits on the right, before „Към рафта“ or the plate switch */
.gornica:has(> .menyu) { flex-wrap: wrap; }
.gornica > .menyu { flex: none; margin-left: auto; }
.gornica > .menyu + .nazad { margin-left: 0; }
.gornica:has(> .menyu--otvoreno) { z-index: 60; }

/* phones: the pill gets its own line under the mark, so nothing in the top line moves */
@media (max-width: 559px) {
  .gornica > .menyu { order: 9; flex-basis: 100%; margin-left: 0; }
  .gornica > .menyu + .nazad { margin-left: auto; }
}

/* the home (header.glava, the mark in the middle): the pill at the right end, in line with the cupboard; on phones
   on its own line under the mark, in the middle. Unused until the home gets the menu. */
.glava > .menyu { position: absolute; top: calc(50% - 21px); right: max(16px, calc((100% - 1120px) / 2)); }
.glava:has(> .menyu--otvoreno) { z-index: 60; }
@media (max-width: 559px) {
  .glava:has(> .menyu) { flex-wrap: wrap; height: auto; row-gap: 4px; }
  .glava > .menyu { position: relative; top: auto; right: auto; flex-basis: 100%; display: flex; justify-content: center; }
}

/* ---------- gentle motion, only where it is welcome ---------- */

@media (prefers-reduced-motion: no-preference) {
  .menyu-strelka { transition: transform .2s ease; }
  .menyu-gumb { transition: background-color .2s ease, box-shadow .2s ease; }
  .menyu-vrazka { transition: background-color .15s ease; }
  .menyu--js .menyu-spisak { transition: opacity .18s ease, translate .18s ease; }
  @starting-style {
    .menyu--js .menyu-spisak { opacity: 0; translate: 0 -6px; }
  }
}
