/* Browser-comment refinements loaded after the established staged-Explore styles. */
/* Selected header direction: editorial brand, centered capsule navigation, and a
   measured active pill that glides between labels without assuming equal widths. */
.app-header {
  background:color-mix(in srgb,var(--surface) 96%,transparent);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}

.primary-nav {
  position:relative;
  isolation:isolate;
  overflow:hidden;
}

.primary-nav-toggle {
  display:none;
}

.primary-nav-links {
  display:flex;
  align-items:center;
  gap:.1rem;
}

.primary-nav-indicator {
  position:absolute;
  z-index:0;
  top:5px;
  bottom:5px;
  left:0;
  width:var(--nav-indicator-width,0px);
  border:1px solid color-mix(in srgb,var(--indigo) 7%,var(--line-soft));
  border-radius:999px;
  background:linear-gradient(
    135deg,
    color-mix(in srgb,var(--indigo-bg) 88%,var(--surface)),
    color-mix(in srgb,var(--indigo-bg) 64%,var(--surface))
  );
  box-shadow:0 7px 18px rgb(11 107 79 / 7%);
  opacity:0;
  pointer-events:none;
  transform:translate3d(var(--nav-indicator-x,0px),0,0);
  transform-origin:left center;
  transition:transform .38s cubic-bezier(.22,1,.36,1),
    width .38s cubic-bezier(.22,1,.36,1),
    opacity .16s ease-out,
    background .2s var(--ease);
}

.primary-nav[data-indicator-ready="true"] .primary-nav-indicator {
  opacity:1;
}

.primary-nav.primary-nav-is-measuring .primary-nav-indicator {
  transition:none;
}

.primary-nav a {
  z-index:1;
  background:transparent !important;
  box-shadow:none !important;
  transition:color .2s var(--ease);
}

.primary-nav a::after {
  display:none;
}

.primary-nav a:hover {
  color:var(--indigo-strong);
  transform:none;
}

.primary-nav a:active {
  transform:translateY(0) scale(.98);
}

@media (min-width:901px) {
  .app-header {
    min-height:88px;
    padding:.75rem clamp(1.35rem,3.2vw,2.4rem);
  }

  .brand {
    gap:.85rem;
  }

  .brand-mark svg {
    width:38px;
    height:38px;
  }

  .brand-text {
    width:8.4rem;
  }

  .app-header .brand-name {
    font-size:1.52rem;
    line-height:.94;
    white-space:normal;
  }

  .primary-nav {
    align-self:center;
    min-width:370px;
    min-height:60px;
    gap:0;
    justify-content:center;
    padding:6px 7px;
    border:1px solid var(--line);
    border-radius:999px;
    background:color-mix(in srgb,var(--surface) 76%,var(--panel));
    box-shadow:inset 0 1px 0 color-mix(in srgb,var(--surface) 80%,transparent);
  }

  .primary-nav a {
    min-height:46px;
    padding:.65rem clamp(1rem,1.65vw,1.35rem);
    border-radius:999px;
    font-size:clamp(.92rem,1.35vw,1.02rem);
  }

  .header-controls {
    min-width:0;
  }

  .account-menu-toggle {
    min-height:52px;
    gap:.6rem;
    padding:.35rem .3rem .35rem .35rem;
  }

  .account-avatar-trigger {
    width:38px;
    height:38px;
    font-size:.78rem;
  }

  #account-menu-toggle .account-trigger-copy {
    display:grid;
  }

  #account-menu-toggle .account-trigger-copy strong {
    font-size:.9rem;
    line-height:1.15;
  }

  #account-menu-toggle .account-trigger-copy small {
    display:none;
  }

  .account-menu-chevron {
    margin-left:.05rem;
  }
}

