/* Header: wordmark, centered pill nav, language menu, phone sheet. */
.logo { position: relative; display: inline-flex; align-items: center; height: 44px; padding-left: 12px; color: var(--ink); }
.logo-word { font-size: 30px; font-weight: 800; letter-spacing: -0.055em; line-height: 1; color: var(--ink); }
.logo::before {
  content: ""; position: absolute; left: 0; top: 0; width: 16px; height: 16px; background: var(--lime);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0c.8 7 5 11.2 12 12-7 .8-11.2 5-12 12-.8-7-5-11.2-12-12 7-.8 11.2-5 12-12z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0c.8 7 5 11.2 12 12-7 .8-11.2 5-12 12-.8-7-5-11.2-12-12 7-.8 11.2-5 12-12z'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 0.5px rgba(20, 33, 15, .55));
}

.site-header { position: fixed; z-index: 100; top: 0; left: 0; right: 0; height: var(--nav-h); transition: background-color .2s var(--ease), box-shadow .2s var(--ease), backdrop-filter .2s; }
.site-header.is-scrolled { background: rgba(250, 249, 246, .84); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 1px 0 var(--line); }
.nav-inner { height: 100%; max-width: 1600px; margin: 0 auto; padding: 0 calc(var(--frame) + 34px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.nav-inner > .logo { justify-self: start; }

/* centered translucent pill */
.nav-links { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-pill); background: var(--nav-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.nav-plain { position: relative; display: inline-flex; align-items: center; height: 40px; padding: 0 20px; border-radius: var(--r-pill); font-weight: 500; font-size: 16px; color: var(--ink); transition: background-color .16s var(--ease), color .16s var(--ease); }
.nav-plain + .nav-plain:not(.nav-sheet-login)::before { content: ""; position: absolute; left: -7px; top: 50%; width: 3px; height: 3px; margin-top: -1.5px; border-radius: 50%; background: var(--ink-2); opacity: .8; }
.nav-plain:hover, .nav-plain[aria-current="true"] { background: var(--forest); color: #fff; }
.nav-plain:hover::before, .nav-plain:hover + .nav-plain::before { opacity: 0; }
.nav-links .nav-sheet-login, .nav-links .lang-switch-sheet { display: none; }
.site-header.is-scrolled .nav-links { background: var(--surface-2); }

.nav-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.nav-login { font-weight: 500; font-size: 16px; color: var(--ink); white-space: nowrap; padding: 0 6px; border-radius: 8px; }
.nav-login:hover { text-decoration: underline; text-underline-offset: 5px; }

.nav-toggle { display: none; appearance: none; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .55); color: var(--ink); cursor: pointer; }
.nav-toggle .nav-toggle-x { display: none; }
.nav-menu-open .nav-toggle .nav-toggle-bars, #nav.menu-open .nav-toggle .nav-toggle-bars { display: none; }
#nav.menu-open .nav-toggle .nav-toggle-x { display: block; }
.nav-menu-lock { overflow: hidden; }

/* ---- Language switcher ---- */
.lang-switch { position: relative; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--ink); }
.flag { display: block; flex: none; width: 20px; height: 20px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--line-2); }
.lang-name, .lang-check { display: none; }
/* without JS: flag + code pills inline */
.lang-switch > a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: var(--r-pill); color: var(--ink-2); border: 1px solid var(--line); background: rgba(255, 255, 255, .5); }
.lang-switch > a:hover { background: var(--surface); }
.lang-switch > a[aria-current="page"] { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.lang-switch-footer { justify-content: flex-start; }

/* with JS: one pill (flag + code + chevron) that opens a menu */
.lang-trigger {
  appearance: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 10px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: rgba(255, 255, 255, .5); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; transition: background-color .16s var(--ease), border-color .16s var(--ease);
}
.lang-trigger:hover, .lang-trigger[aria-expanded="true"] { background: var(--surface); border-color: var(--line-2); }
.lang-chevron { width: 16px; height: 16px; flex: none; opacity: .7; transition: transform .16s var(--ease); }
.lang-trigger[aria-expanded="true"] .lang-chevron { transform: rotate(180deg); }
.lang-menu {
  position: absolute; z-index: 120; right: 0; top: calc(100% + 10px); min-width: 196px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); font-size: 15px;
}
.lang-menu[hidden] { display: none; }
.lang-switch-footer .lang-menu { right: auto; left: 0; top: auto; bottom: calc(100% + 10px); }
.lang-menu > a, .lang-switch-sheet > a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm); border: 0; background: none; color: var(--ink);
  transition: background-color .12s var(--ease);
}
.lang-menu > a:hover, .lang-menu > a:focus-visible, .lang-switch-sheet > a:hover { background: var(--surface-2); }
.lang-menu > a:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.lang-menu .lang-code, .lang-switch-sheet .lang-code { display: none; }
.lang-menu .lang-name, .lang-switch-sheet .lang-name { display: inline; }
.lang-menu .lang-check, .lang-switch-sheet .lang-check { display: block; margin-left: auto; color: var(--ok); visibility: hidden; }
.lang-menu a[aria-current="page"] .lang-check, .lang-switch-sheet a[aria-current="page"] .lang-check { visibility: visible; }

