/*
 * The header on every page of the website (Dany, session 7). On phones: the logo, the name, Log in
 * and a ☰ button, which opens a panel from the right with every section of the site and Sign up. On
 * tablets and computers the sections and Sign up sit in the bar instead, with no ☰.
 * The menu is a popover, so it opens, closes on Escape and closes on a tap outside without any script.
 * /js/menu.js closes it when one of its links is followed, or when the screen widens past a phone's.
 * Colours come from each page's own tokens (landing.css, legal.css).
 */
html { scrollbar-gutter: stable; }
html:has(.menu:popover-open) { overflow: hidden; }
/* The logo's "back to the top" link lands above the bar, not under it. */
#top { scroll-margin-top: 68px; }

.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--brown); color: var(--cream); }
.nav-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.brand { display: flex; flex: none; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 36px; }
.brand span { font: 800 24px/1 var(--display); letter-spacing: -0.01em; }
.links { display: none; }
.links a { padding: 8px 0; color: var(--mute-on-dark); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }
.links a:hover { color: var(--white); }
.links a[aria-current="page"] { color: var(--white); box-shadow: inset 0 -3px 0 var(--orange); }
.acts { display: flex; align-items: center; gap: 6px; }
.login { padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }
.login:hover { background: var(--brown-2); }
.signup { padding: 11px 18px; border-radius: 10px; background: var(--orange); color: var(--brown); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; }
.signup:hover { background: #FF8230; }
/* Phones: Sign up is in the menu, and on the landing page it's the first button below the bar (Dany). */
.acts .signup { display: none; }
.menu-open, .menu-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: none; color: inherit; cursor: pointer; }
.menu-open { margin-right: -6px; }
.menu-open:hover, .menu-close:hover { background: var(--brown-2); }
.menu-open svg, .menu-close svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.nav :focus-visible, .menu :focus-visible { outline-color: var(--orange); }

/* The menu: the browser's popover defaults are a box in the middle, this makes it a panel on the right. */
.menu {
  position: fixed; inset: 0 0 0 auto; width: min(380px, 88vw); height: 100%; max-height: none; margin: 0;
  padding: env(safe-area-inset-top, 0px) 20px calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  border: 0; background: var(--brown); color: var(--cream);
  box-shadow: -24px 0 60px rgb(0 0 0 / 0.3);
  transform: translateX(100%);
  transition-property: transform, overlay, display;
  transition-duration: 0.3s;
  transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-behavior: allow-discrete;
}
.menu:popover-open { display: flex; flex-direction: column; transform: none; }
@starting-style { .menu:popover-open { transform: translateX(100%); } }
.menu::backdrop {
  background: rgb(42 18 6 / 0);
  transition-property: background-color, overlay, display;
  transition-duration: 0.3s;
  transition-behavior: allow-discrete;
}
.menu:popover-open::backdrop { background: rgb(42 18 6 / 0.55); }
@starting-style { .menu:popover-open::backdrop { background: rgb(42 18 6 / 0); } }

.menu-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; margin-right: -6px; }
.menu-links { margin: 12px 0 0; padding: 0; list-style: none; }
.menu-links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; border-bottom: 1px solid rgb(252 240 228 / 0.14); font: 800 28px/1.1 var(--display); text-decoration: none; }
.menu-links a::after { content: ''; flex: none; width: 10px; height: 10px; margin-right: 6px; border-top: 3px solid var(--orange); border-right: 3px solid var(--orange); transform: rotate(45deg); }
.menu-links a:hover { color: var(--orange); }
.menu-acts { display: grid; gap: 10px; margin-top: auto; padding-top: 32px; }
.menu-acts a { display: flex; align-items: center; justify-content: center; min-height: 54px; border-radius: 12px; font: 700 17px/1 var(--body); text-decoration: none; }
.menu-login { box-shadow: inset 0 0 0 2px rgb(252 240 228 / 0.4); }
.menu-login:hover { background: var(--brown-2); }
.menu-signup { background: var(--orange); color: var(--brown); }
.menu-signup:hover { background: #FF8230; }
.menu-small { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 20px 0 0; color: var(--mute-on-dark); font-size: 14px; }
.menu-small a { font-weight: 600; text-decoration: none; }
.menu-small a:hover, .menu-small a[aria-current="page"] { color: var(--white); }

@media (prefers-reduced-motion: reduce) {
  .menu, .menu::backdrop { transition: none; }
}
/* Browsers without popovers (iPhones before iOS 17): no menu, so Sign up stays in the bar. */
@supports not selector(:popover-open) {
  .menu-open, .menu { display: none; }
  .acts .signup { display: block; }
}
/* Tablets and computers: the sections in the bar, and no ☰. */
@media (min-width: 768px) {
  .nav-in { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; }
  .links { display: flex; justify-content: center; gap: 28px; }
  .acts { gap: 8px; }
  .acts .signup { display: block; }
  .menu-open { display: none; }
}
@media (min-width: 768px) and (max-width: 960px) {
  .nav-in { gap: 16px; }
  .links { gap: 20px; }
  .login { padding: 10px 10px; }
}

/*
 * The language switch (D42). Nobody is sent to a language: the pages are English until someone picks
 * one. On tablets and computers the globe at the top right opens the list; on phones the list is in
 * the ☰ menu; every page also has it in the footer, which also covers browsers without popovers.
 * scripts/site-languages.mjs writes it into every page.
 */
.lang-open { display: none; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: 700 14px/1 var(--body); letter-spacing: 0.04em; cursor: pointer; }
.lang-open:hover { background: var(--brown-2); }
.lang-open svg, .menu-langs svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.langs {
  position: fixed; inset: calc(64px + env(safe-area-inset-top, 0px)) max(16px, calc((100vw - 1160px) / 2 + 20px)) auto auto;
  min-width: 200px; margin: 0; padding: 8px;
  border: 0; border-radius: 14px; background: var(--brown); color: var(--cream);
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.35);
}
.langs:popover-open { display: grid; }
.langs a { padding: 12px 14px; border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none; }
.langs a:hover { background: var(--brown-2); }
.langs a[aria-current] { color: var(--orange); }
.menu-langs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 24px 0 0; color: var(--mute-on-dark); font-size: 15px; }
.menu-langs a { font-weight: 600; text-decoration: none; }
.menu-langs a:hover, .menu-langs a[aria-current] { color: var(--white); }
.foot-langs { display: flex; flex-wrap: wrap; gap: 8px 16px; width: 100%; font-size: 14px; }
.foot-langs a { color: var(--mute-on-dark); text-decoration: none; }
.foot-langs a:hover, .foot-langs a[aria-current] { color: var(--cream); }
@media (min-width: 768px) {
  .lang-open { display: inline-flex; }
}
@supports not selector(:popover-open) {
  .lang-open, .langs { display: none; }
}

/*
 * Other languages run longer ("Iniciar sesión", "Registrarse", "Nachfassen"…). Their pages keep the
 * phone header, with the ☰ and no section links, up to 1023px, where English has room from 768px;
 * and on the narrowest phones, Log in waits in the ☰ menu. js/menu.js uses the same widths.
 */
@supports selector(:popover-open) {
  @media (min-width: 768px) and (max-width: 1023px) {
    html:not([lang="en"]) .nav-in { display: flex; }
    html:not([lang="en"]) .links { display: none; }
    html:not([lang="en"]) .menu-open { display: grid; }
  }
  @media (max-width: 359px) {
    html:not([lang="en"]) .acts .login { display: none; }
  }
}
