@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&display=swap');

:root {
  --primary: #1a365d;
  --primary-light: #2b6cb0;
  --primary-lighter: #3182ce;
  --accent: #dd6b20;
  --accent-light: #ed8936;
  --bg: #f7fafc;
  --bg-white: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --text-lighter: #a0aec0;
  --border: #e2e8f0;
  --border-light: #edf2f7;
  --success: #38a169;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.07), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.8;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

img { max-width: 100%; height: auto; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo { font-size: 1.4rem; font-weight: 900; letter-spacing: 0.02em; }
.site-logo a { color: #fff; }
.site-logo a:hover { color: var(--accent-light); }
.site-logo .logo-sub { font-size: 0.75rem; font-weight: 400; opacity: 0.85; display: block; }

.header-nav { display: flex; gap: 24px; align-items: center; }
.header-nav a { color: rgba(255,255,255,0.9); font-size: 0.9rem; font-weight: 500; }
.header-nav a:hover { color: #fff; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Breadcrumb */
.breadcrumb {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  font-size: 0.85rem;
  color: var(--text-light);
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary-light); }
.breadcrumb span { margin: 0 6px; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #2c5282 50%, var(--primary-light) 100%);
  color: #fff;
  padding: 60px 24px;
  text-align: center;
}
.hero h1 { font-size: 2.4rem; font-weight: 900; margin-bottom: 16px; }
.hero p { font-size: 1.1rem; opacity: 0.9; max-width: 700px; margin: 0 auto; line-height: 1.7; }

.hero-search {
  max-width: 500px;
  margin: 24px auto 0;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  outline: none;
}
.hero-search input:focus {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.hero-search::before {
  content: "🔍";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
}

/* Main Layout */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
}

/* Featured Articles */
.featured-section { margin-bottom: 8px; }
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.featured-card {
  display: block;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  transition: transform 0.2s, box-shadow 0.2s;
  border-top: 4px solid var(--accent);
  position: relative;
  color: var(--text);
}
.featured-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.featured-label {
  display: inline-block;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.featured-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  line-height: 1.5;
}
.featured-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
}

.content-full {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Category Cards */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  margin: 32px 0;
}

.category-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.category-card-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
}
.category-card-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.category-card-header .cat-count {
  font-size: 0.85rem;
  opacity: 0.8;
}

.category-card-body { padding: 16px 24px 24px; }
.category-card-body ul { list-style: none; }
.category-card-body li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.category-card-body li:last-child { border-bottom: none; }
.category-card-body li a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}
.category-card-body li a::before {
  content: "›";
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2rem;
}

/* Term Cards (list view) */
.term-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.term-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 4px solid var(--primary-light);
}
.term-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.term-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.term-card h3 a { color: var(--text); }
.term-card h3 a:hover { color: var(--primary-light); }
.term-card p { font-size: 0.9rem; color: var(--text-light); line-height: 1.6; }
.term-card .term-cat {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--primary-light);
  background: #ebf4ff;
  padding: 2px 10px;
  border-radius: 20px;
}

/* Article Content */
.article {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px 48px;
}

.article-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 2px solid var(--border); }
.article-header .article-cat {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.article-header h1 { font-size: 2rem; font-weight: 900; line-height: 1.4; margin-bottom: 12px; color: var(--primary); }
.article-header .article-meta { font-size: 0.85rem; color: var(--text-light); }

.article-overview {
  background: #ebf8ff;
  border-left: 4px solid var(--primary-light);
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 32px;
  font-size: 1.05rem;
  line-height: 1.9;
}

.article h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  position: relative;
}
.article h2::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--accent);
}

.article h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 12px;
}

.article p { margin-bottom: 16px; line-height: 1.9; }

.article ul, .article ol {
  margin: 16px 0;
  padding-left: 24px;
}
.article li { margin-bottom: 8px; line-height: 1.7; }

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
}
.article th, .article td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}
.article th {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}
.article tr:nth-child(even) { background: var(--border-light); }

/* Case Study Box */
.case-study {
  background: #fffaf0;
  border: 1px solid #fbd38d;
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}
.case-study-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.case-study-title::before { content: "📋"; }

/* Point Box */
.point-box {
  background: #f0fff4;
  border: 1px solid #9ae6b4;
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}
.point-box-title {
  font-weight: 700;
  color: var(--success);
  margin-bottom: 12px;
  font-size: 1.05rem;
}

