
:root {
  --bg: #fafbfc;
  --bg-card: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --border: #e5e7eb;
  --code-bg: #f4f6f8;
  --table-head-bg: #f3f4f6;
  --table-row-alt: #f9fafb;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --warning: #f59e0b;
  --danger: #dc2626;
  --success: #16a34a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #60a5fa;
    --accent-soft: #1e3a8a;
    --border: #334155;
    --code-bg: #0b1220;
    --table-head-bg: #273449;
    --table-row-alt: #1a2435;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Meiryo", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.topbar a { color: var(--accent); text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topbar .brand { font-weight: 700; color: var(--text); }
.topbar .spacer { flex: 1; }
.topbar .meta { color: var(--text-muted); font-size: 13px; }

article {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 40px 48px;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  line-height: 1.35;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  font-weight: 700;
}
h1 { font-size: 1.85rem; padding-bottom: 0.4em; border-bottom: 2px solid var(--accent); }
h2 { font-size: 1.5rem; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; color: var(--accent); }
h1:first-child { margin-top: 0; }

p { margin: 0.7em 0; }
strong { color: var(--text); font-weight: 700; }

a { color: var(--accent); }
a:hover { text-decoration: none; }

blockquote {
  margin: 1.2em 0;
  padding: 0.8em 1.2em;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 0 8px 8px 0;
}
blockquote > p { margin: 0.3em 0; }

ul, ol { padding-left: 1.6em; margin: 0.7em 0; }
li { margin: 0.25em 0; }
li > ul, li > ol { margin: 0.2em 0; }

code {
  font-family: "SF Mono", Consolas, Menlo, "DejaVu Sans Mono", monospace;
  background: var(--code-bg);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-size: 0.92em;
}
pre {
  background: var(--code-bg);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.55;
  border: 1px solid var(--border);
}
pre code { background: transparent; padding: 0; font-size: 1em; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2em 0;
  font-size: 0.93em;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}
@media (min-width: 720px) {
  table { display: table; white-space: normal; }
}
th, td {
  padding: 8px 14px;
  text-align: left;
  border: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: var(--table-head-bg);
  font-weight: 700;
  white-space: nowrap;
}
tr:nth-child(even) td { background: var(--table-row-alt); }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }

img { max-width: 100%; border-radius: 8px; }

/* Index page specific */
.index-hero {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: white;
  padding: 48px 48px 40px;
  border-radius: 14px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}
.index-hero h1 { color: white; border: 0; margin: 0 0 12px; font-size: 2.1rem; }
.index-hero p { color: rgba(255,255,255,0.92); font-size: 1.05rem; margin: 4px 0; }
.index-hero .meta { color: rgba(255,255,255,0.78); font-size: 0.9rem; margin-top: 12px; }

.section-title { font-size: 1.05rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; margin: 2em 0 0.8em; }

/* ───── Main reports（3カードを横並び・アイコン付き） ───── */
.main-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
@media (max-width: 880px) {
  .main-cards { grid-template-columns: 1fr; }
}
.main-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.main-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.main-card--exec     { border-left-color: #2563eb; }
.main-card--detail   { border-left-color: #16a34a; }
.main-card--strategy { border-left-color: #dc2626; }
.main-card--exec:hover     { background: linear-gradient(90deg, rgba(37,99,235,0.04), transparent 40%); }
.main-card--detail:hover   { background: linear-gradient(90deg, rgba(22,163,74,0.04), transparent 40%); }
.main-card--strategy:hover { background: linear-gradient(90deg, rgba(220,38,38,0.04), transparent 40%); }
.main-card-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: 10px;
}
.main-card--exec     .main-card-icon { background: rgba(37,99,235,0.10); }
.main-card--detail   .main-card-icon { background: rgba(22,163,74,0.10); }
.main-card--strategy .main-card-icon { background: rgba(220,38,38,0.10); }
.main-card-content { min-width: 0; flex: 1; }
.main-card-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.main-card-title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.main-card-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }

/* ───── Competitor factsheets ───── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.card-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  border-color: var(--accent);
}
.card .card-body {
  display: block;
  padding: 14px 16px 8px;
  padding-right: 60px;  /* logo space top-right */
  text-decoration: none;
  color: inherit;
}
.card-logo-link {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 1;
}
.card-logo-link:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.card-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  background: white;
}
/* 画像読み込み失敗時：JS で .logo-fallback を付与し、data-letter を表示 */
.card-logo-link.logo-fallback::before {
  content: attr(data-letter);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card .title { font-weight: 700; color: var(--text); font-size: 0.98rem; line-height: 1.4; }
.card .subtitle { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; line-height: 1.45; }
.card .badge {
  display: inline-block; font-size: 0.7rem; padding: 1px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  margin-bottom: 4px;
}
.card-footer {
  margin: 0 16px;
  padding: 6px 0 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.card-footer a {
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  padding: 3px 7px;
  border-radius: 5px;
  transition: background 0.15s ease, color 0.15s ease;
}
.card-footer .report-link { color: var(--text-muted); }
.card-footer .report-link:hover { background: var(--accent-soft); color: var(--accent); }
.card-footer .external-link { color: var(--accent); }
.card-footer .external-link:hover { background: var(--accent-soft); }
.threat-critical { background: #fee2e2 !important; color: var(--danger) !important; }
.threat-high     { background: #fed7aa !important; color: #9a3412 !important; }
.threat-moderate { background: #fef3c7 !important; color: #92400e !important; }

footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* TOC（目次）— Markdown TOC 拡張が出すクラス */
.toc {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  margin: 0 0 28px;
  font-size: 0.9rem;
}
.toc::before { content: "目次"; display: block; font-weight: 700; margin-bottom: 6px; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.toc ul { padding-left: 1.2em; margin: 0.2em 0; }
.toc > ul { padding-left: 0; }
.toc > ul > li { list-style: none; }
.toc a { color: var(--accent); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* Print friendly */
@media print {
  body { background: white; }
  .topbar { display: none; }
  article { box-shadow: none; border: 0; padding: 0; }
}
