/* ── Base navbar ── */
.navbar {
  background-color: var(--navbar-bg);
  position: relative;
  width: 100%;
}

.navbar:not(.has-bg-image) {
  background-color: color-mix(in srgb, var(--navbar-bg) 50%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.navbar.navbar-solid:not(.has-bg-image) {
  background-color: var(--navbar-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.navbar:not(.has-bg-image) .color-line {
  opacity: 0.65;
}

.navbar.has-bg-image {
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  max-width: 100vw;
}

.navbar.has-bg-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: color-mix(in srgb, var(--navbar-bg) var(--bg-opacity-value, 55%), transparent);
  z-index: 0;
}

.navbar .container {
  position: relative;
  z-index: 1;
}

/* ── Logo ── */
.logo-container {
  display: flex;
  align-items: center;
  gap: 5rem;
  margin: 0.5rem 1.5rem 0.5rem 0.5rem;
  min-width: 150px;
}

.logo-img {
  max-height: 65px;
  max-width: 220px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

/* ── Menu ── */
.navbar-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-menu li {
  margin: 0 0.5rem;
  text-align: center;
}

.navbar-item.nav-main-item {
  color: var(--navbar-text) !important;
  font-weight: 450;
  font-size: 1rem;
  padding: 0.67rem 1rem;
  background: color-mix(in srgb, var(--navbar-text) 10%, transparent) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--navbar-text) 20%, transparent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background-color 0.3s, color 0.3s, padding 0.2s;
  border-radius: 50px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  line-height: 1.2;
}

.navbar-item.nav-main-item:hover {
  background: color-mix(in srgb, var(--navbar-text) 20%, transparent) !important;
  color: var(--navbar-text) !important;
}

.navbar-item.nav-main-item.is-active {
  background-color: var(--accent) !important;
  border-radius: 64px;
  color: var(--on-accent) !important;
}

.navbar-item.nav-main-item.is-active:hover {
  background-color: var(--accent-hover) !important;
  color: var(--on-accent) !important;
}

.navbar-item.nav-main-item.nav-compact {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

/* ── Shared dropdown (nav items + lang switcher) ── */
.nav-dropdown-wrapper {
  position: relative;
  align-self: center;
}

/* Bridge gap between trigger and menu so hover doesn't break */
.nav-dropdown-wrapper::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 13px;
  background: transparent;
  z-index: 1;
}

.nav-dropdown-trigger {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
  margin-left: 0.25rem;
}

.nav-dropdown-wrapper.is-active .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: calc(100% + 13px);
  left: 0;
  min-width: 220px;
  background-color: color-mix(in srgb, var(--navbar-bg) 60%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--navbar-text) 20%, transparent);
  border-radius: 6px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 0.75rem 0;
  transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
}

.nav-dropdown-wrapper.is-active .nav-dropdown-menu {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.nav-dropdown-item {
  display: block;
  padding: 0.875rem 1.5rem;
  color: var(--navbar-text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  text-align: left;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.nav-dropdown-item:hover {
  background-color: color-mix(in srgb, var(--navbar-text) 12%, transparent);
  color: var(--navbar-text);
  border-left-color: var(--accent);
  padding-left: 1.75rem;
}

.nav-dropdown-item.active {
  background-color: color-mix(in srgb, var(--navbar-text) 12%, transparent);
  border-left-color: var(--accent);
  font-weight: 700;
}

/* ── Right actions (lang + help) ── */
.navbar-right-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.navbar-help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--navbar-text) 10%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--navbar-text) 20%, transparent);
  color: var(--navbar-text);
  border-radius: 50px;
  padding: 0.55rem;
  cursor: pointer;
  transition: background-color 0.3s;
  text-decoration: none;
}

.navbar-help-btn:hover {
  background: color-mix(in srgb, var(--navbar-text) 20%, transparent);
  color: var(--navbar-text);
}

/* Hidden on desktop; the mobile block below reveals it. */
.navbar-help-label {
  display: none;
}

/* ── Lang switcher overrides ── */
.lang-switcher-wrapper {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-top: 5px;
}

.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: color-mix(in srgb, var(--navbar-text) 10%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--navbar-text) 20%, transparent);
  color: var(--navbar-text);
  border-radius: 50px;
  padding: 0.67rem 1rem;
  cursor: pointer;
  font-weight: 450;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lang-switcher-btn:hover {
  background-color: color-mix(in srgb, var(--navbar-text) 15%, transparent);
}

.lang-dropdown {
  left: 50%;
  transform: translateX(-50%);
}

/* ── Burger (mobile) ── */
.navbar-burger {
  display: none;
  cursor: pointer;
  padding: 0.5rem;
}

#burger-icon,
#close-icon {
  filter: brightness(0) invert(1);
}