/* Warning Box */
.warning-box {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}
.warning-box-title {
  font-weight: 700;
  color: #e53e3e;
  margin-bottom: 12px;
  font-size: 1.05rem;
}

/* Related Terms */
.related-terms {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
}
.related-terms h2::after { display: none; }
.related-terms-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin-top: 16px;
}
.related-terms-list a {
  display: inline-block;
  background: var(--border-light);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.2s;
}
.related-terms-list a:hover {
  background: var(--primary);
  color: #fff;
}

/* Sidebar */
.sidebar {}
.sidebar-section {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}
.sidebar-title {
  background: var(--primary);
  color: #fff;
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 700;
}
.sidebar-body { padding: 16px 20px; }
.sidebar-body ul { list-style: none; }
.sidebar-body li { padding: 6px 0; border-bottom: 1px solid var(--border-light); }
.sidebar-body li:last-child { border-bottom: none; }
.sidebar-body li a { font-size: 0.9rem; color: var(--text); display: block; }
.sidebar-body li a:hover { color: var(--primary-light); }
.sidebar-body li.active a { color: var(--primary-light); font-weight: 700; }

/* TOC */
.toc { margin: 24px 0; }
.toc-title { font-size: 1rem; font-weight: 700; margin-bottom: 12px; color: var(--primary); }
.toc-list { list-style: none; padding: 0; }
.toc-list li { padding: 4px 0; }
.toc-list a { font-size: 0.9rem; color: var(--text-light); }
.toc-list a:hover { color: var(--primary-light); }
.toc-list a::before { content: "# "; color: var(--text-lighter); }

/* Footer */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.8);
  padding: 48px 24px 24px;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}
.footer-section h3 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.footer-section ul { list-style: none; }
.footer-section li { padding: 4px 0; }
.footer-section a { color: rgba(255,255,255,0.7); font-size: 0.9rem; }
.footer-section a:hover { color: #fff; }
.footer-bottom {
  max-width: 1200px;
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.15);
  text-align: center;
  font-size: 0.85rem;
}

/* Tag styles */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.tag {
  display: inline-block;
  background: var(--border-light);
  color: var(--text-light);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.82rem;
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin: 32px 0;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-num { font-size: 2rem; font-weight: 900; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-light); }

/* All terms index */
.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
  justify-content: center;
}
.alpha-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}
.alpha-nav a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Section heading */
.section-heading {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
  margin: 40px 0 24px;
  text-align: center;
}
.section-sub {
  text-align: center;
  color: var(--text-light);
  margin: -16px 0 32px;
  font-size: 0.95rem;
}

/* Ad container */
.ad-container {
  background: var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin: 24px 0;
  text-align: center;
  min-height: 100px;
}

