/* 車修理.com 共通スマートフォンシェル */
#mobile-header,
#mobile-drawer,
#mobile-menu-overlay {
  display: none;
}

@media (max-width: 767px) {
  html {
    overflow-x: hidden;
    scroll-padding-top: 68px;
  }

  body {
    min-width: 0;
    /* 画面下クリアランスは mu-plugin `ks-mobile-footer.php` が指定する（二重管理にしない） */
    overflow-x: hidden;
    background: #fff;
  }

  #wrapper {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    box-shadow: none !important;
  }

  /* PC専用の情報量が多いヘッダーはスマホでは置き換える */
  #tab-area,
  #subbar,
  #header,
  #gnav {
    display: none !important;
  }

  #mobile-header {
    display: block;
    position: sticky;
    top: 0;
    z-index: 10020;
    min-height: 58px;
    background: #111;
    border-bottom: 3px solid #cc0000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .24);
  }

  #mobile-header .mobile-head-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 7px;
    min-height: 55px;
    padding: 7px 9px 6px 12px;
  }

  #mobile-header .mobile-brand {
    min-width: 0;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: clamp(16px, 5vw, 21px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.03em;
    white-space: nowrap;
  }

  #mobile-header .mobile-brand:hover {
    color: #fff;
    text-decoration: none;
  }

  #mobile-header .mobile-brand em {
    color: #f12626;
    font-style: normal;
  }

  #mobile-header .mobile-brand small {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: #bbb;
    font-family: "メイリオ", Meiryo, sans-serif;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: .02em;
    text-overflow: ellipsis;
  }

  #mobile-header .mobile-call,
  #mobile-header .mobile-menu-button {
    display: flex;
    min-width: 47px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid #555;
    border-radius: 2px;
    background: #242424;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
  }

  #mobile-header .mobile-call {
    border-color: #b40000;
    background: #b40000;
  }

  #mobile-header .mobile-menu-button {
    width: 52px;
    padding: 0;
    cursor: pointer;
  }

  #mobile-header .mobile-menu-button[aria-expanded="true"] {
    border-color: #fff;
    background: #333;
  }

  #mobile-menu-overlay {
    position: fixed;
    inset: 58px 0 0;
    z-index: 10000;
    background: rgba(0, 0, 0, .58);
  }

  #mobile-menu-overlay.is-open {
    display: block;
  }

  #mobile-drawer {
    position: fixed;
    top: 58px;
    right: 0;
    z-index: 10010;
    width: min(88vw, 360px);
    max-height: calc(100dvh - 58px);
    overflow-y: auto;
    background: #fff;
    border-left: 1px solid #ccc;
    box-shadow: -5px 8px 20px rgba(0, 0, 0, .28);
  }

  #mobile-drawer.is-open {
    display: block;
  }

  #mobile-drawer .mobile-nav-title {
    padding: 10px 14px;
    background: #222;
    color: #fff;
    border-left: 4px solid #cc0000;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
  }

  #mobile-drawer .mobile-main-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  #mobile-drawer .mobile-main-nav a {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 700;
  }

  #mobile-drawer .mobile-main-nav a::after {
    content: "›";
    color: #cc0000;
    font-size: 17px;
  }

  #mobile-drawer .mobile-main-nav a.active {
    background: #fff3f3;
    color: #cc0000;
  }

  #mobile-drawer .mobile-main-nav a:hover {
    text-decoration: none;
  }

  #mobile-drawer .mobile-car-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 10px;
    gap: 6px;
    background: #f2f2f2;
  }

  #mobile-drawer .mobile-car-nav a {
    padding: 8px 4px;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  #main-wrap {
    width: 100% !important;
    padding: 10px !important;
  }

  #main-wrap > .row,
  #main-wrap .row {
    display: block;
    width: 100%;
  }

  #side {
    display: none !important;
  }

  #main,
  .page-content,
  #content {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  #realtime .grid,
  #equip .grid,
  #cars .grid,
  #bnsp .grid,
  #sitemap .grid,
  .testerUl,
  .service-nav {
    grid-template-columns: 1fr 1fr !important;
  }

  #info-block {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  img,
  video,
  iframe {
    max-width: 100% !important;
  }

  .page-content table {
    display: block;
    width: 100% !important;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #footer {
    padding: 22px 12px 18px !important;
  }

  #footer .row1 {
    display: block !important;
  }

  #footer .row1 .logo,
  #footer .row1 .right {
    display: none !important;
  }

  #footer .row1 .info {
    width: 100% !important;
    padding: 0 !important;
    text-align: left;
  }

  #footer .row1 .info .ad {
    line-height: 1.8;
  }

  #footer .copy {
    display: block !important;
    padding-top: 12px !important;
  }

  #footer .copy span:last-child {
    display: none;
  }

  /* 画面下の固定フッターは mu-plugin `ks-mobile-footer.php` が単独で持つ。
     ここには書かない＝二重実装・継ぎ足しCSSを作らない（正本＝/sp-footer） */
}

@media (max-width: 374px) {
  #mobile-header .mobile-brand {
    font-size: 15px;
  }

  #mobile-header .mobile-brand small {
    font-size: 8px;
  }

  #mobile-header .mobile-call {
    display: none;
  }

  #realtime .grid,
  #equip .grid,
  #cars .grid,
  #bnsp .grid,
  #sitemap .grid,
  .testerUl,
  .service-nav {
    grid-template-columns: 1fr !important;
  }
}
