/* ONGIT 8.5.1 — scoped, reversible repair for Forgejo 15.0.x.
   Loaded AFTER v8.3/v8.4; no replacement of Forgejo's native navigation. */
:root { --og85-header-height: 54px; --og85-magenta: #e91e7a; }

/* 1. Real fixed positioning (older v8.3 had relative!important overrides). */
html body #og8-landing #og8-public-header.og85-pinned,
html body #og8-landing.og83-pages-navigation #og8-public-header.og85-pinned,
html body #navbar.og85-pinned,
html body #og8-public-header.og85-pinned {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  transform: none !important;
  z-index: 6500 !important;
  box-shadow: 0 9px 25px rgba(7,5,15,.24) !important;
}
#og8-landing {overflow: visible !important;}
.og85-anchor {display:block!important;height:0!important;width:0!important;margin:0!important;padding:0!important;pointer-events:none!important;}
.og85-spacer {display:block!important;flex:0 0 auto!important;height:0;margin:0!important;padding:0!important;pointer-events:none!important;}
#og8-public-header.og85-pinned .og8-mega, #navbar.og85-pinned details .content, #navbar.og85-pinned .menu {z-index: 6550 !important;}

/* 2. Only public marketing entries are visible in guest app navigation.
   CSS is UX only; actual authorization is always enforced by Forgejo. */
html[data-ongit-auth="guest"] #navbar :is(.og74-primary,#og74-products),
html[data-ongit-auth="guest"] #navbar a[href^="/issues"],
html[data-ongit-auth="guest"] #navbar a[href^="/pulls"],
html[data-ongit-auth="guest"] #navbar a[href^="/explore/repos"],
html[data-ongit-auth="guest"] #navbar a[href^="/explore/users"],
html[data-ongit-auth="guest"] #navbar a[href^="/explore/organizations"] { display:none!important; }

/* 3. Dark navigation even in light/lightgrey theme; preserve the logo links. */
html body #navbar,
html body #navbar .navbar-left,
html body #navbar .navbar-right,
html body #navbar .navbar-mobile-right,
html body #navbar .ui.secondary.menu:not(.dropdown .menu) {
 background:#110d1a !important;color:#f9f4ff!important;
 border-color:transparent!important;
}
html body #navbar a.item,html body #navbar .item:not(.dropdown .menu .item),html body #navbar button {
 color:#f8f3ff!important;-webkit-text-fill-color:#f8f3ff!important;
}
html body #navbar .ui.dropdown .menu,html body #navbar details .content {
 background:#21182b!important;color:#fff!important;border:1px solid #574568!important;
}
html body #navbar .ui.dropdown .menu a,html body #navbar details .content a {color:#f8f3ff!important;}
html body #navbar a.item:hover,html body #navbar a.item.active {background:#35233f!important;}

/* 4. Compact the explore secondary tabs; do NOT hide repository context tabs. */
.page-content.explore {padding-top:8px!important;}
.page-content.explore .ui.secondary.pointing.menu,
.page-content.explore .ui.tabular.menu {margin-top:0!important;margin-bottom:12px!important;min-height:40px!important;}
.page-content.explore .ui.secondary.pointing.menu .item {padding:9px 14px!important;}
.page-content.explore > .ui.container:first-child {padding-top:0!important;}
#navbar + .page-content.explore {margin-top:0!important;}

