/* Shared return links used by workspaces and other local navigation. */
a.map-return {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--outlo-brand-text, #4338ca);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  transition: color .16s ease;
}
.admin-modern a.admin-map-link.map-return { font-size: 13px; line-height: 20px; }
.map-return svg {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
a.map-return:hover { color: var(--outlo-brand-text-hover, #3730a3); }
a.map-return:hover > span:last-child { text-decoration: underline; text-underline-offset: 4px; }
a.map-return:focus-visible { outline: 3px solid var(--outlo-control-focus, #a5b4fc); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .map-return svg { transition: transform .16s ease; }
  .map-return:hover svg { transform: translateX(-3px); }
}
.rs-heading > .map-return,
.public-organizer-shell > .map-return { margin-bottom: 12px; }
.detail-content > .detail-map-return { margin-bottom: 8px; }
:is(.is-search-preview, .is-map-preview, .editor-preview-card, #eventDetailPreview, .embedded-event-editor) .detail-map-return { display: none; }

/* Editing surfaces own navigation until their form is closed. */
body.map-return-suppressed .admin-header-actions :is(#catalogMapHome,[data-outlo-home-mobile]),
body.map-return-suppressed :is(#publicMapReturn, #floatingMapReturn, .admin-map-link, .admin-header-map-mobile, .events-map-link, .admin-review-map-return) {
  display: none !important;
}
/* The workspace header owns the map action once its shared search is mounted. */
body.has-workspace-search-home :is(#floatingMapReturn, .admin-header-map-mobile, .events-map-link, .admin-review-map-return),
body.has-workspace-search-home:not(.admin-nav-open) .admin-sidebar > .admin-map-link { display:none !important; }
/* An event detail is still on the map; the sheet has its own close control. */
body.map-page :is(#publicMapReturn, #floatingMapReturn) { display: none !important; }

/* Desktop uses the header return; mobile and tablet use the floating action. */
.topbar.app-topbar .public-nav-home {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 0;
  min-width: 0;
}
.topbar.app-topbar .public-nav-home .brand-link { grid-column: auto; padding-right: 0 !important; }
.topbar.app-topbar a.public-map-return {
  display: inline-flex;
  min-width: 60px;
  min-height: 44px;
  flex: 0 0 auto;
  gap: 6px;
  font-size: 14px;
  line-height: 20px;
  padding-left: 12px;
  border-left: 1px solid #dcdcf0;
}
.topbar.app-topbar a.public-map-return:visited { color: var(--outlo-brand-text, #4338ca); }
.topbar.app-topbar a.public-map-return:is(:hover, :focus-visible) { color: var(--outlo-brand-text-hover, #3730a3); }
.topbar.app-topbar .public-map-return[hidden] { display: none !important; }
.topbar.app-topbar.is-public-page .public-nav-home { gap: 12px; }
@media (max-width: 1120px) {
  .topbar.app-topbar.is-public-page .public-nav-home { gap: 0; }
  .topbar.app-topbar a.public-map-return { display: none; }
}
@media (min-width: 901px) {
  .map-page .topbar.app-topbar:not(.is-public-page) > .public-nav-home { display: none !important; }
}
@media (min-width: 901px) {
  /* Detail routes have a return group; the home map keeps its search-only grid. */
  body.map-page .topbar.app-topbar.is-public-page {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    padding-left: 32px !important;
  }
  body.map-page .topbar.app-topbar.is-public-page > .public-nav-home {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }
  body.map-page .topbar.app-topbar.is-public-page .topbar-search {
    position: relative !important;
    grid-column: 2 !important;
    top: auto !important;
    left: auto !important;
    width: min(420px, 100%) !important;
    transform: none !important;
  }
  body.map-page .topbar.app-topbar.is-public-page .top-actions {
    grid-column: 3 !important;
  }
}
/* Tablet map/detail transitions share one logo and three independent columns. */
@media (min-width: 901px) and (max-width: 1120px) {
  body.map-page .topbar.app-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
  }
  body.map-page .topbar.app-topbar:not(.is-public-page) > .public-nav-home {
    display: flex !important;
  }
  body.map-page .topbar.app-topbar > #topbarSearchForm {
    grid-column: 2 !important;
  }
  body.map-page .topbar.app-topbar .top-actions {
    grid-column: 3 !important;
  }
}
/* Map search and feedback share the viewport's center, independent of side controls. */
@media (min-width: 901px) {
  body.map-page .topbar.app-topbar:not(.is-public-page) > #topbarSearchForm {
    position: absolute !important;
    grid-column: auto !important;
    grid-row: 1 !important;
    left: 50% !important;
    top: auto !important;
    transform: translateX(-50%) !important;
    justify-self: auto !important;
    align-self: center !important;
    width: min(420px, calc(100vw - 320px)) !important;
    min-width: 0;
  }
}
/* The desktop map keeps its logo in the filter panel, including on event routes.
   Reserve the same left gutter for the header return as for the map search. */
@media (min-width: 1121px) {
  body.map-page .topbar.app-topbar:not(.is-public-page) > #topbarSearchForm {
    /* Keep the centered field clear of the 428px filter-panel gutter. */
    width: min(460px, calc(100vw - 856px)) !important;
  }
  body.map-page .topbar.app-topbar.is-public-page {
    padding-left: 428px !important;
  }
  body.map-page .topbar.app-topbar > .public-nav-home > .brand-link {
    display: none !important;
  }
  body.map-page .topbar.app-topbar a.public-map-return {
    padding-left: 0;
    border-left: 0;
  }
}
@media (max-width: 1050px) {
  .topbar.app-topbar.is-public-page #notificationBell:not([hidden]) {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
  }
}
@media (min-width: 901px) and (max-width: 1280px) {
  .topbar.app-topbar.is-public-page :is(#allEventsLink, #userMenuButton) {
    width: 44px !important;
    min-width: 44px !important;
    padding-inline: 6px !important;
    justify-content: center;
  }
  .topbar.app-topbar.is-public-page #allEventsLink > span,
  .topbar.app-topbar.is-public-page #userMenuName,
  .topbar.app-topbar.is-public-page #userMenuButton .nav-chevron { display: none !important; }
}
@media (max-width: 900px) {
  .topbar.app-topbar.is-public-page {
    width: 100% !important;
    display: flex !important;
    padding: 6px 10px !important;
    column-gap: 6px !important;
  }
  .topbar.app-topbar.is-public-page .public-nav-home { gap: 0; flex: 0 0 auto; }
  .topbar.app-topbar.is-public-page .brand-text-only {
    width: 100px !important;
    min-width: 100px !important;
    min-height: 44px !important;
    font-size: 24px !important;
    gap: 6px !important;
  }
  .topbar.app-topbar.is-public-page .brand-text-only::before {
    width: 28px !important; height: 28px !important; flex-basis: 28px !important;
  }
  .topbar.app-topbar.is-public-page .top-actions {
    margin-left: auto !important; gap: 4px !important; min-width: 0 !important; flex: 0 0 auto;
  }
  .topbar.app-topbar.is-public-page :is(#allEventsLink, #userMenu, #userMenuButton, #mobileSearchToggle, #notificationBell, #notificationBellButton) {
    width: 44px !important; min-width: 44px !important; max-width: 44px !important;
    height: 44px !important; min-height: 44px !important; padding: 0 !important; flex: 0 0 44px !important;
  }
  .topbar.app-topbar.is-public-page #allEventsLink { justify-content: center !important; }
  .topbar.app-topbar.is-public-page #allEventsLink > span { display: none !important; }
}
@media (max-width: 370px) {
  .topbar.app-topbar.is-public-page { padding-inline: 8px !important; column-gap: 4px !important; }
  .topbar.app-topbar.is-public-page .top-actions { gap: 2px !important; }
}

/* Public headers pair Home with the same search control on every screen. */
:is(#catalogMapHome,[data-outlo-home-mobile])[hidden] { display:none !important; }
:is(.topbar.app-topbar, .admin-header-actions).has-search-home :is(#catalogMapHome,[data-outlo-home-mobile]) {
  box-sizing:border-box;
  border-color:var(--line,#e2e8f0);
  border-radius:var(--outlo-control-radius,12px);
  background:var(--surface,#fff);
  color:var(--outlo-brand-text-hover,#283593);
  box-shadow:0 1px 3px rgb(15 23 42 / 6%);
  text-decoration:none;
}
:is(.topbar.app-topbar, .admin-header-actions).has-search-home :is(#catalogMapHome,[data-outlo-home-mobile]):hover {
  border-color:var(--line-strong,#cbd5e1);
  background:var(--surface-muted,#f8fafc);
}
:is(.topbar.app-topbar, .admin-header-actions).has-search-home :is(#catalogMapHome,[data-outlo-home-mobile]):active {
  border-color:var(--outlo-brand-border,#c5cae9);
  background:var(--outlo-brand-soft,#eef0fa);
}
:is(.topbar.app-topbar, .admin-header-actions).has-search-home :is(#catalogMapHome,[data-outlo-home-mobile]):focus-visible { outline:2px solid var(--outlo-brand-accent,#4f46e5); outline-offset:2px; }
:is(.topbar.app-topbar, .admin-header-actions).has-search-home :is(#catalogMapHome,[data-outlo-home-mobile]) svg {
  display:block; width:22px; height:22px;
  fill:none; stroke:currentColor; stroke-width:var(--outlo-icon-stroke,1.8); stroke-linecap:round; stroke-linejoin:round;
}
.topbar.app-topbar.has-search-home .catalog-mobile-search { display:none; }
@media (min-width:901px) {
  body .topbar.app-topbar.has-search-home > #topbarSearchForm:has(> :is(#catalogMapHome,[data-outlo-home-mobile]):not([hidden])) {
    width:min(474px,100%) !important;
  }
  .topbar.app-topbar.has-search-home #topbarSearchForm > :is(#catalogMapHome,[data-outlo-home-mobile]) { margin-inline-end:10px; }
  .topbar.app-topbar.has-search-home #topbarSearchForm > :is(#catalogMapHome,[data-outlo-home-mobile]):not([hidden]) ~ .topbar-search-icon { left:69px; }
  .topbar.app-topbar.has-search-home #topbarSearchForm > #topbarSearchInput { min-width:0; }
  .topbar.app-topbar.has-search-home #topbarSearchForm:has(> :is(#catalogMapHome,[data-outlo-home-mobile]):not([hidden])) > #globalSearchSuggestions {
    left: 54px;
    width: calc(100% - 54px);
  }
}
/* Keep the search clear of the wider signed-in actions from the first paint. */
@media (min-width:1360px) {
  body .topbar.app-topbar.has-search-home:not(.has-session-token) > #topbarSearchForm:has(> #catalogMapHome:not([hidden])) {
    position:absolute !important;
    grid-column:auto !important;
    grid-row:auto !important;
    left:50% !important;
    top:50% !important;
    width:clamp(340px, calc(100vw - 1060px), 474px) !important;
    transform:translate(-50%, -50%) !important;
  }
}
@media (min-width:1440px) {
  body .topbar.app-topbar.has-search-home.has-session-token > #topbarSearchForm:has(> #catalogMapHome:not([hidden])) {
    position:absolute !important;
    grid-column:auto !important;
    grid-row:auto !important;
    left:50% !important;
    top:50% !important;
    width:min(474px, calc(100vw - 1110px)) !important;
    transform:translate(-50%, -50%) !important;
  }
}
@media (max-width:900px) {
  body .topbar.app-topbar.has-search-home.is-public-page:has(> .catalog-mobile-search) {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) !important;
    grid-template-rows:auto !important;
    align-items:center;
  }
  .topbar.app-topbar.has-search-home .catalog-mobile-search {
    display:flex;
    align-items:center;
    gap:4px;
    grid-column:2;
    grid-row:1;
    justify-self:center;
  }
  .topbar.app-topbar.has-search-home.is-public-page:has(> .catalog-mobile-search) > .top-actions {
    grid-column:3 !important;
  }
  .topbar.app-topbar.has-search-home .catalog-mobile-search #mobileSearchToggle {
    border-radius:var(--outlo-control-radius,12px) !important;
    box-shadow:0 1px 3px rgb(15 23 42 / 6%) !important;
  }
  .topbar.app-topbar.has-search-home .catalog-mobile-search #mobileSearchToggle:focus-visible {
    outline:3px solid #a5b4fc !important;
    outline-offset:2px;
  }
}
@media (max-width:370px) {
  body .topbar.app-topbar.is-public-page.has-search-home > .top-actions { gap:4px !important; }
  body.map-page .topbar.app-topbar:has(:is(#catalogMapHome,[data-outlo-home-mobile]):not([hidden])) #allEventsLink {
    width:44px !important; min-width:44px !important; padding:0 !important;
  }
  body.map-page .topbar.app-topbar:has(:is(#catalogMapHome,[data-outlo-home-mobile]):not([hidden])) #allEventsLink > span { display:none !important; }
}
@media (forced-colors:active) {
  :is(.topbar.app-topbar, .admin-header-actions).has-search-home :is(#catalogMapHome,[data-outlo-home-mobile]):is(:link,:visited,:hover,:active,:focus-visible) {
    border-color:ButtonText; background:ButtonFace; color:ButtonText;
  }
}

/* First-paint Home uses the same placement before navigation binds the controls. */
@media (min-width:901px) { [data-outlo-home-mobile] { display:none !important; } }
@media (max-width:900px) { [data-outlo-home-desktop] { display:none !important; } }
