/* ============================================================
   macroscope — 経済を俯瞰する学習ノート 専用スタイル
   styles.css と subpage.css の補強として読み込まれる。
   tplybook.css を下敷きに、アクセントを「経済・金融」らしい紺青に。
   ============================================================ */

:root {
  --ms-accent: #2b5f8c;     /* 紺青：リンク・ラベル */
  --ms-accent-dark: #1f4a6e;
  --ms-up: #c0392b;         /* 上昇（株は赤・債券利回りも） */
  --ms-down: #1f8a5b;       /* 下落（緑） */
}

/* ----- 全体 ----- */
.ms-narrow {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* ----- subhero の上書き ----- */
.subhero-title {
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.4;
  letter-spacing: -0.01em;
}
@media (max-width: 640px) {
  .subhero-title { font-size: 23px; line-height: 1.5; }
}
.subhero-kicker {
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.06em;
}
@media (max-width: 640px) {
  .subhero-kicker { font-size: 12px; }
}

/* ----- カバー画像 ----- */
.ms-cover { margin: -2rem 0 2.5rem; }
.ms-cover img {
  width: 100%; height: auto; display: block;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   一覧：イントロ
   ============================================================ */
.ms-list { padding: 3rem 0 4.5rem; }
.ms-list-intro {
  max-width: 760px;
  margin: 0 auto 2.4rem;
  font-size: 1.02rem;
  line-height: 1.95;
  color: #555;
  letter-spacing: 0.02em;
}

/* ============================================================
   主要指標パネル
   ============================================================ */
.ms-indicators {
  max-width: 960px;
  margin: 0 auto 3rem;
  padding: 1.6rem 1.6rem 1.4rem;
  background: linear-gradient(180deg, #f7f9fc 0%, #f1f5fa 100%);
  border: 1px solid #e1e8f0;
  border-radius: 14px;
}
.ms-indicators-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.ms-indicators-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ms-accent-dark);
  margin: 0;
  letter-spacing: 0.02em;
}
.ms-indicators-updated {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: #8a97a6;
  text-transform: uppercase;
}
.ms-indicators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
}
.ms-indicator {
  background: #fff;
  border: 1px solid #e6ecf3;
  border-radius: 10px;
  padding: 0.9rem 1rem 1rem;
}
.ms-indicator-name {
  font-size: 0.8rem;
  color: #5a6b7d;
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}
.ms-indicator-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 500;
  color: #1a2733;
  line-height: 1.2;
}
.ms-indicator-unit {
  font-size: 0.7rem;
  color: #93a1b0;
  margin-left: 0.25em;
  font-family: 'Noto Sans JP', sans-serif;
}
.ms-indicator-delta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  margin-top: 0.35rem;
}
.ms-indicator-delta.is-up   { color: var(--ms-up); }
.ms-indicator-delta.is-down { color: var(--ms-down); }
.ms-indicator-delta.is-flat { color: #93a1b0; }
.ms-indicator-asof {
  color: #a6b1bd;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.ms-indicator-comment {
  margin-top: 0.55rem;
  font-size: 0.76rem;
  line-height: 1.6;
  color: #6b7886;
}
.ms-indicators-note {
  margin: 1.1rem 0 0;
  font-size: 0.76rem;
  color: #8a97a6;
  line-height: 1.6;
}

/* 赤帯（ヒーローの三角）の上にパネルを乗せる版 */
/* ポータルヘッダー移行対応: 旧固定ヘッダー用の逃がし(104px/92px)は
   subpage.css の .subhero 本体（非固定ヘッダー想定の100px/50px）で
   すでにカバーされるため、subhero本体と揃える。 */
.subhero--ms { padding-top: 100px; }
@media (max-width: 640px) {
  .subhero--ms { padding-top: 50px; }
}
.ms-hero-strip {
  position: relative;
  z-index: 2;
  max-width: 940px;
  margin: 0 auto 1.4rem;
}
.ms-indicators--onred {
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.ms-indicators--onred .ms-indicators-head { margin-bottom: 0.9rem; }
.ms-indicators--onred .ms-indicators-title { color: #fff; }
.ms-indicators--onred .ms-indicators-updated { color: rgba(255, 255, 255, 0.85); }
.ms-indicators--onred .ms-indicators-note { color: rgba(255, 255, 255, 0.92); margin-top: 0.8rem; }
.ms-indicators--onred .ms-indicator {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

/* macroscope 紹介文：白いタイトルカード内（タイトル直下） */
.ms-hero-intro {
  margin: 1.1rem 0 0;
  font-size: 0.98rem;
  line-height: 1.85;
  color: #4a4a4a;
  letter-spacing: 0.02em;
}
@media (max-width: 640px) {
  .ms-hero-intro { font-size: 0.92rem; line-height: 1.8; }
}

/* ============================================================
   一覧：記事数・グリッド・カード
   ============================================================ */
.ms-list-count {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--ms-accent);
  text-transform: uppercase;
}
.ms-list-count::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--ms-accent);
}

/* ----- スレッド（タイムライン）形式の一覧 ----- */
.ms-thread {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 760px;
}
.ms-thread-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #aab6c2;
  margin: 0 0 0.4rem;
  padding-left: 96px;
}
@media (max-width: 560px) {
  .ms-thread-year { padding-left: 0; }
}

