/* Keep the full navigation on its own row when seven links cannot fit beside the logo. */
@media (851px <= width <= 1240px) and (min-height: 501px) {
  .cf-home .cf-mast-main { grid-template-columns: minmax(0, 1fr) auto; min-height: 0; }
  .cf-home .cf-mast-nav {
    grid-area: 2 / 1 / auto / -1;
    justify-content: space-between;
    justify-self: stretch;
    gap: 4px 12px;
    border-top: 1px solid #ffffff15;
    font-size: 14px;
  }
  .cf-home .cf-mast-nav a { display: flex; align-items: center; min-height: 44px; }
  .cf-home .cf-mast-actions { margin-block: 6px; }
}

@media (max-width: 850px), (max-width: 1240px) and (max-height: 500px) {
  .cf-home .cf-mast-top-inner { display: flex; }
  .cf-home .cf-mast-highlights { display: none; }
  .cf-home .cf-mast-local { width: 100%; justify-content: space-between; }
  .cf-home .has-mobile-menu .cf-mast-main {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 62px;
  }
  .cf-home .cf-mast-menu-toggle:not([hidden]) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    gap: 9px;
    padding: 0 14px;
    border: 1px solid #ffffff30;
    border-radius: 999px;
    background: var(--cf-surface);
    color: #f5f3ee;
    font: 750 14px/1.2 Inter, Arial, sans-serif;
    cursor: pointer;
  }
  .cf-home .cf-mast-menu-icon {
    display: inline-block;
    width: 16px;
    height: 12px;
    background: linear-gradient(currentColor, currentColor) 0 2px / 100% 2px no-repeat,
      linear-gradient(currentColor, currentColor) 0 8px / 100% 2px no-repeat;
    color: var(--theme-primary);
  }
  .cf-home .cf-mast-menu-icon::before,
  .cf-home .cf-mast-menu-icon::after { content: none; }
  .cf-home .cf-mast-menu-toggle[aria-expanded="true"] .cf-mast-menu-icon {
    background: linear-gradient(45deg, transparent 44%, currentColor 45% 55%, transparent 56%),
      linear-gradient(-45deg, transparent 44%, currentColor 45% 55%, transparent 56%);
  }
  .cf-home .has-mobile-menu .cf-mast-menu { display: none; }
  .cf-home .has-mobile-menu .cf-mast-menu-toggle[aria-expanded="true"] + .cf-mast-menu {
    position: absolute;
    inset: calc(100% + 6px) max(10px, env(safe-area-inset-right)) auto auto;
    display: grid;
    gap: 10px;
    width: min(calc(100% - 20px), 390px);
    max-height: calc(100dvh - var(--cf-header-clearance) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
    border: 1px solid #ffffff30;
    border-radius: 16px;
    background: rgb(var(--cf-dark-rgb) / .94);
    backdrop-filter: var(--cf-glass-filter);
    box-shadow: 0 20px 45px #000a;
  }
  .cf-home .has-mobile-menu .cf-mast-nav {
    display: grid;
    grid-area: auto;
    grid-template-columns: minmax(0, 1fr);
    justify-self: stretch;
    gap: 2px;
    border: 0;
    font-size: 15px;
  }
  .cf-home .has-mobile-menu .cf-mast-nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding-inline: 10px;
    border-radius: 8px;
  }
  .cf-home .has-mobile-menu .cf-mast-nav a:is(:hover, :focus-visible) { background: #ffffff0d; }
  .cf-home .has-mobile-menu .cf-mast-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-self: stretch;
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid #ffffff20;
  }
  .cf-home .has-mobile-menu .cf-mast-call { width: auto; }
  .cf-home .has-mobile-menu .cf-mast-call span { display: inline; }

  .cf-home body:has(.cf-quick-dock) { padding-bottom: 0; }
  .cf-home .site-viewport-wrapper:has(> .cf-quick-dock) > .cf-footer {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  .cf-home .site-viewport-wrapper:has(> .cf-quick-dock) > .cf-footer::after { content: none; }

  .cf-home .cf-quick-dock {
    position: fixed;
    z-index: 1900;
    inset: auto max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    display: flex;
    align-items: stretch;
    gap: 6px;
    width: min(calc(100% - 20px), 450px);
    margin-inline: auto;
    padding: 6px;
    border: 1px solid #ffffff2c;
    border-radius: 16px;
    background: rgb(var(--cf-dark-rgb) / .92);
    backdrop-filter: var(--cf-glass-filter);
    box-shadow: 0 8px 24px #0008;
  }
  .cf-home .cf-quick-dock .mobile-action-bar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr);
    flex: 1;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
  }
  .cf-home .cf-quick-dock .mobile-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    min-width: 0;
    padding: 6px;
    border: 1px solid #ffffff29;
    border-radius: 10px;
    font: 750 13px/1.2 Inter, Arial, sans-serif;
  }
  .cf-home .cf-quick-dock .mobile-action-btn svg { width: 16px; height: 16px; flex: none; }
  .cf-home .cf-quick-dock .messenger-widget { position: relative; inset: auto; gap: 0; z-index: auto; }
  .cf-home .cf-quick-dock .messenger-fab { width: 44px; height: 44px; border-radius: 10px; }
  .cf-home .cf-quick-dock .messenger-fab svg { width: 22px; height: 22px; }
  .cf-home .cf-quick-dock .messenger-panel {
    position: absolute;
    inset: auto 0 calc(100% + 14px) auto;
    margin: 0;
  }
  .cf-home body:is(.cookie-consent-visible, .estimate-modal-open, :has(.legal-modal:not([hidden])),
    :has(.cf-mast-menu-toggle[aria-expanded="true"])) .cf-quick-dock {
    visibility: hidden;
    pointer-events: none;
  }
}

@media (851px <= width <= 1240px) and (min-height: 501px) {
  .cf-home body:has(.cf-quick-dock) { padding-bottom: 0; }
  .cf-home .cf-quick-dock .mobile-action-bar { display: none; }
  .cf-home .cf-quick-dock .messenger-widget { bottom: max(18px, env(safe-area-inset-bottom)); }
  .cf-home .site-viewport-wrapper:has(> .cf-quick-dock) > .cf-footer { padding-bottom: 28px; padding-inline-end: 90px; }
}

@media (max-width: 599px), (max-width: 1240px) and (max-height: 500px) {
  .cf-home .site-viewport-wrapper:has(> .cf-mast) { --cf-mast-top-height: 0px; }
  .cf-home .cf-mast .cf-mast-top { display: none; }
}

@media (max-width: 1240px) and (max-height: 500px) {
  .cf-home .cf-quick-dock { width: min(calc(100% - 20px), 350px); }
}