.lang-bar { position: fixed; z-index: 99; top: calc(var(--frame) + var(--nav-gap) + var(--nav-h) + 6px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 4px 14px; width: max-content; max-width: calc(100% - 24px); padding: 4px 6px 4px 18px; border-radius: var(--r-pill); background: var(--forest); color: #fff; font-weight: 500; font-size: 14px; box-shadow: var(--shadow-2); }
.lang-bar-go { color: var(--lime); text-decoration: underline; text-underline-offset: 3px; }
.lang-bar-close { appearance: none; border: 0; background: transparent; color: inherit; font-size: 22px; line-height: 1; min-width: 32px; min-height: 32px; cursor: pointer; border-radius: 8px; }
.lang-bar-close:hover { background: rgba(255, 255, 255, .14); }
.lang-bar :focus-visible { outline-color: var(--lime); }

/* ---- Narrow desktop: five pill links plus the actions need tighter spacing before the sheet takes over at 900px ---- */
@media (min-width: 901px) and (max-width: 1240px) {
  .nav-inner { padding: 0 calc(var(--frame) + 14px); gap: 10px; }
  .nav-links { gap: 2px; padding: 4px; }
  .nav-plain { height: 38px; padding: 0 12px; font-size: 15px; }
  .nav-plain + .nav-plain:not(.nav-sheet-login)::before { left: -2.5px; }
  .nav-actions { gap: 10px; }
}
/* ---- Tablet / phone: the pill collapses into a sheet ---- */
@media (max-width: 900px) {
  :root { --nav-h: 68px; }
  .nav-inner { display: flex; justify-content: space-between; padding: 0 calc(var(--frame) + var(--gutter)); }
  .nav-actions { gap: 10px; margin-left: auto; }
  .nav-login, .lang-switch-header { display: none; }
  .nav-toggle { display: inline-grid; }
  .nav-toggle[hidden] { display: none; }
  .nav-links {
    display: none; position: fixed; z-index: 105; left: var(--frame); right: var(--frame); top: calc(var(--nav-h) - 6px);
    flex-direction: column; align-items: stretch; gap: 2px; padding: 8px; border-radius: var(--r-lg);
    background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: var(--shadow-2); border: 1px solid var(--line);
    max-height: calc(100dvh - var(--nav-h) - 16px); overflow-y: auto;
  }
  #nav.menu-open .nav-links { display: flex; }
  .nav-plain { height: 52px; padding: 0 16px; font-size: 18px; border-radius: var(--r-md); }
  .nav-plain + .nav-plain::before { display: none; }
  .nav-links .nav-sheet-login { display: flex; margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-md) var(--r-md); }
  .nav-plain:hover { background: var(--surface-2); color: var(--ink); }
  .nav-links .lang-switch-sheet { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding-top: 6px; border-top: 1px solid var(--line); font-size: 17px; }
  .lang-switch-sheet > a { min-height: 52px; }
  .site-header:has(#nav-toggle[aria-expanded="true"]) { background: rgba(250, 249, 246, .92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
}
@media (max-width: 560px) {
  .nav-inner { padding: 0 calc(var(--frame) + 10px); }
  .logo-word { font-size: 27px; }
  .nav-actions { gap: 8px; }
  .nav-actions .btn-sm { padding-left: 16px; }
}

/* At the very top the bar sits inside the hero frame with breathing room, not glued to the screen edge;
   once the page scrolls it docks to the top as a solid bar. */
.site-header { transition: top .22s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease), backdrop-filter .2s; }
.site-header:not(.is-scrolled) { top: calc(var(--frame) + var(--nav-gap)); }
@media (prefers-reduced-motion: reduce) { .site-header { transition: none; } }
/* Phones: the language hint sits at the bottom so it never covers the headline. */
@media (max-width: 767px) { .lang-bar { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); } }
