/* =====================================================================
   Phones and tablets (design D: "light catalogue")
   - compact header: logo, search button, menu button
   - the menu drops down under the header as a grid of page tiles
   - "Request a Quote" stays at the bottom of the screen
   - home page: search box and category buttons
   Loaded last, so these rules win over the others on small screens.
   ===================================================================== */

/* desktop: hide the phone-only parts */
.hicon,
.msheet,
.scrim,
.qbar,
.mfind {
  display: none;
}

@media (max-width: 1000px) {
  header {
    z-index: 50;
  }
  .hb {
    flex-wrap: nowrap;
    gap: 4px;
    padding: 8px 8px 8px 16px;
    min-height: 64px;
    box-sizing: border-box;
  }
  header .logo img {
    height: 48px;
  }
  .hb > nav#nav,
  .hb > .hq {
    display: none;
  }
  .hicon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: none;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s;
  }
  #msearch {
    margin-left: auto;
  }
  .hicon:hover,
  .hicon:focus-visible {
    background: #ffffff1f;
  }
  .hicon:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
  }
  #menuBtn .i-close,
  body.menu-open #menuBtn .i-open {
    display: none;
  }
  body.menu-open #menuBtn .i-close {
    display: block;
  }
  body.menu-open #menuBtn {
    background: #ffffff26;
  }

  /* the drop-down menu */
  .msheet {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border-radius: 0 0 22px 22px;
    box-shadow: 0 18px 40px #0b1c3540;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition:
      opacity 0.2s ease,
      transform 0.26s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s linear 0.26s;
  }
  body.menu-open .msheet {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition:
      opacity 0.2s ease,
      transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .msheet .wrap {
    padding: 16px 16px 18px;
  }
  #mnav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex: none;
  }
  #mnav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 0 14px;
    border-radius: 14px;
    background: #f0f4f8;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    box-shadow: none;
    opacity: 0;
    transform: translateY(-4px);
    transition:
      opacity 0.2s ease,
      transform 0.22s ease,
      background-color 0.2s;
  }
  #mnav a::after {
    display: none;
  }
  #mnav a svg {
    color: var(--ink-d);
    flex: none;
  }
  #mnav a:hover {
    background: var(--tint);
  }
  #mnav a.on {
    background: var(--ink-d);
    color: #fff;
  }
  #mnav a.on svg {
    color: #fff;
  }
  /* an odd number of pages: the last tile takes the full row */
  #mnav a:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  body.menu-open #mnav a {
    opacity: 1;
    transform: none;
    transition-delay: calc(var(--nav-order, 0) * 18ms);
  }
  .mfoot {
    margin-top: 16px;
  }
  .mfoot .btn {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border-radius: 14px;
  }
  #dcontact {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 18px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--mute);
    text-align: center;
  }
  #dcontact a {
    display: inline-block;
    padding: 10px 0;
    color: var(--mute);
  }

  /* dark layer behind the menu; tapping it closes the menu */
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: #0b1c3573;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  body.menu-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
  /* the page underneath does not scroll while the menu is open */
  html.menu-lock,
  html.menu-lock body {
    overflow: hidden;
  }

  /* "Request a Quote" bar at the bottom of the screen */
  .qbar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px #14212b14;
    transition: transform 0.25s ease;
  }
  .qbar .btn {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border-radius: 14px;
  }
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
  /* not needed on pages that already are a form */
  body[data-page="quote"] .qbar,
  body[data-page="contact"] .qbar,
  body[data-page="consult"] .qbar,
  body[data-page="custom"] .qbar,
  body[data-page="thanks"] .qbar {
    display: none;
  }
  body[data-page="quote"],
  body[data-page="contact"],
  body[data-page="consult"],
  body[data-page="custom"],
  body[data-page="thanks"] {
    padding-bottom: 0;
  }
  body.menu-open .qbar {
    transform: translateY(110%);
  }
  .pro-field small.vm:empty {
    display: none;
  }

  /* home: search box and category buttons */
  .mfind {
    display: block;
    padding: 18px 0 0;
  }
  #mfind {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    padding: 0 14px;
    border-radius: 14px;
    background: #f0f4f8;
    border: 1px solid #e1e8ef;
    color: var(--mute);
  }
  #mfind:focus-within {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px #4a84b826;
  }
  #mq {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 16px; /* 16px stops phones zooming in on the box */
    color: var(--ink);
    outline: none;
    padding: 0;
  }
  .mfind .chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 14px 0 4px;
    margin: 0 -18px;
    padding-left: 18px;
    padding-right: 18px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mfind .chips::-webkit-scrollbar {
    display: none;
  }
  .mfind .chip {
    flex: none;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 99px;
    border: 1px solid #d3dde6;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
  }
  .mfind .chip.on {
    background: var(--ink-d);
    border-color: var(--ink-d);
    color: #fff;
  }
}

/* phones: tighter home hero and cards */
@media (max-width: 700px) {
  .hero {
    padding: 28px 0 32px;
  }
  .hero h1 {
    font-size: 30px;
  }
  .hero .row {
    margin-top: 18px;
  }
  .hero .row .btn {
    flex: 1 1 140px;
    text-align: center;
  }
  .hero .home-product {
    padding: 16px;
  }
  .hero .home-product .pimg {
    height: 190px !important;
  }
  .development-art b {
    font-size: 24px;
  }
  .expertise-panel h3 {
    font-size: 24px;
    margin: 0;
  }
  .home-areas {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .home-area .cb {
    padding: 16px;
    gap: 6px;
  }
  .home-area h3 {
    font-size: 16px;
  }
  .home-area p {
    font-size: 13px;
    line-height: 1.45;
  }
  .home-area:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .pro .pro-hero h1 {
    font-size: 30px;
  }
  .pro .pro-hero p {
    font-size: 16px;
  }
  .pro-back {
    margin-bottom: 16px;
  }
}

/* empty check messages take no space */
.pro-field small.vm:empty {
  display: none;
}