/* GKS mobile search 1.0.0. Scoped UI; existing theme styles are not replaced. */
#gks-ms-entry { --gks-ms-css-ready: 1; display: none !important; }
#gks-ms-dialog:not([open]) { display: none !important; }
#gks-ms-dialog[hidden] { display: none !important; }
#gks-ms-dialog [hidden] { display: none !important; }

@media (max-width: 849px) {
  html.gks-ms-ready #gks-ms-entry {
    display: block !important;
    padding: 8px max(14px, env(safe-area-inset-right)) 16px max(14px, env(safe-area-inset-left));
    background: #fff;
  }
  /* Only hide the former search after the replacement is fully initialized. */
  html.gks-ms-ready #main-menu .header-search-form { display: none !important; }
}

#gks-ms-entry *, #gks-ms-dialog * { box-sizing: border-box; }
#gks-ms-entry button, #gks-ms-dialog button {
  margin: 0;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  cursor: pointer;
  touch-action: manipulation;
}
#gks-ms-entry .gks-ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 820px;
  min-height: 48px;
  margin: 0 auto;
  padding-left: 18px;
  background: #f0f1f1;
  border-radius: 28px;
  color: #697578;
  text-align: left;
}
#gks-ms-entry .gks-ms-lens, #gks-ms-dialog .gks-ms-submit {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1ba7b6;
  color: #fff;
  font-size: 23px;
}
#gks-ms-entry i, #gks-ms-dialog i { top: auto; line-height: 1; }
#gks-ms-dialog {
  position: fixed;
  inset: var(--gks-ms-top, 0px) auto auto var(--gks-ms-left, 0px);
  width: var(--gks-ms-width, 100%);
  height: var(--gks-ms-height, 100dvh);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #596263;
  font-family: inherit;
  font-size: 16px;
  overflow: hidden;
  overscroll-behavior: none;
}
#gks-ms-dialog[open] { display: flex; flex-direction: column; }
#gks-ms-dialog::backdrop { background: #fff; }
#gks-ms-dialog .gks-ms-form {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 12px max(10px, env(safe-area-inset-left));
  border-bottom: 1px solid #e7ecec;
}
#gks-ms-dialog .gks-ms-field {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  border-radius: 26px;
  background: #f0f1f1;
}
#gks-ms-dialog #gks-ms-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 12px 0 12px 16px;
  border: 0;
  border-radius: 26px;
  background: transparent;
  box-shadow: none;
  color: #39484c;
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  -webkit-appearance: none;
  appearance: none;
}
#gks-ms-dialog #gks-ms-input::placeholder { color: #697578; opacity: 1; }
#gks-ms-dialog .gks-ms-clear {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  color: #5d6b6e;
  font-size: 26px;
}
#gks-ms-dialog .gks-ms-submit { flex-basis: 44px; width: 44px; height: 44px; margin-right: 2px; }
#gks-ms-dialog .gks-ms-close { flex: 0 0 48px; height: 48px; background: transparent; color: #45565a; }
#gks-ms-dialog .gks-ms-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  scrollbar-width: thin;
}
#gks-ms-dialog .gks-ms-results h2 {
  margin: 20px 0 8px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: .7px;
  color: #677679;
  text-transform: uppercase;
}
#gks-ms-dialog .gks-ms-list { list-style: none; padding: 0; margin: 0; }
#gks-ms-dialog .gks-ms-list li { list-style: none; padding: 0; margin: 0; }
#gks-ms-dialog .gks-ms-result {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f1;
  color: #465559;
  text-decoration: none;
}
#gks-ms-dialog .gks-ms-result img, #gks-ms-dialog .gks-ms-image-fallback {
  display: block;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 50%;
  background: #edf2f2;
  object-fit: cover;
}
#gks-ms-dialog .gks-ms-name { min-width: 0; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
#gks-ms-dialog .gks-ms-page { min-height: 48px; }
#gks-ms-dialog .gks-ms-message { margin: 24px 0 12px; font-size: 15px; line-height: 1.5; color: #59696d; }
#gks-ms-dialog .gks-ms-retry { padding: 0 12px; border-radius: 8px; background: #edf6f6; color: #086f7a; }
#gks-ms-dialog .gks-ms-footer {
  flex: 0 0 auto;
  padding: 4px max(16px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border-top: 1px solid #e7ecec;
  background: #fff;
}
#gks-ms-dialog .gks-ms-all { display: flex; align-items: center; justify-content: space-between; width: 100%; background: #fff; color: #087986; font-size: 15px; font-weight: 600; }
#gks-ms-dialog .gks-ms-submit[aria-busy="true"] { opacity: .65; }
#gks-ms-entry button:focus-visible, #gks-ms-dialog button:focus-visible, #gks-ms-dialog a:focus-visible, #gks-ms-dialog #gks-ms-input:focus-visible { outline: 2px solid #087986; outline-offset: 2px; }
#gks-ms-dialog .gks-ms-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-height: 420px) {
  #gks-ms-dialog .gks-ms-form { padding-top: 4px; padding-bottom: 4px; }
  #gks-ms-dialog .gks-ms-results h2 { margin-top: 12px; }
}

/* GKS mobile polish 1.0.1 — approved iPhone annotations, CSS only. */
@media (max-width: 849px) {
  /* Flatsome's divider beneath the logo row; only when mobile search is active. */
  html.gks-ms-ready #header #masthead .top-divider { display: none; }

  /* Give the existing magnifying glass a shadow; retain its shape and size. */
  #gks-ms-entry .gks-ms-lens,
  #gks-ms-dialog .gks-ms-submit {
    box-shadow: -3px 3px 9px rgba(45, 58, 60, .24);
  }

  /* Quiet, inset grey focus border around the field, without changing its size. */
  #gks-ms-dialog .gks-ms-field:focus-within {
    box-shadow: inset 0 0 0 1px #ccd2d3;
  }
  #gks-ms-dialog #gks-ms-input:focus,
  #gks-ms-dialog #gks-ms-input:focus-visible {
    outline: none;
    box-shadow: none;
  }

  /* Keep the existing clear button/handler and its 44px target; move it left. */
  #gks-ms-dialog .gks-ms-clear {
    order: -1;
    margin-left: 6px;
    margin-right: -6px;
    background: radial-gradient(circle at center, #d4dadb 0 10px, transparent 10.5px);
    color: #5c696d;
    font-size: 23px;
    font-weight: 600;
    line-height: 44px;
  }
  #gks-ms-dialog .gks-ms-field:has(.gks-ms-clear:not([hidden])) #gks-ms-input {
    padding-left: 8px;
  }

  /* The entire result card remains a link; release the CTA's width for badges. */
  .gks-search-results .gks-profile-result__arrow { display: none; }
}
