/* meem Docs カスタムスタイル */

/* ============================================
   ラクスムブランドカラー
   ============================================ */
:root {
  --rakusumu-primary: #4CAF82;
  --rakusumu-accent: #2D9B7A;
}

.md-header {
  background-color: var(--rakusumu-primary) !important;
}

/* ============================================
   ① ビューポート最適化
   Material for MkDocs が自動で
   <meta name="viewport" content="width=device-width, initial-scale=1">
   を出力するため追加設定は不要。
   以下はタッチ操作の最適化のみ。
   ============================================ */
a, button, .md-nav__link {
  -webkit-tap-highlight-color: transparent;
}

/* ============================================
   ② カードグリッド — レスポンシブ対応
   スマホ: 1列 / タブレット: 2列 / PC: 3列
   ============================================ */
.site-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}
@media screen and (min-width: 600px) {
  .site-grid { grid-template-columns: repeat(2, 1fr); }
}
@media screen and (min-width: 960px) {
  .site-grid { grid-template-columns: repeat(3, 1fr); }
}
.site-grid .site-card {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 8px;
  padding: 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.site-grid .site-card:hover {
  border-color: var(--md-accent-fg-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.site-grid .site-card a {
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

/* ============================================
   ③ フォントサイズ — スマホ最適化
   ============================================ */
@media screen and (max-width: 599px) {
  .md-typeset {
    font-size: 0.85rem;
  }
  .md-typeset h1 {
    font-size: 1.4rem;
  }
  .md-typeset h2 {
    font-size: 1.2rem;
  }
  .md-typeset h3 {
    font-size: 1.05rem;
  }
  .site-grid .site-card {
    padding: 12px;
  }
  .site-grid .site-card a {
    font-size: 0.85rem;
  }
}

/* ============================================
   ④ ナビゲーション — スマホ対応
   Material for MkDocs がハンバーガーメニューを
   自動提供するため、タップ領域の拡大のみ追加。
   ============================================ */
@media screen and (max-width: 76.1875em) {
  .md-nav__link {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    min-height: 44px;
  }
}

/* ============================================
   ⑤ テーブル — スマホ横スクロール対応
   ============================================ */
.md-typeset table:not([class]) {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}
@media screen and (max-width: 599px) {
  .md-typeset table:not([class]) th,
  .md-typeset table:not([class]) td {
    padding: 0.5em 0.8em;
    font-size: 0.8rem;
  }
}

/* ============================================
   ⑥ 検索結果の見た目改善・ハイライト
   ============================================ */
.md-search-result mark {
  background-color: #FFF176;
  color: inherit;
  padding: 0.05em 0.15em;
  border-radius: 2px;
}
[data-md-color-scheme="slate"] .md-search-result mark {
  background-color: #F9A825;
  color: #1a1a1a;
}
.md-search-result__item {
  border-left: 3px solid var(--rakusumu-primary);
  padding-left: 12px !important;
  margin-bottom: 8px;
}
.md-search-result__link {
  border-radius: 6px;
  padding: 8px 12px !important;
  transition: background-color 0.15s;
}
.md-search-result__link:hover {
  background-color: rgba(76, 175, 130, 0.08);
}
.md-search-result__meta {
  color: var(--md-default-fg-color--light);
  font-size: 0.7rem;
}
.md-search-result__teaser mark {
  font-weight: 600;
}
@media screen and (max-width: 599px) {
  .md-search__input {
    font-size: 16px;  /* iOS ズーム防止 */
    height: 48px;
  }
  .md-search-result__link {
    padding: 10px 8px !important;
  }
  .md-search-result__title {
    font-size: 0.85rem;
  }
  .md-search-result__teaser {
    font-size: 0.75rem;
  }
}

/* ============================================
   ⑦ タグ絞り込みフィルター
   ============================================ */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.tag-filter-btn {
  display: inline-block;
  padding: 6px 14px;
  border: 1.5px solid var(--md-default-fg-color--lighter);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: var(--md-default-fg-color--light);
  user-select: none;
}
.tag-filter-btn:hover {
  border-color: var(--rakusumu-primary);
  color: var(--rakusumu-primary);
}
.tag-filter-btn.active {
  background-color: var(--rakusumu-primary);
  border-color: var(--rakusumu-primary);
  color: #fff;
}
@media screen and (max-width: 599px) {
  .tag-filter-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
}

/* ============================================
   ⑧ 動画埋め込み（YouTube）
   サムネ表示 → クリックでその場再生
   ============================================ */
.video-embed {
  max-width: 640px;
  margin: 16px 0 24px;
}
.video-embed .video-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}
.video-embed .video-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}
.video-embed .video-wrap:hover img {
  opacity: 0.85;
}
/* 再生ボタン */
.video-embed .video-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 55% center;
  background-size: 32px;
  transition: transform 0.15s, background-color 0.15s;
}
.video-embed .video-wrap:hover::after {
  transform: translate(-50%, -50%) scale(1.1);
  background-color: rgba(29, 158, 117, 0.9);
}
/* iframe 再生中 */
.video-embed .video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-embed .video-wrap.playing::after {
  display: none;
}
.video-embed .video-wrap.playing img {
  display: none;
}
.video-embed .video-title {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--md-default-fg-color--light);
}

@media screen and (max-width: 599px) {
  .video-embed {
    max-width: 100%;
  }
  .video-embed .video-wrap::after {
    width: 48px;
    height: 48px;
    background-size: 24px;
  }
  .video-embed .video-title {
    font-size: 0.8rem;
  }
}
