/* ================================================================
   page-article の共通タイポグラフィ
   h1/h2 は index.astro の .mission-title を基準に統一
   ================================================================ */

.page-article { padding: 0; }

/* --- h1 (ページタイトル) : h2 の自然な拡張 --------------------- */
/* .p_title は WP 由来の h1 クラス。素の h1 もカバーする */
.page-article h1,
.page-article .p_title {
  font-size: 2.6em;
  color: var(--brand-primary, #0655B4);
  background: #fff;
  border: none;
  letter-spacing: .06em;
  padding: 0 0 4px;
  margin: 10px 0 2px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}
/* サブタイトル (英字) */
.page-article .p_title_s {
  display: block;
  text-align: center;
  color: #0655B4;
  letter-spacing: .3em;
  font-size: .9em;
  font-style: italic;
  font-weight: 500;
  margin: 0 0 28px;
  opacity: .75;
}

/* --- h2 (セクション見出し) : mission-title の色・太さを踏襲しつつ
        セクション境界が分かるようにページ幅の淡い帯を敷く -------- */
.page-article h2,
.page-article .new_h2 {
  position: relative;
  font-size: 1.7em;
  color: var(--brand-primary, #0655B4);
  background: rgba(6, 85, 180, .04);
  border: none;
  letter-spacing: .05em;
  padding: 14px 20px 14px 26px;
  margin: 48px -20px 24px;
  font-weight: 700;
  line-height: 1.3;
  border-radius: 0 6px 6px 0;
}
.page-article h2::before,
.page-article .new_h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(
    180deg,
    #e74c3c 0%,
    #f39c12 16%,
    #f1c40f 32%,
    #2ecc71 48%,
    #3498db 64%,
    #5b6ee1 82%,
    #e056fd 100%
  );
  border-radius: 2px 0 0 2px;
}
.page-article .new_h2 .h2_line,
.page-article .new_h2 p.h2_line {
  display: inline;
  margin: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

/* --- h3 以降は少し小さく段階的に ------------------------------- */
.page-article h3 {
  font-size: 1.35em;
  color: #1a2633;
  margin: 30px 0 14px;
  font-weight: 600;
  letter-spacing: .04em;
}
.page-article h4 {
  font-size: 1.1em;
  margin: 22px 0 10px;
  font-weight: 600;
}

/* ================================================================
   SiteOrigin Panels 由来のカードグリッド
   PDF 書影などの並び。縦一列にならないよう強制
   ================================================================ */

.entry-body .panel-layout { width: 100%; }
.entry-body .panel-grid,
.entry-body div.panel-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
  gap: 28px 24px !important;
  margin: 0 0 32px !important;
  float: none !important;
  clear: both;
}
/* library 等: .panel-row-style (pc_library_line / sp_library_line) が
   panel-grid と cell の間に挟まっているケース */
.entry-body .panel-grid.panel-has-style {
  display: block !important;
}
.entry-body .panel-row-style {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
  gap: 28px 24px !important;
  width: 100%;
  margin: 0 0 32px !important;
}
/* モバイル用の重複行は PC では非表示、PC用は SP で非表示 */
.entry-body .sp_library_line { display: none !important; }
@media (max-width: 780px) {
  .entry-body .pc_library_line { display: none !important; }
  .entry-body .sp_library_line { display: grid !important; }
}
.entry-body .panel-grid-cell,
.entry-body div.panel-grid-cell {
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  display: block !important;
}
.entry-body .panel-grid-cell-empty { display: none !important; }

.entry-body .panel-grid-cell .so-panel,
.entry-body .panel-grid-cell .widget_text,
.entry-body .panel-grid-cell .widget {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

.entry-body .so-widget-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 496/720;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08);
  transition: transform .25s ease, box-shadow .25s ease;
  background: #fff;
}
.entry-body .panel-grid-cell a:hover .so-widget-image {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 24px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.1);
}
.entry-body .bn_title {
  margin: 10px 0 0;
  font-size: 0.88em;
  color: #333;
  text-align: center;
  line-height: 1.4;
  font-weight: 500;
}

/* 写真 + 文章の2カラム行(introduction など): 画像列を固定幅、文章を残り */
.entry-body .panel-grid:has(> .panel-grid-cell:nth-child(2):last-child):has(.widget_media_image) {
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) !important;
  gap: 24px !important;
  align-items: start;
}
@media (max-width: 780px) {
  .entry-body .panel-grid:has(> .panel-grid-cell:nth-child(2):last-child):has(.widget_media_image) {
    grid-template-columns: 1fr !important;
  }
}

