/* 全ページ共通のスタイル。2026年10月まで layout.html にインラインで埋め込んでいた（約15KB）が、
   ページごとに毎回転送されるため外部ファイルにしてキャッシュさせる（Grok Botの監査 #469 T11）。
   layout.html は更新日時を ?v= に付けて読み込むので、ここを変えればキャッシュは切り替わる */
:root {
  --xl-bg: #0e1013;
  --xl-surface: #191c20;
  --xl-surface-2: #22262b;
  --xl-border: #33373c;
  --xl-text: #d7dadc;
  --xl-text-muted: #8b9095;
  --xl-accent: #1d9bf0;
  --xl-accent-hover: #4ab3f4;
  --xl-code: #f0a83c;
}

html { scrollbar-color: var(--xl-border) var(--xl-bg); }

body {
  background: var(--xl-bg);
  color: var(--xl-text);
  font-size: 1.05rem;
}
a { color: var(--xl-accent); }
a:hover { color: var(--xl-accent-hover); }

/* ---- レイアウト: サイドバー + メイン ---- */
.xl-layout { display: flex; align-items: flex-start; min-height: 100vh; }

.xl-sidebar {
  --bs-offcanvas-width: 260px;
  --bs-offcanvas-bg: var(--xl-surface);
  --bs-offcanvas-color: var(--xl-text);
  border-right: 1px solid var(--xl-border);
}
@media (min-width: 992px) {
  .xl-sidebar { width: 260px; flex: 0 0 260px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.xl-sidebar-inner { padding: 1.5rem 1.25rem; }
.xl-brand { display: block; margin-bottom: 1.5rem; line-height: 0; }
.xl-brand img { height: 36px; width: auto; display: block; }
.xl-nav { list-style: none; padding: 0; margin: 0; }
.xl-nav-link {
  display: block; padding: .7rem .9rem; border-radius: 999px; color: var(--xl-text);
  text-decoration: none; font-size: 1.1rem; font-weight: 500; margin-bottom: .2rem;
  transition: background-color .15s;
}
.xl-nav-link:hover { background: var(--xl-surface-2); color: var(--xl-text); }
.xl-nav-label {
  display: block; padding: 1rem .9rem .3rem; font-size: .8rem; font-weight: 700;
  color: var(--xl-text-muted); text-transform: uppercase; letter-spacing: .05em;
}
.xl-nav-sublink { font-size: 1rem; padding-top: .5rem; padding-bottom: .5rem; }

.xl-nav-row { display: flex; align-items: center; gap: .1rem; }
.xl-nav-row .xl-nav-link { flex: 1 1 auto; margin-bottom: 0; }
.xl-nav-toggle {
  flex: 0 0 auto; background: none; border: none; color: var(--xl-text-muted);
  width: 2.2rem; height: 2.2rem; border-radius: 999px; display: flex;
  align-items: center; justify-content: center; transition: transform .2s, background-color .15s;
}
.xl-nav-toggle:hover { background: var(--xl-surface-2); color: var(--xl-text); }
.xl-nav-toggle[aria-expanded="true"] { transform: rotate(180deg); }

.xl-mobile-header {
  position: sticky; top: 0; z-index: 1030; display: flex; align-items: center;
  justify-content: space-between; padding: .75rem 1rem; background: var(--xl-bg);
  border-bottom: 1px solid var(--xl-border);
}
.xl-mobile-header .xl-brand { margin-bottom: 0; }
.xl-mobile-header .xl-brand img { height: 30px; }
.xl-menu-btn {
  background: none; border: 1px solid var(--xl-border); border-radius: 999px;
  width: 2.4rem; height: 2.4rem; color: var(--xl-text); display: flex;
  align-items: center; justify-content: center;
}

.xl-main { flex: 1 1 auto; min-width: 0; }
.xl-main-inner { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.xl-prose { max-width: 720px; margin: 0 auto; }

.xl-footer { text-align: center; color: var(--xl-text-muted); padding: 2rem 0; border-top: 1px solid var(--xl-border); margin-top: 2rem; }

/* ---- カード・テキスト色の上書き ---- */
.article-card { background: var(--xl-bg); border: 1px solid var(--xl-border); transition: border-color .15s; }
.article-card:hover { border-color: var(--xl-text-muted); }
.buzz-post-card { background: var(--xl-bg); border: 1px solid var(--xl-border); }
.xl-buzz-intro { max-width: 760px; }
.xl-buzz-intro p:last-child { margin-bottom: 0; }
.card { background: var(--xl-surface); border-color: var(--xl-border); color: var(--xl-text); }
.card-header { background: var(--xl-surface-2); border-color: var(--xl-border); color: var(--xl-text); }
.text-dark { color: var(--xl-text) !important; }
.text-muted { color: var(--xl-text-muted) !important; }
.text-primary { color: var(--xl-accent) !important; }
.border-top { border-color: var(--xl-border) !important; }
.border-primary { border-color: var(--xl-accent) !important; }

/* ---- 等幅フォント（罫線文字のASCIIアート用。システムフォント依存だと
   環境によって罫線文字(╭━╮┃╰╯等)の表示幅がズレるため、Webフォントで固定する） ---- */
.xl-mono { font-family: 'DotGothic16', 'MS Gothic', 'Osaka-Mono', monospace; }

/* ---- フォーム要素（ツールページ用） ---- */
.form-control, .form-select {
  background-color: var(--xl-surface); border-color: var(--xl-border); color: var(--xl-text);
}
.form-control:focus, .form-select:focus {
  background-color: var(--xl-surface); border-color: var(--xl-accent); color: var(--xl-text);
  box-shadow: 0 0 0 .2rem rgba(29,155,240,.25);
}
.form-control::placeholder { color: var(--xl-text-muted); opacity: .8; }
.form-check-input { background-color: var(--xl-surface); border-color: var(--xl-border); }
.form-check-input:checked { background-color: var(--xl-accent); border-color: var(--xl-accent); }
.form-label { color: var(--xl-text); font-weight: 600; }

/* ---- タグ（バッジ代替） ---- */
.xl-tag {
  display: inline-block; padding: .3rem .85rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; border: 1px solid var(--xl-accent);
  color: var(--xl-accent) !important; background: transparent; text-decoration: none !important;
}
.xl-tag:hover { background: rgba(29,155,240,.12); }
.xl-tag-muted { border-color: var(--xl-border); color: var(--xl-text-muted) !important; }
.xl-tag-muted:hover { border-color: var(--xl-text-muted); color: var(--xl-text) !important; background: var(--xl-surface-2); }
.xl-tag.active { background: var(--xl-accent); color: #000 !important; }

.topic-badge { font-size: .8rem; }
.share-btn { min-width: 120px; }
.share-hatena { background: #00a4de; border-color: #00a4de; color: #fff; }
.share-hatena:hover { background: #008fc2; border-color: #008fc2; color: #fff; }
.share-line { background: #06c755; border-color: #06c755; color: #fff; }
.share-line:hover { background: #05a847; border-color: #05a847; color: #fff; }
.share-threads { background: #000; border-color: #000; color: #fff; }
.share-threads:hover { background: #333; border-color: #333; color: #fff; }
.share-bluesky { background: #1185fe; border-color: #1185fe; color: #fff; }
.share-bluesky:hover { background: #0a6fd9; border-color: #0a6fd9; color: #fff; }

/* ---- トップページ: コンテンツカード ---- */
.xl-overview-card {
  display: block; padding: 1.5rem 1.75rem; border-radius: .9rem;
  background: var(--xl-surface); border: 1px solid var(--xl-border);
  text-decoration: none !important; color: var(--xl-text) !important;
  transition: border-color .15s;
}
.xl-overview-card:hover { border-color: var(--xl-accent); }
.xl-overview-card-soon { opacity: .65; }
.xl-overview-card-title {
  font-size: 1.2rem; font-weight: 800; margin-bottom: .4rem;
  display: flex; align-items: center; gap: .6rem;
}
.xl-overview-card-desc { color: var(--xl-text-muted); line-height: 1.7; margin: 0; }

/* ---- 記事サムネイル（OGP画像。背景色がページと同じ#0e1013で境目が見えないため、
   アクセントカラーのグローで浮き上がらせる） ---- */
.xl-thumbnail {
  border-radius: 18px;
  box-shadow: 0 0 0 2px rgba(29, 155, 240, 0.7), 0 0 80px 10px rgba(29, 155, 240, 0.55);
}

/* ---- 目次ボックス ---- */
.xl-toc { background: var(--xl-surface); border: 1px solid var(--xl-border); border-radius: .75rem; padding: 1.1rem 1.35rem; margin-bottom: 2rem; }
.xl-toc-title { font-weight: 700; color: var(--xl-text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .6rem; }
.xl-toc a { color: var(--xl-text); text-decoration: none; }
.xl-toc a:hover { color: var(--xl-accent); }

/* ---- 記事本文 タイポグラフィ ---- */
.article-body { line-height: 1.9; font-size: 1.08rem; }
.article-body p { margin-bottom: 1.4em; }
.article-body ul, .article-body ol { margin-bottom: 1.4em; padding-left: 1.6em; }
.article-body li { margin-bottom: 0.4em; }
.article-body img { max-width: 100%; height: auto; margin: 1.25rem 0; border-radius: .5rem; border: 1px solid var(--xl-border); cursor: zoom-in; }
.article-body .xl-figure { margin: 1.25rem 0 1.6rem; }
.article-body .xl-figure img { margin: 0; }
.article-body .xl-figure figcaption { margin-top: .5rem; font-size: .85rem; color: var(--xl-text-muted); line-height: 1.6; }

/* ---- 画像ライトボックス ---- */
.xl-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 2rem;
  opacity: 0; visibility: hidden; transition: opacity .2s;
}
.xl-lightbox.visible { opacity: 1; visibility: visible; }
.xl-lightbox-img { max-width: 95vw; max-height: 90vh; border-radius: .5rem; box-shadow: 0 8px 40px rgba(0,0,0,.6); cursor: zoom-out; }
.xl-lightbox-close {
  position: absolute; top: 1.25rem; right: 1.25rem; width: 2.6rem; height: 2.6rem;
  border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: 1.5rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.xl-lightbox-close:hover { background: rgba(255,255,255,.2); }

/* ---- Cookie同意バナー（X埋め込みウィジェット用。埋め込みのあるページでのみ表示） ---- */
.xl-cookie-consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
  background: var(--xl-surface); border-top: 1px solid var(--xl-border);
  padding: 1rem 1.25rem; box-shadow: 0 -4px 16px rgba(0,0,0,.35);
}
.xl-cookie-consent p { color: var(--xl-text); margin-bottom: .75rem; }

.article-body a { text-decoration: underline; text-underline-offset: 2px; }
.article-body code { background: var(--xl-surface-2); color: var(--xl-code); padding: .1em .35em; border-radius: .3em; font-weight: 600; }
.article-body pre {
  background: var(--xl-surface-2); border: 1px solid var(--xl-border); border-radius: .5rem;
  padding: 1rem 1.15rem; margin: 1.25rem 0; overflow-x: auto;
}
.article-body pre code {
  background: none; color: var(--xl-text); padding: 0; font-weight: 400;
  white-space: pre-wrap; word-break: break-word;
}

h1 { font-weight: 800; letter-spacing: -.01em; }

.article-body h2 {
  margin: 4.5rem 0 1.25rem;
  padding: .65rem 1rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--xl-accent);
  background: var(--xl-surface-2);
  border-left: 4px solid var(--xl-accent);
  border-radius: 0 .5rem .5rem 0;
}
.article-body h2::before { content: "»"; margin-right: .5rem; color: var(--xl-accent); }
.article-body h3 {
  margin: 3.2rem 0 .8rem;
  padding-left: .7em;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--xl-text);
  border-left: 4px solid var(--xl-accent);
}
.article-body h3::before { content: "›"; color: var(--xl-accent); margin-right: .3rem; }

/* ---- 太字強調（地の文中の重要文に使う。**bold** で頻繁に使ってよい） ---- */
.article-body strong { color: var(--xl-code); font-weight: 700; }

/* ---- 強調ハイライト（1記事に1〜2箇所、最重要フレーズのみ） ---- */
.article-body .xl-highlight {
  background: linear-gradient(transparent 62%, rgba(240,168,60,.4) 62%);
  padding: 0 .05em;
}

/* ---- 装飾された箇条書き ---- */
.article-body ul { list-style: none; padding-left: 1.5em; }
.article-body ul > li { position: relative; }
.article-body ul > li::before { content: "▸"; position: absolute; left: -1.3em; color: var(--xl-accent); font-weight: 700; }
.article-body ol { list-style: none; padding-left: 0; counter-reset: xl-ol; }
.article-body ol > li {
  position: relative; padding-left: 2.5em; counter-increment: xl-ol;
}
.article-body ol > li::before {
  content: counter(xl-ol); position: absolute; left: 0; top: .05em;
  width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--xl-accent); color: #04141d;
  font-weight: 700; font-size: .8em; display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ---- 吹き出し（編集部コメント） ---- */
.xl-speech { display: flex; align-items: flex-start; gap: .9rem; margin: 1.75rem 0; }
.xl-speech-avatar {
  flex: 0 0 auto; width: 2.9rem; height: 2.9rem; border-radius: 50%;
  background: var(--xl-accent); display: flex; align-items: center; justify-content: center;
}
.xl-speech-avatar svg { width: 1.4rem; height: 1.4rem; }
.xl-speech-body { flex: 1 1 auto; min-width: 0; }
.xl-speech-name { font-size: .78rem; font-weight: 700; color: var(--xl-text-muted); margin-bottom: .35rem; }
.xl-speech-bubble {
  position: relative; background: var(--xl-surface-2); border: 1px solid var(--xl-border);
  border-radius: 0 .75rem .75rem .75rem; padding: .9rem 1.1rem;
}
.xl-speech-bubble::before {
  content: ""; position: absolute; left: -8px; top: 0;
  border-width: 0 8px 8px 0; border-style: solid;
  border-color: transparent var(--xl-border) transparent transparent;
}
.xl-speech-bubble::after {
  content: ""; position: absolute; left: -6.5px; top: 0;
  border-width: 0 7px 7px 0; border-style: solid;
  border-color: transparent var(--xl-surface-2) transparent transparent;
}
.xl-speech-bubble p:last-child { margin-bottom: 0; }

/* ---- テーブル ---- */
.article-body table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: .95rem; }
.article-body table th, .article-body table td { border: 1px solid var(--xl-border); padding: .5rem .75rem; vertical-align: top; }
.article-body table thead th { background-color: var(--xl-surface-2); color: var(--xl-text); font-weight: 600; }
.article-body table tbody tr:nth-child(even) { background-color: var(--xl-surface); }

/* ---- プルクオート ---- */
.article-body blockquote {
  border-left: 4px solid var(--xl-accent); padding: .6rem 1rem; margin: 1.5rem 0;
  background: var(--xl-surface); color: var(--xl-text); font-style: italic; border-radius: 0 .5rem .5rem 0;
}

/* ---- 結論ボックス（タブ付き） ---- */
.xl-callout {
  position: relative; border: 1px solid var(--xl-accent); border-radius: 0 .75rem .75rem .75rem;
  background: var(--xl-surface); padding: 1.4rem 1.35rem 1.1rem; margin: 3.5rem 0 1.75rem;
}
.xl-callout-label {
  position: absolute; top: 0; left: 1.1rem; transform: translateY(-100%);
  display: inline-block; font-size: .95rem; font-weight: 700; letter-spacing: .04em;
  color: var(--xl-bg); background: var(--xl-accent); border-radius: .4rem .4rem 0 0; padding: .4rem 1rem;
}
.xl-callout p, .xl-callout ul, .xl-callout ol { margin-bottom: .6em; }
.xl-callout p:last-child, .xl-callout ul:last-child, .xl-callout ol:last-child { margin-bottom: 0; }
.xl-callout-good { border-color: #0ca30c; }
.xl-callout-good .xl-callout-label { background: #0ca30c; color: #04140a; }
.xl-callout-bad { border-color: #d03b3b; }
.xl-callout-bad .xl-callout-label { background: #d03b3b; color: #1a0505; }

/* ---- 推奨行動ボックス（各セクションの実践的まとめ） ---- */
.xl-action {
  background: rgba(240,168,60,.1); border: 1px solid rgba(240,168,60,.45);
  border-left: 4px solid var(--xl-code); border-radius: .5rem;
  padding: .95rem 1.15rem; margin: 1.6rem 0;
}
.xl-action-label {
  display: inline-block; font-weight: 700; color: var(--xl-code); margin-right: .5em;
}
.xl-action p { margin-bottom: 0; display: inline; }

@media (max-width: 768px) {
  .article-body { line-height: 1.75; }
  .article-body h2 { font-size: 1.3rem; margin-top: 3.6rem; }
  .article-body h3 { font-size: 1.1rem; margin-top: 2.6rem; }
  .xl-callout { margin-top: 3rem; }
}
