/* Header search and the shared Toolbox page frame. */
.geniart-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  min-height: 50px;
}

.geniart-header__actions .geniart-discord { align-self: center; margin-top: 0; }

.geniart-header-search {
  --gi-search-width: min(19.5rem, calc(100vw - 44px));
  position: relative;
  flex: 0 0 auto;
}

.geniart-header-search.is-enhanced { width: 42px; height: 42px; }
.geniart-header-search [hidden] { display: none; }

.geniart-header-search__toggle,
.geniart-header-search__submit {
  display: inline-grid;
  flex: 0 0 42px;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--gi-border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--gi-paper);
  cursor: pointer;
}

.geniart-header-search__toggle:hover,
.geniart-header-search__submit:hover {
  background: rgba(241, 146, 31, 0.14);
  color: var(--gi-primary);
}

.geniart-header-search__form {
  display: flex;
  align-items: center;
  width: var(--gi-search-width);
  height: 42px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--gi-border);
  border-radius: 999px;
  background: var(--gi-surface-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.geniart-header-search.is-enhanced .geniart-header-search__form {
  position: absolute;
  z-index: 3;
  inset-block-start: 0;
  inset-inline-end: 0;
}

.geniart-header-search.is-open .geniart-header-search__form {
  animation: geniart-search-open 180ms ease-out;
}

.geniart-header-search__form:focus-within {
  border-color: var(--gi-primary);
  box-shadow: 0 0 0 2px rgba(241, 146, 31, 0.16);
}

.geniart-header-search input[type="search"] {
  display: block;
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 0.6rem 0 1rem;
  border: 0;
  border-radius: 999px 0 0 999px;
  outline: none;
  background: transparent;
  box-shadow: none;
  color: var(--gi-paper);
  font-size: 16px;
  line-height: 1.2;
}

.geniart-header-search input[type="search"]::placeholder { color: var(--gi-muted); opacity: 1; }
.geniart-header-search__submit { flex-basis: 40px; width: 40px; height: 40px; border: 0; background: transparent; }

/* The header shell is capped at 1420px, whereas the generic shell is 1440px. */
.geniart-tool-hero.geniart-shell { width: min(1420px, calc(100% - 40px)); }
.geniart-tool-hero > .geniart-page__cover { min-width: 0; }

/* The original Mosaïque code stays intact; only its host page gains tool width. */
.page-id-12129 .geniart-page__content { width: min(1200px, calc(100% - 2rem)); margin-inline: auto; }
.geniart-toolbox-exploration.geniart-shell { width: min(1200px, calc(100% - 2rem)); }

@keyframes geniart-search-open {
  from { width: 42px; opacity: 0.65; }
  to { width: var(--gi-search-width); opacity: 1; }
}

@media (min-width: 961px) {
  .geniart-navigation .menu-item:has(> a[href$="/midjourney/"]) > .sub-menu { left: calc(50% + 48px); }
}

@media (max-width: 960px) {
  .geniart-header__shell { grid-template-columns: minmax(0, 1fr) auto auto; }
  .geniart-header__actions { min-height: 50px; }
  .geniart-tool-hero.geniart-shell { width: min(1420px, calc(100% - 20px)); }

  /* Follow the mobile menu's visibility, including while a link has focus. */
  .geniart-navigation .sub-menu,
  .geniart-navigation .menu-item:hover > .sub-menu,
  .geniart-navigation .menu-item:focus-within > .sub-menu {
    visibility: inherit;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .geniart-header-search.is-open .geniart-header-search__form { animation: none; }
}
