/* Header tools and footer: intrinsic labels own their space. */
body .search-stack { container: catalog-search / inline-size; }

@media (min-width: 901px) {
  body .site-header { container: brand-header / inline-size; height: auto; min-height: 96px; }
  body .site-header .header-inner { min-height: 96px; height: auto; }
  body .catalog-head { grid-template-columns: repeat(auto-fit, minmax(min(450px, 100%), 1fr)); }
  body .catalog-head::before { width: 100%; }
  body .catalog-head .catalog-title-line { flex-wrap: wrap; }

  @container brand-header (max-width: 1120px) {
    body .site-header .header-inner { grid-template-columns: 160px minmax(0, 1fr) 240px; gap: 12px; }
    body .site-header .header-inner .certificates { display: none; }
    body .site-header .city-nav { min-width: 0; flex-wrap: wrap; gap: 8px 12px; }
    body .site-header .city-nav a { white-space: nowrap; }
  }

  @container brand-header (max-width: 800px) {
    body .site-header .header-inner { grid-template-columns: minmax(0, 1fr) 240px; gap: 10px 16px; padding-block: 12px; }
    body .site-header .brand { grid-column: 1; grid-row: 1; max-width: 100%; }
    body .site-header .phone-cluster { grid-column: 2; grid-row: 1; min-width: 0; }
    body .site-header .city-nav { grid-column: 1 / -1; grid-row: 2; display: flex; justify-content: flex-start; }
  }

  body .search-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 154px max-content max-content;
    gap: 6px;
    align-items: stretch;
  }

  body .search-tools > * { min-width: 0; }
  body .search-tools .global-search {
    display: block;
    height: 50px;
    border: 0;
    border-radius: 7px;
    box-shadow: none;
    background: transparent;
  }

  body .search-tools .global-search input {
    width: 100%;
    height: 50px;
    margin: 0;
    padding: 0 12px 0 38px;
    border: 1px solid #dfe4e8;
    border-radius: 7px;
    box-shadow: none;
    background: #fff;
    color: #30373e;
    font-size: 13px;
    line-height: 1.4;
  }

  body .search-tools .search-icon { left: 13px; }

  body .search-tools .city-filter-toggle,
  body .search-tools .request-button {
    position: static;
    width: 100%;
    height: 50px;
    min-height: 50px;
    margin: 0;
    padding: 7px 11px;
    border: 1px solid #dfe4e8;
    border-radius: 7px;
    background: #fff;
    color: #30373e;
    box-shadow: none;
    transform: none;
  }

  body .search-tools .city-filter-toggle {
    grid-template-columns: minmax(0, 1fr) 10px;
    grid-template-rows: auto auto;
    gap: 1px 6px;
    align-content: center;
    text-align: left;
  }

  body .search-tools .city-filter-toggle small { font-size: 11px; line-height: 1.3; }
  body .search-tools .city-filter-toggle strong { min-width: 0; font-size: 13px; line-height: 1.35; }
  body .search-tools .request-button { min-width: 108px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
  body .search-tools .request-button-label { min-width: max-content; }
  body .search-tools .request-button #requestCount { flex: 0 0 auto; min-width: 24px; height: 26px; display: grid; place-items: center; padding: 0 6px; border: 0; border-radius: 5px; background: #f3f5f6; font-size: 12px; line-height: 1; }
  body .search-tools .request-button.has-items { border-color: #efce97; background: #fff8ec; }
  body .search-tools .request-button.has-items #requestCount { background: #fff0d6; color: #795825; }

  body .search-tools .search-shortcuts {
    width: max-content;
    min-width: 146px;
    height: 50px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0;
    border: 1px solid #dfe4e8;
    border-radius: 7px;
    background: #fff;
    box-shadow: none;
    overflow: visible;
  }

  body .search-tools .search-shortcuts button {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    margin: 0;
    padding: 3px 10px;
    border: 0;
    border-radius: 6px 6px 0 0;
    background: transparent;
    box-shadow: none;
    color: #414950;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
    transform: none;
  }

  body .search-tools .search-shortcuts button + button { border-top: 1px solid #e7ebee; border-radius: 0 0 6px 6px; }
  body .search-tools .search-shortcuts button i { flex: 0 0 16px; width: 16px; height: 16px; }
  body .search-tools .search-shortcuts button span { flex: 0 0 auto; overflow: visible; text-overflow: clip; white-space: nowrap; }
  body .search-tools .search-shortcuts button:hover { background: #fff8ec; color: #72542d; }

  body .search-tools :is(.global-search input,.city-filter-toggle,.request-button):hover { border-color: #ecc98f; box-shadow: none; }
  body .search-tools :is(.city-filter-toggle,.request-button):active { background: #fff8ec; transform: none; }
  body .search-tools .global-search input:focus { border-color: #e6b567; outline: 0; box-shadow: none !important; }
  body .search-tools :is(.city-filter-toggle,.request-button):focus-visible { border-color: #e6b567; outline: 1px solid #e6b567; outline-offset: -1px; box-shadow: none; }
  body .search-tools .search-shortcuts button:focus-visible { background: #fff8ec; outline: 1px solid #e6b567; outline-offset: -1px; box-shadow: none; }

  /* High browser zoom can leave fewer CSS pixels than the viewport breakpoint
     suggests. Only the toolbar reflows; the surrounding catalogue stays put. */
  @container catalog-search (max-width: 555px) {
    body .search-tools { grid-template-columns: minmax(0, 1fr) 154px; gap: 6px; }
    body .search-tools .global-search { grid-column: 1; grid-row: 1; }
    body .search-tools .city-filter { grid-column: 2; grid-row: 1; }
    body .search-tools .search-shortcuts { grid-column: 1; grid-row: 2; width: 100%; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 1fr; height: 38px; }
    body .search-tools .search-shortcuts button { justify-content: center; padding: 5px 8px; gap: 6px; border-radius: 6px 0 0 6px; }
    body .search-tools .search-shortcuts button + button { border-top: 0; border-left: 1px solid #e7ebee; border-radius: 0 6px 6px 0; }
    body .search-tools .request-button { grid-column: 2; grid-row: 2; height: 38px; min-height: 38px; }
  }

  @container catalog-search (max-width: 430px) {
    body .search-tools .search-shortcuts { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); height: 50px; }
    body .search-tools .search-shortcuts button { justify-content: flex-start; border-radius: 6px 6px 0 0; padding: 3px 10px; }
    body .search-tools .search-shortcuts button + button { border-left: 0; border-top: 1px solid #e7ebee; border-radius: 0 0 6px 6px; }
    body .search-tools .request-button { height: 50px; min-height: 50px; }
  }

  @container catalog-search (max-width: 320px) {
    body .search-tools { grid-template-columns: minmax(0, 1fr); }
    body .search-tools :is(.global-search,.city-filter,.search-shortcuts,.request-button) { grid-column: 1; grid-row: auto; }
    body .search-tools .city-filter-toggle { height: auto; min-height: 50px; }
    body .search-tools .city-filter-toggle strong { white-space: normal; overflow: visible; text-overflow: clip; }
  }

  @container catalog-search (max-width: 170px) {
    body .search-tools .search-shortcuts button i { display: none; }
    body .search-tools .search-shortcuts button { padding-inline: 8px; }
  }
}

body .site-footer { container: site-footer / inline-size; border-top: 1px solid #e5e9ec; background: #f6f8f9; }
body .site-footer .footer-main { grid-template-columns: 210px minmax(0, 1fr) minmax(310px, 470px); gap: 28px; align-items: start; }
body .site-footer .footer-contact { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; align-items: start; }
body .site-footer .footer-contact > span { grid-column: 1; font-size: 11px; line-height: 1.4; font-weight: 600; letter-spacing: .06em; }
body .site-footer .footer-phones { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; min-width: 0; }
body .site-footer .footer-phones a { display: grid; grid-template-columns: 138px minmax(0, 1fr); align-items: baseline; column-gap: 12px; min-width: 0; white-space: normal; overflow-wrap: normal; }
body .site-footer .footer-phones small { font-size: 12px; line-height: 1.45; font-weight: 400; letter-spacing: 0; text-transform: none; white-space: nowrap; overflow-wrap: normal; }
body .site-footer .footer-phones strong { font-size: 14px; line-height: 1.45; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow-wrap: normal; }
body .site-footer .footer-contact-link { grid-column: 1; justify-self: start; max-width: 100%; padding: 3px 0; font-size: 13px; line-height: 1.5; font-weight: 500; color: #745a34; overflow-wrap: normal; text-wrap: balance; }
body .site-footer .footer-contact-link:hover { color: #4f3d22; }
body .site-footer a:focus-visible { outline: 1px solid #e6b567; outline-offset: 3px; border-radius: 3px; }
body .site-footer .footer-bottom { gap: 12px; padding-right: 0; font-size: 12px; line-height: 1.5; }

@container site-footer (max-width: 1120px) {
  body .site-footer .footer-main { grid-template-columns: 180px minmax(0, 1fr) 310px; gap: 20px; }
}

@container site-footer (max-width: 800px) {
  body .site-footer .footer-main { grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; }
  body .site-footer .footer-brand { display: none; }
}

@container site-footer (max-width: 580px) {
  body .site-footer .footer-main { grid-template-columns: minmax(0, 1fr); }
  body .site-footer .footer-contact { width: 100%; }
  body .site-footer .footer-summary { display: none; }
}

@container site-footer (max-width: 360px) {
  body .site-footer .footer-phones a { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
}
