/* ==========================================================================
   03 お知らせページ 専用CSS
   構成：①ファーストビュー（見出し＋お知らせ一覧、背景ベージュ） ②白い余白
        ③Heroアクセント（subpage.css） ④フッター
   ・style.css / subpage.css のトークンを継承する
   ・一覧UI（.news-list 等）自体は style.css で定義済みのものをそのまま使用し、
     ここでは「行をクリック可能にする」「フォーカス表示」など03固有の追加分のみを記述する
   ・お知らせ詳細モーダル（.news-modal 等）は、02のイベント詳細モーダル
     （events.css の .event-modal）と同じ寸法・タイポグラフィを踏襲した専用実装
   ・TOPページ・02ページ（index.html / events.html / style.css / events.css）は変更しない
   ========================================================================== */

:root {
  --color-accent-warm: #880015;
}

/* --------------------------------------------------------------------------
   このページには右側固定ナビ（TOPページ内セクション移動用）が無いため、
   style.css 側で確保されている余白（body の padding-right）と
   フッターの相殺マージンを、このページ内でのみ解除する（02と同じ対応）。
   ※ style.css 自体は変更しない
   -------------------------------------------------------------------------- */
body {
  padding-right: 0;
}
.site-footer {
  margin-right: 0;
  padding-right: clamp(24px, 5vw, 64px);
}

/* --------------------------------------------------------------------------
   左（見出し）と右（一覧）の間の余白を03ページのみ狭め、一覧側を広く使う
   ・style.css 側の .section__container--split（左260〜380px／gap 48〜96px）は
     TOP・02ページ共通のため変更せず、03ページ内でのみ gap を上書きする
   -------------------------------------------------------------------------- */
.subpage-intro .section__container--split {
  gap: clamp(16px, 1.8vw, 28px);
}

/* --------------------------------------------------------------------------
   お知らせ一覧：行全体をクリック可能にする
   ・.news-list / .news-list__item 等の見た目（グリッド・余白・罫線・ドット色）は
     style.css で定義済みのものをそのまま使用する（TOPページと共通）
   ・03ページでは各行の内容を <button class="news-list__item"> でラップし、
     行全体をクリック／キーボード操作可能にする
   -------------------------------------------------------------------------- */
.news-list__item {
  display: grid; /* style.css の .news-list__item と同じグリッド定義を button 要素にも適用 */
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding-left: 1em;
  padding-right: 1em;
  border-bottom: 0.5px solid var(--color-border);
}
.news-list__item:focus-visible {
  outline: 2px solid var(--color-accent-warm);
  outline-offset: -2px;
}

/* 日付の下に表示する、筆で水彩ラインを描くようなhoverアニメーション。
   通常時は非表示にしておき、行にマウスを合わせた（または focus した）ときのみ
   ・水彩ストロークが左→右へ「描かれる」ように伸びる（overflow:hiddenの器を広げて見せる手法）
   ・ストロークの先端を筆の画像が追従する
   ・ホバーを外すと素早く元の状態に戻る */
