/* ===================================================================
   Harmonythm Biz - Mobile / Tablet Responsive Overlay (2026-05-26)
   harmonythm 本体 CSS は無改変、ここで viewport 別に上書き
   =================================================================== */

/* デスクトップ：ハンバーガー関連を非表示（デフォルト） */
#hmthm-hamburger,
#hmthm-drawer,
#hmthm-drawer-overlay { display: none; }

/* === 単一投稿ページ：harmonythm の 616px 固定を撤廃し TOP と同幅に === */
#single_post {
  width: auto !important;
  float: none !important;
  margin: 0 auto 50px !important;
  max-width: 948px;
}
/* JS で main_content 幅を post_list 基準に合わせるので、single ページ用に right_col 内のセンター揃え */
#right_col { text-align: center; }
#right_col > * { text-align: left; }
#single_post { display: block; }
#single_post .post_image img { width: 100%; height: auto; }
#single_post .post { margin: 0 24px !important; line-height: 1.85; }
#single_post .post_title { font-size: 22px !important; margin: 8px 24px 14px !important; }

/* archive_headline：もう少しメリハリ */
.grid_layout #archive_headline {
  font-size: 18px !important;
  font-weight: bold;
  padding: 18px 24px !important;
  text-align: left !important;
}
.grid_layout #archive_headline:after { left: 36px !important; top: 50px !important; }

/* ===== 固定フッター（全viewport共通・モバイル優先デザイン）===== */
#hmthm-sticky-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000;
  display: flex; align-items: stretch;
  background: rgba(143, 114, 48, .96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 -2px 10px rgba(0,0,0,.25);
  border-top: 1px solid rgba(255,255,255,.18);
}
#hmthm-sticky-footer .sf-link {
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 8px 4px 7px;
  color: #fff !important;
  text-decoration: none !important;
  font-size: 10.5px;
  letter-spacing: .04em;
  line-height: 1.2;
  border-right: 1px solid rgba(255,255,255,.16);
}
#hmthm-sticky-footer .sf-link:last-child { border-right: none; }
#hmthm-sticky-footer .sf-ico { font-size: 17px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
#hmthm-sticky-footer .sf-flag { width: 26px; height: 17px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,.4); border-radius: 1px; }
#hmthm-sticky-footer .sf-link[aria-label="ホーム"] .sf-flag { width: 22px; height: 22px; box-shadow: none; color: #fff; }
#hmthm-sticky-footer .sf-link:active { background: rgba(0,0,0,.18); }

/* 本文末尾が固定フッターに隠れないようマージン確保 */
body { padding-bottom: 60px; }

/* デスクトップではフッター文字を少し大きく */
@media (min-width: 1024px) {
  #hmthm-sticky-footer { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: 12px 12px 0 0; }
  #hmthm-sticky-footer .sf-link { font-size: 12px; padding: 10px 8px 9px; }
  #hmthm-sticky-footer .sf-ico { font-size: 19px; }
  #hmthm-sticky-footer .sf-flag { width: 30px; height: 20px; }
  #hmthm-sticky-footer .sf-link[aria-label="ホーム"] .sf-flag { width: 24px; height: 24px; }
}

/* ---- TABLET (~1024px) ---- */
@media (max-width: 1023px) {
  #main_content { width: 100% !important; max-width: 100vw !important; box-sizing: border-box; padding: 0 16px; margin: 16px auto 0 !important; }
  .grid_layout #archive_headline { width: auto !important; margin: 0 0 16px 0 !important; padding: 14px 16px !important; text-align: left; font-size: 13px; }
  .grid_layout #archive_headline:after { display: none; }
}

