/* ── Hamburger button ─────────────────────────────────────────────────────── */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.75);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.topbar.open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar.open .hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.topbar.open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile-only elements — hidden on desktop */
.social-label { display: none; }
.lang-long    { display: none; }

/* ── Mobile hamburger — portrait ─────────────────────────────────────────── */

@media (max-width: 1024px) {

  :root { --menu-indent: 40px; }

  html { overflow-x: hidden; }

  .topbar { padding: 0 24px; transition: background 0.25s ease; }
  .topbar.open { background: #080808; }

  .hamburger { display: flex; }

  /* Nav overlay — transparent; topbar-panel provides the dark background */
  .menu_page {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--topbar-height));
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: transparent;
    z-index: 100;
    pointer-events: none;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .topbar.open .menu_page   { transform: translateX(0); }
  .topbar.open .menu_page a { pointer-events: auto; }

  .menu_page a {
    height: auto;
    display: block;
    padding: 1rem var(--menu-indent);
    font-size: 18px;
    letter-spacing: 0.1em;
    animation: none;
  }

  /* Background panel — grid rows: spacer (behind nav) | social | lang */
  .topbar-panel {
    flex: none;
    display: grid;
    grid-template-rows: 1fr auto auto;
    gap: 0;
    justify-content: start;
    justify-items: stretch;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--topbar-height));
    background: #080808;
    z-index: 99;
    overflow-y: auto;
    pointer-events: none;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .topbar-panel::before { content: ''; }
  .topbar.open .topbar-panel { pointer-events: auto; transform: translateX(0); }

  /* Social icon label — visible only in hamburger mode */
  .social-label {
    display: inline;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  /* Lang — grid row 3 */
  .menu_language {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 0 1rem;
    border-top: none;
    margin: 0;
  }

  /* Separator line — change the margin value to adjust gap above and below the line equally */
  .menu_language::before {
    content: '';
    display: block;
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 1rem 0 1rem var(--menu-indent);
  }

  .menu_language a {
    display: block;
    padding: 0.75rem var(--menu-indent);
    font-size: 12px;
    letter-spacing: 0.14em;
  }

  .menu_language a.selected { color: white; }

  .lang-sep   { display: none; }
  .lang-short { display: none; }
  .lang-long  { display: inline; }
}

/* ── Mobile hamburger — compact portrait (501–750px tall) ───────────────────── */
/* Reduces the gap between nav and the social/lang block; adjust max-height cap and threshold */

@media (max-width: 1024px) and (min-height: 501px) and (max-height: 650px) {
  .menu_language::before { margin-top: 0.25rem; margin-bottom: 0.25rem; }
  .menu_page a { padding: 0.65rem var(--menu-indent); }
  .menu_language a, .social-link { padding: 0.5rem var(--menu-indent); }
}

/* ── Mobile hamburger — landscape (3 columns: nav | social | lang) ─────────── */

@media (max-width: 1024px) and (max-height: 515px) {

  .menu_page {
    width: 40%;
    flex-direction: column;
    justify-content: center;
  }

  .topbar-panel {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
    padding: 0 5vw 0 40%;
  }

  .topbar-panel::before { display: none; }

  .menu_social {
    border-top: none;
    padding: 0 1.5rem 0 5vw;
    width: auto;
    flex-direction: column;
    /* centered vertical line on right edge — adjust 10%/90% to change length */
    background-image: linear-gradient(to bottom,
      transparent 10%,
      rgba(255,255,255,0.1) 10%,
      rgba(255,255,255,0.1) 90%,
      transparent 90%);
    background-size: 1px 100%;
    background-position: right center;
    background-repeat: no-repeat;
  }

  .menu_page a { padding: 0.65rem var(--menu-indent); }
  .social-link { width: auto; padding: 0.4rem 0; }

  .menu_language::before { display: none; }

  .menu_language {
    border-top: none;
    border-left: none;
    flex-direction: column;
    padding: 0 0 0 1.5rem;
    gap: 0;
    margin: 0;
  }

  .menu_language a { padding: 0.4rem 0; }
}