/* ── Responsive ── */
@media screen and (max-width: 1023px) {
  .navbar .container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
  }

  .logo-container {
    gap: 0.75rem;
    margin: 0;
  }

  .navbar-menu {
    display: none;
    flex-basis: 100%;
  }

  .navbar-menu li {
    margin: 0.2rem 0;
  }

  .navbar-burger {
    display: block;
    position: static;
    padding: 0.5rem;
    flex-shrink: 0;
  }

  /* Shared: identical in both styles, so it stays in one place. */
  .navbar-menu.active {
    display: flex;
    margin-top: 4px;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    flex-basis: 100%;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }

  /* No background of its own — the open menu grows the <nav>, so the
     navbar's own background-color/image already sits behind these pills.
     A second translucent layer here just muddied it. Only a faint rule
     separates the menu from the bar above.
     The transparent/box-shadow pair is not redundant: Bulma ships
     `.navbar-menu { background-color: #fff; box-shadow: ... }` below
     1024px, which the classic dark overlay happened to hide. */
  .nav-style-modern .navbar-menu.active {
    /* Side padding so the pills inset from the panel edges. No bottom
       padding: the last pill's own 8px margin spaces it from
       .navbar-right-actions, which continues the stack directly below. */
    padding: 0.75rem 1.25rem 0;
    background-color: transparent;
    box-shadow: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    animation: navbarMenuSlideDown 0.2s ease forwards;
  }

  .nav-style-classic .navbar-menu.active {
    padding: 0.25rem 0 1rem;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 0;
  }

  /* Classic-only: the redesign deleted this rule outright rather than
     changing it, so without it a classic navbar that has a background
     image gets the wrong overlay. */
  .navbar.nav-style-classic.has-bg-image .navbar-menu.active {
    background: rgba(0, 0, 0, 0.48);
  }

  /* Referenced by the modern branch only; an unused keyframe costs nothing. */
  @keyframes navbarMenuSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .navbar-menu.active li {
    width: 100%;
    margin: 0;
  }

  /* Shared: identical in both styles. */
  .navbar-menu.active .navbar-item.nav-main-item {
    width: 100%;
    text-align: left;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Pill cards rather than flat full-width rows: each item is a rounded,
     translucent card separated by a gap, so the active one can be filled
     solid with the theme accent instead of relying on a thin edge marker. */
  .nav-style-modern .navbar-menu.active .navbar-item.nav-main-item {
    display: block;
    margin: 0 0 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08) !important;
    padding: 12px 16px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 1;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  }

  .nav-style-modern .navbar-menu.active .navbar-item.nav-main-item:hover {
    background: rgba(255, 255, 255, 0.16) !important;
  }

  /* Solid accent fill, with the theme's text colour for contrast on it. */
  .nav-style-modern .navbar-menu.active .navbar-item.nav-main-item.is-active {
    background: var(--accent) !important;
    border-color: var(--accent);
    color: var(--on-accent) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
  }

  /* Flat rows with a left edge marker on the active item. */
  .nav-style-classic .navbar-menu.active .navbar-item.nav-main-item {
    margin: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid transparent;
    background: transparent !important;
    padding: 0.85rem 1.5rem;
    opacity: 0.72;
  }

  .nav-style-classic .navbar-menu.active .navbar-item.nav-main-item:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-left-color: var(--accent);
    opacity: 1;
  }

  .nav-style-classic .navbar-menu.active .navbar-item.nav-main-item.is-active {
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 0;
    border-left: 3px solid var(--accent);
    color: var(--navbar-text) !important;
    opacity: 1;
  }

  /* Shared: identical in both styles. */
  .navbar-menu.active .nav-dropdown-trigger {
    justify-content: space-between;
    width: 100%;
  }

  /* Overrides the pill's `display: block` so the chevron can be pushed to
     the far edge of the pill. */
  .nav-style-modern .navbar-menu.active .nav-dropdown-trigger {
    display: flex;
    align-items: center;
  }

  .navbar-menu.active .nav-dropdown-trigger .dropdown-arrow {
    flex-shrink: 0;
  }

  .nav-dropdown-wrapper {
    width: 100%;
    text-align: left;
  }

  /* On mobile: hide with display:none so it takes no space when collapsed */
  .nav-dropdown-menu {
    display: none;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    position: static;
    width: 100%;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 8px;
    padding: 0.25rem 0;
  }

  .nav-dropdown-wrapper.is-active .nav-dropdown-menu {
    display: block;
  }

  .nav-dropdown-item {
    text-align: left;
    padding: 0.7rem 1.5rem 0.7rem 2rem;
    border-left: 3px solid transparent;
  }

  .nav-dropdown-item:hover {
    border-left-color: var(--accent);
    padding-left: 2rem;
  }

  /* Shared: identical in both styles. */
  .navbar-right-actions {
    display: none;
    width: 100%;
    flex-basis: 100%;
    flex-direction: column;
  }

  /* stretch, not center — these are full-width pills continuing the nav
     stack above, not standalone chips. */
  .nav-style-modern .navbar-right-actions {
    align-items: stretch;
    gap: 8px;
  }

  .nav-style-classic .navbar-right-actions {
    align-items: center;
    gap: 0.5rem;
  }

  /* Shared: identical in both styles. */
  .navbar-right-actions.mobile-active {
    display: flex;
  }

  /* Continues the pill stack directly below .navbar-menu.active. Like it,
     carries no background of its own — the navbar's shows through. */
  .nav-style-modern .navbar-right-actions.mobile-active {
    padding: 0 1.25rem 1rem;
  }

  .nav-style-classic .navbar-right-actions.mobile-active {
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    padding: 0.6rem 0 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 0 14px 14px;
  }

  /* Same pill as .navbar-item.nav-main-item above. */
  .nav-style-modern .navbar-help-btn {
    justify-content: flex-start;
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    gap: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 14px;
  }

  .nav-style-modern .navbar-help-btn:hover {
    background: rgba(255, 255, 255, 0.16);
  }

  /* Compact icon-only circle; the label stays hidden. */
  .nav-style-classic .navbar-help-btn {
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    gap: 0.5rem;
  }

  /* Modern only — classic keeps the desktop `display: none`. */
  .nav-style-modern .navbar-help-label {
    display: inline;
  }

  /* Shared: identical in both styles. */
  .lang-switcher-wrapper {
    display: flex;
    margin: 0;
    flex-direction: column;
  }

  .nav-style-modern .lang-switcher-wrapper {
    width: 100%;
    align-items: stretch;
  }

  .nav-style-classic .lang-switcher-wrapper {
    width: auto;
    align-items: center;
  }

  /* Matches .navbar-item.nav-main-item exactly, so the switcher reads as one
     more entry in the pill stack rather than a leftover control. */
  .nav-style-modern .lang-switcher-wrapper .lang-switcher-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 12px 16px;
    text-align: left;
    gap: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 14px;
    opacity: 1;
  }

  .nav-style-modern .lang-switcher-wrapper .lang-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.16);
  }

  /* Chevron to the far edge, mirroring the DATA TOOLS pill. */
  .nav-style-modern .lang-switcher-wrapper .lang-switcher-btn .dropdown-arrow {
    margin-left: auto;
  }

  /* Classic qualifies on .mobile-active — keep that; it is not equivalent to
     the modern selector and must not be "tidied" into matching it. */
  .nav-style-classic .lang-switcher-wrapper.mobile-active .lang-switcher-btn {
    width: 100%;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid transparent;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0.85rem 1.5rem;
    text-align: left;
    gap: 0.4rem;
    opacity: 0.72;
  }

  .nav-style-classic .lang-switcher-wrapper.mobile-active .lang-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-left-color: var(--accent);
    opacity: 1;
  }

  .lang-dropdown {
    transform: none;
    background: rgba(255, 255, 255, 0.07) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
  }

}