@media (min-width:641px) and (max-width:900px) {
  .app-header {
    grid-template-columns:minmax(112px,1fr) auto minmax(112px,1fr);
    grid-template-rows:72px;
    min-height:72px;
    gap:clamp(.5rem,1vw,.8rem);
    padding:.35rem clamp(.75rem,2vw,1.1rem);
  }

  .brand {
    grid-column:1;
    grid-row:1;
    width:auto;
    height:auto;
    justify-content:flex-start;
    border-radius:0;
  }

  .brand:hover,
  .brand:focus-visible {
    background:transparent;
  }

  .app-header .brand-mark {
    display:none;
  }

  .app-header .brand-text {
    display:block;
  }

  .brand-wordmark {
    width:clamp(112px,16vw,128px);
  }

  .primary-nav {
    grid-column:2;
    grid-row:1;
    align-self:center;
    justify-self:center;
    width:max-content;
    min-width:330px;
    min-height:54px;
    gap:0;
    padding:5px;
    overflow:hidden;
    border:1px solid var(--line);
    border-radius:999px;
    background:color-mix(in srgb,var(--surface) 76%,var(--panel));
    box-shadow:inset 0 1px 0 color-mix(in srgb,var(--surface) 80%,transparent);
  }

  .primary-nav-indicator {
    display:block;
  }

  .primary-nav a {
    position:relative;
    min-height:42px;
    padding:.55rem clamp(.72rem,1.45vw,.92rem);
    border-radius:999px;
    font-size:clamp(.86rem,1.7vw,.94rem);
  }

  .primary-nav a::after {
    display:none;
  }

  .header-controls {
    grid-column:3;
    grid-row:1;
    justify-self:end;
  }
}

@media (min-width:720px) and (max-width:900px) {
  .account-menu-toggle {
    width:auto;
    min-height:48px;
    gap:.45rem;
    padding:.3rem .15rem .3rem .3rem;
  }

  .account-avatar-trigger {
    width:34px;
    height:34px;
  }

  #account-menu-toggle .account-trigger-copy {
    display:grid;
  }

  #account-menu-toggle .account-trigger-copy strong {
    max-width:112px;
    overflow:hidden;
    font-size:.82rem;
    line-height:1.15;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  #account-menu-toggle .account-trigger-copy small {
    display:none;
  }

  .account-menu-chevron {
    display:block;
  }
}

