/* ===== VARIABLES ===== */
:root {
  --primary:    #2d3a8c;
  --primary-lt: #4a5fca;
  --accent:     #5b7fff;
  --bg:         #ffffff;
  --bg-alt:     #f5f7ff;
  --border:     #d6dcf5;
  --text:       #1a1a2e;
  --text-muted: #555577;
  --warning-bg: #fffbe6;
  --warning-bd: #e6c940;
  --tip-bg:     #edf6ff;
  --tip-bd:     #5b7fff;
  --radius:     6px;
  --max-w:      900px;
}

/* commands ページのみ最大幅を広げる */
.page-commands { --max-w: 1040px; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 15px;
}
body.page-commands { line-height: 1.7; }

/* ===== TOP NAV ===== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  height: 48px;
  font-size: 14px;
}
.topnav .brand { font-weight: 700; font-size: 15px; margin-right: auto; }
.topnav a { color: #ccd6ff; text-decoration: none; padding: 6px 12px; border-radius: var(--radius); transition: background .15s; }
.topnav a:hover, .topnav a.active { background: rgba(255,255,255,.15); color: #fff; }

/* ===== PAGE HEADER ===== */
.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
  color: #fff;
  padding: 48px 24px 40px;
  text-align: center;
}
.page-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.page-header p  { font-size: 1rem; opacity: .85; }

/* ===== DOWNLOAD BUTTON ===== */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 999px;
  text-decoration: none;
  margin-top: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: transform .15s, box-shadow .15s;
}
.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
.btn-download::before {
  content: "⬇";
  font-size: 16px;
}

.page-commands .page-header { padding: 40px 24px 32px; }
.page-commands .page-header h1 { font-size: 1.9rem; }
.page-commands .page-header p  { font-size: .95rem; }

/* ===== TABLE ===== */
.tbl-wrap { overflow-x: auto; margin-bottom: 20px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
tbody tr:nth-child(even) { background: var(--bg-alt); }
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* ===== CALLOUT ===== */
.tip {
  background: var(--tip-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.warning {
  background: var(--warning-bg);
  border-left: 4px solid var(--warning-bd);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.tip strong, .warning strong { display: block; margin-bottom: 4px; }

/* ===== CODE ===== */
code {
  font-family: "Consolas", "SFMono-Regular", monospace;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 13px;
  color: var(--primary);
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   index ページ専用
   ============================================================ */

/* ===== LAYOUT ===== */
.page-index .wrapper { max-width: var(--max-w); margin: 0 auto; padding: 40px 24px 80px; }

/* ===== SECTIONS ===== */
.page-index section { margin-bottom: 56px; }
.page-index h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 20px;
}
.page-index h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 24px 0 8px; }
.page-index p { margin-bottom: 12px; }
.page-index ul, .page-index ol { padding-left: 1.5em; margin-bottom: 12px; }
.page-index li { margin-bottom: 4px; }

/* ===== TABLE ===== */
.page-index thead tr { background: var(--primary); color: #fff; }
.page-index thead th { padding: 10px 14px; text-align: left; font-weight: 600; white-space: nowrap; }
.page-index tbody tr:hover { background: #eef1ff; }
.page-index td.badge { font-family: monospace; font-size: 12px; color: var(--primary); white-space: nowrap; }
.page-index td.center { text-align: center; }

/* ===== STEPS ===== */
.page-index .steps { counter-reset: step; list-style: none; padding-left: 0; }
.page-index .steps li { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.page-index .steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; margin-top: 2px;
}
.page-index .steps li .step-body { flex: 1; }
.page-index .steps li .step-body strong { display: block; margin-bottom: 2px; }

/* ===== IMG PLACEHOLDER ===== */
.page-index .img-ph {
  display: block;
  background: #e8ecf8;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
  margin: 16px 0;
}
.page-index .img-ph::before { content: "📷 "; }

/* ===== TRIGGER BADGE ===== */
.page-index .tr-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  vertical-align: middle;
}
.page-index .tr-badge.sub { background: #6d7fc0; }

/* ===== CHANGELOG ARCHIVE (details/summary) ===== */
.page-index .changelog-archive { margin-top: 12px; }
.page-index .changelog-archive > summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  user-select: none;
}
.page-index .changelog-archive > summary::-webkit-details-marker { display: none; }
.page-index .changelog-archive > summary::before {
  content: "▶";
  font-size: 10px;
  transition: transform .15s;
}
.page-index .changelog-archive[open] > summary::before { transform: rotate(90deg); }
.page-index .changelog-archive > summary:hover { background: #e8ecff; }
.page-index .changelog-archive[open] > .tbl-wrap { margin-top: 12px; }

/* ============================================================
   commands ページ専用
   ============================================================ */

/* ===== LAYOUT ===== */
.page-commands .layout {
  display: flex;
  align-items: flex-start;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 80px;
  gap: 32px;
}

/* ===== SIDEBAR ===== */
.page-commands .sidebar {
  flex-shrink: 0;
  width: 210px;
  position: sticky;
  top: 64px;
  align-self: flex-start;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 0;
  font-size: 13px;
}
.page-commands .sidebar h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 0 14px 6px;
}
.page-commands .sidebar a {
  display: block;
  padding: 5px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-commands .sidebar a:hover { color: var(--primary); background: #e8ecff; border-left-color: var(--accent); }

/* ===== MAIN CONTENT ===== */
.page-commands .main { flex: 1; min-width: 0; }

/* ===== CATEGORY SECTION ===== */
.page-commands .cat-section { margin-bottom: 52px; }
.page-commands .cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 700;
}
.page-commands .cat-header .cat-icon { font-size: 1.1rem; }

/* ===== TABLE ===== */
.page-commands .tbl-wrap { margin-bottom: 0; }
.page-commands table { border: 1px solid var(--border); border-top: none; }
.page-commands thead tr { background: #e8ecff; }
.page-commands thead th { padding: 8px 14px; text-align: left; font-weight: 600; color: var(--primary); white-space: nowrap; border-bottom: 1px solid var(--border); }
.page-commands tbody td { vertical-align: middle; }
.page-commands tbody tr:hover { background: #dce4ff; }
.page-commands td.cmd-thumb { width: 100px; padding: 4px 8px; }
.page-commands td.cmd-thumb img { width: 96px; height: 54px; object-fit: cover; border-radius: 3px; display: block; }
.page-commands td.cmd-name { font-weight: 600; white-space: nowrap; vertical-align: middle; }
.page-commands td.desc { color: var(--text); vertical-align: middle; }

/* ===== CALLOUT ===== */
.page-commands .tip { padding: 10px 14px; margin-top: 10px; margin-bottom: 0; font-size: 13px; color: var(--text-muted); }
.page-commands .tip strong { display: inline; margin-bottom: 0; color: var(--text); }

/* ===== CODE ===== */
.page-commands code { font-size: 12px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  .page-commands .sidebar { display: none; }
  .page-commands .layout { padding: 16px; }
  .page-commands td.cmd-thumb { display: none; }
}
