/* ==========================================================================
   Ploto Manual - Styling Sheet (Vanilla CSS)
   ========================================================================== */

/* 2カラムレイアウト構成 */
.manual-container {
  display: flex;
  max-width: 1200px;
  margin: 80px auto 0; /* ヘッダーの高さ考慮 */
  padding: 40px 24px;
  gap: 40px;
  min-height: calc(100vh - 80px - 200px); /* ヘッダー・フッター高さ考慮 */
}

/* サイドバー */
.manual-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  height: fit-content;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.manual-sidebar-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.manual-menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manual-menu-item a {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.manual-menu-item a:hover {
  color: var(--color-primary-light);
  background-color: var(--bg-card-hover);
}

.manual-menu-item.active a {
  color: var(--text-inverse);
  background: var(--gradient-primary);
  font-weight: 600;
}

.manual-back-link {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
}
.manual-back-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--color-primary-light);
  font-weight: 500;
}
.manual-back-link a:hover {
  text-decoration: underline;
}

/* メインコンテンツエリア */
.manual-content {
  flex-grow: 1;
  min-width: 0; /* flexの子要素がはみ出さないように */
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  box-shadow: var(--shadow-sm);
}

/* マークダウン・本文スタイル */
.manual-article h1 {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.3;
}

.manual-article h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.manual-article h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 12px;
}

.manual-article p {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.8;
}

/* 準備中 (Coming Soon) */
.coming-soon-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.coming-soon-icon {
  font-size: 4rem;
  margin-bottom: 24px;
  animation: manual-float 3s ease-in-out infinite;
}

@keyframes manual-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 画像スタイル */
.manual-image-container {
  margin: 24px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  background-color: var(--bg-main);
}

.manual-image-container img {
  width: 100%;
  height: auto;
}

.manual-image-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 10px;
  background-color: var(--bg-card-hover);
  border-top: 1px solid var(--border-color);
}

/* キーボードキー風 kbd */
kbd {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.2);
  font-family: monospace;
  font-size: 0.85em;
  font-weight: bold;
  padding: 2px 6px;
  color: var(--text-main);
}

/* 各機能紹介用のカード/グリッド */
.manual-step-card {
  background-color: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  transition: var(--transition-smooth);
}

.manual-step-card:hover {
  border-color: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* モバイル対応 */
@media (max-width: 992px) {
  .manual-container {
    flex-direction: column;
    margin-top: 70px;
    padding: 20px 16px;
    gap: 24px;
  }
  
  .manual-sidebar {
    width: 100%;
    position: static;
  }
  
  .manual-content {
    padding: 24px;
  }
}

/* インラインアイコンリスト */
.manual-icon-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.manual-icon-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.manual-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  flex-shrink: 0;
  margin-top: 2px;
}

.manual-icon-wrapper svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

/* ==========================================================================
   優先度マトリクスの「4つの象限」図
   --------------------------------------------------------------------------
   以前はスクリーンショット画像(matrix-quadrants.png)だったが、
   ・軸ラベルが日本語のまま全言語で表示される
   ・ライトテーマ固定でダークテーマだと浮く
   という問題があったため、HTML/CSSでの描画に置き換えている。
   ========================================================================== */
.matrix-quadrants {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  margin: 24px 0;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-main);
  box-shadow: var(--shadow-sm);
}

.mq-axis {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.mq-axis-top    { grid-area: 1 / 2 / 2 / 3; text-align: center; }
.mq-axis-left   { grid-area: 2 / 1 / 3 / 2; text-align: right; }
.mq-axis-right  { grid-area: 2 / 3 / 3 / 4; text-align: left; }
.mq-axis-bottom { grid-area: 3 / 2 / 4 / 3; text-align: center; }

.mq-plane {
  grid-area: 2 / 2 / 3 / 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 3 / 2;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

/* 中央の十字（軸）はセルの内側の辺を破線にして描く。
   --border-color だとダークテーマで沈むため、--text-muted を薄めた色を使う。 */
.mq-plane {
  --mq-cross: color-mix(in srgb, var(--text-muted) 45%, transparent);
}

.mq-q2 { border-right: 1px dashed var(--mq-cross); border-bottom: 1px dashed var(--mq-cross); }
.mq-q1 { border-bottom: 1px dashed var(--mq-cross); }
.mq-q4 { border-right: 1px dashed var(--mq-cross); }

.mq-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  text-align: center;
  background-color: var(--bg-card);
}

.mq-numeral {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6vw, 3rem);
  font-weight: 700;
  line-height: 1;
  opacity: 0.55;
}

