/* Site menu: a labelled "Menu" button plus a full-width panel for narrow screens.
   One stylesheet for every page (linked with a content-hash query by
   scripts/lib/website-menu.mjs). Relies only on the site's CSS variables and
   carries fallbacks, so it renders on any page type. Works without JavaScript:
   the panel is a <details> element; assets/site-menu.js only adds polish.

   Breakpoints (above the widest header the six-link nav plus button plus switcher needs):
     > 1100px  desktop: the inline nav shows, the menu is hidden
     <= 1100px the inline nav hides, the "Menu" button appears
     <= 560px  the header language dropdown moves into the panel */

.header .site-menu { display: none; }

@media (max-width: 1100px) {
  .header .nav { display: none !important; }
  .header .site-menu { display: block; }
  .header-inner > .logo { margin-right: auto; }
}

/* ---- header fit, for every page type ----
   The header call-to-action keeps a short label on narrower screens (the part after the
   dash is wrapped in .btn-more by scripts/lib/website-menu.mjs); the logo never wraps;
   phones get a compact bar so logo, button, menu and language always fit. */
.header-inner .logo { white-space: nowrap; flex-shrink: 0; }
.header-inner > .btn { text-align: center; }
@media (max-width: 1180px) { .header-inner .btn-more { display: none; } }
@media (max-width: 560px) {
  .header-inner { padding: 0.7rem max(1rem, env(safe-area-inset-right)) 0.7rem max(1rem, env(safe-area-inset-left)); gap: 0.6rem; }
  .header-inner .logo { font-size: 1.2rem; gap: 0.4rem; }
  .header-inner > .btn { font-size: 0.8rem; padding: 0.5rem 0.95rem; white-space: nowrap; }
  .header-inner .lang-btn { padding: 0.4rem 0.5rem; }
}
@media (max-width: 420px) {
  .header-inner { gap: 0.4rem; }
  .header-inner .logo { font-size: 1.05rem; }
  .header-inner .logo-icon { width: 24px; height: 24px; }
  .header-inner > .btn { font-size: 0.74rem; padding: 0.45rem 0.7rem; }
}
@media (max-width: 420px) {
  /* Long localized labels (de, fr, es, pt) wrap to two lines instead of pushing the Menu button off-screen. */
  .header-inner > .btn { white-space: normal; line-height: 1.15; min-width: 0; padding: 0.4rem 0.6rem; }
  .site-menu-btn { flex-shrink: 0; }
}
@media (max-width: 340px) {
  .header-inner .logo-icon { display: none; }
}
.footer-links { flex-wrap: wrap; }

/* ---- the button ---- */
.site-menu > summary { list-style: none; }
.site-menu > summary::-webkit-details-marker { display: none; }
.site-menu-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 40px; padding: 0.5rem 0.95rem;
  border: 1px solid var(--line-bright, #3d3527); border-radius: 999px;
  background: transparent; color: var(--ink, #f4ecdb);
  font: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.site-menu-btn:hover, .site-menu[open] > .site-menu-btn { border-color: var(--accent, #e0a96d); background: var(--surface, #1c1813); }
.site-menu-btn:focus-visible, .site-menu-list a:focus-visible, .site-menu-lang-list a:focus-visible {
  outline: 2px solid var(--accent, #e0a96d); outline-offset: 2px;
}
.site-menu-ico { width: 1.15rem; height: 1.15rem; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.site-menu-ico path { transform-box: fill-box; transform-origin: center; transition: transform 0.18s ease, opacity 0.12s ease; }
.site-menu[open] .site-menu-ico .l1 { transform: translateY(5px) rotate(45deg); }
.site-menu[open] .site-menu-ico .l2 { opacity: 0; }
.site-menu[open] .site-menu-ico .l3 { transform: translateY(-5px) rotate(-45deg); }

/* ---- the panel: hangs under the sticky header, full width, scrolls if tall ---- */
.header .site-menu-panel {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 60;
  max-height: calc(100vh - 4.5rem); max-height: calc(100dvh - 4.5rem);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 0.4rem max(1.25rem, env(safe-area-inset-right)) calc(1.1rem + env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  background: var(--surface, #1c1813);
  border-bottom: 1px solid var(--line-bright, #3d3527);
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.5);
}
@media (prefers-reduced-motion: no-preference) {
  .site-menu[open] .site-menu-panel { animation: site-menu-in 0.16s ease-out; }
  @keyframes site-menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
}
.site-menu-nav, .site-menu-lang { max-width: 640px; margin: 0 auto; }
.site-menu-list { list-style: none; margin: 0; padding: 0; }
.site-menu-list li + li { border-top: 1px solid var(--line, #2a241c); }
.site-menu-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 48px; padding: 0.7rem 0.15rem;
  color: var(--ink, #f4ecdb); font-size: 1.02rem; font-weight: 500;
}
.site-menu-list a::after { content: "\203A"; color: var(--ink-faint, #6e6557); font-size: 1.3rem; line-height: 1; }
.site-menu-list a:hover { color: var(--accent, #e0a96d); opacity: 1; }
.site-menu-list a[aria-current="page"] { color: var(--accent, #e0a96d); }
.site-menu-list + .site-menu-list { margin-top: 0.35rem; padding-top: 0.35rem; border-top: 1px solid var(--line-bright, #3d3527); }

/* ---- language row (phones only; wider screens keep the header dropdown) ---- */
.site-menu-lang { display: none; margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--line-bright, #3d3527); }
.site-menu-lang-title { margin: 0 0 0.55rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint, #6e6557); }
.site-menu-lang-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.site-menu-lang-list a { display: inline-block; padding: 0.5rem 0.85rem; border: 1px solid var(--line-bright, #3d3527); border-radius: 999px; font-size: 0.88rem; color: var(--ink-dim, #a59b85); }
.site-menu-lang-list a:hover { border-color: var(--accent, #e0a96d); color: var(--ink, #f4ecdb); opacity: 1; }
.site-menu-lang-list a[aria-current="true"] { border-color: var(--accent, #e0a96d); color: var(--accent, #e0a96d); }
@media (max-width: 560px) {
  .site-menu-lang { display: block; }
  .header .lang { display: none; }
  .site-menu-btn { padding: 0.45rem 0.85rem; font-size: 0.85rem; }
}
@media (max-width: 420px) {
  .site-menu-btn { padding: 0.4rem 0.65rem; gap: 0.35rem; font-size: 0.8rem; min-height: 36px; }
  .site-menu-ico { width: 1rem; height: 1rem; }
}
