/* Desktop header: keep the brand and member tools together above a single-row nav. */
@media (min-width: 761px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand utilities"
      "nav nav";
    align-items: center;
    column-gap: 18px;
    row-gap: 0;
    padding: 14px max(24px, calc((100vw - 1320px) / 2));
  }

  .site-header .header-main {
    display: contents;
  }

  .site-header .brand {
    grid-area: brand;
    width: clamp(180px, 20vw, 270px);
    max-width: none;
    min-width: 0;
    margin: 0;
  }

  .site-header .utilities {
    grid-area: utilities;
    justify-self: end;
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    gap: 12px;
    padding-left: 14px;
    border-left: 1px solid var(--line);
    font-size: .9rem;
  }

  .site-header .main-nav {
    grid-area: nav;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 1.4vw, 24px);
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 10px 0 0;
    font-size: 1rem;
  }

  .site-header .main-nav > a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .site-header .menu-toggle {
    display: none;
  }
}

@media (min-width: 761px) and (max-width: 900px) {
  .site-header {
    padding-right: 18px;
    padding-left: 18px;
  }

  .site-header .brand {
    width: 180px;
  }
}

@media (min-width: 901px) {
  /* One desktop brand row across content and course pages. */
  .site-header .header-main .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    width: clamp(340px, 28vw, 390px);
    max-width: none;
    flex: none;
  }

  .site-header .header-main .brand .brand-symbol {
    display: block;
    flex: 0 0 180px;
    width: 180px;
    height: 74px;
    overflow: visible;
  }

  .site-header .header-main .brand .brand-symbol img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    object-position: left center;
  }

  .site-header .header-main .brand-wordmark {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
    line-height: 1.15;
  }

  .site-header .header-main .brand-wordmark strong {
    font-size: 1.6rem;
    letter-spacing: -.025em;
    white-space: nowrap;
  }

  .site-header .header-main .brand-wordmark small {
    margin-top: 4px;
    font-size: .95rem;
    letter-spacing: .03em;
    line-height: 1.35;
    white-space: nowrap;
  }

  .site-header .main-nav {
    font-size: 18px;
  }

  .site-header .main-nav > a {
    font-weight: 600;
  }

  .site-header .main-nav > .course-search-nav {
    position: relative;
    display: inline-flex;
    flex: 0 0 48px;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    font-size: 0;
    line-height: 0;
  }

  .site-header .main-nav > .course-search-nav::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border: 2px solid currentColor;
    border-radius: 50%;
    content: "";
    transform: translate(-67%, -67%);
  }

  .site-header .main-nav > .course-search-nav::after {
    position: absolute;
    top: calc(50% + 3px);
    left: calc(50% + 4px);
    width: 12px;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
    content: "";
    transform: rotate(45deg);
    transform-origin: left center;
  }
}