/* 5. Login: accessible, consistent contrast for every ONGIT color mode. */
html.og85-auth-page {--og85-panel:#fff;--og85-foreground:#22212c;--og85-input:#f8f8fa;--og85-edge:#c7c4cf;--og85-bg:#f5f5f8;--og85-hint:#636171;}
html.og85-auth-page[data-og-palette="dark"],
html.og85-auth-page[data-og-palette="grey"],
html.og85-auth-page[data-og-palette="vscode"] {
 --og85-panel:#211d2b;--og85-foreground:#f5f2fa;--og85-input:#2c2735;--og85-edge:#625971;--og85-bg:#15121d;--og85-hint:#c7bdd3;
}
html.og85-auth-page body {background:var(--og85-bg)!important;color:var(--og85-foreground)!important;}
html.og85-auth-page .page-content .ui.segment,
html.og85-auth-page .page-content .ui.attached.segment,
html.og85-auth-page .page-content .ui.form,
html.og85-auth-page .page-content .ui.top.attached.header {
 background:var(--og85-panel)!important;color:var(--og85-foreground)!important;border-color:var(--og85-edge)!important;
}
html.og85-auth-page .page-content :is(h1,h2,h3,.ui.header,.ui.top.attached.header,.ui.form .field>label,.ui.checkbox label,.ui.checkbox label:before){color:var(--og85-foreground)!important;-webkit-text-fill-color:var(--og85-foreground)!important;}
html.og85-auth-page .page-content .ui.form input:not([type="checkbox"]):not([type="radio"]),
html.og85-auth-page .page-content .ui.form select,
html.og85-auth-page .page-content .ui.form textarea {
 background:var(--og85-input)!important;color:var(--og85-foreground)!important;-webkit-text-fill-color:var(--og85-foreground)!important;
 border:1px solid var(--og85-edge)!important;border-radius:8px!important;min-height:42px!important;
}
html.og85-auth-page .page-content .ui.form input::placeholder {color:var(--og85-hint)!important;opacity:1!important;}
html.og85-auth-page .page-content .ui.form input:focus-visible {outline:2px solid #ad74e7!important;outline-offset:1px!important;}
html.og85-auth-page .page-content .ui.checkbox label {padding-left:4px!important;}
html.og85-auth-page .page-content .ui.form .field,.og85-form-surface .field {margin-bottom:14px!important;}

/* 6. Explore/repositories: dark inputs on light canvas were unreadable. */
html[data-og-palette="light"],html[data-og-palette="lightgrey"] {--og85-repo-input:#fff;--og85-repo-ink:#2b2534;--og85-repo-border:#bfc1ce;}
html[data-og-palette="dark"],html[data-og-palette="grey"],html[data-og-palette="vscode"] {--og85-repo-input:#282433;--og85-repo-ink:#f2edfc;--og85-repo-border:#655d72;}
.page-content.explore .ui.input input,
.page-content.explore .ui.form input,
.page-content.explore .ui.selection.dropdown,
.page-content.explore select,
.page-content.explore button.ui.button {
 background:var(--og85-repo-input,var(--og-input,#fff))!important;
 color:var(--og85-repo-ink,var(--og-text,#222))!important;
 -webkit-text-fill-color:var(--og85-repo-ink,var(--og-text,#222))!important;
 border:1px solid var(--og85-repo-border,#999)!important;
}
.page-content.explore .ui.input input::placeholder {color:var(--og85-repo-ink,var(--og-text,#555))!important;opacity:.65!important;}
.page-content.explore .ui.dropdown .menu,.page-content.explore .ui.dropdown .menu .item {background:var(--og85-repo-input,#fff)!important;color:var(--og85-repo-ink,#222)!important;}
.page-content.explore .ui.button:hover,.page-content.explore a:hover {filter:brightness(.94);}
.page-content.explore :is(a,.repository.name) {text-decoration-thickness:1px;text-underline-offset:3px;}

/* 7. The open-source project footer is preserved; don't cover its links. */
#og75-footer,#og74-footer,.og75-footer {position:relative;z-index:1;}
@media(max-width:760px) {
 html body #navbar.og85-pinned,html body #og8-public-header.og85-pinned {max-height:90dvh!important;overflow:visible!important;}
 .page-content.explore .ui.secondary.pointing.menu {overflow-x:auto;}
}
.og85-guest-hidden{display:none!important;}

#og85-footer-docs{display:flex;justify-content:center;gap:18px;flex-wrap:wrap;padding:12px 20px 20px}
#og85-footer-docs a{font-size:13px;color:#c9b2df}#og85-footer-docs a:hover{color:#fff;text-decoration:underline}
#og8-landing #og85-help-links .og8-mega {right:0;left:auto;min-width:270px;}
