/* Zengince navigation repair
   This file owns the desktop/tablet header geometry and intentionally loads
   after the legacy style layers. Mobile navigation remains in style.css. */

@media (min-width: 981px) {
  body .navbar {
    height: 72px;
    min-height: 72px;
    padding: 0 !important;
  }

  body .navbar .navbar-shell {
    width: 100%;
    max-width: 1520px;
    min-height: 71px;
    padding-right: 24px;
    padding-left: 24px;
    align-items: center;
  }

  .navbar-brand {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
  }

  .navbar-nav,
  [data-theme="light"] .navbar-nav {
    width: max-content;
    max-width: 100%;
    justify-self: start;
    gap: 2px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .navbar-nav > a,
  .nav-dropbtn {
    position: relative;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 0.75rem;
    font-weight: 500;
  }

  .navbar-nav > a:hover,
  .nav-dropbtn:hover,
  .nav-dropdown:hover .nav-dropbtn,
  .nav-dropdown.open .nav-dropbtn,
  [data-theme="light"] .navbar-nav > a:hover,
  [data-theme="light"] .nav-dropbtn:hover {
    color: var(--nav-label-strong);
    background: var(--nav-control-hover);
    box-shadow: none;
  }

  .navbar-nav > a.active,
  [data-theme="light"] .navbar-nav > a.active {
    color: var(--nav-label-strong);
    background: var(--nav-control-hover);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-label-strong) 8%, transparent);
  }

  .navbar-nav > a.active::after {
    content: none;
    display: none;
  }

  .nav-dropdown {
    flex: 0 0 auto;
  }

  .nav-actions {
    position: relative;
    z-index: 3;
    min-width: max-content;
    justify-self: end;
    gap: 10px;
  }

  .nav-actions .theme-toggle,
  [data-theme="light"] .nav-actions .theme-toggle {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    margin: 0;
    border-radius: 9px;
  }

  .nav-actions .auth-cluster {
    min-width: max-content;
    flex: 0 0 auto;
    gap: 7px;
    padding-left: 12px;
  }

  .nav-login,
  .nav-join {
    min-height: 40px;
  }
}

@media (min-width: 981px) and (max-width: 1279px) {
  .navbar .navbar-shell {
    grid-template-columns: max-content max-content max-content;
    justify-content: space-between;
    gap: clamp(16px, 2vw, 28px);
  }

  .navbar-search {
    display: none !important;
  }

  .navbar-nav {
    gap: clamp(6px, 1vw, 14px);
  }

  .navbar-nav > a,
  .nav-dropbtn {
    padding-right: 4px;
    padding-left: 4px;
    font-size: 0.76rem;
  }

  .nav-login {
    display: none !important;
  }

  .nav-section-link:not(.nav-section-primary) {
    display: none !important;
  }
}

@media (min-width: 1280px) and (max-width: 1479px) {
  .navbar .navbar-shell {
    grid-template-columns: max-content minmax(210px, 260px) minmax(0, 1fr) max-content;
    justify-content: stretch;
    gap: clamp(12px, 1.25vw, 18px);
  }

  .navbar-search {
    width: 100%;
    min-width: 0;
    max-width: 260px;
  }

  .navbar-nav {
    gap: 0;
  }

  .navbar-nav > a,
  .nav-dropbtn {
    padding-right: 9px;
    padding-left: 9px;
    font-size: 0.73rem;
  }

  .nav-actions {
    margin-left: 8px;
  }

  .nav-section-link--secondary {
    display: none !important;
  }
}

@media (min-width: 1480px) {
  .navbar .navbar-shell {
    grid-template-columns: max-content minmax(280px, 340px) minmax(0, 1fr) max-content;
    justify-content: stretch;
    gap: clamp(18px, 1.8vw, 28px);
  }

  .navbar-search {
    width: 100%;
    min-width: 0;
    max-width: 340px;
  }

  .navbar-nav {
    justify-self: center;
    gap: 4px;
  }

  .navbar-nav > a,
  .nav-dropbtn {
    padding-right: 12px;
    padding-left: 12px;
    font-size: 0.76rem;
  }
}

