/* =====================================================
    News show 用スタイル。
    一覧画面用 (`.news-index` / `.news-item-head` 等) は `_news_index.css`
    側にあり、本 file は show 画面 (`.news-show` / `.news-body` /
    `.news-footer-breadcrumb` / `.share-buttons--icon-only`) のみ扱う。
===================================================== */

/* =====================================================
    News / Show
===================================================== */
.news-show {
  width: 80vw;
  margin: 150px auto 5rem;
  padding: 0 5rem;
}

.news-show .breadcrumb-nav { margin-bottom: 0; }
.news-show .news-item-head { margin-left: .2rem; }

.news-show .news-item-subject {
  padding-top: .25rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid rgb(215, 215, 215);
}

.news-show .news-item-subject .news-title { font-size: 28px; font-weight: 600; }

.news-show .news-cover-image {
  display: flex;
  margin: 1rem auto 0.25rem;
}

.news-show .news-cover-image picture {
  width: 100%;
  height: auto;
}

.news-show .news-cover-image img {
  width: 100%;
  height: auto;
  border-radius: .25rem;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

/* --- タブレット以下 --- */
@media (max-width: 959px) {
  .news-show {
    width: 90vw;
    margin: 120px auto 2rem;
    padding: 0;
  }
}

/* --- モバイル --- */
@media (max-width: 519px) {
  .news-show .news-item-subject .news-title  { font-size: 22px; }
}

/* =====================================================
    マークダウン
===================================================== */
.news-body {
  margin: 2rem auto 4rem;
}

.news-body {
  font-size: 16px;
  line-height: 1.5;
  color: rgb(50, 50, 50);
  word-wrap: break-word;
  white-space: normal;
}

/* 段落: 段落間の余白は付けず、改行(空段落)を 1 行ずつそのまま見せる方針。 */
.news-body p {
  margin-block: 0;
  line-height: 1.85;
}
/* 空段落 (<p></p>) は中身が無く高さ 0 で潰れるため、nbsp で 1 行分の line box を
   与えて改行による空行をそのまま表示する(空行 n 個 = n 行ぶんの高さ)。 */
.news-body p:empty::before {
  content: "\00a0";
}

/* 見出し */
.news-body h1,
.news-body h2,
.news-body h3,
.news-body h4,
.news-body h5,
.news-body h6 {
  margin-top: 3rem;
  font-weight: bold;
  line-height: 1.3;
}
.news-body h1 { font-size: 2rem; }
.news-body h2 { font-size: 1.75rem; }
.news-body h3 { font-size: 1.5rem; }
.news-body h4 { font-size: 1.25rem; }
.news-body h5 { font-size: 1rem; }
.news-body h6 { font-size: 0.875rem; }

/* リスト */
.news-body ul,
.news-body ol {
  margin: 1rem 0 1rem 1.5rem;
  padding: 0;
}
.news-body li { margin: 0.5rem 0; }

/* ブロッククオート */
.news-body blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 4px solid #ccc;
  color: #666;
  background: #f9f9f9;
}

/* コード */
.news-body code {
  background: #f6f8fa;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: Menlo, Monaco, "Courier New", monospace;
  font-size: 0.9rem;
  overflow-x: auto;
}
.news-body pre {
  background: #f6f8fa;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 5px;
  margin: 1rem 0;
}

/* リンク */
.news-body a {
  color: #0366d6;
  text-decoration: none;
}
.news-body a:hover { text-decoration: underline; }

/* 画像 */
.news-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.75rem auto;
}