.ms-thread-item { margin: 0; }
.ms-thread-link {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 1.2rem;
  text-decoration: none;
  color: inherit;
  padding: 1.3rem 0.6rem 1.3rem 0;
  position: relative;
}

/* 左の日付レール（縦線＋ドット） */
.ms-thread-rail {
  position: relative;
  text-align: right;
  padding-right: 1.2rem;
  border-right: 2px solid #e6ecf3;
}
.ms-thread-dot {
  position: absolute;
  right: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ms-accent);
  transition: background 0.18s ease, transform 0.18s ease;
}
.ms-thread-link:hover .ms-thread-dot {
  background: var(--ms-accent);
  transform: scale(1.15);
}
.ms-thread-date {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 500;
  color: #33424f;
  line-height: 1.1;
}
.ms-thread-wd {
  display: block;
  font-size: 0.72rem;
  color: #9aa6b2;
  margin-top: 0.2rem;
}

/* 右の本文 */
.ms-thread-body { padding-top: 0.1rem; }
.ms-thread-meta {
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin-bottom: 0.45rem;
}
.ms-thread-cat {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ms-accent);
  background: #eef3f9;
  border-radius: 999px;
  padding: 0.18em 0.7em;
}
.ms-thread-fulldate {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #aab6c2;
  letter-spacing: 0.03em;
}
.ms-thread-title {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.55;
  color: #1a1a1a;
  margin: 0 0 0.5rem;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}
.ms-thread-link:hover .ms-thread-title { color: var(--ms-accent); }
.ms-thread-excerpt {
  font-size: 0.92rem;
  line-height: 1.8;
  color: #5f6b77;
  margin: 0 0 0.7rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ms-thread-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0; padding: 0;
}
.ms-thread-tags li {
  font-size: 0.74rem;
  color: #788694;
  background: #f2f5f9;
  border-radius: 999px;
  padding: 0.2em 0.7em;
}

/* 最後の項目だけ縦線を短く（ぶら下がりを防ぐ） */
.ms-thread-item:last-child .ms-thread-rail::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 18px;
  bottom: -1.3rem;
  width: 2px;
  background: #fff;
}

@media (max-width: 560px) {
  .ms-thread-link {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid #eef2f6;
  }
  .ms-thread-rail {
    text-align: left;
    border-right: 0;
    padding-right: 0;
    display: flex;
    align-items: baseline;
    gap: 0.5em;
  }
  .ms-thread-dot { display: none; }
  .ms-thread-date { font-size: 0.95rem; }
  .ms-thread-wd { margin-top: 0; }
}

