/* Final screen: .d-end fills the viewport on desktop/tablet so the
   previous section cannot show above Get in Touch. Extra space stays
   inside the blue contact area (content centered); the #333 footer
   stays at the bottom. min-height (not a fixed height) so a too-tall
   block can still grow. Phones grow naturally. v1. */

/* Cancel html{scroll-padding-top:var(--head-h)} so Contact / .d-end
   land flush at the top of the viewport (no strip of the previous
   section under the header). */
.d-end,
.d-end[data-snap],
.d-end > .d-sec.d-contact,
#contact{
  scroll-margin-top: calc(0px - var(--head-h, 80px));
}

@media (min-width: 800px){
  .d-end{
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
  }
  .d-end > .d-sec.d-contact,
  .d-sec.d-contact{
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: calc(var(--head-h, 72px) + 8px);
    padding-bottom: 16px;
  }
  .d-end .d-foot{
    flex: 0 0 auto;
    background: #333333;
    color: #fff;
  }

  /* Compact the footer at tablet widths too (was only 1200px+), so
     1024x768 can fit in one screen. */
  .d-end .d-foot{
    padding: 10px var(--pad) 8px;
  }
  .d-end .d-foot .d-foot-top{ gap: 12px 24px; }
  .d-end .d-foot .d-foot-brandblock{ max-width: 170px; }
  .d-end .d-foot .d-foot-cols{ gap: 14px; }
  .d-end .d-foot .d-foot-cols h3{ margin-bottom: 4px; }
  .d-end .d-foot .d-foot-cols a{
    padding: 1px 0;
    font-size: 15px;
    line-height: 1.3;
  }
  .d-end .d-foot .d-foot-cols p{
    font-size: 13px;
    line-height: 1.3;
  }
  .d-end .d-foot-cities{
    margin-top: 6px;
    padding: 5px 0;
  }
  .d-end .d-foot .d-foot-partners{
    margin-top: 2px;
    padding-top: 5px;
    gap: 8px 18px;
  }
  .d-end .d-foot .d-foot-partners img{ height: 26px; }
  .d-end .d-foot .d-foot-copy{ margin-top: 4px; font-size: 13px; }

  /* Keep footer columns on one row at 1024-wide, where auto-fit wraps. */
  .d-end .d-foot .d-foot-top{
    grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
  }
  .d-end .d-foot .d-foot-cols{
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .d-end .d-contact .d-center{ margin-bottom: 6px; }
  .d-end .d-contact .d-h2{ margin-bottom: 6px; }
  .d-end .d-contact .contact-kicker{ margin-bottom: 4px; }
  .d-end .d-contact .contact-address{ font-size: 15px; line-height: 1.3; }
  .d-end .d-contact .contact-offices{ gap: 12px 28px; }
  .d-end .d-contact .contact-lines{ margin-top: 12px; }
  .d-end .contact-form{ gap: 6px; }
  .d-end .contact-field,
  .d-end .contact-phone-field{ gap: 3px; }
  .d-end .contact-form input,
  .d-end .contact-form select,
  .d-end .contact-form textarea{ padding: 7px 12px; }
  .d-end .contact-form textarea{ min-height: 64px; }
}

/* Short desktops and laptops (1366x768, 1280x720, 1024x768, 1920x950
   with a short window): tighten spacing so the content fits, then let
   min-height fill any leftover. */
@media (min-width: 800px) and (max-height: 1000px){
  .d-end > .d-sec.d-contact,
  .d-sec.d-contact{
    padding-top: calc(var(--head-h, 72px) + 4px);
    padding-bottom: 8px;
  }
  .d-end .d-contact .d-center{ margin-bottom: 2px; }
  .d-end .d-contact .d-h2{
    margin-bottom: 2px;
    font-size: clamp(30px, 3.8vw, 48px);
  }
  .d-end .d-contact .d-sub{ font-size: 14px; }
  .d-end .d-contact .contact-address{ font-size: 13px; line-height: 1.25; }
  .d-end .d-contact .contact-offices{ gap: 8px 20px; }
  .d-end .d-contact .contact-lines{ margin-top: 8px; }
  .d-end .contact-form{ gap: 4px; }
  .d-end .contact-field,
  .d-end .contact-phone-field{ gap: 1px; }
  .d-end .contact-field label,
  .d-end .contact-phone-field label,
  .d-end .contact-cc label{ font-size: 11px; }
  .d-end .contact-form input,
  .d-end .contact-form select,
  .d-end .contact-form textarea{
    padding: 4px 10px;
    font-size: 14px;
  }
  .d-end .contact-form textarea{ min-height: 40px; }
  .d-end .contact-submit{ padding: 5px 12px; font-size: 13px; }
  .d-end .d-foot{ padding: 6px var(--pad) 6px; }
  .d-end .d-foot .d-foot-brandblock{ max-width: 140px; }
  .d-end .d-foot .d-foot-cols a{ font-size: 13px; }
  .d-end .d-foot .d-foot-cols p{ font-size: 12px; line-height: 1.25; }
  .d-end .d-foot-cities{ margin-top: 4px; padding: 3px 0; }
  .d-end .d-foot-cities li{ font-size: 12px; }
  .d-end .d-foot .d-foot-partners{ padding-top: 3px; }
  .d-end .d-foot .d-foot-partners img{ height: 22px; }
  .d-end .d-foot .d-foot-copy{ margin-top: 2px; }
}

/* Phones: do not force a full viewport; let the block grow with the
   content. No blank band, no sideways scroll. */
@media (max-width: 799px){
  .d-end{
    min-height: 0;
    height: auto;
  }
  .d-end > .d-sec.d-contact,
  .d-sec.d-contact{
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    justify-content: flex-start;
  }
}

/* Tightest fit for 1280x720, including longer Thai / Japanese type. */
@media (min-width: 800px) and (max-height: 740px){
  .d-end > .d-sec.d-contact,
  .d-sec.d-contact{
    padding-top: calc(var(--head-h, 72px) + 2px);
    padding-bottom: 4px;
  }
  .d-end .d-contact .d-h2{
    margin-bottom: 0;
    font-size: clamp(26px, 3.2vw, 40px);
  }
  .d-end .d-contact .d-sub{ font-size: 13px; line-height: 1.3; }
  .d-end .d-contact .d-center{ margin-bottom: 0; }
  .d-end .d-contact .contact-address{ font-size: 12px; line-height: 1.2; }
  .d-end .d-contact .contact-offices{ gap: 4px 16px; }
  .d-end .d-contact .contact-lines{ margin-top: 4px; }
  .d-end .contact-form{ gap: 2px; }
  .d-end .contact-form input,
  .d-end .contact-form select,
  .d-end .contact-form textarea{
    padding: 3px 8px;
    font-size: 13px;
  }
  .d-end .contact-form textarea{ min-height: 32px; }
  .d-end .contact-submit{ padding: 4px 10px; font-size: 12px; }
  .d-end .d-foot{ padding: 4px var(--pad) 4px; }
  .d-end .d-foot .d-foot-partners img{ height: 20px; }
  .d-end .d-foot .d-foot-copy{ margin-top: 0; font-size: 12px; }
  .d-end .d-foot-cities{ margin-top: 2px; padding: 2px 0; }
}