/* Search control — one calm surface, no browser-default white input */
@media (min-width: 1280px) {
  .navbar .navbar-search,
  [data-theme="light"] .navbar .navbar-search {
    position: relative;
    min-height: 44px;
    gap: 10px;
    padding: 4px 5px 4px 13px;
    overflow: visible;
    border: 1px solid #d8e1da;
    border-radius: 12px;
    color: #52645a;
    background: #f2f5f1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78), 0 4px 14px rgba(29, 65, 46, .035);
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
  }

  [data-theme="dark"] .navbar .navbar-search {
    border-color: rgba(151, 196, 169, .16);
    color: #9fb1a6;
    background: rgba(255, 255, 255, .045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
  }

  .navbar .navbar-search:focus-within,
  [data-theme="light"] .navbar .navbar-search:focus-within {
    border-color: rgba(20, 118, 75, .42);
    background: #f7faf6;
    box-shadow: 0 0 0 3px rgba(20, 118, 75, .075), 0 8px 22px rgba(26, 73, 48, .06);
  }

  [data-theme="dark"] .navbar .navbar-search:focus-within {
    border-color: rgba(91, 205, 137, .42);
    background: rgba(255, 255, 255, .065);
  }

  .navbar .navbar-search svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: currentColor;
  }

  .navbar .navbar-search input,
  [data-theme="light"] .navbar .navbar-search input,
  [data-theme="dark"] .navbar .navbar-search input {
    height: 34px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    color: var(--nav-label-strong);
    background: transparent !important;
    box-shadow: none !important;
    font: 500 .75rem/1 var(--font-body);
    appearance: none;
    -webkit-appearance: none;
  }

  html[data-theme="light"] body .navbar .navbar-search input:not([type="range"]):not([type="checkbox"]):not([type="radio"]) {
    border-color: transparent !important;
    color: var(--nav-label-strong) !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .navbar .navbar-search input::placeholder {
    color: #7a8980;
    opacity: 1;
  }

  [data-theme="dark"] .navbar .navbar-search input::placeholder {
    color: #92a49a;
  }

  .navbar .navbar-search input::-webkit-search-decoration,
  .navbar .navbar-search input::-webkit-search-cancel-button,
  .navbar .navbar-search input::-webkit-search-results-button,
  .navbar .navbar-search input::-webkit-search-results-decoration {
    display: none;
    -webkit-appearance: none;
  }

  .navbar .navbar-search button,
  [data-theme="light"] .navbar .navbar-search button {
    min-width: 49px;
    min-height: 34px;
    flex: 0 0 auto;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    background: #176f4b;
    box-shadow: 0 5px 13px rgba(23, 111, 75, .16);
    font-size: .65rem;
    font-weight: 650;
    cursor: pointer;
    transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  }

  [data-theme="dark"] .navbar .navbar-search button {
    color: #092016;
    background: #73d69b;
    box-shadow: none;
  }

  .navbar .navbar-search button:hover {
    background: #0f5f3e;
    box-shadow: 0 7px 18px rgba(23, 111, 75, .22);
    transform: translateY(-1px);
  }
}

.navbar-search-suggestions {
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  z-index: 1400;
  width: min(480px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 110px));
  overflow: hidden auto;
  padding: 8px;
  border: 1px solid rgba(56, 82, 67, .16);
  border-radius: 14px;
  color: #203229;
  background: #f8faf7;
  box-shadow: 0 22px 58px rgba(25, 54, 38, .16);
}

.navbar-search-suggestions[hidden] {
  display: none;
}

[data-theme="dark"] .navbar-search-suggestions {
  border-color: rgba(163, 199, 177, .16);
  color: #edf2ee;
  background: #1d231f;
  box-shadow: 0 24px 62px rgba(0, 0, 0, .36);
}

.navbar-search-state {
  padding: 18px 16px;
  color: #68776e;
  font-size: .73rem;
  line-height: 1.5;
}

[data-theme="dark"] .navbar-search-state {
  color: #98a99f;
}

.navbar-search-results {
  display: grid;
  gap: 3px;
}

.navbar-search-result {
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}

.navbar-search-result:hover,
.navbar-search-result.is-active {
  border-color: rgba(28, 116, 76, .13);
  background: #edf3ee;
}