.ms-empty {
  max-width: 540px;
  margin: 2rem auto;
  padding: 3rem 2rem;
  text-align: center;
  border: 1px dashed #cdd7e1;
  border-radius: 12px;
  color: #888;
}
.ms-empty h3 { font-size: 1.2rem; color: #555; margin: 0 0 0.6rem; }

/* ============================================================
   記事本文
   ============================================================ */
.ms-article { padding: 2rem 0 4rem; }
.ms-prose {
  font-size: 1.0625rem;
  line-height: 1.95;
  color: #2a2a2a;
  letter-spacing: 0.02em;
}
.ms-prose h2, .ms-prose h3, .ms-prose h4, .ms-prose h5, .ms-prose h6 {
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: #1a1a1a;
}
.ms-prose h2 {
  font-size: 1.5rem;
  margin: 2.8em 0 0.7em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid #eaf0f6;
}
.ms-prose h3 { font-size: 1.22rem; margin: 2.0em 0 0.6em; color: var(--ms-accent-dark); }
.ms-prose h4 { font-size: 1.06rem; margin: 1.7em 0 0.5em; color: #333; }
.ms-prose > *:first-child { margin-top: 0; }
.ms-prose p { margin: 1.4em 0; }

/* 強調 — 赤文字＋マーカー風（tplybook と揃える） */
.ms-prose strong {
  font-weight: 700;
  color: #d6453f;
  background: linear-gradient(transparent 62%, rgba(255, 220, 100, 0.45) 62%);
  padding: 0 0.05em;
}
.ms-prose em { font-style: italic; color: #444; }

.ms-prose a {
  color: var(--ms-accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(43, 95, 140, 0.35);
  transition: border-color 0.15s, color 0.15s;
  padding-bottom: 1px;
}
.ms-prose a:hover {
  color: var(--ms-accent-dark);
  border-bottom-color: rgba(43, 95, 140, 0.9);
}

.ms-prose ul, .ms-prose ol { margin: 1.4em 0; padding-left: 1.6em; }
.ms-prose li { margin: 0.5em 0; }

.ms-prose code {
  background: #f1f4f8;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ms-accent-dark);
}
.ms-prose pre {
  background: #1e1e26;
  color: #e8e8ec;
  padding: 1.3em 1.5em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.8em 0;
  font-size: 0.9rem;
  line-height: 1.75;
}
.ms-prose pre code { background: transparent; padding: 0; color: inherit; font-size: inherit; }

.ms-prose hr {
  border: 0;
  border-top: 1px solid #cdd7e1;
  width: 80px;
  margin: 3.5em auto;
}

/* 引用 — 経済ノートでは「用語メモ」「今日のひとこと」に使う想定 */
.ms-prose blockquote {
  border-left: 4px solid var(--ms-accent);
  padding: 0.6em 1.4em;
  margin: 1.8em 0;
  color: #44505c;
  background: #f6f9fc;
  border-radius: 0 8px 8px 0;
}
.ms-prose blockquote p { margin: 0.6em 0; }

/* テーブル — 指標表で多用するので見やすく */
.ms-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.8em 0;
  font-size: 0.95rem;
}
.ms-prose th, .ms-prose td {
  border: 1px solid #e2e8ef;
  padding: 0.65em 0.95em;
  text-align: left;
  vertical-align: top;
}
.ms-prose th { background: #eef3f9; font-weight: 700; color: #2a3a48; }
.ms-prose tbody tr:nth-child(even) td { background: #fafbfd; }

.ms-prose .lesson-figure { margin: 2.2em 0; }
.ms-prose .lesson-figure img, .ms-prose .lesson-figure video {
  width: 100%; height: auto; display: block; border-radius: 6px;
}
.ms-prose .lesson-figure figcaption {
  margin-top: 0.7em; font-size: 0.88rem; color: #888; text-align: center;
}

/* タグリスト */
.ms-tag-list {
  list-style: none;
  padding: 0;
  margin: 3.5em 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.ms-tag {
  display: inline-block;
  padding: 0.3em 0.95em;
  background: #eef2f7;
  border-radius: 999px;
  font-size: 0.85rem;
  color: #5a6b7d;
  letter-spacing: 0.02em;
}

/* ============================================================
   一覧ツール（用語集リンクなど）
   ============================================================ */
.ms-list-tools {
  margin: 0 0 2.4rem;
  text-align: center;
}
.ms-glossary-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.6em 1.1em;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
  background: #fff;
  color: var(--ms-accent-dark);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.ms-glossary-link:hover {
  background: #f1f6fb;
  border-color: var(--ms-accent);
  transform: translateY(-1px);
}

/* ============================================================
   経済用語ノート（用語集）
   ============================================================ */
.ms-gloss { padding: 2.5rem 0 4rem; }
.ms-gloss-intro {
  font-size: 1.0rem;
  line-height: 1.9;
  color: #555;
  margin: 0 0 1.8rem;
}
.ms-gloss-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.2rem;
  flex-wrap: wrap;
}
.ms-gloss-search {
  flex: 1 1 280px;
  padding: 0.7em 1em;
  border: 1px solid #d7e0ea;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #2a3a48;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ms-gloss-search:focus {
  outline: none;
  border-color: var(--ms-accent);
  box-shadow: 0 0 0 3px rgba(43, 95, 140, 0.12);
}
.ms-gloss-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #93a1b0;
  white-space: nowrap;
}

.ms-gloss-group { margin-bottom: 2.6rem; }
.ms-gloss-group-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ms-accent);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #eaf0f6;
}
.ms-gloss-list { margin: 0; }
.ms-gloss-term {
  padding: 1.1rem 0;
  border-bottom: 1px solid #eef2f6;
}
.ms-gloss-dt {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6em;
  margin: 0 0 0.45rem;
}
.ms-gloss-word {
  font-size: 1.12rem;
  font-weight: 700;
  color: #1a2733;
}
.ms-gloss-reading {
  font-size: 0.78rem;
  color: #93a1b0;
}
.ms-gloss-dd { margin: 0; }
.ms-gloss-short {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.8;
  color: #2a2a2a;
}
.ms-gloss-detail {
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  line-height: 1.85;
  color: #5f6b77;
}
.ms-gloss-example {
  margin: 0.7rem 0 0;
  padding: 0.6rem 0.85rem 0.65rem;
  background: #f3f7fb;
  border-left: 3px solid var(--ms-accent);
  border-radius: 0 6px 6px 0;
}
.ms-gloss-example-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ms-accent-dark);
  margin-bottom: 0.25rem;
}
.ms-gloss-example-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.85;
  color: #3a4754;
}
.ms-gloss-related {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.ms-gloss-related-label {
  font-size: 0.72rem;
  color: #aab6c2;
  margin-right: 0.2em;
}
.ms-gloss-related-tag {
  font-size: 0.75rem;
  color: #788694;
  background: #f2f5f9;
  border-radius: 999px;
  padding: 0.2em 0.7em;
}
.ms-gloss-empty-msg {
  color: #93a1b0;
  font-size: 0.95rem;
  padding: 1.5rem 0;
}
.ms-gloss-note {
  margin-top: 2.5rem;
  font-size: 0.8rem;
  line-height: 1.7;
  color: #93a1b0;
}
.ms-gloss-updated { font-family: 'JetBrains Mono', monospace; }

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 768px) {
  .ms-prose { font-size: 1rem; line-height: 1.9; }
  .ms-prose h2 { font-size: 1.3rem; }
  .ms-prose h3 { font-size: 1.13rem; }
  .ms-prose h4 { font-size: 1.02rem; }
  .ms-cover { margin: -1rem 0 2rem; }
  .ms-list { padding: 2rem 0 3rem; }
  .ms-indicators-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
