/* Public city header: reserve each control's space and keep the search seam square. */
@layer gentri-refinement {
@media screen {
  html:root[data-city-government] body.city-government .city-header .city-navigation__inner,
  html:root[data-city-government] body.city-government .city-header .city-primary-nav {
    min-width: 0 !important;
  }
  html:root[data-city-government] body.city-government .city-header .city-primary-nav {
    flex-wrap: wrap;
  }
  html:root[data-city-government] body.city-government .city-header .city-primary-nav > a {
    flex-shrink: 0;
  }
  html:root[data-city-government] body.city-government .city-header .city-nav-search {
    min-width: 0 !important;
    flex-shrink: 0 !important;
    gap: 0 !important;
    border-radius: 10px !important;
  }
  html:root[data-city-government] body.city-government .city-header .city-nav-search > #city-nav-search {
    width: 0 !important;
    min-width: 0 !important;
    flex: 1 1 0% !important;
    min-height: 44px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
  }
  html:root[data-city-government] body.city-government .city-header .city-nav-search > button {
    width: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    flex: 0 0 44px !important;
    margin: 0 !important;
    padding: 8px !important;
    border: 0 !important;
    border-left: 1px solid var(--city-border) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  html:root[data-city-government] body.city-government .city-header .city-nav-search:focus-within {
    border-color: var(--city-brand) !important;
    outline: 3px solid var(--city-focus) !important;
    outline-offset: 2px !important;
  }
  html:root[data-city-government] body.city-government .city-header .city-nav-search > button:focus-visible {
    outline: 2px solid var(--city-brand) !important;
    outline-offset: -4px !important;
  }
}
/* Keep all navigation labels on their own row before they could collide with search.
   Below 56rem the established menu button and expandable navigation retain control. */
@media screen and (min-width: 56.001rem) and (max-width: 74.999rem) {
  html:root[data-city-government] body.city-government .city-header .city-navigation__inner {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    padding-bottom: 12px;
  }
  html:root[data-city-government] body.city-government .city-header .city-primary-nav {
    width: 100%;
    justify-content: space-between;
  }
  html:root[data-city-government] body.city-government .city-header .city-nav-search {
    width: min(100%, 24rem) !important;
    justify-self: end;
    margin: 0 !important;
  }
}
}

/* Government collections share one readable row per record. */
@media screen {
  html:root[data-city-government] body.city-government [data-city-government-collection] :is(.city-official-grid, .city-record-grid, .city-record-list) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    gap: 14px;
  }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-official-card {
    padding: 20px;
    border-color: var(--city-border);
    border-radius: 14px;
    box-shadow: var(--city-shadow-sm);
  }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-record-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
    gap: 18px;
    min-height: 0;
    padding: 20px;
  }
  html:root[data-city-government] body.city-government [data-city-government-collection] :is(.city-record-card__symbol, .city-record-card__image) {
    width: 64px;
    height: 64px;
    margin: 0;
    border-radius: 12px;
    aspect-ratio: 1;
  }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-record-card__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 24px;
    min-width: 0;
    padding: 0;
  }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-record-card__body > :is(.city-record-card__topline, h3, .city-record-card__meta, .city-record-card__facts, .city-record-card__summary) {
    grid-column: 1;
    margin-block: 0;
  }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-record-card__body > .city-record-card__action {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: center;
    margin: 0;
  }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-record-card__actions {
    grid-column: 1 / -1;
    margin-top: 4px;
  }
  html:root[data-city-government] body.city-government .city-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 20px;
    border: 1px solid var(--city-border);
    border-radius: 14px;
    background: var(--city-surface);
    box-shadow: 0 3px 14px -9px var(--city-brand);
  }
  html:root[data-city-government] body.city-government .city-pagination__summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    color: var(--city-text);
    font-size: 14px;
  }
  html:root[data-city-government] body.city-government .city-pagination__summary > span {
    flex-basis: 100%;
    color: var(--city-muted);
    font-size: 12px;
    line-height: 1.5;
  }
  html:root[data-city-government] body.city-government :is(.city-pagination__controls, .city-pagination__pages) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
  }
  html:root[data-city-government] body.city-government .city-pagination__controls { margin-left: auto; }
  html:root[data-city-government] body.city-government .city-pagination :is(.city-pagination__direction, .city-pagination__number) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--city-border) !important;
    border-radius: 9px !important;
    background: var(--city-surface) !important;
    color: var(--city-text) !important;
    font-size: 13px !important;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
  }
  html:root[data-city-government] body.city-government .city-pagination .city-pagination__number.is-current {
    border-color: var(--city-brand) !important;
    background: var(--city-brand) !important;
    color: #fff !important;
    box-shadow: 0 3px 8px -4px var(--city-brand);
  }
  html:root[data-city-government] body.city-government .city-pagination a:hover {
    border-color: var(--city-brand) !important;
    background: var(--city-brand-soft) !important;
    color: var(--city-brand-strong) !important;
  }
  html:root[data-city-government] body.city-government .city-pagination .is-disabled {
    color: var(--city-muted) !important;
    background: var(--city-surface-inset) !important;
    opacity: .65;
  }
  html:root[data-city-government] body.city-government .city-pagination__ellipsis {
    min-width: 20px;
    text-align: center;
    color: var(--city-muted);
  }
}
@media screen and (max-width: 40rem) {
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-official-card { padding: 14px; }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-record-card {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }
  html:root[data-city-government] body.city-government [data-city-government-collection] :is(.city-record-card__symbol, .city-record-card__image) { width: 44px; height: 44px; }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-record-card__body { display: block; }
  html:root[data-city-government] body.city-government [data-city-government-collection] .city-record-card__body > :is(.city-record-card__action, .city-record-card__actions) { margin-top: 12px; }
  html:root[data-city-government] body.city-government .city-pagination { padding: 14px; gap: 12px; }
  html:root[data-city-government] body.city-government .city-pagination__controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-left: 0;
    gap: 8px;
  }
  html:root[data-city-government] body.city-government .city-pagination__pages {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: center;
  }
}

/* The disclosure owns its whole navigation/search panel, including closing.
   Without JavaScript the existing header's display rules remain in control. */
@media screen and (max-width: 56rem) {
  html:root[data-city-government] body.city-government .city-header .city-navigation[data-city-menu-panel] {
    display: block !important;
    box-sizing: border-box;
    transform-origin: top center;
  }
  html:root[data-city-government] body.city-government .city-header .city-navigation[data-city-menu-panel].is-menu-animating {
    overflow: hidden !important;
    pointer-events: none;
    will-change: height, opacity, transform;
  }
  html:root[data-city-government] body.city-government .city-header .city-navigation[data-city-menu-panel][hidden] {
    display: none !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  html:root[data-city-government] body.city-government .city-header .city-navigation[data-city-menu-panel] {
    transform: none !important;
  }
}