.mq-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

/* 象限ごとの色。取るべき行動（急ぐ / 計画する / 任せる / やめる）を色で示す。
   color-mix 非対応ブラウザでは背景は素の --bg-card のまま（可読性は保たれる）。 */
.mq-q1 { background-color: color-mix(in srgb, var(--color-danger) 10%, var(--bg-card)); }
.mq-q2 { background-color: color-mix(in srgb, var(--color-primary) 10%, var(--bg-card)); }
.mq-q3 { background-color: color-mix(in srgb, var(--color-accent) 10%, var(--bg-card)); }

.mq-q1 .mq-numeral { color: var(--color-danger); }
.mq-q2 .mq-numeral { color: var(--color-primary); }
.mq-q3 .mq-numeral { color: var(--color-accent); }
.mq-q4 .mq-numeral { color: var(--text-muted); }

/* 狭い画面では左右の軸ラベルが平面を潰すので、縦書きにして幅を節約する */
@media (max-width: 640px) {
  .matrix-quadrants {
    padding: 14px;
    gap: 8px;
  }

  .mq-plane {
    aspect-ratio: 1 / 1;
  }

  .mq-axis {
    font-size: 0.7rem;
  }

  .mq-axis-left,
  .mq-axis-right {
    writing-mode: vertical-rl;
    text-align: center;
    justify-self: center;
  }

  .mq-axis-left {
    transform: rotate(180deg);
  }

  .mq-label {
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   図の中のパーツに説明を出すツールチップ（カンバンのカード見本・ノートの書式バー）
   --------------------------------------------------------------------------
   トリガーを button にしているのは、hover のないタッチ環境でもタップで
   フォーカスが当たり、説明を開けるようにするため。
   ========================================================================== */
/* 説明を出す各パーツ。button だが図の中での見た目は素の要素と同じにする。 */
.manual-tip-part {
  position: relative;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  text-align: left;
  cursor: help;
  border-radius: 6px;
  -webkit-appearance: none;
  appearance: none;
}

.manual-tip-part:hover,
.manual-tip-part:focus,
.manual-tip-part:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-primary) 60%, transparent);
  outline-offset: 2px;
}

/* --- パーツの説明ツールチップ ---------------------------------------------
   visibility で開閉する。aria-describedby から参照している要素は非表示でも
   読み上げ対象になるため、支援技術には常に説明が届く。 */
.manual-tip {
  /* ライトテーマではカードとほぼ同じ白になって浮いて見えないため、
     吹き出しだけ濃い面色にする（三角も同じ変数を参照する）。 */
  --manual-tip-bg: var(--bg-card-hover);
  --manual-tip-fg: var(--text-main);
  --manual-tip-border: var(--border-color);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: max-content;
  max-width: min(260px, 62vw);
  padding: 10px 12px;
  border: 1px solid var(--manual-tip-border);
  border-radius: 8px;
  background-color: var(--manual-tip-bg);
  color: var(--manual-tip-fg);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.65;
  text-align: left;
  white-space: normal;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* 吹き出しの三角。枠線と同色の三角の上に背景色の三角を重ねて縁取りを作る。 */
.manual-tip::before,
.manual-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
}

.manual-tip::before { top: 100%; border-top-color: var(--manual-tip-border); }
.manual-tip::after  { top: calc(100% - 1px); border-top-color: var(--manual-tip-bg); }

[data-theme="light"] .manual-tip {
  --manual-tip-bg: #1f2937;
  --manual-tip-fg: #f8fafc;
  --manual-tip-border: #111827;
}

/* カードの上端に近いパーツは、図の外へ飛び出さないよう下側に開く */
.manual-tip--below {
  top: calc(100% + 10px);
  bottom: auto;
}