/* ── Text logo ── */
.text-logo-wrapper {
  position: relative;
  display: inline-block;
  text-align: center;
  color: var(--navbar-text);
  font-weight: 500;
  padding: 0.2rem;
  text-decoration: none;
}

.text-logo-bracket {
  position: absolute;
  width: 9px;
  height: 9px;
  border-color: var(--navbar-text);
  border-style: solid;
}

.bracket-tl { top: 0; left: 0; border-width: 2px 0 0 2px; }
.bracket-tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.bracket-bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.bracket-br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.text-logo-content {
  display: flex;
  flex-direction: column;
  font-size: 1rem;
  line-height: 1;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
}

.text-logo-line-1 { white-space: nowrap; }
.text-logo-line-2,
.text-logo-line-3 {
  color: var(--navbar-accent);
  white-space: nowrap;
}

/* ── Color lines ── */
.navbar:has(.color-lines-container) .container {
  padding-bottom: 15px;
}

/* When color lines are OFF, nudge dropdowns down 2px so they clear the navbar edge */
.navbar:not(:has(.color-lines-container)) .nav-dropdown-wrapper::after {
  height: 15px;
}

.navbar:not(:has(.color-lines-container)) .nav-dropdown-menu {
  top: calc(100% + 15px);
}

.navbar:has(.color-lines-container) .logo-container {
  margin: 0.1rem 1.5rem 0.4rem 0.5rem;
}

.color-lines-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 18px;
  pointer-events: none;
  z-index: 2;
}

.color-line {
  height: 6px;
  width: 100%;
}
