/**
 * header_menu.css
 * ハンバーガーメニュー（ドロワー）のスタイル
 */

/* ========================================
   ヘッダー位置調整（本文と揃える）
======================================== */
.site-header {
  position: relative;
  width: 100%;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.page-title {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
  flex: 1;
}

/* ========================================
   ハンバーガーボタン
======================================== */
.hamburger-btn {
  position: relative;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  z-index: 1001;
  flex-shrink: 0;
}

/* TOPページ専用の位置調整 */
body > header.site-header:not(:has(.page-title)) .hamburger-btn {
  margin-left: auto;
}

.hamburger-btn span {
  display: block;
  width: 28px;
  height: 3px;
  background: #333;
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger-btn:hover span {
  background: #007bff;
}

/* ドロワーオーバーレイ */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 1100;
}

.drawer-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ドロワーメニュー */
.drawer-menu {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
  transition: right 0.3s;
  z-index: 1101;
  overflow-y: auto;
}

.drawer-menu.show {
  right: 0;
}

/* ドロワーヘッダー */
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #ddd;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
}

.drawer-close {
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.drawer-close:hover {
  color: #333;
}

/* ドロワーメニューリスト */
.drawer-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.drawer-menu-list li {
  border-bottom: 1px solid #eee;
}

.drawer-menu-list li:last-child {
  border-bottom: none;
}

.drawer-menu-list a,
.drawer-menu-list button {
  display: block;
  padding: 15px 20px;
  color: #333;
  text-decoration: none;
  font-size: 1rem;
  transition: background 0.2s;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
}

.drawer-menu-list a:hover,
.drawer-menu-list button:hover {
  background: #f0f0f0;
}

/* 外部リンク */
.drawer-menu-list .external a::after {
  content: ' ↗';
  font-size: 0.8em;
  color: #999;
}

/* アクションボタン */
.drawer-menu-list .action button {
  font-weight: bold;
  color: #fff;
}

.drawer-menu-list .action button:hover {
  background: #e8f5fe;
}

/* Xポストボタン（Twitter風デザイン） */
.x-post-btn {
  display: flex !important;
  align-items: center;
  gap: 8px;
  background: #000 !important;
  color: #fff !important;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 20px !important;
}

.x-post-btn:hover {
  background: #333 !important;
}

.x-post-btn .x-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* スマホ対応 */
@media (max-width: 768px) {
  .drawer-menu {
    width: 280px;
    right: -280px;
  }
}

/* body scroll lock */
body.drawer-open {
  overflow: hidden;
}

/* ヘッダーのposition調整（既存との整合性） */
.site-header {
  position: relative;
}

/* ページタイトルとハンバーガーボタンの衝突回避 */
.page-title {
  padding-right: 60px; /* ハンバーガーボタン分の余白 */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@media (max-width: 768px) {
  .page-title {
    padding-right: 55px;
    font-size: 1.2rem;
  }
}