.news-list__date-wrap {
  position: relative;
  display: inline-block;
}
.news-list__date-mark {
  position: absolute;
  left: -17px; /* 日付テキストの半文字（約9px）分ほど手前から描き始める */
  bottom: -6px;
  width: 128px;
  height: 20px;
  pointer-events: none; /* マークをクリックしても行のクリック判定を妨げない */
}
.news-list__date-mark-reveal {
  position: absolute;
  inset: 0;
  width: 0%;
  overflow: hidden;
  transition: width 0.72s cubic-bezier(0.22, 0.72, 0.24, 1);
}
.news-list__date-mark-stroke {
  display: block;
  width: 128px;
  height: 20px;
  object-fit: fill; /* 素材の縦横比よりも、日付の下に自然に収まる横長サイズを優先する */
  opacity: 0.85;
  mix-blend-mode: multiply; /* 背景に馴染ませ、水彩のような透け感を出す */
}
.news-list__item:hover .news-list__date-mark-reveal,
.news-list__item:focus-visible .news-list__date-mark-reveal {
  width: 100%;
}
.news-list__date-mark-pen {
  position: absolute;
  left: -14px;
  top: -9px;
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0;
  transform: rotate(-10deg) translateY(1px);
  /* ホバーを外したときに素早く元へ戻すためのtransition。
     ホバー中はkeyframesアニメーションが優先されるため、この指定は
     アニメーション終了後（マウスが離れたとき）にのみ働く */
  transition: left 0.18s ease, opacity 0.12s ease, transform 0.18s ease;
}
.news-list__item:hover .news-list__date-mark-pen,
.news-list__item:focus-visible .news-list__date-mark-pen {
  animation: news-date-mark-pen-draw 0.72s cubic-bezier(0.22, 0.72, 0.24, 1)
    forwards;
}
/* 筆が線の先端を追いかけ、描き終わったタイミングでフェードアウトする */
@keyframes news-date-mark-pen-draw {
  0% {
    opacity: 0;
    left: -14px;
    transform: rotate(-10deg) translateY(1px);
  }
  12% {
    opacity: 1;
  }
  82% {
    opacity: 1;
    left: 112px;
    transform: rotate(-7deg) translateY(-1px);
  }
  100% {
    opacity: 0;
    left: 112px;
    transform: rotate(-7deg) translateY(-1px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .news-list__date-mark-reveal,
  .news-list__date-mark-pen {
    transition: none;
  }
  .news-list__item:hover .news-list__date-mark-pen,
  .news-list__item:focus-visible .news-list__date-mark-pen {
    animation: none;
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   行間の罫線が二重に見える不具合の修正
   ・各行を <li><button class="news-list__item"></button></li> という構造にした結果、
     style.css の `.news-list__item:first-child { border-top: ... }` が
     「liの中で唯一のbutton＝常にfirst-child」に該当し、意図せず全行に
     border-topが付いてしまっていた（前の行のborder-bottomと重なって太く見えていた）
   ・ここで一旦全行のborder-topを打ち消し、リスト全体の本当の最初の行にのみ、
     より詳細度の高いセレクタで改めてborder-topを付け直す
   -------------------------------------------------------------------------- */
.news-list__item:first-child {
  border-top: none;
}
.news-list > li:first-child > .news-list__item {
  border-top: 0.5px solid var(--color-border);
}

/* --------------------------------------------------------------------------
   タイトルの視認性を高める（TOPページの.news-list__textと同じ対応）
   ・色（#222222）・フォントサイズ（16px）は style.css の既定で目標値を
     満たしているため据え置き、body既定の font-weight: 300 により
     文字が細く見える点のみ補正する
   -------------------------------------------------------------------------- */
.news-list__text {
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   お知らせ詳細モーダル
   ・寸法・タイポグラフィ・余白は 02 の .event-modal（events.css）を踏襲
   ・表示順は system-spec.md §9-4 のとおり：
     公開日 → （区切り線） → タイトル → カテゴリー（ドット表示） → 本文 → （イベント投稿のみ）02への導線リンク
   -------------------------------------------------------------------------- */
.news-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background-color: rgba(34, 34, 34, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.news-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.news-modal-overlay[hidden] {
  display: flex; /* JSで opacity 制御するため、hidden解除のタイミングはJS側で管理 */
}

.news-modal {
  position: relative;
  background-color: #FFFFFF;
  width: 74%;
  max-width: 600px;
  max-height: 84vh;
  overflow-y: auto;
  border-radius: 4px;
  padding: clamp(32px, 5vw, 44px) clamp(28px, 5vw, 48px) clamp(36px, 5vw, 44px);
  box-shadow: 0 8px 28px rgba(34, 34, 34, 0.18);
  transform: translateY(8px);
  transition: transform 0.25s ease;
}
.news-modal-overlay.is-open .news-modal {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .news-modal-overlay,
  .news-modal {
    transition: none;
  }
}

.news-modal__close {
  position: absolute;
  top: 18px;
  right: 20px;
  font-size: 20px;
  line-height: 1;
  color: var(--color-accent-warm);
  padding: 8px;
}

.news-modal__date {
  font-family: var(--font-serif-en);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.news-modal__divider {
  width: 100%;
  height: 0.5px;
  background-color: var(--color-accent-warm);
  margin-bottom: 20px;
}

.news-modal__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(20px, 2.6vw, 24px);
  line-height: 1.55;
  color: var(--color-text);
  margin: 0 0 12px;
}

.news-modal__category {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--color-text);
  margin-bottom: 24px;
}
.news-modal__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--color-dot-red); /* 既定値。カテゴリー種別に応じて修飾クラスで上書き */
}
.news-modal__category--news .news-modal__dot { background-color: var(--color-dot-red); }
.news-modal__category--event .news-modal__dot { background-color: var(--color-dot-blue); }
.news-modal__category--health .news-modal__dot { background-color: var(--color-dot-green); }
.news-modal__category--seminar .news-modal__dot { background-color: var(--color-dot-yellow); }

.news-modal__body {
  font-size: 14px;
  line-height: 1.9;
  color: #333333;
  margin: 0;
  white-space: pre-line;
}

/* お知らせ本文の下に表示する関連リンク群
   ・ポスター等の添付ファイルがある場合：02と同じ「ポスターを見る」ボタン（実線ボックス）
   ・Category＝研修会・イベントの投稿の場合：02ページへの控えめなテキストリンク
   ・どちらも任意項目のため、無い場合は要素ごと表示しない */
.news-modal__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

/* 「ポスターを見る」：02の .event-modal__poster-btn と同じ見た目（実線ボックス） */
.news-modal__poster-btn {
  display: inline-block;
  border: 0.5px solid var(--color-accent-warm);
  color: var(--color-accent-warm);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 2px;
}
.news-modal__poster-btn[hidden] {
  display: none;
}

/* Category＝研修会・イベント の投稿にのみ表示する、02ページへの控えめなテキストリンク。
   02モーダルの「ポスターを見る」ボタン（実線ボックス）より弱いトーンにするため、
   下線付きのテキストリンクのみとする */
.news-modal__event-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0; /* margin-topは親の .news-modal__actions 側で一括管理する */
  color: var(--color-accent-warm);
  font-size: 13px;
  border-bottom: 1px solid var(--color-accent-warm);
  padding-bottom: 3px;
  width: fit-content;
}
/* display: inline-flex の指定が、hidden属性によるブラウザ標準の非表示指定
   （[hidden]{ display:none }）と詳細度で競合してしまうため、明示的に上書きする。
   これが無いと、Category＝NEWSの投稿でもリンクが常に表示されてしまう */
.news-modal__event-link[hidden] {
  display: none;
}
.news-modal__event-link-icon {
  transition: transform 0.25s ease;
}
.news-modal__event-link:hover .news-modal__event-link-icon,
.news-modal__event-link:focus-visible .news-modal__event-link-icon {
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  .news-modal__event-link-icon {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   レスポンシブ：スマートフォン（〜767px）
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .news-modal-overlay {
    padding: 0;
  }
  .news-modal {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
  }
}