/* ---- MOBILE (~768px and below) ---- */
@media (max-width: 768px) {
  body { background-color: #b89342; }

  /* レイアウト：左右並列を解除＋順序差替（ロゴ → 本文 → サイドバー） */
  #main_content {
    width: 100% !important; max-width: 100vw !important;
    margin: 0 auto !important; padding: 0 12px;
    box-sizing: border-box;
    display: flex !important; flex-direction: column !important;
  }
  /* #left_col の子要素を flex 項目化（display:contents で wrapper を透過） */
  #left_col { display: contents !important; }
  #right_col { width: 100% !important; float: none !important; margin: 0 0 20px 0 !important; order: 1 !important; }

  /* 並び順：ロゴ → グローバルメニュー → 本文（right_col）→ メニュー帯 → ウィジェット → コピーライト */
  #logo_block_image { order: 0 !important; }
  #right_col        { order: 2 !important; }
  #menu_block       { order: 3 !important; }
  .side_widget      { order: 4 !important; }
  #copy_right       { order: 5 !important; }

  /* ハンバーガーボタン（モバイル時のみ表示・固定ヘッダ右上） */
  #hmthm-hamburger {
    display: block !important;
    position: fixed; top: 12px; right: 12px; z-index: 10001;
    width: 46px; height: 46px;
    background: #8f7230; border: none; border-radius: 6px;
    padding: 0; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
  }
  /* 3本のバーを絶対配置で button の中央に固定 → 開く時に中心 X */
  #hmthm-hamburger span {
    display: block;
    position: absolute;
    left: 12px;
    width: 22px; height: 2px;
    background: #fff;
    border-radius: 1px;
    transform-origin: center center;
    transition: transform .25s ease, opacity .15s ease, top .25s ease;
  }
  #hmthm-hamburger span:nth-child(1) { top: 15px; }
  #hmthm-hamburger span:nth-child(2) { top: 22px; }
  #hmthm-hamburger span:nth-child(3) { top: 29px; }
  /* 開いた時：中央22pxへ集約 + 上下を回転、中央は完全消去 */
  #hmthm-hamburger[aria-expanded="true"] span:nth-child(1) { top: 22px; transform: rotate(45deg); }
  #hmthm-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  #hmthm-hamburger[aria-expanded="true"] span:nth-child(3) { top: 22px; transform: rotate(-45deg); }

  /* オーバーレイ */
  #hmthm-drawer-overlay {
    display: block !important;
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(0,0,0,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
  }
  #hmthm-drawer-overlay[aria-hidden="false"] { opacity: 1; pointer-events: auto; }

  /* ドロワー */
  #hmthm-drawer {
    display: block !important;
    position: fixed; top: 0; right: 0;
    width: 84vw; max-width: 320px; height: 100vh;
    background: #b89342;
    z-index: 9999;
    transform: translateX(100%); transition: transform .28s ease;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 60px 14px 20px 14px; box-sizing: border-box;
    box-shadow: -4px 0 14px rgba(0,0,0,.4);
  }
  #hmthm-drawer[aria-hidden="false"] { transform: translateX(0); }

  #hmthm-drawer-close {
    position: absolute; top: 8px; right: 12px;
    width: 38px; height: 38px;
    background: transparent; color: #fff;
    border: none; font-size: 30px; line-height: 1;
    cursor: pointer; padding: 0;
  }

  /* === ドロワー内：シンプルテキスト統一・装飾なし（クラスセレクタ）=== */
  #hmthm-drawer .block { background: transparent !important; box-shadow: none !important; padding: 0 !important; margin: 0 0 18px 0 !important; }
  #hmthm-drawer h3.side_headline { color: #fff; font-size: 11px; letter-spacing: .14em; margin: 14px 0 8px; padding: 0 2px 6px; border-bottom: 1px solid rgba(255,255,255,.35); }
  /* ロゴ・コピー・ウィジェット・SNS・検索は非表示（id-prefixed後も対応） */
  #hmthm-drawer [id$="logo_block_image"],
  #hmthm-drawer [id$="copy_right"],
  #hmthm-drawer .side_widget,
  #hmthm-drawer [id$="social_link"],
  #hmthm-drawer [id$="search_area"] { display: none !important; }

  /* Photo categories：3列・小さいテキスト・テキストリンクのみ */
  #hmthm-drawer ul.side_category {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px 8px !important;
    padding: 0 !important; margin: 0 !important;
    list-style: none !important;
  }
  #hmthm-drawer ul.side_category li { margin: 0 !important; padding: 0 !important; background: none !important; float: none !important; }
  #hmthm-drawer ul.side_category li a {
    display: block !important;
    background: none !important;
    color: #fff !important;
    padding: 3px 0 !important;
    border-radius: 0 !important;
    text-decoration: underline;
    font-size: 10.5px !important;
    line-height: 1.35;
    word-break: break-all;
  }
  #hmthm-drawer ul.side_category ul.children { display: none !important; }

  /* Archive：横並びテキスト */
  #hmthm-drawer [id$="side_archive"] ul {
    display: flex !important; flex-wrap: wrap !important;
    gap: 4px 10px !important;
    padding: 0 !important; margin: 0 !important;
    list-style: none !important;
  }
  #hmthm-drawer [id$="side_archive"] li { float: none !important; margin: 0 !important; padding: 0 !important; }
  #hmthm-drawer [id$="side_archive"] li a {
    width: auto !important; height: auto !important;
    background: none !important;
    color: #fff !important;
    font-size: 11px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    text-decoration: underline;
    display: inline-block;
  }
  #hmthm-drawer [id$="side_archive"] .year { display: inline; padding: 0; }
  #hmthm-drawer [id$="side_archive"] .year::after { content: "."; }
  #hmthm-drawer [id$="side_archive"] .month { display: inline; padding: 0; }

  /* Global menu：シンプルテキストリスト */
  #hmthm-drawer ul.menu { padding: 0 !important; margin: 0 !important; list-style: none !important; }
  #hmthm-drawer ul.menu li { background: none !important; padding: 0 !important; margin: 0 0 6px 0 !important; }
  #hmthm-drawer ul.menu li a {
    display: block !important;
    background: none !important;
    color: #fff !important;
    padding: 4px 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    text-decoration: underline;
    font-size: 12px !important;
  }
  #hmthm-drawer ul.sub-menu {
    padding: 0 0 0 12px !important; margin: 2px 0 4px !important; list-style: none !important;
  }
  #hmthm-drawer ul.sub-menu li a { font-size: 11px !important; }

  body.hmthm-drawer-open { overflow: hidden; }

  /* ロゴ */
  #logo_block_image { margin: 12px 0 12px 0 !important; padding: 0 !important; background: transparent !important; }
  #logo_block_image img,
  #logo img { width: 100% !important; max-width: 320px !important; height: auto !important; display: block; margin: 0 auto; }
  #logo { width: 100% !important; height: auto !important; position: static !important; padding: 0 !important; }

  /* サイドメニューブロック内アイテムは横並びチップ風 */
  #menu_block { padding: 12px !important; margin: 0 0 16px 0 !important; }
  #side_category ul { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
  #side_category ul li { display: inline-block; margin: 0 !important; padding: 0 !important; background: none !important; }
  #side_category ul li a { display: inline-block !important; padding: 6px 10px !important; font-size: 12px !important; margin: 0 !important; }
  #side_category ul ul.children { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0 12px; padding: 0; width: 100%; flex-basis: 100%; }

  /* アーカイブ：年月ボタンも横並び */
  #side_archive ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 !important; padding: 0 !important; list-style: none; }
  #side_archive ul li { float: none !important; margin: 0 !important; padding: 0 !important; }
  #side_archive ul li a { width: 50px !important; height: 50px !important; }

  /* グローバルメニュー */
  #global_menu ul { padding: 0 !important; margin: 0 !important; list-style: none; }
  #global_menu ul li { margin: 0 0 2px 0 !important; }
  #global_menu ul.sub-menu { padding-left: 16px !important; }

  /* 検索 */
  #social_link { display: none !important; }
  #search_area { margin: 12px 0 0 0 !important; }

  /* タイトル帯（カテゴリ／アーカイブ） */
  .grid_layout #archive_headline { width: auto !important; margin: 0 0 16px 0 !important; padding: 14px 16px !important; text-align: left; font-size: 13px; line-height: 1.4 !important; }
  .grid_layout #archive_headline:after { display: none; }

  /* 投稿リスト：Masonry 解除 → 縦1列フロー */
  .post_list { width: 100% !important; min-width: 0 !important; height: auto !important; position: static !important; }
  .post_list .post_item {
    position: relative !important;
    left: auto !important; top: auto !important;
    width: 100% !important;
    float: none !important;
    margin: 0 0 16px 0 !important;
    box-sizing: border-box;
  }

  /* ヒーロー画像 */
  #recommend_slider { width: 100% !important; height: auto !important; }
  #recommend_slider a, #recommend_slider img { width: 100% !important; height: auto !important; display: block !important; }

  /* バナー */
  .post_item.banner_block { width: 100% !important; }
  .post_item.banner_block img { width: 100% !important; height: auto !important; display: block; }

  /* 投稿カード内画像 */
  .post_list .post_image { display: block; width: 100%; }
  .post_list .post_image img { width: 100% !important; height: auto !important; display: block; }

  /* メタ情報 */
  .post_list .meta { padding: 8px 12px 0 !important; }
  .post_list .date { width: 45px !important; height: 45px !important; font-size: 11px !important; }
  .post_list .post_category { padding-left: 56px !important; font-size: 11px; line-height: 1.5; }

  /* タイトル */
  .post_list .post_title { padding: 8px 12px !important; font-size: 15px !important; line-height: 1.5 !important; }

  /* 抜粋 */
  .post_list .excerpt { padding: 0 12px 12px !important; font-size: 13px; line-height: 1.7; }

  /* 次の記事へ */
  #next_post { text-align: center; padding: 16px 0; }
  #next_post a { display: inline-block; padding: 12px 32px; background: #8f7230; color: #fff; border-radius: 5px; text-decoration: none; font-size: 13px; }

  /* return top */
  #return_top { display: none; }

  /* 著作 */
  #copy_right { font-size: 10px; text-align: center; padding: 12px 0; }

  /* 単一投稿 */
  .single_post { padding: 16px; box-sizing: border-box; }
  .single_post .post_title { font-size: 19px !important; line-height: 1.5; }
  .single_post .entry_content { font-size: 14px; line-height: 1.85; }
  .single_post img { max-width: 100% !important; height: auto !important; }

  /* widget */
  .side_widget { padding: 12px !important; margin: 0 0 12px !important; }
}

/* ---- 小型モバイル (~480px) ---- */
@media (max-width: 480px) {
  #main_content { padding: 0 8px; }
  #logo_block_image img,
  #logo img { max-width: 260px !important; }
  .post_list .post_title { font-size: 14px !important; }
  .post_list .excerpt { font-size: 12px !important; }
  #side_archive ul li a { width: 44px !important; height: 44px !important; font-size: 10px !important; }
}