/* Unified mobile and tablet header; desktop rules above remain unchanged. */
@media (max-width: 900px) {
  body .site-header,
  body.course-experience-page .site-header {
    display: block;
    min-height: 0;
    padding: 0;
  }

  body .site-header .header-main,
  body.course-experience-page .site-header .header-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    width: calc(100% - 32px);
    min-height: 0;
    padding: 12px 0;
  }

  body .site-header .header-main .brand,
  body.course-experience-page .site-header .header-main .brand {
    display: flex;
    order: 0;
    flex: 1 1 0;
    align-items: center;
    gap: 8px;
    width: auto;
    min-width: 0;
    max-width: calc(100% - 96px);
    min-height: 60px;
    margin: 0;
    font-size: 18px;
  }

  body .site-header .brand-symbol,
  body.course-experience-page .site-header .brand-symbol {
    display: block;
    flex: 0 0 56px;
    width: 56px;
    height: 60px;
    overflow: hidden;
  }

  body .site-header .brand-symbol img,
  body.course-experience-page .site-header .brand-symbol img {
    display: block;
    width: auto;
    max-width: none;
    height: 60px;
    object-fit: contain;
  }

  body .site-header .brand-wordmark,
  body.course-experience-page .site-header .brand-wordmark {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    line-height: 1.25;
    white-space: normal;
  }

  body .site-header .brand-wordmark strong,
  body.course-experience-page .site-header .brand-wordmark strong {
    font-size: 24px;
    letter-spacing: -.025em;
    white-space: nowrap;
  }

  body .site-header .brand-wordmark small,
  body.course-experience-page .site-header .brand-wordmark small {
    margin-top: 4px;
    font-size: 18px;
    line-height: 1.4;
    letter-spacing: 0;
    white-space: normal;
  }

  body .site-header .menu-toggle,
  body.course-experience-page .site-header .menu-toggle {
    display: inline-flex;
    order: 1;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    margin-left: auto;
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1.5;
  }

  body .site-header .utilities,
  body.course-experience-page .site-header .utilities {
    display: flex;
    order: 2;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 4px 12px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 18px;
  }

  body .site-header .utilities > a,
  body.course-experience-page .site-header .utilities > a {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    min-height: 48px;
    padding: 8px 4px;
    font-size: 18px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  body .site-header .utilities .text-size-tools,
  body.course-experience-page .site-header .utilities .text-size-tools {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    margin: 0;
    font-size: 18px;
  }

  body .site-header .text-size-tools button,
  body.course-experience-page .site-header .text-size-tools button {
    min-width: 48px;
    min-height: 48px;
    font-size: 18px;
  }

  body .site-header .main-nav,
  body.course-experience-page .site-header .main-nav {
    display: none;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    width: calc(100% - 32px);
    min-height: 0;
    margin: 0 auto;
    padding: 0 0 12px;
    font-size: 18px;
  }

  body .site-header .main-nav[data-open="true"],
  body.course-experience-page .site-header .main-nav[data-open="true"] {
    display: grid;
  }

  body .site-header .main-nav > a,
  body.course-experience-page .site-header .main-nav > a {
    display: flex;
    order: 0;
    align-items: center;
    width: auto;
    min-width: 0;
    min-height: 48px;
    height: auto;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 18px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Use the same clear magnifier as desktop instead of the tiny glyph. */
  body .site-header .main-nav > .course-search-nav,
  body.course-experience-page .site-header .main-nav > .course-search-nav {
    position: relative;
    font-size: 0;
  }

  body .site-header .course-search-nav::before,
  body.course-experience-page .site-header .course-search-nav::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 10px;
    width: 22px;
    height: 22px;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-sizing: border-box;
  }

  body .site-header .course-search-nav::after,
  body.course-experience-page .site-header .course-search-nav::after {
    content: "";
    position: absolute;
    left: 35px;
    top: 30px;
    width: 10px;
    height: 2px;
    background: currentColor;
    transform: rotate(45deg);
    transform-origin: left center;
  }
}

/* Association logo alone: remove the duplicate wordmark and show the full artwork. */
@media (min-width: 901px) {
  body .site-header .header-main .brand,
  body.course-experience-page .site-header .header-main .brand {
    width: 300px;
  }
  body .site-header .header-main .brand .brand-symbol,
  body.course-experience-page .site-header .header-main .brand .brand-symbol {
    flex: 0 1 300px;
    width: 300px;
    height: auto;
    overflow: visible;
  }
  body .site-header .header-main .brand .brand-symbol img,
  body.course-experience-page .site-header .header-main .brand .brand-symbol img {
    width: 100%;
    height: auto;
  }
}
@media (max-width: 900px) {
  body .site-header .brand-symbol,
  body.course-experience-page .site-header .brand-symbol {
    flex: 0 1 230px;
    width: min(230px, 100%);
    height: auto;
    overflow: visible;
  }
  body .site-header .brand-symbol img,
  body.course-experience-page .site-header .brand-symbol img {
    width: 100%;
    max-width: 100%;
    height: auto;
  }
}
