/* Smartphone-only layout adjustments. Desktop styles are not changed. */
@media screen and (max-width: 768px) {
  html,
  body {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Header: center the logo and reduce the gap above the category navigation. */
  .site-header .header-table,
  .site-header .header-table > tbody,
  .site-header .header-table > tbody > tr,
  .site-header .header-table > tbody > tr > td {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .site-header .header-table > tbody > tr > td:first-child {
    padding-top: 8px !important;
    padding-bottom: 2px !important;
    text-align: center !important;
  }

  .site-header .header-table > tbody > tr > td:nth-child(2) {
    padding-top: 0 !important;
  }

  .site-header .brand-logo {
    display: block !important;
    width: auto !important;
    max-width: min(210px, 82vw) !important;
    height: 58px !important;
    object-fit: contain !important;
    margin: 0 auto !important;
  }

  /* Category navigation: horizontal scrolling with the active item centered by mobile.js. */
  .site-header .nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 2px 8px 7px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: auto;
  }

  .site-header .nav::-webkit-scrollbar {
    display: none;
  }

  .site-header .nav::before,
  .site-header .nav::after {
    content: "";
    flex: 0 0 50% !important;
    height: 1px;
    pointer-events: none;
  }

  /* On the top page, start the category navigation from the left. */
  .site-header .nav.nav-home-start::before,
  .site-header .nav.nav-home-start::after {
    flex-basis: 0 !important;
    width: 0 !important;
  }

  .site-header .nav a {
    display: inline-block !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  /* Four-card sections: show two cards per row on smartphones. */
  table.layout-4 {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  table.layout-4 > tbody {
    display: block !important;
    width: 100% !important;
  }

  table.layout-4 > tbody > tr {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    width: 100% !important;
  }

  table.layout-4 > tbody > tr > td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    vertical-align: top !important;
  }

  table.layout-4 .card {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* Keep every ordinary four-card image at the same mobile size. */
  table.layout-4 .card img:not(.product-photo) {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    aspect-ratio: 8 / 5 !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  /* Property photos use a dedicated 8:5 frame so all four remain identical
     even on mobile browsers that do not apply aspect-ratio consistently. */
  table.layout-4.property-portfolio .card .property-photo-frame > img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  /* Product cards use one consistent portrait frame. */
  table.layout-4 .card img.product-photo {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    aspect-ratio: 4 / 5 !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  /* Show the complete product lineup without changing its frame size. */
  table.layout-4 .card img.product-lineup-photo {
    object-fit: contain !important;
    background: #f8fafc !important;
  }

  /* Quick Links banners remain uniformly wide and compact. */
  .section.soft table.layout-4 .card > a > img {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    aspect-ratio: 3 / 1 !important;
    object-fit: cover !important;
    object-position: center center !important;
  }
}

@media screen and (max-width: 430px) {
  .site-header .brand-logo {
    height: 54px !important;
    max-width: min(190px, 82vw) !important;
  }
}

.footer-about-mobile {
  display: none;
}

/* Smartphone footer: company details first, Group and Information side by side. */
@media screen and (max-width: 768px) {
  .footer .footer-table,
  .footer .footer-table > tbody,
  .footer .footer-table > tbody > tr {
    display: block !important;
    width: 100% !important;
  }

  .footer .footer-table > tbody > tr {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: auto auto !important;
    column-gap: 16px !important;
    row-gap: 14px !important;
    align-items: start !important;
  }

  .footer .footer-table > tbody > tr > td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .footer .footer-table > tbody > tr > td:nth-child(1) {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
  }

  .footer .footer-table > tbody > tr > td:nth-child(2) {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }

  .footer .footer-table > tbody > tr > td:nth-child(3) {
    grid-column: 2 !important;
    grid-row: 2 !important;
    text-align: left !important;
  }

  .footer .footer-table > tbody > tr > td:nth-child(3) strong {
    display: block !important;
    margin-bottom: 3px !important;
  }

  .footer .footer-company-suffix {
    display: none !important;
  }

  .footer .footer-about-mobile {
    display: inline-block !important;
  }

  .footer .footer-table > tbody > tr > td:nth-child(3) a {
    display: inline !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .footer .copyright {
    width: 100% !important;
    text-align: center !important;
  }
}
