/* assets/css/header.css
   The one site header (header.php): logo, language and menu buttons, dropdowns.
   Same look on the map and on every other page. Plain CSS, no Sass build. */

.siteHeader {
  --h-ink: #152233;
  --h-muted: #6B7686;
  --h-surface: #fff;
  --h-blue: var(--blue-color, #3749F0);
  --h-radius: 12px;
  --h-shadow: 0 1px 6px rgba(21, 34, 51, .06);
  --h-shadow-lg: 0 5px 16px rgba(21, 34, 51, .11);

  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  pointer-events: none;               /* only the buttons catch clicks, not the empty bar */
  font-family: inherit;
}
.siteHeader > * { pointer-events: auto; }

/* map page: just the buttons, top corner over the map */
.siteHeader--map {
  position: absolute;
  inset-inline: auto 0;
  z-index: 800;
}

/* ---------- logo: no tile, straight on the page (same as on the map) ----------
   a soft halo in the page colour keeps it readable over whatever scrolls underneath */
.siteLogo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 2px;
  color: var(--h-blue);
  filter: drop-shadow(0 0 1.5px var(--h-halo, #F4F5F8)) drop-shadow(0 0 3px var(--h-halo, #F4F5F8)) drop-shadow(0 0 6px var(--h-halo, #F4F5F8));
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}
.siteLogo .hLogo { display: block; }
.siteLogo:hover { color: var(--h-ink); }

/* ---------- buttons ---------- */
.siteNav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
  position: relative;
  z-index: 2;                         /* above the open dropdowns */
}
.siteNav a { margin: 0; }
.siteNav .btn_menu {
  box-sizing: border-box;
  height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: var(--h-radius);
  background: var(--h-surface);
  box-shadow: var(--h-shadow);
  color: var(--h-ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.siteNav .btn_menu:hover,
.siteNav .btn_menu.opened { background: var(--h-ink); color: #fff; }
.siteNav .btn_menu:hover path { fill: currentColor; }
.siteNav .btn_menu span { margin: 0; }
.siteNav .btn_menu:focus-visible { outline: 3px solid var(--h-blue); outline-offset: 2px; }

/* phones and narrow windows: icon only */
@media (max-width: 979px) {
  .siteNav .btn_menu { width: 44px; padding: 0; }
  .siteNav .btn_menu .text_open_menu,
  .siteNav .btn_menu .text_close_menu { display: none !important; }
  .siteLogo { padding: 0 2px; }
}

/* ---------- main menu panel ---------- */
.siteHeader .popup-menu {
  position: absolute;
  top: 60px;
  inset-inline-end: 10px;
  left: auto;
  bottom: auto;
  float: none;
  transform: none;
  box-sizing: border-box;
  width: min(340px, calc(100vw - 20px));
  height: auto;
  max-height: calc(100dvh - 76px);
  overflow-y: auto;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 8px;
  border-radius: 18px;
  background: var(--h-surface);
  box-shadow: var(--h-shadow-lg);
}
body.rtl .siteHeader .popup-menu { right: auto; left: 10px; }
.siteHeader .menu-list { margin: 0; padding: 0; list-style: none; }
.siteHeader .menu-list li { margin: 0; font-size: 17px; }
.siteHeader .menu-list li a {
  display: block;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  color: var(--h-ink);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}
.siteHeader .menu-list li a:hover { border: 0; background: #F4F5F8; color: var(--h-blue); }
.siteHeader .menu-list li.active a { background: #EEF0FE; color: var(--h-blue); }

/* languages: one row of choices under the links */
.siteMenuLangs {
  margin: 4px 6px 0;
  padding: 12px 8px 6px;
}
.siteMenuLangs .language-select {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0;
  padding: 4px;
  border-radius: 12px;
  background: #F4F5F8;
  list-style: none;
}
.siteMenuLangs .language-select li { margin: 0; }
.siteMenuLangs .language-select a {
  display: block;
  padding: 9px 4px;
  border-radius: 9px;
  color: var(--h-muted);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.siteMenuLangs .language-select a:hover { color: var(--h-ink); }
.siteMenuLangs .language-select li.active a { background: var(--h-surface); color: var(--h-ink); box-shadow: 0 1px 2px rgba(21, 34, 51, .07); }

.siteMenuBrand { display: none; }   /* phones only, see the full-screen menu below */

/* copyright + privacy: at the bottom of the main menu, on every screen size */
.siteMenuFoot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  margin: 8px 6px 2px;
  padding: 12px 8px 4px;
  color: var(--h-muted);
  font-size: 13px;
}
.siteMenuFoot a { color: var(--h-muted); text-decoration: underline; }
.siteMenuLegal { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; }   /* privacy policy + accessibility */
.siteMenuFoot a:hover { color: var(--h-blue); }


/* ---------- phones: the menu takes the whole screen ----------
   Links at the top (scroll if they don't fit), languages + © / privacy pinned to the bottom.
   The logo and the close button stay on top of it. */
@media (max-width: 979px) {
  .siteHeader .siteNav,
  .siteHeader .siteLogo { position: relative; z-index: 2; }
  .siteHeader .popup-menu {
    position: fixed;
    inset: 0;
    z-index: 1;
    width: 100%;
    max-height: none;
    height: 100dvh;
    padding: 72px 16px calc(12px + env(safe-area-inset-bottom));
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    gap: 0;
  }
  body.rtl .siteHeader .popup-menu { left: 0; right: 0; }
  .siteHeader .siteMenuLinks {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 12px;
  }
  .siteHeader .menu-list li a { padding: 14px 12px; font-size: 22px; font-weight: 700; }
  .siteMenuLangs { flex: none; margin: 0; padding: 14px 0 6px; }
  .siteMenuFoot { flex: none; margin: 6px 0 0; padding: 12px 2px 0; }
  /* map page: its header has no logo, so the menu brings one (top corner, like on other pages) */
  .siteHeader .siteMenuBrand { display: inline-flex; position: absolute; top: 10px; inset-inline-start: 10px; }
  /* the page underneath doesn't scroll while the menu is open */
  html:has(#popup_menu[style*="flex"]) { overflow: hidden; }
}

/* ---------- desktop: the menu is a tall panel over 60% of the screen ----------
   Logo standing down the side, big links, languages + © / privacy at the bottom.
   The rest of the page is dimmed; a click there closes the menu (assets/js/script.js). */
.siteMenuMark { display: none; }
@media (min-width: 980px) {
  .siteHeader .siteNav { position: relative; z-index: 2; }        /* Close button stays on top of the panel */
  .siteHeader .popup-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-end: 0;
    inset-inline-start: auto;
    z-index: 1;
    width: clamp(620px, 60vw, 1100px);
    height: 100dvh;
    max-height: none;
    padding: 32px 48px 28px 32px;
    border-radius: 0;
    box-shadow: 0 0 0 100vmax rgba(21, 34, 51, .28);              /* dims the page around the panel */
    overflow: hidden;
  }
  body.rtl .siteHeader .popup-menu { left: 0; right: auto; padding: 32px 32px 28px 48px; }
  .siteHeader .popup-menu[style*="flex"] {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto;
    column-gap: clamp(28px, 3.5vw, 56px);
  }
  .siteMenuMark {
    display: block;
    grid-column: 1;
    grid-row: 1 / -1;
    height: calc(100dvh - 60px);
    max-width: 30vw;
    color: var(--h-blue);
  }
  .siteMenuMark svg { display: block; width: auto; height: 100%; max-width: 100%; }
  .siteMenuMark:hover { color: var(--h-ink); }

  .siteHeader .siteMenuLinks {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
    overflow-y: auto;
    padding-top: 56px;                                             /* clear of the Close button */
  }
  .siteHeader .menu-list li a {
    padding: 6px 0;
    border-radius: 0;
    font-size: clamp(30px, 2.9vw, 50px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -.02em;
  }
  :lang(he) .siteHeader .menu-list li a { letter-spacing: 0; }
  .siteHeader .menu-list li a:hover { background: none; color: var(--h-blue); }
  .siteHeader .menu-list li.active a { background: none; color: var(--h-blue); }
  .siteMenuLangs { grid-column: 2; grid-row: 2; margin: 0; padding: 20px 0 0; }
  .siteMenuLangs .language-select { width: 240px; }
  .siteMenuFoot { grid-column: 2; grid-row: 3; margin: 0; padding: 16px 0 0; justify-content: flex-start; gap: 6px 24px; }
  html:has(#popup_menu[style*="flex"]) { overflow: hidden; }       /* the page doesn't scroll under the menu */
}

/* ---------- menu: open / close animation (assets/js/script.js adds .is-closing before hiding) ---------- */
@keyframes menuDropIn  { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes menuDropOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes menuSheetIn  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes menuSheetOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(14px); } }
.siteHeader .popup-menu { transform-origin: top right; animation: menuDropIn .18s cubic-bezier(.2, .8, .2, 1); }
body.rtl .siteHeader .popup-menu { transform-origin: top left; }
.siteHeader .popup-menu.is-closing { animation: menuDropOut .18s ease-in forwards; }
@keyframes menuPanelIn  { from { opacity: 0; translate: 40px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes menuPanelOut { from { opacity: 1; translate: 0 0; } to { opacity: 0; translate: 40px 0; } }
@keyframes menuPanelInRtl  { from { opacity: 0; translate: -40px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes menuPanelOutRtl { from { opacity: 1; translate: 0 0; } to { opacity: 0; translate: -40px 0; } }
@media (min-width: 980px) {
  .siteHeader .popup-menu { animation: menuPanelIn .26s cubic-bezier(.2, .8, .2, 1); }
  .siteHeader .popup-menu.is-closing { animation: menuPanelOut .18s ease-in forwards; }
  body.rtl .siteHeader .popup-menu { animation-name: menuPanelInRtl; }
  body.rtl .siteHeader .popup-menu.is-closing { animation-name: menuPanelOutRtl; }
}
@media (max-width: 979px) {
  .siteHeader .popup-menu { animation-name: menuSheetIn; animation-duration: .22s; }
  .siteHeader .popup-menu.is-closing { animation-name: menuSheetOut; animation-duration: .18s; }
}
@media (prefers-reduced-motion: reduce) {
  .siteHeader .popup-menu, .siteHeader .popup-menu.is-closing { animation: none; }
}

/* ---------- offline notice (assets/js/script.js offlineNotice) ----------
   bottom centre; on the map it sits above the phone panel (--sheet-visible comes from themap/app.js) */
.offlineNote {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sheet-visible, 0px) + 16px);
  z-index: 9500;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(460px, calc(100vw - 24px));
  box-sizing: border-box;
  padding: 10px 8px 10px 14px;
  border-radius: 12px;
  background: #152233;
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 4px 16px rgba(21, 34, 51, .18);
  transform: translateX(-50%);
  animation: offlineIn .25s ease-out;
}
.offlineNote[hidden] { display: none; }
html[dir="rtl"] .offlineNote { padding: 10px 14px 10px 8px; }
.offlineIco { flex: none; color: #F9DF6D; }
.offlineMsg { flex: 1; }
.offlineClose {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
}
.offlineClose:hover { background: rgba(255, 255, 255, .22); }
@keyframes offlineIn { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { .offlineNote { animation: none; } }

/* text for search engines and screen readers only (e.g. the map page's <h1>) */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* place contacts as links (themap/contacts.js, hatahana_contacts_html): map "Details" dialog + /place pages */
.ctList { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ctItem { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: baseline; margin: 0; }
.ctLabel { font-size: 13px; color: var(--muted, #6B7385); }
.ctValue { min-width: 0; overflow-wrap: anywhere; }
.ctValue a { color: var(--blue-color, #3749F0); text-decoration: none; font-weight: 500; }
.ctValue a:hover { text-decoration: underline; }
.ctItem:not(:has(.ctLabel)) { grid-template-columns: minmax(0, 1fr); }
