/* Structural fixes for native links and dialogs in the standalone templates. */
/* Blend the logo's baked-in navy backdrop into the shared navigation surface. */
#site-header,
.congress-topbar,
.contest-topbar {
  background: #0e1a2b;
  isolation: isolate;
}

#site-header .brand img,
.congress-topbar .congress-logo img,
.contest-topbar .contest-logo img {
  mix-blend-mode: lighten;
  /* Fade the bright cropped artwork before the ASA icon begins. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 6%);
  mask-image: linear-gradient(to right, transparent, #000 6%);
}

* {
  -webkit-user-drag: none !important;
}

/* Match the research header's desktop and tablet navigation rhythm. */
@media (min-width: 768px) {
  body .congress-topbar__inner,
  body .contest-topbar__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 64px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0;
    gap: 26px;
  }

  body .congress-logo img,
  body .contest-logo img {
    width: 214px;
  }

  body .congress-anchors,
  body .contest-anchors {
    grid-column: auto;
    order: 0;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body .congress-anchors > a,
  body .contest-anchors > a,
  body .congress-review-dropdown__toggle {
    min-height: 34px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.7;
  }
}

/* Allow the dropdown to extend beyond the navigation row. */
@media (min-width: 768px) {
  body[data-page^="thinktank"] #site-header .main-nav {
    flex-wrap: wrap;
    overflow: visible;
  }
}

