/* ガイド記事ページ — iframe デモ（左）＋ 記事テキスト（右） */

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

header {
  flex-shrink: 0;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

header h1 span { color: var(--accent); }
header a.logo-link { color: var(--text); text-decoration: none; }

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
  margin-left: auto;
}
.back-link:hover {
  color: var(--accent);
  background: var(--surface-hover);
  border-color: var(--accent);
}

/* メインエリア: iframe 左 + 記事 右 */
.usage-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* デモ iframe エリア */
.usage-demo {
  flex: 0 0 58%;
  position: relative;
}

/* ドラッグ可能な仕切り（texttree.css の .divider と同じパターン） */
.usage-divider {
  width: 6px;
  flex-shrink: 0;
  cursor: col-resize;
  position: relative;
  background: transparent;
}
.usage-divider::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 1px;
  background: var(--border);
  transition: background 0.15s, left 0.1s, width 0.1s;
}
.usage-divider:hover::after,
.usage-divider.dragging::after {
  left: 1px;
  width: 3px;
  background: var(--accent);
}

.usage-demo iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* 記事テキストエリア */
.usage-article {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

/* Markdown レンダリング結果のスタイル */
.article-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-content > h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-top: 24px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

.article-content > h2:first-child {
  margin-top: 0;
}

.article-content p,
.article-content li {
  font-size: 13px;
  line-height: 1.85;
  color: var(--text-muted);
}

.article-content ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 4px;
}

.article-content ul li::before {
  content: '・';
}

/* 記事内リンク */
.article-content a {
  color: var(--text);
  text-decoration: underline;
}
.article-content a:hover {
  color: var(--accent);
}

/* --- 以降の段落を脚注スタイルに */
.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0 4px;
}
.article-content hr + p {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.75;
}

/* code / kbd */
.article-content code {
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
}

kbd {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text);
  line-height: 1.6;
  white-space: nowrap;
}

/* Markdown テーブル（キーボードショートカット等） */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.article-content table th,
.article-content table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.article-content table th {
  font-weight: 600;
  color: var(--text);
  opacity: 0.8;
}

.article-content table td:first-child {
  white-space: nowrap;
  width: 1%;
}

/* 記事内画像 — サイズは GuideLayout.astro の JS で自然幅を読んで設定 */
.article-content img {
  display: block;
  margin: 10px 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}

/* 関連記事セクション */
.related-articles {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.related-articles h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.related-articles ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.related-articles ul li::before {
  content: none;
}
.related-articles a {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.related-articles a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ライトボックス */
.img-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
}
.img-lightbox.is-open {
  display: flex;
}
.img-lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 6px;
  object-fit: contain;
  cursor: default;
}

/* 言語切替トグル（ヘッダー右端） */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
}
.lang-toggle em {
  font-family: 'Noto Color Emoji', sans-serif;
  font-style: normal;
}
.lang-toggle a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color 0.15s, border-color 0.15s;
}
.lang-toggle a:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.lang-toggle span {
  color: var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
}
