/* Shared mobile navigation and legacy layout repair.
   Desktop styles remain untouched. */

#mobile-site-bar,
#mobile-page-hero,
#mobile-menu-drawer,
#mobile-menu-backdrop,
#mobile-site-footer {
  display: none;
}

@media screen and (max-width: 768px) {
  html.mobile-menu-ready,
  html.mobile-menu-ready body {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden;
  }

  html.mobile-menu-ready body {
    margin: 0 !important;
    padding: 0 0 28px !important;
    background-color: #fff !important;
    background-image: none !important;
    background-attachment: scroll !important;
    -webkit-text-size-adjust: 100%;
  }

  /* The legacy multicolor logo remains on PC, but is replaced by the mobile bar logo. */
  html.mobile-menu-ready .clearText {
    display: none !important;
  }

  /* The roof illustration was the old mobile header. Keep it on PC only. */
  html.mobile-menu-ready #header > img[src*="top_yane.png"] {
    display: none !important;
  }

  html.mobile-menu-ready #header #top,
  html.mobile-menu-ready .mobile-hero-source-title,
  html.mobile-menu-ready.mobile-fixed-layout body > h1 {
    display: none !important;
  }

  #mobile-site-bar {
    position: sticky;
    top: 0;
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 58px;
    padding: 7px 10px 7px 14px;
    box-sizing: border-box;
    color: #155b42;
    background: #e5f7ef;
    border-bottom: 1px solid #b8e3d0;
    box-shadow: 0 2px 8px rgba(24, 91, 67, .14);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    text-align: left;
  }

  #mobile-site-bar .mobile-site-name {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    min-width: 0;
    color: #155b42;
    text-decoration: none;
  }

  #mobile-site-bar .mobile-site-logo {
    display: block;
    width: 172px;
    max-width: 100%;
    height: auto;
  }

  #mobile-page-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 138px;
    padding: 18px 16px;
    box-sizing: border-box;
    border-bottom: 1px solid #b8e3d0;
    background-color: #eaf8f1;
    background-image: linear-gradient(rgba(255, 255, 255, .08), rgba(255, 255, 255, .18)), url("/imgs/001.jpg");
    background-position: center 76%;
    background-size: cover;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    text-align: center;
  }

  .mobile-home-catch,
  .mobile-page-title {
    max-width: 100%;
    margin: 0 !important;
    padding: 11px 15px !important;
    box-sizing: border-box;
    border: 1px solid rgba(77, 181, 139, .45);
    border-radius: 8px;
    color: #155b42 !important;
    background: rgba(255, 255, 255, .84);
    box-shadow: 0 2px 10px rgba(21, 91, 66, .13);
    text-align: center !important;
  }

  .mobile-home-catch {
    display: flex;
    width: min(100%, 520px);
    gap: 3px;
    padding: 4px !important;
    overflow: hidden;
  }

  .mobile-home-catch span {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    margin: 0;
    padding: 10px 3px;
    color: #fff;
    font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    font-size: clamp(16px, 4.8vw, 22px);
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -.03em;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  }

  .mobile-catch-summer {
    background: #0082ca;
  }

  .mobile-catch-winter {
    background: #dc8264;
  }

  .mobile-catch-quiet {
    background: #13a63b;
  }

  .mobile-page-title {
    font-size: clamp(17px, 5vw, 21px) !important;
    font-weight: 800;
    line-height: 1.45 !important;
    overflow-wrap: anywhere;
  }

  #mobile-menu-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 96px;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid #72b99b;
    border-radius: 6px;
    color: #155b42;
    background: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
  }

  @media screen and (max-width: 360px) {
    #mobile-site-bar {
      padding-left: 10px;
      padding-right: 8px;
    }

    #mobile-site-bar .mobile-site-logo {
      width: 155px;
    }

    #mobile-menu-button {
      min-width: 90px;
      padding-right: 9px;
      padding-left: 9px;
    }
  }

  .mobile-menu-icon,
  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    display: block;
    width: 21px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .mobile-menu-icon {
    position: relative;
  }

  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    position: absolute;
    left: 0;
    content: "";
  }

  .mobile-menu-icon::before { top: -7px; }
  .mobile-menu-icon::after { top: 7px; }

  #mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: block;
    visibility: hidden;
    opacity: 0;
    border: 0;
    background: rgba(0, 0, 0, .55);
    transition: opacity .2s ease, visibility .2s ease;
  }

  #mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 10030;
    display: block;
    width: min(88vw, 360px);
    height: 100vh;
    height: 100dvh;
    padding: 0 0 24px;
    box-sizing: border-box;
    overflow-y: auto;
    color: #222;
    background: #fff;
    box-shadow: -5px 0 20px rgba(0, 0, 0, .26);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    text-align: left;
    transform: translateX(105%);
    transition: transform .22s ease;
    -webkit-overflow-scrolling: touch;
  }

  html.mobile-menu-open,
  html.mobile-menu-open body {
    overflow: hidden !important;
  }

  html.mobile-menu-open #mobile-menu-backdrop {
    visibility: visible;
    opacity: 1;
  }

  html.mobile-menu-open #mobile-menu-drawer {
    transform: translateX(0);
  }

  .mobile-menu-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 7px 10px 7px 18px;
    box-sizing: border-box;
    color: #155b42;
    background: #e5f7ef;
    border-bottom: 1px solid #b8e3d0;
  }

  .mobile-menu-head strong {
    font-size: 17px;
  }

  #mobile-menu-close {
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    color: #155b42;
    background: transparent;
    font-size: 31px;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-menu-section {
    padding: 14px 16px 0;
  }

  .mobile-menu-section h2 {
    width: auto !important;
    height: auto !important;
    margin: 0 0 6px !important;
    padding: 0 0 6px !important;
    border-bottom: 2px solid #d8e6dc;
    color: #1d6f52 !important;
    background: none !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    text-align: left !important;
  }

  .mobile-menu-section-collapsible {
    padding-top: 9px;
  }

  .mobile-menu-section-collapsible h2 {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: 0;
  }

  .mobile-menu-section-toggle {
    position: relative;
    display: block;
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 11px 44px 11px 12px;
    border: 1px solid #cfe3d7;
    border-radius: 6px;
    color: #1d6f52;
    background: #f2faf6;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
  }

  .mobile-menu-section-toggle::after {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 24px;
    color: #1d6f52;
    content: "+";
    font-size: 23px;
    font-weight: 400;
    line-height: 1;
    text-align: center;
    transform: translateY(-50%);
  }

  .mobile-menu-section-toggle[aria-expanded="true"] {
    border-color: #9ecdb5;
    border-radius: 6px 6px 0 0;
    background: #e5f7ef;
  }

  .mobile-menu-section-toggle[aria-expanded="true"]::after {
    content: "\2212";
  }

  .mobile-menu-section-collapsible .mobile-menu-list {
    padding: 8px 0 2px;
  }

  .mobile-menu-section-collapsible .mobile-menu-list[hidden] {
    display: none !important;
  }

  .mobile-menu-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .mobile-menu-list a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 10px;
    box-sizing: border-box;
    border: 1px solid #d7ddd8;
    border-radius: 5px;
    color: #222;
    background: #fff;
    font-size: 14px;
    line-height: 1.35;
    text-decoration: none;
  }

  .mobile-menu-actions {
    display: grid;
    gap: 9px;
    padding: 18px 16px 0;
  }

  .mobile-menu-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 8px 12px;
    box-sizing: border-box;
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
  }

  .mobile-menu-contact { background: #b84427; }
  .mobile-menu-phone { background: #1f7b59; }

  /* Shared mobile footer replaces the inconsistent legacy footers. */
  html.mobile-menu-ready #footer,
  html.mobile-menu-ready #footer2,
  html.mobile-menu-ready #footer3,
  html.mobile-menu-ready #footer4,
  html.mobile-menu-ready #footer5,
  html.mobile-menu-ready body > footer:not(#mobile-site-footer) {
    display: none !important;
  }

  #mobile-site-footer {
    display: block;
    clear: both;
    width: 100%;
    margin: 28px 0 0;
    padding: 0;
    box-sizing: border-box;
    border-top: 5px solid #4db58b;
    color: #24483a;
    background: #eff9f4;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    text-align: left;
  }

  .mobile-footer-inner {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 24px 16px 18px;
    box-sizing: border-box;
  }

  .mobile-footer-brand {
    text-align: center;
  }

  .mobile-footer-name {
    color: #155b42;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.3;
    text-decoration: none;
  }

  .mobile-footer-tagline {
    margin: 5px 0 0 !important;
    color: #4a645a;
    font-size: 13px !important;
    line-height: 1.5 !important;
    text-align: center;
  }

  .mobile-footer-actions {
    display: grid;
    gap: 10px;
    margin: 19px 0;
  }

  .mobile-footer-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 9px 12px;
    box-sizing: border-box;
    border-radius: 7px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
  }

  .mobile-footer-contact { background: #b84c2d; }
  .mobile-footer-phone { background: #1f7b59; }

  .mobile-footer-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid #c9e7d9;
    border-left: 1px solid #c9e7d9;
  }

  .mobile-footer-nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 10px;
    box-sizing: border-box;
    border-right: 1px solid #c9e7d9;
    border-bottom: 1px solid #c9e7d9;
    color: #185f46;
    background: #fff;
    font-size: 14px;
    line-height: 1.35;
    text-decoration: none;
  }

  .mobile-footer-company {
    display: grid;
    gap: 4px;
    margin-top: 18px;
    text-align: center;
  }

  .mobile-footer-company strong {
    color: #24483a;
    font-size: 14px;
    line-height: 1.5;
  }

  .mobile-footer-company span {
    color: #587066;
    font-size: 12px;
    line-height: 1.5;
  }

  .mobile-footer-copyright {
    margin: 14px 0 0 !important;
    padding-top: 13px;
    border-top: 1px solid #c9e7d9;
    color: #687b73;
    font-size: 11px !important;
    line-height: 1.5 !important;
    text-align: center;
  }

  /* Existing navigation and sidebars are replaced only after JS is ready. */
  html.mobile-menu-ready #nav,
  html.mobile-menu-ready #g_nav,
  html.mobile-menu-ready #sidebar1,
  html.mobile-menu-ready #sidebar2,
  html.mobile-menu-ready #side_menu01,
  html.mobile-menu-ready #side_menu02 {
    display: none !important;
  }

  /* Dreamweaver fluid-grid pages. */
  html.mobile-menu-ready .gridContainer,
  html.mobile-menu-ready #contents,
  html.mobile-menu-ready #main_contents {
    float: none !important;
    clear: both !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  html.mobile-menu-ready .fluid {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  html.mobile-menu-ready .gridContainer {
    padding: 0 !important;
  }

  html.mobile-menu-ready #main_contents {
    padding: 12px 14px 0 !important;
  }

  html.mobile-menu-ready #main_contents .main_h1,
  html.mobile-menu-ready #main_contents .main_h2 {
    height: auto !important;
    font-size: 18px !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  html.mobile-menu-ready #main_contents .main_h3 {
    height: auto !important;
    font-size: 17px !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  /* Page titles on fluid-grid subpages must wrap without pushing the layout. */
  html.mobile-menu-ready #header #top {
    float: none !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
    color: #333 !important;
    background: #fff !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  /* Older fixed-width pages. */
  html.mobile-fixed-layout body > h1 {
    width: 100% !important;
    height: auto !important;
    min-height: 74px;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    overflow: hidden;
    color: transparent !important;
    background-position: center top !important;
    background-size: cover !important;
    font-size: 1px !important;
  }

  html.mobile-fixed-layout #pageBody,
  html.mobile-fixed-layout #container {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    background-image: none !important;
  }

  /* shade.js wraps fixed pages and applies zoom: 980/407 on phones. */
  html.mobile-fixed-layout .gridContainer {
    zoom: 1 !important;
    position: static !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  html.mobile-fixed-layout #footer,
  html.mobile-fixed-layout #footer3,
  html.mobile-fixed-layout #footer4,
  html.mobile-fixed-layout #footer5 {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-right: auto !important;
    margin-left: auto !important;
    box-sizing: border-box !important;
  }

  html.mobile-fixed-layout #footer5 p {
    width: auto !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    box-sizing: border-box !important;
  }

  /* quickFlip panels are absolutely positioned and collapse their parent. */
  html.mobile-fixed-layout #flip-container {
    position: static !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  html.mobile-fixed-layout #flip-container > div {
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  /* quickFlip creates a duplicate of the first panel for its animation. */
  html.mobile-fixed-layout #flip-container > div:nth-child(2) {
    display: none !important;
  }

  html.mobile-fixed-layout #mainContent,
  html.mobile-fixed-layout #mainContent2,
  html.mobile-fixed-layout #main {
    float: none !important;
    clear: both !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 12px 14px 24px !important;
    box-sizing: border-box !important;
    overflow: hidden;
    font-size: 16px !important;
    line-height: 1.7 !important;
  }

  /* Legacy boxes used fixed heights that make wrapped mobile text overlap. */
  html.mobile-fixed-layout #mainContent div,
  html.mobile-fixed-layout #mainContent2 div,
  html.mobile-fixed-layout #main div,
  html.mobile-fixed-layout #mainContent section,
  html.mobile-fixed-layout #mainContent2 section,
  html.mobile-fixed-layout #main section {
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
  }

  /* The soundproof-window page used a screenshot of the old TOP page as a
     text-box background. Remove that obsolete image on mobile. */
  html.mobile-fixed-layout #mainContent2 .doa .parag_in42 {
    width: 100% !important;
    margin: 0 0 18px !important;
    padding: 16px !important;
    border: 1px solid #c9e7d9 !important;
    border-radius: 8px;
    color: #24483a !important;
    background-color: #f5fbf8 !important;
    background-image: none !important;
    font-size: 16px !important;
    line-height: 1.75 !important;
  }

  html.mobile-fixed-layout #mainContent2 .doa .parag_in42 p {
    margin: 0 !important;
  }

  /* The original profile box reserved 415px for a background portrait,
     leaving only one-character-wide text on phones. Use a regular card. */
  html.mobile-fixed-layout #mainContent2 .doa .parag_in4 {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 18px 0 !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    border: 1px solid #c9e7d9 !important;
    border-radius: 8px;
    color: #24483a !important;
    background-color: #f5fbf8 !important;
    background-image: none !important;
    font-size: 16px !important;
    line-height: 1.75 !important;
  }

  html.mobile-fixed-layout #mainContent2 .doa .parag_in4 p {
    margin: 0 !important;
  }

  html.mobile-fixed-layout #mainContent h1,
  html.mobile-fixed-layout #mainContent2 h1,
  html.mobile-fixed-layout #main h1,
  html.mobile-fixed-layout #mainContent h2,
  html.mobile-fixed-layout #mainContent2 h2,
  html.mobile-fixed-layout #main h2,
  html.mobile-fixed-layout #mainContent h3,
  html.mobile-fixed-layout #mainContent2 h3,
  html.mobile-fixed-layout #main h3,
  html.mobile-fixed-layout #mainContent h4,
  html.mobile-fixed-layout #mainContent2 h4,
  html.mobile-fixed-layout #main h4 {
    width: auto !important;
    height: auto !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  html.mobile-fixed-layout #mainContent h1,
  html.mobile-fixed-layout #mainContent2 h1,
  html.mobile-fixed-layout #main h1 { font-size: 22px !important; }

  html.mobile-fixed-layout #mainContent h2,
  html.mobile-fixed-layout #mainContent2 h2,
  html.mobile-fixed-layout #main h2 { font-size: 20px !important; }

  html.mobile-fixed-layout #mainContent h3,
  html.mobile-fixed-layout #mainContent2 h3,
  html.mobile-fixed-layout #main h3 { font-size: 18px !important; }

  html.mobile-fixed-layout #mainContent h4,
  html.mobile-fixed-layout #mainContent2 h4,
  html.mobile-fixed-layout #main h4 { font-size: 17px !important; }

  /* Wide legacy tables must fit the viewport instead of clipping content. */
  html.mobile-fixed-layout #mainContent table,
  html.mobile-fixed-layout #mainContent2 table,
  html.mobile-fixed-layout #main table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  html.mobile-fixed-layout #mainContent td,
  html.mobile-fixed-layout #mainContent2 td,
  html.mobile-fixed-layout #main td,
  html.mobile-fixed-layout #mainContent th,
  html.mobile-fixed-layout #mainContent2 th,
  html.mobile-fixed-layout #main th {
    width: auto !important;
    height: auto !important;
    box-sizing: border-box !important;
  }

  html.mobile-fixed-layout .p1 {
    font-size: 13px !important;
    line-height: 1.5 !important;
  }

  html.mobile-fixed-layout .clearfloat {
    font-size: 1px !important;
  }

  html.mobile-menu-ready img,
  html.mobile-menu-ready object,
  html.mobile-menu-ready embed,
  html.mobile-menu-ready video,
  html.mobile-menu-ready iframe {
    max-width: 100% !important;
    height: auto;
  }

  html.mobile-menu-ready input,
  html.mobile-menu-ready select,
  html.mobile-menu-ready textarea,
  html.mobile-menu-ready button {
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }

  html.mobile-menu-ready table {
    max-width: 100% !important;
  }

  html.mobile-menu-ready pre,
  html.mobile-menu-ready code,
  html.mobile-menu-ready td,
  html.mobile-menu-ready th {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  html.mobile-menu-ready [style*="width"] {
    max-width: 100% !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #mobile-menu-drawer,
  #mobile-menu-backdrop {
    transition: none;
  }
}