/* テーブル */
.news-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.news-body th,
.news-body td {
  border: 1px solid #ddd;
  padding: 0.5rem;
}
.news-body th { background: #f6f8fa; }

/* 水平線 */
.news-body hr {
  border: 0;
  height: 1px;
  background: #ddd;
  margin: 2rem 0;
}

/* 改行は余白なし */
.news-body br {
  display: inline;
  margin: 0;
}

/* 空行用スペーサー */
.news-body .md-gap {
  display: block;
  height: 1rem;
}

/* ハイライト */
.news-body mark { border-radius: 2px; padding: 0 2px; }

/* タスクリスト */
.news-body ul[data-type="taskList"] {
  list-style: none;
  margin-left: 0.5rem;
  padding: 0;
}

.news-body ul[data-type="taskList"] li[data-type="taskItem"] {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.3rem 0;
}

.news-body ul[data-type="taskList"] li[data-type="taskItem"] > label {
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.news-body ul[data-type="taskList"] li[data-type="taskItem"] > label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  pointer-events: none; /* 公開側は操作不可 */
}

.news-body ul[data-type="taskList"] li[data-type="taskItem"] > div { flex: 1; }

.news-body ul[data-type="taskList"] li[data-type="taskItem"][data-checked="true"] > div {
  text-decoration: line-through;
  color: #999;
}

/* YouTube 埋め込み。wrapper の inline style="width: NN%"(エディタで設定)を
   尊重して任意幅にできるよう、padding-bottom ハックではなく iframe 側の
   aspect-ratio で 16:9 を保つ(padding % は親幅基準で wrapper 縮小時に比率が
   崩れるため)。幅未指定(既存記事)は block 全幅。width 指定時は margin:auto で中央寄せ。 */
.news-body div[data-youtube-video] {
  margin: 1.5rem auto;
  max-width: 100%;
}

.news-body div[data-youtube-video] iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: none;
  border-radius: 4px;
}

/* --- タブレット以下 --- */
@media (max-width: 959px) {
  .news-body {
    margin: 1.5rem auto 3rem;
  }
  .news-body {
    font-size: 0.875rem;
  }

  .news-body img { margin-block: 0.5rem; }

  .news-body table {
    display: block;
    width: 100%;
    margin-block: 1rem;
  }

  .news-body pre { margin-block: 1rem; }
}

