/* Shared responsive refinements, loaded after each public page's theme. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-width: 0; }
main, nav, section, article, aside, form, fieldset, label,
.masthead > *, .header-actions > *, .opening > *, .pre-application > *,
.dialog-body > *, .dialog-info, .wch-auth-field, .wch-account-card > *,
.research-item > *, .person-title > *, .entry-top > *, .page-head > * {
  min-width: 0;
}
input, select, textarea { max-width: 100%; }
button, .button, .button-link, .primary-button, .application-button {
  max-width: 100%;
  overflow-wrap: anywhere;
}
h1, h2, h3, p, dd, .source-note, .breadcrumb, .country-link,
.artifact-meta, .wch-auth-error, .wch-auth-status, .translation-note {
  overflow-wrap: anywhere;
}
.opening { grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); }
.pre-application { grid-template-columns: minmax(0,.85fr) minmax(0,1.25fr); }
.application-fields, .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.comparison-wrap, .source-table-wrap, .privacy-table-wrap {
  max-width: 100%;
  overscroll-behavior-inline: contain;
}
.comparison-wrap:focus-visible, .source-table-wrap:focus-visible,
.privacy-table-wrap:focus-visible { outline: 2px solid var(--wine,#742d3b); outline-offset: 3px; }
dialog, dialog.wch-auth, dialog.launch-notice, .community dialog {
  box-sizing: border-box;
  max-width: calc(100% - 24px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  overscroll-behavior: contain;
}
.wch-auth-head { position: sticky; top: 0; z-index: 3; background: #faf8f3; }
.wch-auth-head button, .launch-notice-close { min-width: 44px; min-height: 44px; padding: 0; flex-shrink: 0; }
.dialog-header { gap: 12px; }
.dialog-header .close { min-width: 44px; min-height: 44px; flex-shrink: 0; }
.wch-auth-trigger { min-width: 0; }
.wch-auth-trigger > span { min-width: 0; }
.wch-auth-trigger > svg { flex-shrink: 0; }
.wch-auth-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
.wch-auth-tabs button { white-space: normal; }
.language-picker { max-width: 100%; }
.language-picker select { min-width: 0; }
.language-error { max-width: calc(100vw - 32px); overflow-wrap: anywhere; }
.privacy-masthead { flex-wrap: wrap; }
.privacy-brand, .privacy-masthead > * { min-width: 0; }
.privacy-language { flex-wrap: wrap; }
.privacy-language select { max-width: 100%; }
.pagination-row, .results-label { flex-wrap: wrap; gap: 12px; }
.research-item img { flex: 0 0 75px; }
.time-label, .launch-notice-timer span { overflow-wrap: anywhere; }

/* Account and language controls share one size throughout the public header. */
.masthead { --header-control-width: 6.75rem; --header-control-height: 2.75rem; }
.masthead .wch-auth-trigger, .masthead .language-picker select {
  box-sizing: border-box; width: var(--header-control-width);
  min-width: 0; max-width: var(--header-control-width);
  height: var(--header-control-height); min-height: var(--header-control-height);
  border-radius: 0; margin: 0;
}
.masthead .wch-auth-trigger { gap: 4px; padding: 0 8px; font-size: .875rem; }
.masthead .wch-auth-trigger > svg { width: 16px; height: 16px; }
.masthead .wch-auth-trigger > span {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.masthead .language-picker { margin: 0; }
.masthead .language-picker select { padding-block: 0; font-size: 1rem; }
html[dir=rtl] .masthead .wch-auth-trigger { margin: 0; }

@media (max-width: 1100px) {
  .category-nav { flex-wrap: wrap; justify-content: flex-start; gap: 0 28px; }
  .category-nav a { white-space: normal; }
  .masthead { max-width: 100%; }
  .filter-toggle { white-space: normal; text-align: start; }
  .page-head { flex-wrap: wrap; }
}

@media (max-width: 950px) {
  .opening { grid-template-columns: minmax(0,1.2fr) minmax(0,.8fr); }
  .pre-application { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 900px) {
  .workspace, .workspace.collector-view { display: block; padding-inline: 24px; }
  .directory { padding: 20px 0; border: 0; border-bottom: 1px solid var(--line); }
  .directory .country-list { max-height: 270px; margin-inline: 0; }
  .directory-kicker, .directory-note { display: none; }
  .workspace main, .collector-view main { padding: 28px 0 44px; }
  .community-shell { display: block; padding-inline: 24px; }
  .community-sidebar { padding: 18px 0 0; }
  .community-sidebar .eyebrow, .community .sidebar-note { display: none; }
  .community-sidebar nav {
    display: flex; flex-wrap: wrap; gap: 8px;
    overflow: visible; padding-block: 0 14px;
    border-bottom: 1px solid var(--line);
  }
  .community-sidebar nav a {
    flex: 1 1 150px; min-width: 0; min-height: 44px;
    display: flex; align-items: center;
    padding: 10px 12px; border: 1px solid var(--line);
    font-size: .875rem; overflow-wrap: anywhere;
  }
  .community-sidebar nav a[aria-current] { background: var(--paper); border-color: var(--wine); }
  .community main { padding: 26px 0 44px; }
  .community .tabs { flex-wrap: wrap; overflow: visible; gap: 8px; }
  .community .tabs button { flex: 1 1 130px; white-space: normal; }
  .research-results { grid-template-columns: minmax(0,1fr); }
  html[dir=rtl] .directory { border-left: 0; }
}

@media (max-width: 700px) {
  /* Brand, account, globe and language stay on the same compact row. */
  .masthead, .community .masthead {
    --header-control-width: 6rem;
    display: grid; grid-template-columns: minmax(0,1fr) var(--header-control-width) auto;
    width: 100%; gap: 12px 8px; padding: 18px 20px;
    align-items: center;
  }
  .masthead > .brand { grid-area: 1 / 1; justify-self: start; }
  .masthead > .language-picker { grid-area: 1 / 3; margin: 0; justify-self: end; }
  .masthead > .wch-auth-trigger, .masthead > .header-actions {
    grid-area: 1 / 2; width: var(--header-control-width); margin: 0;
  }
  .masthead .header-actions { display: flex; gap: 0; }
  .masthead .header-actions .wch-auth-trigger { margin: 0; }
  .masthead .collector-nav, .community .masthead .collector-nav {
    grid-area: 2 / 1 / auto / -1; width: 100%; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 0 20px;
  }
  .masthead .collector-nav a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 10px; }
  .masthead .language-picker select { padding-inline: 8px; }
  .opening { grid-template-columns: minmax(0,1fr); }
  .opening h1 { font-size: clamp(2.35rem,9.6vw,4rem); }
  .category-nav { padding-inline: 20px; gap: 0 20px; overflow: visible; }
  .category-nav a { min-height: 44px; font-size: 1rem; }
  .workspace, .workspace.collector-view, .community-shell { padding-inline: 20px; }
  .catalogue-tools .filters { grid-template-columns: minmax(0,1fr) auto; }
  .catalogue-tools .filters .searchbox { grid-column: 1 / -1; }
  .catalogue-tools .filters select { width: 100%; }
  .filter-toggle { max-width: 150px; }
  .application-fields, .form-grid { grid-template-columns: minmax(0,1fr); }
  .wch-auth-body { padding: 22px 20px; }
  .community dialog.wch-auth { padding: 0; }
  .wch-auth-head { padding: 10px 16px; }
  .wch-auth h2 { font-size: 2rem; }
  .community .wch-auth h2 { font-size: 2rem; margin-bottom: 22px; }
  .dialog-info dl > div { grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); }
  .dialog-image { min-height: 0; height: min(280px,38vh); height: min(280px,38dvh); }
  .dialog-image img { max-height: 100%; }
  .time-value { font-size: clamp(2.35rem,10vw,3.875rem); }
  .launch-notice-timer strong { font-size: clamp(2rem,9vw,2.5rem); }
  .time-label, .launch-notice-timer span { letter-spacing: .02em; line-height: 1.5; }
  .year-directory summary { flex-wrap: wrap; gap: 6px 14px; }
  .year-directory summary > span:last-child { white-space: normal; }
  .compare-check { min-height: 44px; font-size: .875rem; }
  .pagination button { min-width: 44px; min-height: 44px; font-size: .875rem; }
  .community .text-button, .clear-btn, .launch-trigger, .explore-link,
  .privacy-tabs a, .privacy-footer a { min-height: 44px; display: inline-flex; align-items: center; }
  .community .search-row { flex-wrap: wrap; }
  .community .search-row input { flex: 1 1 160px; }
  .community .search-row button { flex: 0 1 auto; }
  .source-table-wrap { padding-inline: 0; }
  .privacy-main { margin-block: 28px 44px; }
  .privacy-card { padding: 18px; }
  .privacy-layer, .privacy-optional { padding: 14px; }
  .privacy-actions > button { flex: 1 1 180px; }
  .community input:not([type=checkbox]):not([type=radio]),
  .community select, .community textarea, input:not([type=checkbox]):not([type=radio]),
  select, textarea, .directory input, .directory select,
  .filters select, .advanced-filters input, .advanced-filters select,
  .privacy-language select { font-size: 1rem; }
  #site-toast, #notice { width: max-content; max-width: calc(100vw - 32px); overflow-wrap: anywhere; }
}

