/* ========================================
   Base
======================================== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    "Meiryo", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP",
    sans-serif;
  color: #1f2937;
  background: #f3f4f6;
  line-height: 1.9;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

a {
  color: #1d4ed8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

code {
  font-family: Consolas, Monaco, "Courier New", monospace;
}

/* ========================================
   Page Header
======================================== */
.manual-page-header {
  padding: 36px 24px 28px;
  border-bottom: 1px solid #d1d5db;
  background: #ffffff;
}

.manual-page-header-inner {
  max-width: 1400px;
  margin: 0 auto;
}

.manual-page-title {
  margin: 0 0 10px;
  font-size: 44px;
  line-height: 1.3;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.01em;
}

.manual-page-lead {
  margin: 0;
  font-size: 16px;
  line-height: 1.8;
  color: #4b5563;
}

/* ========================================
   Layout
======================================== */
.rsys-manual-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 20px 88px;
}

.rsys-manual {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}

/* ========================================
   Left Navigation
======================================== */
.rsys-manual-nav {
  width: 260px;
  flex: 0 0 260px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding-right: 4px;
}

.rsys-manual-nav-box {
  border: 1px solid #d1d5db;
  background: #ffffff;
  border-radius: 10px;
  padding: 14px 14px 16px;
}

.rsys-manual-nav-title {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 17px;
  line-height: 1.4;
  font-weight: 700;
  color: #111827;
}

.rsys-manual-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rsys-manual-nav li + li {
  margin-top: 4px;
}

.rsys-manual-nav a {
  display: block;
  padding: 2px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 500;
  transition:
    color 0.18s ease,
    font-weight 0.18s ease;
}

/* ========================================
   目次 階層整理
======================================== */
.rsys-manual-nav > .rsys-manual-nav-box > ul > li {
  margin-top: 10px;
}

.rsys-manual-nav > .rsys-manual-nav-box > ul > li:first-child {
  margin-top: 0;
}

.rsys-manual-nav > .rsys-manual-nav-box > ul > li:not(:has(> a)) {
  font-size: 12px;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.03em;
}

.rsys-manual-nav li ul {
  margin-top: 4px;
  padding-left: 10px;
}

.rsys-manual-nav li ul li + li {
  margin-top: 3px;
}

.rsys-manual-nav li ul a {
  font-size: 12.5px;
  font-weight: 500;
  color: #6b7280;
}

.rsys-manual-nav a:hover {
  text-decoration: none;
  color: #1d4ed8;
}

.rsys-manual-nav a.is-active {
  background: transparent;
  border: none;
  color: #1d4ed8;
  font-weight: 800;
  box-shadow: none;
}

/* ========================================
   Right Content
======================================== */
.rsys-manual-content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 900px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 32px 34px 40px;
}

/* ========================================
   Section
======================================== */
.rsys-section {
  scroll-margin-top: 20px;
  margin-bottom: 84px;
  padding-bottom: 28px;
  border-bottom: 1px solid #e5e7eb;
}

.rsys-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.rsys-section-header {
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 2px solid #d1d5db;
}

.rsys-section-title {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.35;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.01em;
}

.rsys-section-lead {
  margin: 0;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.8;
}

.rsys-block {
  margin-top: 28px;
}

.rsys-block h3 {
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 4px solid #1d4ed8;
  font-size: 22px;
  line-height: 1.45;
  font-weight: 800;
  color: #111827;
}

.rsys-block h4 {
  margin: 24px 0 10px;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 700;
  color: #1f2937;
}

.rsys-block p {
  margin: 0 0 16px;
  color: #374151;
  font-size: 15px;
  line-height: 1.95;
}

.rsys-block ul {
  margin: 0 0 16px 1.2em;
  padding: 0;
  color: #374151;
}

.rsys-block li {
  line-height: 1.9;
}

.rsys-block li + li {
  margin-top: 6px;
}

/* ========================================
   Note
======================================== */
.rsys-note {
  padding: 16px 18px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.85;
  color: #1f2937;
}