@media (max-width:640px) {
  .app-header {
    grid-template-columns:44px minmax(0,1fr) 52px;
    grid-template-rows:64px;
    min-height:64px;
    gap:.35rem;
    padding:0 .55rem;
  }

  .app-header .brand {
    grid-column:1;
    grid-row:1;
    width:44px;
    height:44px;
    justify-content:center;
    border-radius:50%;
  }

  .app-header .brand-mark {
    display:inline-flex;
    width:40px;
    height:40px;
  }

  .app-header .brand-text {
    display:none;
  }

  .primary-nav {
    grid-column:2;
    grid-row:1;
    align-self:center;
    justify-self:center;
    display:block;
    width:min(170px,100%);
    min-width:0;
    min-height:44px;
    padding:0;
    overflow:visible;
    border:0;
    border-radius:0;
    background:transparent;
    box-shadow:none;
  }

  .primary-nav-toggle {
    display:flex;
    width:100%;
    min-height:44px;
    align-items:center;
    justify-content:center;
    gap:.55rem;
    padding:.55rem .8rem;
    border:1px solid var(--line);
    border-radius:999px;
    background:color-mix(in srgb,var(--surface) 78%,var(--panel));
    color:var(--indigo-strong);
    font-family:var(--font-serif);
    font-size:.9rem;
    font-weight:650;
    box-shadow:0 5px 16px rgb(37 35 31 / 4%);
  }

  .primary-nav-toggle:hover:not(:disabled),
  .primary-nav-toggle:focus-visible,
  .primary-nav-toggle[aria-expanded="true"] {
    border-color:color-mix(in srgb,var(--indigo) 40%,var(--line));
    background:var(--indigo-bg);
    color:var(--indigo-strong);
  }

  .primary-nav-toggle svg {
    flex:none;
    transition:transform .18s cubic-bezier(.22,1,.36,1);
  }

  .primary-nav[data-mobile-open="true"] .primary-nav-toggle svg {
    transform:rotate(180deg);
  }

  .primary-nav-indicator {
    display:none;
  }

  .primary-nav-links {
    position:absolute;
    z-index:60;
    top:calc(100% + 8px);
    left:50%;
    display:grid;
    width:min(210px,calc(100vw - 6.5rem));
    gap:.2rem;
    padding:.4rem;
    overflow:hidden;
    border:1px solid var(--line);
    border-radius:16px;
    background:color-mix(in srgb,var(--surface) 97%,transparent);
    box-shadow:0 16px 38px rgb(37 35 31 / 14%);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    clip-path:inset(0 0 100% 0 round 16px);
    translate:-50% 0;
    transform:translateY(-7px) scale(.98);
    transform-origin:top center;
    transition:clip-path .2s cubic-bezier(.22,1,.36,1),
      opacity .13s ease-out,
      transform .2s cubic-bezier(.22,1,.36,1),
      visibility 0s linear .2s;
  }

  .primary-nav[data-mobile-open="true"] .primary-nav-links {
    opacity:1;
    visibility:visible;
    pointer-events:auto;
    clip-path:inset(0 round 16px);
    transform:translateY(0) scale(1);
    transition:clip-path .22s cubic-bezier(.22,1,.36,1),
      opacity .14s ease-out,
      transform .22s cubic-bezier(.22,1,.36,1),
      visibility 0s;
  }

  .primary-nav a {
    min-height:44px;
    justify-content:flex-start;
    padding:.65rem .8rem;
    border-radius:11px;
    font-size:.92rem;
    text-align:left;
  }

  .primary-nav a::after {
    display:none;
  }

  .primary-nav a[aria-current="page"] {
    background:var(--indigo-bg) !important;
    color:var(--indigo-strong);
  }

  .header-controls {
    grid-column:3;
    grid-row:1;
  }
}

body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .filter-bar {
  border-bottom:0;
  background:transparent;
  box-shadow:none;
}

body.workspace-active[data-view="explore"][data-explore-stage="landing"]:has(
  .advanced-filters[aria-hidden="false"]
) main {
  display:grid;
  grid-template-rows:auto auto;
  align-content:start;
  height:auto;
  min-height:calc(100dvh - 88px);
  overflow:visible;
}

body.workspace-active[data-view="explore"][data-explore-stage="landing"]:has(
  .advanced-filters[aria-hidden="false"]
) .filter-bar {
  align-self:start;
  margin:.75rem auto 1.5rem;
}

body.workspace-active[data-view="explore"][data-explore-stage="landing"]:has(
  .advanced-filters[aria-hidden="false"]
) .explore-hero-copy {
  display:none;
}

.results-panel .result-accepting,
.results-panel .result-accepting.status-unknown {
  align-items:center;
}

.results-panel .result-accepting > svg {
  flex:none;
}

@container results-pane (min-width:1000px) {
  .results-panel .result-metric,
  .results-panel .result-rank {
    gap:.32rem;
    font-size:.82rem;
    font-weight:550;
    line-height:1.25;
  }

  .results-panel .result-metric svg {
    width:19px;
    height:19px;
    shape-rendering:geometricPrecision;
    stroke-width:1.9;
  }
}

body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .result-card.selected,
body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .result-card[aria-current="true"] {
  border:1px solid color-mix(in srgb,var(--indigo) 42%,var(--line));
  background:color-mix(in srgb,var(--indigo-bg) 42%,var(--surface));
  box-shadow:none;
  transform:none;
}

body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .result-card.selected::before,
body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .result-card[aria-current="true"]::before {
  display:none;
}

.result-card.is-opening {
  animation:result-selection-cue .2s var(--ease) both;
}

