/* ==========================================================
   Rinnai - ヘッダー（状態：通常） / Figma design export
   すべてのスタイルを @media screen and (max-width: 768px) 内に格納
   ========================================================== */

@media screen and (max-width: 768px) {

  :root {
    --color-white: #ffffff;
    --color-black: #000000;
    --color-text: #333333;
    --color-border: #c0c6cf;
    --color-dot-inactive: #999999;
    --color-dot-active: #333333;
    --color-brand-red: #cf000e;

    --header-height: 56px;
    --page-width: 390px;
  }

  header * {
    box-sizing: border-box;
  }

  header [hidden] {
    display: none !important;
  }

  header button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
  }

  /* .btn--menu が active（メニュー展開）の間、ページ全体のスクロールを停止 */
  html.is-menu-open,
  html.is-menu-open body {
    overflow: hidden;
    height: 100%;
  }

  #siteHeader {
    display: none;
  }

  /* ------------------------------------------------------------
     Header
     ------------------------------------------------------------ */
  .header {
    position: relative;
    width: 100%;
    z-index: 300;
    background: var(--color-white);
  }

  .header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: var(--header-height);
    padding-left: 16px;
    overflow: hidden;
    position: relative;
    z-index: 2;
  }

  .header__logo {
    display: block;
    width: 96px;
    height: 24px;
    flex-shrink: 0;
  }

  .header__logo img {
    width: 100%;
    height: 100%;
  }

  .header__menu {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }

  .btn__header {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
  }

  .btn__icon--search {
    width: 24px;
    height: 24px;
  }

  /* Figmaコンポーネント button-search / button-menu の
     バリアント「state」(default / hover / active) を反映 */
  .btn--search:hover,
  .btn--search:focus-visible,
  .btn--search.is-active {
    background: #efefef;
  }

  .btn--menu:hover,
  .btn--menu:focus-visible,
  .btn--menu.is-active {
    background: #eeeeee;
  }

  /* ハンバーガー ⇄ クローズ アイコンのクロスフェード */
  .btn__icon-stack {
    position: relative;
    display: block;
    width: 25px;
    height: 24px;
  }

  .btn__icon-stack .btn__icon {
    position: absolute;
    inset: 0;
    margin: auto;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }

  .btn__icon--menu {
    width: 25px;
    height: 24px;
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }

  .btn__icon--close {
    width: 21px;
    height: 21px;
    opacity: 0;
    transform: rotate(-45deg) scale(0.7);
  }

  .btn--menu.is-active .btn__icon--menu {
    opacity: 0;
    transform: rotate(45deg) scale(0.7);
  }

  .btn--menu.is-active .btn__icon--close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }

  /* ------------------------------------------------------------
     検索パネル（状態：キーワード検索）
     ------------------------------------------------------------ */
  .search-panel {
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    z-index: 3;
    background: #efefef;
    padding: 16px;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }

  .search-panel.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .search-panel__field {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    background: var(--color-white);
    padding: 9px 16px;
  }

  .search-panel__input {
    flex: 1 0 0;
    min-width: 0;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    color: var(--color-text);
    background-color: transparent;
  }

  .search-panel__input::placeholder {
    color: #999999;
  }

  .search-panel__submit {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* ------------------------------------------------------------
     メニュードロワー（状態：メニュー展開／子メニュー展開）
     ------------------------------------------------------------ */
  .menu-drawer {
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    z-index: 3;
    background: #efefef;
    padding: 12px 0 60px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .menu-drawer.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .menu-drawer__title {
    margin: 0;
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    text-align: left;
  }

  .menu-drawer__list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .menu-drawer__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 47px;
    padding: 12px 16px 12px 32px;
    background: none;
    border: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  .menu-drawer__label {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
  }

  /* アコーディオン（先頭2グループ）
     コンポーネント "a"（57:113）state=open の背景色変更を反映 */
  .menu-drawer__item.is-open > .menu-drawer__row {
    background: #dadddf;
  }

  .menu-drawer__item.is-open .menu-drawer__sublist {
    background: var(--color-white);
  }

  .icon-toggle {
    position: relative;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  .icon-toggle::before,
  .icon-toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 16px;
    height: 2px;
    background: var(--color-text);
    transform: translateY(-50%);
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .icon-toggle::after {
    transform: translateY(-50%) rotate(90deg);
  }

  .menu-drawer__item.is-open .icon-toggle::after {
    transform: translateY(-50%) rotate(0deg);
    opacity: 0;
  }

  .menu-drawer__sublist {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease;
  }

  .menu-drawer__item.is-open .menu-drawer__sublist {
    opacity: 1;
    /* max-height はJSで実際のコンテンツ高さに合わせて設定 */
  }

  .menu-drawer__sublink {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 44px;
    padding: 12px 16px 12px 48px;
    border-top: 1px solid #efefef;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);

    img {
      max-width: min-content;
    }

    &:link {
      color: var(--color-text);
    }
  }

  /* プレーンリンク（3グループ目：展開なし） */
  .menu-drawer__list--plain .menu-drawer__row {
    padding: 12px 16px 12px 32px;
  }

  .menu-drawer__list--plain img {
    flex-shrink: 0;
    max-width: min-content;
  }

}

@media screen and (min-width: 769px) {

  .header {
    display: none;
  }

}