@media (max-width: 480px) {
  .privacy-masthead .wch-auth-trigger { width: 100%; margin: 0; }
  .privacy-masthead .wch-auth-trigger strong { max-width: 100%; white-space: normal; }
  .community-sidebar nav a { flex-basis: 120px; }
  .pagination-row { justify-content: center; }
  .pagination-row .meta { flex-basis: 100%; order: 2; text-align: center; }
  .dialog-info dl > div { grid-template-columns: minmax(0,1fr); gap: 5px; }
  .launch-notice-content h2 { font-size: clamp(2rem,9vw,2.625rem); }
}

@media (max-width: 380px) {
  .masthead, .community .masthead { --header-control-width: 5.5rem; padding-inline: 16px; gap: 12px 6px; }
  .masthead .monogram { font-size: 2rem; padding-inline-end: 0; }
  .masthead .wch-auth-trigger { padding-inline: 6px; }
  .workspace, .workspace.collector-view, .community-shell { padding-inline: 16px; }
  .category-nav { gap: 0 16px; padding-inline: 16px; }
  .catalogue-tools .filters { grid-template-columns: minmax(0,1fr); gap: 4px; }
  .filter-toggle { max-width: none; justify-content: space-between; padding-inline: 0; }
  .collection-more-action::before, .collection-more-action::after { display: none; }
  .dialog-body { padding: 16px; }
}