@keyframes result-selection-cue {
  0% { transform:scale(.995); }
  55% { transform:scale(1.002); }
  100% { transform:none; }
}

@keyframes specialist-workspace-out {
  to { opacity:.16; transform:scale(.985); }
}

@keyframes specialist-workspace-in {
  from { opacity:0; transform:scale(.985); }
  to { opacity:1; transform:none; }
}

.refine-entry-row > .refinement-disclosure {
  background-image:linear-gradient(
    120deg,
    color-mix(in srgb,var(--surface) 96%,var(--indigo-bg)),
    color-mix(in srgb,var(--surface) 78%,var(--indigo-bg))
  );
  background-position:0 50%;
  background-size:180% 100%;
  transition:border-color .18s var(--ease), background-position .18s var(--ease),
    color .18s var(--ease), box-shadow .18s var(--ease);
}

.refine-entry-row > .refinement-disclosure:hover,
.refine-entry-row > .refinement-disclosure:focus-visible,
.refine-entry-row > .refinement-disclosure[aria-expanded="true"] {
  background-image:linear-gradient(
    120deg,
    color-mix(in srgb,var(--surface) 76%,var(--indigo-bg)),
    var(--indigo-bg)
  );
  background-position:100% 50%;
}

.refine-entry-row .refinement-label-stack {
  transition-duration:.18s;
}

.refinement-label {
  transition:opacity .12s ease-out, transform .18s var(--ease);
}

.filter-count {
  transition:width .18s var(--ease), min-width .18s var(--ease), padding .18s var(--ease),
    opacity .12s ease-out, transform .18s var(--ease);
}

.advanced-filters.sort-is-expanded .advanced-filter-fields,
.advanced-filters.sort-is-expanded .advanced-filter-columns,
.advanced-filters.sort-is-expanded .referral-preferences-section {
  transform:scaleY(.96);
}

.invite-page-form {
  display:grid;
  gap:1rem;
  padding:1.1rem 1.25rem 1.25rem;
}

.invite-form-fields {
  display:grid;
  grid-template-columns:minmax(0,1.6fr) minmax(180px,.7fr);
  gap:1rem;
}

.invite-form-fields input {
  min-height:48px;
}

.invite-form-note {
  margin:0;
  color:var(--muted);
  font-size:.76rem;
  line-height:1.45;
}

.invite-page-form .auth-error {
  margin:0;
}

.invite-form-actions {
  display:flex;
  justify-content:flex-end;
  padding-top:.9rem;
  border-top:1px solid var(--line-soft);
}

.invite-form-actions .btn-primary {
  min-height:44px;
}

.invite-history .table-scroll {
  border-top:0;
}

.profile-panel {
  container-name:profile-pane;
  container-type:inline-size;
}

.profile-specialty {
  display:inline-flex;
  align-items:center;
  gap:.4rem;
}

.profile-specialty svg {
  flex:none;
  color:var(--indigo);
}

@container profile-pane (max-width:680px) {
  .profile-title-meta {
    align-items:flex-start;
    flex-direction:column;
    gap:.35rem;
  }

  .profile-title-meta > *,
  .profile-title-meta .profile-language-line,
  .profile-title-meta .badge {
    min-height:20px;
    margin:0;
    padding-right:0;
    border-right:0;
    font-size:.82rem;
    font-weight:550;
    line-height:1.35;
  }

  .profile-source-line > :not(.ard-link) {
    display:none;
  }

  .profile-source-line {
    display:block;
    margin-top:.25rem;
  }
}

@media (max-width:620px) {
  .invite-form-fields {
    grid-template-columns:1fr;
  }

  .invite-form-actions .btn-primary {
    width:100%;
    justify-content:center;
  }
}