/* --- モバイル --- */
@media (max-width: 519px) {
  .news-body {
    margin: 1rem auto 2rem;
  }
  .news-body {
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .news-body h1,
  .news-body h2,
  .news-body h3,
  .news-body h4,
  .news-body h5,
  .news-body h6 {
    margin-block-start: 1.5rem;
    margin-block-end: 0.75rem;
  }

  .news-body h1 { font-size: 1.5rem; }
  .news-body h2 { font-size: 1.25rem; }
  .news-body h3 { font-size: 1.125rem; }

  .news-body ul,
  .news-body ol {
    margin-block: 0.75rem;
    padding-inline-start: 1rem;
  }

  .news-body li { margin-block: 0.4rem; }

  .news-body img { margin-block: 0.5rem; }
}

/* =====================================================
    記事下部パンくず
===================================================== */
.news-footer-breadcrumb {
  margin: 2rem -5rem 0;
  padding: 1.5rem 1rem;
  border-top: 1px solid rgb(215, 215, 215);
  border-bottom: 1px solid rgb(215, 215, 215);
}

.news-footer-breadcrumb .breadcrumb-nav {
  padding-left: 0;
}

.news-footer-breadcrumb .breadcrumb-nav .breadcrumb {
  color: rgb(125, 125, 125);
  font-size: 14px;

  display: flex;
  flex-wrap: nowrap;      /* 折り返さない */
  align-items: center;
  overflow: hidden;       /* はみ出しを隠す（ellipsisの前提） */
  gap: .2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 100%;        /* 念のため */
}

.news-footer-breadcrumb .breadcrumb-nav .breadcrumb .breadcrumb-item {
  white-space: nowrap;
  flex: 0 0 auto;       /* デフォは伸縮しない */
}

/* 最後の項目だけ伸縮＆省略記号 */
.news-footer-breadcrumb .breadcrumb-nav .breadcrumb .breadcrumb-item:last-child {
  flex: 1 1 auto;       /* 余白をここで吸収 */
  min-width: 0;         /* flex下でellipsisを効かせるのに必須 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 中身が a / span / strong 等でも省略されるよう保険 */
.news-footer-breadcrumb .breadcrumb-nav .breadcrumb .breadcrumb-item:last-child > * {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 区切り記号（行頭に来ないよう :after で後置） */
.news-footer-breadcrumb .breadcrumb-nav .breadcrumb .breadcrumb-item:not(:last-child)::after {
  content: "›";
  margin: 0 .25rem;
  flex: 0 0 auto;
}

/* before は無効化（念のため） */
.news-footer-breadcrumb .breadcrumb-nav .breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  content: none;
  margin: 0;
}

/* --- タブレット以下 --- */
@media (max-width: 959px) {
  .news-footer-breadcrumb {
    margin: 2rem -5vw 0;
  }

  .news-footer-breadcrumb .breadcrumb-nav .breadcrumb {
    font-size: 12px;
    gap: .2rem;
  }
  /* 区切りの間隔を少し詰める */
  .news-footer-breadcrumb .breadcrumb-nav .breadcrumb .breadcrumb-item:not(:last-child)::after { margin: 0 .2rem; }
}

/* --- モバイル --- */
@media (max-width: 519px) {
  .news-footer-breadcrumb {
    margin: 1rem -5vw 0;
    padding: 1.25rem 1rem;
    width: 100vw; /* 端まで広げる */
  }

  .news-footer-breadcrumb .breadcrumb-nav .breadcrumb {
    font-size: 10px;
    gap: .15rem;
  }

  /* さらに区切りを詰める */
  .news-footer-breadcrumb .breadcrumb-nav .breadcrumb .breadcrumb-item:not(:last-child)::after { margin: 0 .15rem; }
}

/* =====================================================
    SNSシェアボタン
===================================================== */
.share-buttons--icon-only {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  /* タイトル下線 (`.news-item-subject` border-bottom) と干渉しないよう
     breathing room を確保。 */
  margin-top: .75rem;
}

/* FA `fa-square-x-twitter` / `fa-square-facebook` は square 背景 + 白アイコン
   が glyph 内蔵デザインだったが、rails_icons + SimpleIcons 移行で素のロゴ
   SVG (透明背景 + brand color path) になり見た目が変わった。CSS 側で
   brand color の rounded square 背景 + 白アイコンを再現して旧 FA 同等の
   square button 体裁を回復する。 */
.share-buttons--icon-only .sb {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

.share-buttons--icon-only .sb:hover {
  opacity: .7;
  transform: translateY(-2px);
}

/* ブランドロゴは box に対して ~70% padding 入りで表示。 */
.share-buttons--icon-only .sb .sb-icon {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.share-buttons--icon-only .sb.sb-x        { background: #000;    }
.share-buttons--icon-only .sb.sb-facebook { background: #1877F2; }
.share-buttons--icon-only .sb.sb-line     { background: #00C300; }

/* シェアメニューはブランド色と並んだ時に主張しすぎないよう、塗りつぶしを外して
   透明背景 + 細枠 + outline icon の控えめな見た目に。 */
.share-buttons--icon-only .sb.sb-share {
  background: transparent;
  border: 1px solid #c0c0c0;
  color: #6c757d;
}
.share-buttons--icon-only .sb.sb-share .sb-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
}

/* ─────────── レスポンシブ ─────────── */
@media (max-width: 959px) {
  .share-buttons--icon-only {
    gap: 0.4rem;
    margin-top: .6rem;
  }
  .share-buttons--icon-only .sb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }
  .share-buttons--icon-only .sb .sb-icon {
    width: 22px;
    height: 22px;
  }
  .share-buttons--icon-only .sb.sb-share .sb-icon {
    width: 19px;
    height: 19px;
  }
}

@media (max-width: 519px) {
  .share-buttons--icon-only {
    gap: 0.3rem;
    margin-top: .5rem;
  }
  .share-buttons--icon-only .sb {
    width: 28px;
    height: 28px;
    border-radius: 5px;
  }
  .share-buttons--icon-only .sb .sb-icon {
    width: 18px;
    height: 18px;
  }
  .share-buttons--icon-only .sb.sb-share .sb-icon {
    width: 16px;
    height: 16px;
  }
}