/* Responsive */
@media (max-width: 768px) {
  .main-container {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .sidebar { order: 2; }
  .article { padding: 24px 20px; }
  .article-header h1 { font-size: 1.5rem; }
  .hero { padding: 40px 16px; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 0.95rem; }
  .featured-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .term-list { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .mobile-menu-btn { display: block; }
  .header-inner { padding: 12px 16px; }
  .footer-inner { grid-template-columns: 1fr; }
  .stats-bar { gap: 20px; }
  .stat-num { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .article { padding: 20px 16px; }
  .article h2 { font-size: 1.2rem; }
  .breadcrumb { font-size: 0.8rem; padding: 10px 16px; }
}

/* Print */
@media print {
  .site-header, .sidebar, .site-footer, .ad-container, .breadcrumb { display: none; }
  .main-container { grid-template-columns: 1fr; }
  .article { box-shadow: none; padding: 0; }
}

/* =========================================================================
   図解と「実際の事例」ブロック
   - 図は画像ではなく、文字と枠（HTMLとCSS）で作っています。
     画面が狭いときは自動で縦並びになり、文字の大きさは変わりません。
   ========================================================================= */

/* ---- 図のわく ---- */
.md-fig { margin: 28px 0; }
.md-fig-cap {
  font-size: 0.95rem; font-weight: 700; line-height: 1.6; color: var(--primary);
  background: var(--border-light); border-left: 5px solid var(--primary);
  padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 14px;
}
.md-fig-note { font-size: 0.85rem; color: var(--text-light); line-height: 1.8; margin-top: 12px; }

/* ---- 箱と矢印 ---- */
.md-flow { display: grid; gap: 10px; align-items: stretch; }
.md-flow.c3 { grid-template-columns: 1fr auto 1fr auto 1fr; }
.md-flow.c2 { grid-template-columns: 1fr auto 1fr; }
.md-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.md-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.md-node {
  background: var(--bg-white); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-align: center; font-weight: 700; font-size: 0.95rem; line-height: 1.55;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
}
.md-node small { display: block; font-weight: 400; font-size: 0.8rem; color: var(--text-light); line-height: 1.65; }
.md-node.key  { border-color: var(--primary); background: #eef3fa; }
.md-node.good { border-color: var(--success); background: #eaf6ef; }
.md-node.warn { border-color: var(--accent);  background: #fdf1e7; }
.md-node.ng   { border-color: #e53e3e;        background: #fdecec; }
.md-arrow { align-self: center; justify-self: center; color: var(--text-lighter); font-size: 1.5rem; font-weight: 700; line-height: 1; text-align: center; }
.md-arrow .v { display: none; }
.md-arrow small { display: block; font-size: 0.72rem; font-weight: 400; color: var(--text-light); white-space: nowrap; }
.md-down { text-align: center; color: var(--text-lighter); font-size: 1.5rem; line-height: 1; margin: 10px 0; }

/* ---- 並べて比べるパネル ---- */
.md-panel { border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg-white); overflow: hidden; }
.md-panel > h4 { margin: 0; padding: 10px 14px; font-size: 0.95rem; color: #fff; background: var(--text-light); }
.md-panel.ok > h4 { background: var(--success); }
.md-panel.ng > h4 { background: #e53e3e; }
.md-panel ul, .md-panel ol { margin: 0; padding: 12px 16px 12px 32px; font-size: 0.9rem; line-height: 1.85; }
.md-panel p.res { margin: 0; padding: 10px 14px; font-size: 0.88rem; font-weight: 700; line-height: 1.7; border-top: 1px solid var(--border); background: var(--border-light); }

/* ---- 順番に進む図（M&Aの流れなど） ---- */
.md-steps { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; }
.md-steps::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.md-steps > li { position: relative; padding: 0 0 16px; font-size: 0.92rem; line-height: 1.8; }
.md-steps > li::before {
  content: ""; position: absolute; left: -26px; top: 7px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg-white); border: 3px solid var(--primary-light);
}
.md-steps > li:last-child { padding-bottom: 0; }
.md-steps b { color: var(--primary); }
.md-steps small { display: block; font-size: 0.8rem; color: var(--text-light); line-height: 1.7; }

/* ---- 横棒グラフ ---- */
.md-bars { background: var(--bg-white); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.md-bar-row { display: grid; grid-template-columns: 170px 1fr 72px; align-items: center; gap: 10px; font-size: 0.85rem; line-height: 1.4; margin: 7px 0; }
.md-bar-track { background: var(--border-light); border-radius: 5px; height: 15px; overflow: hidden; }
.md-bar-fill { background: var(--primary-light); height: 100%; border-radius: 5px; }
.md-bar-row > span:last-child { text-align: right; font-weight: 700; }

/* ---- 実際の事例ブロック ---- */
.real-cases { margin: 28px 0; border: 2px solid var(--primary-light); border-radius: var(--radius-lg); overflow: hidden; }
.real-cases > h2 { margin: 0 !important; padding: 12px 18px; font-size: 1.05rem; color: #fff; background: var(--primary); }
.real-cases > h2::after { display: none; }
.real-case { padding: 16px 18px; }
.real-case + .real-case { border-top: 1px solid var(--border); }
.real-case h4 { margin: 0 0 4px; font-size: 1rem; color: var(--primary); line-height: 1.55; }
.real-case .when { display: block; font-size: 0.78rem; color: var(--text-light); font-weight: 400; margin-bottom: 6px; }
.real-case p { margin: 0 0 8px; font-size: 0.92rem; line-height: 1.85; }
.real-case .point { margin: 8px 0 0; padding: 10px 12px; background: var(--border-light); border-radius: var(--radius); font-size: 0.88rem; line-height: 1.8; }
.real-case .point b { color: var(--primary); }
.real-case .src { margin: 8px 0 0; font-size: 0.78rem; color: var(--text-light); }
.real-case .src a { color: var(--primary-light); }

/* ---- 狭い画面 ---- */
@media (max-width: 760px) {
  .md-flow.c3, .md-flow.c2, .md-grid2, .md-grid3 { grid-template-columns: 1fr; }
  .md-arrow .h { display: none; }
  .md-arrow .v { display: block; }
  .md-bar-row { grid-template-columns: 110px 1fr 64px; font-size: 0.78rem; }
}