.manual-tip--below::before { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--manual-tip-border); }
.manual-tip--below::after  { top: auto; bottom: calc(100% - 1px); border-top-color: transparent; border-bottom-color: var(--manual-tip-bg); }

/* 左端・右端のパーツは中央揃えだとカードからはみ出すので、端に寄せる */
.manual-tip--start { left: 0; transform: none; }
.manual-tip--end   { left: auto; right: 0; transform: none; }

.manual-tip--start::before,
.manual-tip--start::after { left: 20px; }

.manual-tip--end::before,
.manual-tip--end::after { left: auto; right: 20px; transform: none; }

.manual-tip-part:hover > .manual-tip,
.manual-tip-part:focus > .manual-tip,
.manual-tip-part:focus-visible > .manual-tip {
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .manual-tip { transition: none; }
}


@media (max-width: 640px) {
  .manual-tip {
    max-width: min(240px, 72vw);
  }
}

/* ==========================================================================
   カンバンのカード見本
   --------------------------------------------------------------------------
   4象限の図と同じ理由（多言語化・テーマ追従・軽量化）でスクリーンショット
   (kanban-card.png) をHTML/CSSでの再現に置き換えている。
   タグの色はアプリ側でユーザーが自由に決めるものなので、テーマ変数ではなく
   見本としての固定色を使う。
   ========================================================================== */
.kanban-card-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-main);
  box-shadow: var(--shadow-sm);
}

.manual-figure-caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.manual-figure-hint {
  font-size: 0.75rem;
  opacity: 0.85;
}

.kc-card {
  width: 100%;
  max-width: 320px;
  padding: 16px 16px 14px;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.kc-assignee {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background-color: var(--bg-card-hover);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.kc-title {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
}

.kc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.kc-tag {
  padding: 3px 10px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
}

.kc-tag-a { background-color: #f59e0b; }
.kc-tag-b { background-color: #f26d6d; }

.kc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.kc-due,
.kc-todo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* 期限は状態に応じてアプリ側で色が変わる。ここでは「期限切れ」の見た目を示す。 */
.kc-due {
  padding: 4px 8px;
  border-radius: 6px;
  background-color: color-mix(in srgb, var(--color-danger) 14%, transparent);
  color: var(--color-danger);
}

.kc-todo {
  color: var(--text-muted);
}

.kc-due svg,
.kc-todo svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.kc-priority {
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--color-accent);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .kanban-card-figure {
    padding: 16px;
  }

  .kc-meta {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   ノートの書式バー
   --------------------------------------------------------------------------
   note-format.png の代わりにHTML/CSSで再現している。アイコンだけのボタンが
   並ぶため、説明は共通のツールチップ（.manual-tip）で出す。
   ========================================================================== */
.note-format-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-main);
  box-shadow: var(--shadow-sm);
}

.nf-toolbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

/* --border-color はダークテーマのカード上だとほぼ見えないので、少し強い色にする */
.nf-divider {
  width: 1px;
  align-self: stretch;
  margin: 0 4px;
  background-color: color-mix(in srgb, var(--text-muted) 40%, transparent);
}

.nf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-main);
}

.nf-btn svg {
  width: 17px;
  height: 17px;
}

/* 文字色ボタンは、アプリと同じように現在の色を下線で示す */
.nf-btn-color {
  position: relative;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 3px;
}

.nf-btn-color::after {
  content: "";
  width: 17px;
  height: 3px;
  border-radius: 2px;
  background-color: var(--color-danger);
}

.nf-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.nf-select svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.nf-btn:hover,
.nf-select:hover {
  background-color: var(--bg-card-hover);
}

/* 説明はボタンではなくツールバー全体を基準に置く。ボタンが小さいうえに
   狭い画面では折り返すため、ボタン中央に出すと図の外へはみ出してしまう。 */
.nf-toolbar .manual-tip-part {
  position: static;
}

.nf-toolbar .manual-tip {
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  width: auto;
  max-width: none;
  transform: none;
  text-align: center;
}

.nf-toolbar .manual-tip::before,
.nf-toolbar .manual-tip::after {
  display: none;
}

@media (max-width: 640px) {
  .note-format-figure {
    padding: 16px;
  }

  .nf-divider {
    margin: 0 2px;
  }
}