@media (max-width:520px) {
  body[data-view="explore"] .search-wrap,
  body[data-view="explore"] .search-wrap.has-search-value {
    --search-clear-size:34px !important;
    --search-submit-width:0px;
  }

  body[data-view="explore"] .search-submit {
    display:none;
  }

  body[data-view="explore"] .search-wrap .search-clear {
    top:50%;
    right:7px;
    width:34px;
    min-width:34px;
    height:34px;
    min-height:34px;
    gap:0;
    padding:0;
    border:1px solid var(--line);
    background:color-mix(in srgb,var(--surface) 76%,var(--indigo-bg));
    transform:translateY(-50%);
    transition:opacity .14s ease-out, visibility 0s linear .14s,
      color var(--dur) var(--ease), background var(--dur) var(--ease);
  }

  body[data-view="explore"] .search-wrap.has-search-value .search-clear {
    transform:translateY(-50%);
    transition:opacity .14s ease-out, visibility 0s,
      color var(--dur) var(--ease), background var(--dur) var(--ease);
  }

  body[data-view="explore"] .search-clear > span {
    display:none;
  }

  body[data-view="explore"] .search-clear svg {
    width:19px;
    height:19px;
  }

  body[data-view="explore"] .search-wrap input#search,
  body[data-view="explore"] .search-wrap.has-search-value input#search,
  body[data-view="explore"][data-explore-stage="landing"] .search-wrap input#search,
  body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .search-wrap input#search {
    padding-right:3rem;
  }

  body[data-view="explore"][data-explore-stage="profile"] .profile-header {
    position:relative;
    z-index:auto;
    top:auto;
  }

  .summary-section {
    overflow:visible;
  }

  .summary-section > h3 {
    position:sticky;
    z-index:8;
    top:0;
    border-bottom:1px solid var(--line-soft);
    border-radius:var(--r-md) var(--r-md) 0 0;
    background:var(--surface);
    box-shadow:0 5px 14px rgb(37 35 31 / 7%);
  }
}

/* Search is one persistent control across Explore stages. Its type, overall measure,
   and icon-only clear action no longer change when a query or breakpoint changes. */
body[data-view="explore"] .filter-primary .field-search,
body[data-view="explore"][data-explore-stage="landing"] .filter-primary .field-search,
body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .filter-primary .field-search {
  width:min(100%,860px);
  justify-self:center;
}

body[data-view="explore"] .search-wrap,
body[data-view="explore"] .search-wrap.has-search-value,
body[data-view="explore"][data-explore-stage="landing"] .search-wrap,
body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .search-wrap {
  --search-clear-size:34px !important;
}

body[data-view="explore"] .search-wrap input#search {
  font-family:var(--font-sans) !important;
}

body[data-view="explore"] .search-wrap .search-clear,
body[data-view="explore"] .search-wrap.has-search-value .search-clear {
  top:50%;
  display:grid;
  width:34px;
  min-width:34px;
  height:34px;
  min-height:34px;
  place-items:center;
  gap:0;
  padding:0;
  border:1px solid var(--line);
  border-radius:999px;
  background:color-mix(in srgb,var(--surface) 76%,var(--indigo-bg));
  font-size:0;
  transform:translateY(-50%);
  transition:opacity .14s ease-out, visibility 0s linear .14s,
    color var(--dur) var(--ease), background var(--dur) var(--ease);
}

body[data-view="explore"] .search-wrap.has-search-value .search-clear {
  transition:opacity .14s ease-out, visibility 0s,
    color var(--dur) var(--ease), background var(--dur) var(--ease);
}

body[data-view="explore"] .search-clear > span {
  display:none;
}

body[data-view="explore"] .search-clear svg {
  width:19px;
  height:19px;
}

/* Status and reset context only exists when a real refinement is active.
   Collapse the parent row so its fixed padding cannot leave an empty band. */