/* 単独行(カードが無い)の panel-grid は普通のブロックに */
.entry-body .panel-grid:has(> .panel-grid-cell:only-child) {
  display: block !important;
  grid-template-columns: none !important;
}

/* ================================================================
   Markdown の直下 ul をタイル (library のような一覧ページ用)
   ================================================================ */
.page-article > ul,
.page-article .entry-content > ul {
  list-style: none;
  padding: 0;
  margin: 0 0 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.page-article > ul > li,
.page-article .entry-content > ul > li {
  margin: 0;
  padding: 0;
}
.page-article > ul > li > a,
.page-article .entry-content > ul > li > a {
  display: block;
  padding: 16px 18px;
  background: #fff;
  border-radius: 8px;
  text-decoration: none;
  color: #1a2633;
  font-weight: 500;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  border-left: 3px solid var(--brand-primary, #0655B4);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.page-article > ul > li > a:hover,
.page-article .entry-content > ul > li > a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  border-left-color: #e74c3c;
  color: var(--brand-primary, #0655B4);
}

/* ================================================================
   刊行物ハブ (publication.md の最新号プレビューカード)
   ================================================================ */
.pub-hub {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  margin: 0 0 40px;
}
.pub-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #1a2633;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: transform .2s, box-shadow .2s;
}
.pub-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,.14);
}
.pub-thumb {
  aspect-ratio: 496/720;
  overflow: hidden;
  background: #f0f4f9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pub-thumb--text {
  background: linear-gradient(135deg, var(--brand-primary, #0655B4), #0a7bd9);
  color: #fff;
  font-size: 1.4em;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .08em;
  text-align: center;
}
.pub-caption {
  padding: 14px 16px 16px;
  border-top: 3px solid var(--brand-primary, #0655B4);
}
.pub-section { font-weight: 700; font-size: 1em; color: #1a2633; margin-bottom: 4px; }
.pub-latest { font-size: .82em; color: #666; }

/* ================================================================
   ロールモデル集などのボタン
   ================================================================ */
.entry-body .btn_model {
  display: block;
  background: linear-gradient(135deg, var(--brand-primary, #0655B4), #0a7bd9);
  color: #fff;
  text-align: center;
  padding: 22px;
  border-radius: 8px;
  font-weight: bold;
  text-decoration: none;
  letter-spacing: .05em;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
.entry-body .btn_model:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
}

/* ================================================================
   レスポンシブ
   ================================================================ */
@media (max-width: 780px) {
  .entry-body .panel-grid,
  .entry-body div.panel-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 20px 16px !important;
  }
  .page-article h1,
  .page-article .p_title { font-size: 2em; }
  .page-article h2,
  .page-article .new_h2 { font-size: 1.6em; }
}

/* --- PDF thumbnail tiles (publication detail pages) --- */
.pub-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 28px 24px;
  margin: 0 0 40px;
}
.pub-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #1a2633;
  transition: transform .2s;
}
.pub-item:hover { transform: translateY(-4px); }
.pub-item-thumb {
  aspect-ratio: 496/720;
  overflow: hidden;
  background: #f0f4f9;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08);
  transition: box-shadow .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pub-item:hover .pub-item-thumb {
  box-shadow: 0 12px 24px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.1);
}
.pub-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pub-item-thumb--fallback {
  background: linear-gradient(135deg, var(--brand-primary, #0655B4), #0a7bd9);
  color: #fff;
  font-size: 1.6em;
  font-weight: 700;
  letter-spacing: .1em;
}
.pub-item-title {
  margin-top: 10px;
  font-size: .85em;
  line-height: 1.45;
  color: #333;
  text-align: center;
  font-weight: 500;
}
@media (max-width: 780px) {
  .pub-list { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 16px; }
}

.pub-item-title { display: flex; flex-direction: column; gap: 2px; }
.pub-item-vol { font-size: .75em; color: #0655B4; letter-spacing: .08em; font-weight: 600; }
.pub-item-affiliation { font-size: .78em; color: #666; }
.pub-item-name { font-size: 1em; color: #1a2633; font-weight: 600; margin-top: 2px; }

/* ================================================================
   Global mobile responsiveness hardening
   - Prevent horizontal overflow from long strings, wide tables,
     embedded media and fixed-width WP grids.
   ================================================================ */
.entry-body,
.entry-content,
.page-article { max-width: 100%; }
.entry-body img,
.entry-content img,
.page-article img { max-width: 100%; height: auto; }
.entry-body iframe,
.entry-content iframe { max-width: 100%; }

/* Tables overflow horizontally on mobile rather than break layout */
.entry-body table,
.entry-content table {
  max-width: 100%;
}
@media (max-width: 780px) {
  .entry-body .su-table,
  .entry-body .su-table-responsive,
  .entry-body table,
  .entry-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .entry-body table,
  .entry-content table { white-space: nowrap; }
  .entry-body .su-tabs-nav { flex-wrap: wrap; }
  .entry-body .su-tabs-nav span { flex: 0 0 auto; }
}

/* Tablet / large-phone breakpoint ------------------------------- */
@media (max-width: 780px) {
  .page-article h2,
  .page-article .new_h2 {
    font-size: 1.35em;
    padding: 12px 14px 12px 20px;
    margin: 36px -12px 18px;
  }
  .page-article h3 { font-size: 1.2em; }
  .pub-hub { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
  .page-article > ul,
  .page-article .entry-content > ul {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
  }
}

/* Small phone breakpoint (iPhone SE / standard smartphones) ----- */
@media (max-width: 480px) {
  .mainContent { padding: 18px 14px !important; }
  .page-article h1,
  .page-article .p_title { font-size: 1.6em; letter-spacing: .04em; }
  .page-article .p_title_s { font-size: .78em; letter-spacing: .22em; margin-bottom: 20px; }
  .page-article h2,
  .page-article .new_h2 {
    font-size: 1.15em;
    padding: 10px 12px 10px 16px;
    margin: 28px -14px 16px;
    line-height: 1.35;
  }
  .page-article h3 { font-size: 1.05em; margin: 22px 0 10px; }
  .page-article h4 { font-size: 1em; }
  .entry-body .panel-grid,
  .entry-body div.panel-grid,
  .entry-body .panel-row-style {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px 12px !important;
  }
  .pub-list,
  .pub-hub {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
  }
  .page-article > ul,
  .page-article .entry-content > ul {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .entry-body .bn_title,
  .pub-item-title { font-size: .78em; }
  .pub-caption { padding: 10px 12px 12px; }
}

/* ================================================================
   ロールモデル プロフィール (Markdown 新形式)
   ================================================================ */
.rm-profile { margin-bottom: 32px; }
.rm-theme {
  text-align: center;
  font-size: 1.3em;
  color: var(--brand-primary, #0655B4);
  font-weight: 600;
  margin: 0 0 24px;
  line-height: 1.5;
  padding: 18px 20px;
  background: rgba(6, 85, 180, .04);
  border-radius: 8px;
}
.rm-header {
  display: grid;
  grid-template-columns: minmax(180px, 300px) 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 28px;
}
.rm-photo img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.rm-affiliation {
  margin: 0 0 4px;
  font-size: .95em;
  color: #444;
}
.rm-name {
  font-size: 1.5em;
  font-weight: 700;
  margin: 0 0 16px;
  color: #1a2633;
}
.rm-role {
  font-size: .7em;
  font-weight: 400;
  color: #666;
}
.rm-detail { margin-bottom: 10px; }
.rm-label {
  margin: 0;
  font-weight: 600;
  font-size: .85em;
  color: #444;
}
.rm-value {
  margin: 0;
  font-size: .82em;
  color: #555;
  line-height: 1.6;
}
.rm-style {
  margin: 24px 0;
  text-align: center;
}
.rm-style img {
  max-width: 100%;
  height: auto;
}
.rm-published {
  text-align: right;
  font-size: .85em;
  color: #666;
  margin-top: 32px;
}
@media (max-width: 780px) {
  .rm-header { grid-template-columns: 1fr; }
  .rm-photo { max-width: 280px; }
  .rm-name { font-size: 1.3em; }
}

/* Very narrow (< 360px) — fold to single column ----------------- */
@media (max-width: 360px) {
  .entry-body .panel-grid,
  .entry-body div.panel-grid,
  .entry-body .panel-row-style,
  .pub-list,
  .pub-hub {
    grid-template-columns: 1fr !important;
  }
  .page-article h1,
  .page-article .p_title { font-size: 1.4em; }
}