[hidden] { display: none !important; }
.template-page { display: contents; }
.template-page[hidden] { display: none !important; }
a[data-go] { display: block; color: inherit; text-decoration: none; }
.template-content-link { color: inherit; text-decoration: none; }
.hero-main > .template-content-link { display: contents; }
.header-actions input.header-search {
  width: 200px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 72px 0 16px !important;
  border: 1px solid rgba(255, 255, 255, .24) !important;
  border-radius: 999px !important;
  background-color: rgba(255, 255, 255, .10) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0%200%2024%2024' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16%2016%205%205'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 18px 18px !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 500;
  line-height: 1 !important;
  letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 8px 24px rgba(0, 0, 0, .10) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  cursor: text !important;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
.header-search-wrap {
  position: relative;
  display: inline-flex;
  width: 200px;
  height: 38px;
}
.header-actions .header-search-wrap input.header-search {
  width: 100% !important;
  background-image: none !important;
}
.header-search-submit,
.header-search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  z-index: 1;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .72);
  cursor: pointer;
  transform: translateY(-50%);
  transition: opacity .18s ease, color .18s ease;
}
.header-search-clear {
  right: 38px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.header-search-wrap:focus-within .header-search-clear {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
.header-search-submit:hover,
.header-search-clear:hover {
  color: #fff;
}
.header-actions input.header-search::placeholder {
  color: rgba(255, 255, 255, .64) !important;
}
.header-actions input.header-search::-webkit-search-cancel-button {
  -webkit-appearance: none !important;
  appearance: none !important;
}
.header-actions input.header-search:hover {
  background-color: rgba(255, 255, 255, .15) !important;
  border-color: rgba(255, 255, 255, .36) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 10px 28px rgba(0, 0, 0, .14) !important;
}
.header-actions input.header-search:focus-visible {
  outline: none !important;
  border-color: rgba(255, 255, 255, .5) !important;
  background-color: rgba(255, 255, 255, .16) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 3px rgba(94, 231, 255, .18), 0 10px 28px rgba(0, 0, 0, .14) !important;
}
.template-auth-dialog { width: min(460px, calc(100% - 32px)); border: 0; border-radius: 14px; padding: 24px; color: #17243c; }
.template-auth-dialog::backdrop { background: rgb(12 24 44 / 55%); }
.template-message { padding: 12px 16px; margin-top: 12px; border: 1px solid #cbd5e1; border-radius: 6px; background: #f8fafc; color: #334155; font-size: 14px; }

body .header-actions .button.button--quiet:hover {
  color: #fff;
  background: #0653e9e0;
}

/* Keep search content focused and comfortably readable on wide screens. */
body[data-page="search"] .search-page {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: 48px 24px 72px;
}

body[data-page="search"] .search-box {
  max-width: 840px;
  margin: 0 auto;
  border-color: #cbd9e9;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgb(11 78 162 / 6%);
}

.search-box button {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 120px;
  padding: 0 18px;
  border: 0;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.search-box button svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

body[data-page="search"] .search-page__toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 952px;
  margin-inline: auto;
  padding-right: 56px;
}

body[data-page="search"] .search-page__toolbar .search-box {
  flex: 1;
  min-width: 0;
  margin: 0;
}

body[data-page="search"] .search-page__back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #475569;
  background: transparent;
  cursor: pointer;
}

body[data-page="search"] .search-page__back:hover {
  color: var(--brand);
  background: #f1f5f9;
}

body[data-page="search"] .search-page__back:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

body[data-page="search"] .search-page__close {
  top: 12px;
  right: 24px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 0;
  color: #475569;
  background: transparent;
  font-size: 26px;
  text-decoration: none;
  box-shadow: none;
}

body[data-page="search"] .search-page__close:hover {
  color: var(--brand);
}

body[data-page="search"] .search-hot,
body[data-page="search"] .search-daily,
body[data-page="search"] .search-tabs,
body[data-page="search"] .search-count,
body[data-page="search"] .search-hit-list {
  width: 100%;
  max-width: 840px;
  margin-left: auto;
  margin-right: auto;
}

body[data-page="search"] .pagination {
  width: 100%;
  max-width: 840px;
  margin-left: auto;
  margin-right: auto;
}

body[data-page="search"] .search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(22 119 255 / 12%);
}

body[data-page="search"] .search-hot a {
  border-color: #e2e8f0;
  border-radius: 20px;
}

body[data-page="search"] .search-hot a:hover {
  border-color: #b7d3f4;
  color: var(--brand);
  background: #edf5ff;
}

body[data-page="search"] .search-daily__list a:hover {
  color: var(--brand);
}

body[data-page="search"] .search-hit-card strong {
  font-size: 18px;
  line-height: 1.6;
}

@media (max-width: 640px) {
  body[data-page="search"] .search-page__toolbar {
    gap: 12px;
    padding-right: 0;
  }

  body[data-page="search"] .search-page {
    padding: 28px 20px 48px;
  }

  body[data-page="search"] .search-box {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  body[data-page="search"] .search-box a {
    min-width: 0;
    padding-inline: 12px;
  }

  body[data-page="search"] .search-page__close {
    right: 20px;
  }
}

/* Frontier navigation: compact trigger and a panel matching the navy header. */
.frontier-nav { position: relative; display: flex; align-items: center; border-radius: 6px; }
body .main-nav .frontier-nav > a { padding-right: 3px; }
.frontier-nav__toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; min-height: 40px; padding: 0; border: 0;
  border-radius: 0 6px 6px 0; background: transparent; color: inherit;
  cursor: pointer; font-size: 0;
}
.frontier-nav__toggle::before {
  content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg);
  opacity: .7; transition: transform .18s ease;
}
.frontier-nav.is-open .frontier-nav__toggle::before { transform: translateY(1px) rotate(225deg); }
/* Paint the whole trigger once so the link and arrow never stack backgrounds. */
.frontier-nav:hover,
.frontier-nav:focus-within,
.frontier-nav.is-open { background: rgba(127, 158, 201, .12); }
.frontier-nav:has(> a[aria-current="page"]) { background: #1456a8; }
body .site-header .main-nav .frontier-nav > a,
body .site-header .main-nav .frontier-nav > .frontier-nav__toggle {
  background: transparent;
}
body .site-header .main-nav .frontier-nav > a::after { display: none; }
.frontier-nav__toggle:focus-visible { outline: 2px solid #78b3ff; outline-offset: -2px; }
.frontier-nav__menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 100;
  width: 188px; padding: 7px; border: 1px solid #344760;
  border-radius: 8px; background: #15263d; box-shadow: 0 12px 28px #08132140;
}
.frontier-nav__menu::before { content: ''; position: absolute; top: -10px; left: 0; right: 0; height: 10px; }
.frontier-nav.is-open > .frontier-nav__menu { display: grid; gap: 3px; }
body .main-nav .frontier-nav__menu a {
  display: flex; align-items: center; min-height: 40px; padding: 9px 13px;
  color: #dce5f2; background: transparent; border-radius: 4px;
  font-size: 14px; line-height: 22px; font-weight: 400; white-space: nowrap;
  text-align: left; transition: background .15s ease, color .15s ease;
}
body .main-nav .frontier-nav__menu a::after { display: none; }
body .main-nav .frontier-nav__menu a:hover,
body .main-nav .frontier-nav__menu a:focus-visible,
body .main-nav .frontier-nav__menu a[aria-current="page"] { color: #fff; background: #24456b; }
@media (max-width: 767px) {
  body .site-header .main-nav.is-open {
    align-items: stretch; gap: 4px; padding: 12px 18px 18px;
    max-height: calc(100dvh - 64px); overflow-y: auto;
    border-bottom: 1px solid #344760; box-shadow: 0 12px 28px #08132130;
  }
  body .site-header .main-nav.is-open > a { width: 100%; padding: 10px 12px; text-align: left; }
  .frontier-nav { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  body .main-nav .frontier-nav > a { flex: 1; padding: 10px 12px; }
  .frontier-nav__toggle { width: 44px; min-height: 44px; }
  .frontier-nav__menu {
    position: static; width: auto; flex-basis: calc(100% - 16px); margin: 0 8px 8px;
    padding: 6px; box-shadow: none; border-color: #30435e; background: #0e1c30;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .frontier-nav__menu::before { display: none; }
  body .main-nav .frontier-nav__menu a { min-height: 44px; padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .frontier-nav__toggle::before, body .main-nav .frontier-nav__menu a { transition: none; }
}

/* Give the navigation its own row before desktop controls start overlapping. */
@media (min-width: 768px) and (max-width: 1199px) {
  body .site-header .site-header__inner {
    grid-template-columns: auto minmax(0, 1fr); gap: 0 20px;
    padding: 8px 20px 10px;
  }
  body .site-header .header-actions { grid-column: 2; grid-row: 1; justify-self: end; }
  body .site-header .main-nav {
    grid-column: 1 / -1; grid-row: 2; width: 100%; min-width: 0;
    justify-content: center; flex-wrap: wrap; overflow: visible;
  }
}

/* Frontier article: breadcrumb above, content and hot ranking in two columns below. */
#industry-reference .frontier-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 26px;
  align-items: start;
}

#industry-reference .frontier-article-main {
  min-width: 0;
}

#industry-reference .frontier-article-layout > .article-hot-ranking {
  position: sticky;
  top: 88px;
  align-self: start;
  margin: 0;
}

@media (max-width: 1024px) {
  #industry-reference .frontier-article-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  #industry-reference .frontier-article-layout > .article-hot-ranking {
    position: static;
  }
}