.advanced-filter-heading {
  min-height:84px;
  max-height:96px;
  overflow:hidden;
  opacity:1;
  transform:none;
  visibility:visible;
  transition:min-height .18s cubic-bezier(.22,1,.36,1),
    max-height .18s cubic-bezier(.22,1,.36,1),
    padding .18s cubic-bezier(.22,1,.36,1),
    opacity .14s ease-out,
    transform .18s cubic-bezier(.22,1,.36,1),
    visibility 0s;
}

.advanced-filter-heading[data-visible="false"] {
  min-height:0;
  max-height:0;
  padding-top:0;
  padding-bottom:0;
  opacity:0;
  transform:translateY(-6px);
  visibility:hidden;
  pointer-events:none;
  transition:min-height .18s cubic-bezier(.4,0,.6,1),
    max-height .18s cubic-bezier(.4,0,.6,1),
    padding .18s cubic-bezier(.4,0,.6,1),
    opacity .12s ease-out,
    transform .18s cubic-bezier(.4,0,.6,1),
    visibility 0s linear .18s;
}

@media (min-width:521px) {
  body[data-view="explore"] .search-wrap .search-clear {
    right:calc(var(--search-submit-edge) + var(--search-submit-width) + .55rem);
  }

  body[data-view="explore"] .search-wrap.has-search-value input#search {
    padding-right:calc(var(--search-submit-width) + var(--search-clear-size) + 1.55rem);
  }
}

@media (max-width:520px) {
  body[data-view="explore"] .filter-primary .field-search,
  body[data-view="explore"][data-explore-stage="landing"] .filter-primary .field-search,
  body[data-view="explore"]:is([data-explore-stage="results"],[data-explore-stage="profile"]) .filter-primary .field-search {
    width:calc(100% - .75rem);
  }
}

/* Keep the landing footer anchored while the criteria panel changes height.
   The expanded state uses the same two-row contract as the closed landing:
   content consumes the flexible row and the trust signature owns the footer row. */
body.workspace-active[data-view="explore"][data-explore-stage="landing"]:has(
  .advanced-filters[aria-hidden="false"]
) main {
  display:grid;
  grid-template-rows:minmax(0,1fr) auto;
  align-content:stretch;
  height:100%;
  min-height:0;
  overflow:auto;
}

body.workspace-active[data-view="explore"][data-explore-stage="landing"]:has(
  .advanced-filters[aria-hidden="false"]
) .guardrail-band,
body[data-view="explore"][data-explore-stage="landing"]:has(
  .advanced-filters[aria-hidden="false"]:not(.sort-is-expanded)
) .guardrail-band {
  grid-row:2;
  align-self:end;
  margin-top:0;
}

/* The official wordmark remains artwork. Live header copy shares the same
   self-hosted editorial serif stack as the landing headline for stable Safari rendering. */
.app-header,
.app-header .brand-name,
.primary-nav a,
#account-menu-toggle,
#account-menu-toggle .account-trigger-copy,
#account-menu-toggle .account-trigger-copy strong,
#account-menu-toggle .account-trigger-copy small {
  font-family:var(--font-serif);
}

@media (max-width:560px) {
  body.workspace-active[data-view="explore"][data-explore-stage="landing"]:has(
    .advanced-filters[aria-hidden="false"]
  ) main {
    display:flex;
    height:auto;
    min-height:calc(100dvh - 64px);
    padding-bottom:clamp(1rem,2.25vh,1.2rem);
    overflow:visible;
  }

  body.workspace-active[data-view="explore"][data-explore-stage="landing"]:has(
    .advanced-filters[aria-hidden="false"]
  ) .guardrail-band {
    margin-top:auto;
  }
}

@media (prefers-reduced-motion:reduce) {
  .primary-nav-indicator,
  .primary-nav a,
  .primary-nav-toggle,
  .primary-nav-toggle svg,
  .primary-nav-links {
    transition-duration:.01ms !important;
  }

  .refine-entry-row > .refinement-disclosure,
  .refine-entry-row .refinement-label-stack,
  .refinement-label,
  .filter-count {
    transition-duration:.01ms !important;
  }
}