/* ========================================
   Image Card
======================================== */
.rsys-image-card {
  margin: 16px 0 0;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.rsys-image-card.half {
  width: 70%;
  margin: 0 auto;
}

.rsys-image-card img {
  width: 100%;
}

.rsys-image-card figcaption {
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: #4b5563;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* ========================================
   Table
======================================== */
.rsys-table-wrap {
  overflow-x: auto;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #ffffff;
}

.rsys-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.rsys-table tr:not(:last-child) {
  border-bottom: #6b7280;
}

.rsys-table th,
.rsys-table td {
  padding: 13px 15px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.8;
}

.rsys-table tr:last-child th,
.rsys-table tr:last-child td {
  border-bottom: none;
}

.rsys-table th {
  width: 220px;
  background: #f9fafb;
  font-weight: 700;
  white-space: nowrap;
  color: #111827;
}

.rsys-table td {
  color: #374151;
  background: #ffffff;
}

.rsys-color-chip {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  vertical-align: middle;
  margin-right: 6px;
}

/* ========================================
   Code Block
======================================== */
.rsys-code-wrap {
  margin-top: 14px;
}

.rsys-code-label {
  display: inline-block;
  margin: 0 0 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.rsys-code {
  position: relative;
  background: #111827;
  color: #f9fafb;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1f2937;
}

.rsys-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.rsys-copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.rsys-copy-btn:active {
  transform: translateY(1px);
}

.rsys-code pre {
  margin: 0;
  padding: 46px 16px 16px;
  overflow-x: auto;
  white-space: pre;
  font-size: 13px;
  line-height: 1.75;
}

.rsys-code code {
  color: inherit;
}

/* ========================================
   Responsive
======================================== */
@media (max-width: 1180px) {
  .rsys-manual {
    gap: 24px;
  }

  .rsys-manual-nav {
    width: 280px;
    flex: 0 0 280px;
  }

  .rsys-manual-content {
    max-width: none;
    padding: 28px 24px 34px;
  }
}

@media (max-width: 980px) {
  .rsys-manual {
    flex-direction: column;
  }

  .rsys-manual-nav {
    width: 100%;
    flex: 0 0 auto;
    position: relative;
    top: auto;
    max-height: none;
  }

  .rsys-manual-content {
    width: 100%;
    max-width: none;
  }

  .rsys-section-title {
    font-size: 24px;
  }

  .manual-page-title {
    font-size: 36px;
  }
}

@media (max-width: 640px) {
  .manual-page-header {
    padding: 24px 16px 20px;
  }

  .rsys-manual-wrap {
    padding: 24px 16px 60px;
  }

  .manual-page-title {
    font-size: 30px;
  }

  .manual-page-lead {
    font-size: 14px;
  }

  .rsys-manual-content {
    padding: 22px 16px 28px;
    border-radius: 12px;
  }

  .rsys-section-title {
    font-size: 22px;
  }

  .rsys-block h3 {
    font-size: 20px;
  }

  .rsys-table th,
  .rsys-table td {
    font-size: 13px;
    padding: 11px 12px;
  }

  .rsys-manual-nav a {
    font-size: 13px;
  }

  .rsys-code pre {
    font-size: 12px;
  }

  .rsys-image-card.half {
    width: 100%;
  }
}
.rsys-table tr:not(:last-child) {
  border-bottom: 1px solid #e5e7eb;
}

.rsys-compare-item {
  min-width: 0;
}

/* ========================================
   デフォルト強調（任意）
======================================== */
.rsys-compare-item:first-child {
  border-color: #9ca3af;
}

/* ========================================
   Compare Gallery
   ※カスタマイズ例比較画像用
======================================== */

.rsys-compare-gallery {
  margin-top: 18px;
}

/* 共通アイテム */
.rsys-compare-item {
  position: relative;
  margin: 0;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  overflow: visible;
  background: #ffffff;
  z-index: 1;
}
.rsys-compare-item img {
  display: block;
  width: 100%;
  height: auto;
}

.rsys-compare-item figcaption {
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 700;
  color: #374151;
  text-align: center;
}

/* デフォルト画像を少しだけ識別しやすくする */
.rsys-compare-item:first-child {
  border-color: #9ca3af;
}

/* ----------------------------------------
   ① ほぼ正方形
   ボタン・カード・小パーツ向け
---------------------------------------- */
.rsys-compare--square {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.rsys-compare--square .rsys-compare-item img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* ----------------------------------------
   ② 横長
   カレンダー・フォーム・一覧向け
---------------------------------------- */
.rsys-compare--wide {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rsys-compare--wide .rsys-compare-item img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* ----------------------------------------
   ③ 横細長
   バナー・ヘッダー向け
---------------------------------------- */
.rsys-compare--thin {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rsys-compare--thin .rsys-compare-item img {
  aspect-ratio: 4 / 1;
  object-fit: cover;
}

/* ========================================
   Code Preview
   ※「このCSSはこのパターンです」を示す小画像
======================================== */
.rsys-code-preview {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f9fafb;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
  position: relative;
  z-index: 1;
}

/* hoverでカード拡張 */
.rsys-code-preview:hover {
  transform: scale(1.8);
  z-index: 20;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}
.rsys-code-preview img {
  display: block;
  width: 120px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  transition: width 0.18s ease;
}

/* hover時に画像自体を拡張 */
.rsys-code-preview:hover img {
  width: 420px;
  aspect-ratio: auto;
}

.rsys-code-preview:hover {
  position: relative;
  z-index: 50;
}

.rsys-code-preview figcaption {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 700;
  color: #374151;
}

/* ========================================
   Responsive
   ※スマホ重視ではないが最低限だけ保持
======================================== */
@media (max-width: 1180px) {
  .rsys-compare--square {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .rsys-compare--square {
    grid-template-columns: 1fr;
  }

  .rsys-code-preview {
    flex-direction: column;
    align-items: flex-start;
  }

  .rsys-code-preview img {
    width: 100%;
    max-width: 180px;
  }
}

/* ========================================
   Compare Hover Zoom (Follow Cursor)
======================================== */

.rsys-compare-item,
.rsys-code-preview {
  position: relative;
  overflow: hidden;
}

.rsys-compare-item img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out;
  transform-origin: center center;
  will-change: transform;
}

.rsys-compare-item.is-zoom {
  z-index: 30;
}

.rsys-compare-item.is-zoom img {
  position: relative;
  transform: scale(3.2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  border-radius: 10px;
  background: #fff;
}

.rsys-compare-gallery {
  position: relative;
  overflow: visible;
}

/* 高さ固定（最重要） */
.rsys-compare-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #eee;
  position: relative;
}

/* 画像 */
.rsys-compare-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

/* ズームは画像だけ */
.rsys-compare-item.is-zoom img {
  transform: scale(2.6);
}

/* 前面制御（ここがz-indexの正解） */
.rsys-compare-item.is-zoom {
  z-index: 100;
}

/* caption（高さ干渉防止） */
.rsys-compare-item figcaption {
  margin-top: 8px;
  text-align: center;
  font-weight: 700;
}