[data-theme="dark"] .navbar-search-result:hover,
[data-theme="dark"] .navbar-search-result.is-active {
  border-color: rgba(115, 214, 155, .16);
  background: rgba(115, 214, 155, .075);
}

.navbar-search-result-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(25, 108, 72, .18);
  border-radius: 9px;
  color: #176f4b;
  background: rgba(23, 111, 75, .055);
  font-size: .76rem;
  font-weight: 700;
}

.navbar-search-result-icon.is-entry {
  color: #8a6724;
  border-color: rgba(138, 103, 36, .18);
  background: rgba(138, 103, 36, .055);
}

[data-theme="dark"] .navbar-search-result-icon {
  color: #78dda1;
  border-color: rgba(120, 221, 161, .19);
  background: rgba(120, 221, 161, .07);
}

[data-theme="dark"] .navbar-search-result-icon.is-entry {
  color: #e2bd73;
  border-color: rgba(226, 189, 115, .19);
  background: rgba(226, 189, 115, .07);
}

.navbar-search-result-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.navbar-search-result-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-search-result-heading strong {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: .77rem;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-search-result-heading small {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  color: #176f4b;
  background: rgba(23, 111, 75, .08);
  font-size: .5rem;
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
}

[data-theme="dark"] .navbar-search-result-heading small {
  color: #78dda1;
  background: rgba(120, 221, 161, .09);
}

.navbar-search-result-preview {
  overflow: hidden;
  color: #68776e;
  font-size: .66rem;
  line-height: 1.42;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-search-result-copy > small {
  color: #849087;
  font-size: .57rem;
  line-height: 1.35;
}

[data-theme="dark"] .navbar-search-result-preview,
[data-theme="dark"] .navbar-search-result-copy > small {
  color: #98a99f;
}

.navbar-search-all {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 12px;
  border-top: 1px solid rgba(56, 82, 67, .12);
  color: #176f4b;
  font-size: .65rem;
  font-weight: 650;
  text-decoration: none;
}

[data-theme="dark"] .navbar-search-all {
  border-top-color: rgba(163, 199, 177, .12);
  color: #78dda1;
}

@media (prefers-reduced-motion: reduce) {
  .navbar .navbar-search,
  .navbar .navbar-search button {
    transition: none;
  }
}

/* Signed-in desktop collision guard */
@media (min-width: 1480px) and (max-width: 1679px) {
  .navbar .navbar-shell {
    grid-template-columns: max-content minmax(230px, 300px) minmax(0, 1fr) max-content;
    gap: clamp(12px, 1.2vw, 18px);
  }

  .navbar-nav .nav-section-link--secondary {
    display: none !important;
  }

  .navbar-nav > a,
  .nav-dropbtn {
    padding-right: 10px;
    padding-left: 10px;
  }

  .nav-actions {
    gap: 6px;
  }

  .nav-actions .auth-cluster {
    gap: 4px;
    padding-left: 8px;
  }
}

/* Resolved desktop navigation order */
@media (min-width: 981px) {
  .navbar-nav .nav-section-link--secondary {
    display: none !important;
  }

  .navbar .nav-actions {
    margin-left: clamp(10px, 1vw, 16px);
    padding-left: 0;
    gap: 9px;
  }

  .navbar .nav-actions::before {
    content: none;
    display: none;
  }

  .navbar .nav-actions .auth-cluster {
    order: 1;
    padding-left: 11px;
    border-left: 1px solid var(--nav-border-strong);
  }

  .navbar .nav-actions .theme-toggle {
    order: 2;
    position: relative;
    z-index: 1;
    margin-left: 3px;
    overflow: hidden;
    isolation: isolate;
  }

  .navbar .nav-actions .navbar-toggle {
    order: 3;
  }

  html[data-theme="dark"] .navbar .nav-actions .theme-toggle {
    border-color: rgba(151, 196, 169, .22);
    background: #15211a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
  }

  html[data-theme="dark"] .navbar .nav-actions .theme-toggle:hover {
    border-color: rgba(151, 218, 177, .34);
    background: #1a2a21;
  }
}
