/*
 * seiji_soku — 王道まとめサイト CSS
 * クラス契約: docs/ui-structure.md(A3 の SSR ビュー + A2 のレンダラが出力するクラス名)。
 * 依存: なし(外部フォント/CDN 不使用。システムフォントのみ)。
 */

/* ==========================================================================
   1. カスタムプロパティ(パレット・寸法)
   ========================================================================== */
:root {
  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-text: #222222;
  --color-text-muted: #666666;
  --color-text-faint: #999999;
  --color-border: #e2e2e2;
  --color-accent: #c0392b;
  --color-accent-dark: #a5301f;
  --color-link: #0000cd;
  --color-footer-bg: #2b2b2b;

  --radius-sm: 4px;
  --radius-md: 8px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 4px 14px rgba(0, 0, 0, 0.14);

  --max-width: 1100px;
  --sidebar-width: 320px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Yu Gothic Medium", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
}

/* ==========================================================================
   2. リセット / ベース
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   3. ヘッダー(header.site-header)
   ========================================================================== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.site-title a {
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.site-logo {
  height: 32px;
  width: auto;
  display: block;
}

.global-nav {
  width: 100%;
  min-width: 0;
}

.nav-list {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-item {
  flex: 0 0 auto;
}

.nav-item a {
  display: block;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

.nav-item a:hover {
  background: var(--color-bg);
  color: var(--color-accent);
}

.nav-item-category a {
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ==========================================================================
   4. フッター(footer.site-footer)
   ========================================================================== */
.site-footer {
  margin-top: 40px;
  padding: 32px 16px 24px;
  background: var(--color-footer-bg);
  color: #cfcfcf;
}

.footer-links {
  max-width: var(--max-width);
  margin: 0 auto 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
}

.footer-links a {
  font-size: 13px;
  color: #dcdcdc;
}

.footer-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-ai-disclaimer {
  max-width: 700px;
  margin: 0 auto 12px;
  font-size: 12px;
  line-height: 1.7;
  color: #9a9a9a;
  text-align: center;
}

.copyright {
  font-size: 12px;
  color: #8a8a8a;
  text-align: center;
}

/* ==========================================================================
   5. 全体レイアウト(main.layout)
   ========================================================================== */
.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.layout-main {
  min-width: 0;
}

.layout-sidebar {
  min-width: 0;
}

@media (min-width: 1024px) {
  .layout {
    grid-template-columns: 1fr var(--sidebar-width);
  }

  .layout.layout-full {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   6. 記事カード(a.article-card)+ ページネーション(nav.pagination)
   ========================================================================== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease;
}

.article-card:hover {
  box-shadow: var(--shadow-card-hover);
}

/*
 * サムネイル表示改善: 正方形(1:1)だとチャート画像が中央だけ切り抜かれて判読しづらいため
 * 横長 4:3 の固定枠にする(レターボックス無し・object-fit: cover で全面充填)。
 * 一覧で情報量が読み取れるよう、旧サイズ(120px 角)より一回り大きい 160x120 を基準サイズとする。
 */
.article-card-thumb {
  flex: 0 0 160px;
  width: 160px;
  height: 120px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.article-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.article-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-lead {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-faint);
}

@media (max-width: 420px) {
  .article-card-thumb {
    /* 4:3 を維持したまま縮小(旧 88x88 角より一回り大きい)。 */
    flex-basis: 132px;
    width: 132px;
    height: 99px;
  }
}

/* カテゴリバッジ(一覧カード内は非リンク span、記事ページは a) */
.category-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
  white-space: nowrap;
}

a.category-badge:hover {
  background: var(--color-accent-dark);
}

.list-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border-radius: var(--radius-md);
}

.page-title {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--color-accent);
  font-size: 20px;
  font-weight: 800;
}

.pagination {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

a.pagination-item:hover {
  background: var(--color-accent);
  color: #ffffff;
}

.pagination-current {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: none;
}

.pagination-dots {
  display: inline-flex;
  min-width: 20px;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
}

.pagination-prev,
.pagination-next {
  padding: 0 16px;
}

/* ==========================================================================
   7. サイドバー(div.sidebar)
   ========================================================================== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-widget {
  padding: 16px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.widget-title {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--color-accent);
  font-size: 15px;
  font-weight: 800;
}

.widget-empty {
  font-size: 13px;
  color: var(--color-text-muted);
}

.search-form {
  display: flex;
  gap: 6px;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
}

.search-input:focus-visible {
  outline: 2px solid var(--color-accent);
}

.search-button {
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.search-button:hover {
  background: var(--color-accent-dark);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ranking-rank {
  flex: 0 0 auto;
  min-width: 22px;
  font-size: 19px;
  font-weight: 900;
  font-style: italic;
  line-height: 1.3;
  color: var(--color-text-faint);
}

.ranking-item:nth-child(1) .ranking-rank,
.ranking-item:nth-child(2) .ranking-rank,
.ranking-item:nth-child(3) .ranking-rank,
.ranking-page-item:nth-child(1) .ranking-rank,
.ranking-page-item:nth-child(2) .ranking-rank,
.ranking-page-item:nth-child(3) .ranking-rank {
  color: var(--color-accent);
}

.ranking-link {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ranking-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.category-list {
  display: flex;
  flex-direction: column;
}

.category-list-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 2px;
  border-bottom: 1px solid var(--color-bg);
  font-size: 14px;
  color: var(--color-text);
}

.category-list-item:last-child a {
  border-bottom: none;
}

.category-list-item a::after {
  content: "\203a";
  color: var(--color-text-faint);
}

.category-list-item a:hover {
  color: var(--color-accent);
}

.latest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.latest-item {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--color-border);
}

.latest-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.latest-link {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.latest-link:hover {
  color: var(--color-accent);
}

.recommended-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recommended-item {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--color-border);
}

.recommended-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.recommended-link {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recommended-link:hover {
  color: var(--color-accent);
}

/* ==========================================================================
   8. ランキングページ(div.ranking-page)
   ========================================================================== */
.ranking-page-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-page-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.ranking-page-item .ranking-rank {
  flex: 0 0 40px;
  min-width: 40px;
  text-align: center;
  font-size: 24px;
}

.ranking-page-item .article-card {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

/* ==========================================================================
   9. 検索ページ(div.search-page)
   ========================================================================== */
.search-form-main {
  max-width: 480px;
  margin-bottom: 20px;
}

.search-summary {
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.search-empty,
.search-prompt {
  padding: 40px 16px;
  text-align: center;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

/* ==========================================================================
   10. 記事詳細(article.article)
   ========================================================================== */
.article {
  padding: 20px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.breadcrumb {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.breadcrumb a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--color-text-faint);
}

.breadcrumb-current {
  color: var(--color-text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.article-header {
  margin-bottom: 16px;
}

.article-title {
  margin-bottom: 12px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.45;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.article-lead {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--color-bg);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 15px;
  line-height: 1.8;
}

.ai-disclaimer {
  margin-bottom: 20px;
  padding: 9px 12px;
  background: #fff8e6;
  border: 1px solid #f0e0ab;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.6;
  color: #8a6d1a;
}

.article-body {
  margin-bottom: 24px;
}

.article-body-error {
  padding: 28px 16px;
  text-align: center;
  background: #fff4f4;
  border: 1px solid #f3caca;
  border-radius: var(--radius-md);
  color: #a33;
}

.article-source {
  margin-bottom: 20px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text-muted);
}

.article-source-label {
  font-weight: 700;
}

.article-source-link {
  color: var(--color-link);
  text-decoration: underline;
  word-break: break-all;
}

.article-source-link:hover {
  color: var(--color-accent);
}

.article-tags {
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag a {
  display: inline-block;
  padding: 5px 12px;
  background: var(--color-bg);
  border-radius: 999px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.tag a::before {
  content: "#";
  color: var(--color-text-faint);
}

.tag a:hover {
  background: var(--color-accent);
  color: #ffffff;
}

.tag a:hover::before {
  color: #ffffff;
}

/* シェアバー: X=黒 / はてブ=水色 / LINE=緑、白文字・角丸 */
.share-bar {
  margin: 24px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.share-x {
  background: #000000;
}

.share-x:hover {
  background: #333333;
}

.share-hatena {
  background: #00a4de;
}

.share-hatena:hover {
  background: #0090c4;
}

.share-line {
  background: #06c755;
}

.share-line:hover {
  background: #05a847;
}

.related-articles {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.related-title {
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--color-accent);
  font-size: 18px;
  font-weight: 800;
}

.related-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .related-list {
    grid-template-columns: 1fr 1fr;
  }

  .related-list .article-card {
    height: 100%;
  }
}

.back-to-list {
  margin-top: 24px;
  text-align: center;
}

.back-to-list a {
  display: inline-block;
  padding: 10px 26px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

.back-to-list a:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ==========================================================================
   11. 記事本文レンダラ(A2 出力。res / tweet / heading / text / image / quote)
   ========================================================================== */

/* --- res(2ch風レス): .res > .t_h(番号・名前・日付) + .t_b(本文) --- */
.res {
  padding-bottom: 4px;
}

.t_h {
  margin-bottom: 3px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 15px;
  color: #767676;
}

.res-num {
  font-weight: 700;
}

.res-num::after {
  content: "\ff1a";
  color: var(--color-text-faint);
}

.res-name {
  font-weight: 700;
}

.t_b {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.75;
  color: #0000cd;
  word-break: break-word;
  overflow-wrap: break-word;
}

.t_b a,
.article-text a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.t_b a:hover,
.article-text a:hover {
  color: var(--color-accent);
}

.res-anchor {
  color: #0000cd;
  text-decoration: underline;
}

.res-anchor:hover {
  color: var(--color-accent);
}

/* --- tweet(X ポスト埋め込み): blockquote.twitter-tweet(widgets.js 読込前/失敗時のフォールバック見た目) --- */
blockquote.twitter-tweet {
  margin: 20px auto;
  max-width: 550px;
  padding: 16px;
  background: #f8f9fa;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.6;
}

blockquote.twitter-tweet p {
  margin-bottom: 8px;
  color: var(--color-text);
}

blockquote.twitter-tweet a {
  color: #1da1f2;
  word-break: break-all;
}

blockquote.twitter-tweet a:hover {
  text-decoration: underline;
}

/* --- heading(見出し): h2/h3.article-heading --- */
.article-heading {
  margin: 28px 0 14px;
  padding-left: 10px;
  border-left: 5px solid var(--color-accent);
  font-weight: 800;
  line-height: 1.5;
}

h2.article-heading {
  font-size: 19px;
}

h3.article-heading {
  margin-top: 22px;
  border-left-width: 4px;
  font-size: 16px;
}

/* --- text(段落): p.article-text(強調は .article-text-emphasis) --- */
.article-text {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.85;
}

.article-text-emphasis {
  padding: 10px 14px;
  background: #fff3cd;
  border-radius: var(--radius-sm);
}

.article-text-emphasis strong {
  color: #8a5a00;
  font-weight: 700;
}

/* --- image(画像): figure.article-image --- */
.article-image {
  margin: 20px 0;
}

.article-image img {
  width: 100%;
  border-radius: var(--radius-md);
}

.article-image figcaption {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-faint);
}

.article-image-credit::before {
  content: "\00a9\0020";
}

/* --- quote(引用): blockquote.quote --- */
blockquote.quote {
  margin: 20px 0;
  padding: 14px 18px;
  background: var(--color-bg);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  color: var(--color-text-muted);
}

.quote-text {
  line-height: 1.8;
}

.quote-cite {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  font-style: normal;
  color: var(--color-text-faint);
}

.quote-cite::before {
  content: "\2014\0020";
}

.quote-cite a {
  color: var(--color-text-faint);
  text-decoration: underline;
}

.quote-cite a:hover {
  color: var(--color-accent);
}

/* --- youtube(YouTube 動画埋め込み): figure.article-youtube > .article-youtube-frame(16:9) + figcaption --- */
.article-youtube {
  margin: 20px 0;
}

/* 16:9 のレスポンシブ埋め込み枠。padding-top:56.25% で高さを幅の 56.25% に固定する。 */
.article-youtube-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.article-youtube-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.article-youtube-caption {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.article-youtube-caption a {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  word-break: break-word;
}

.article-youtube-caption a:hover {
  text-decoration: underline;
}

.article-youtube-author {
  color: var(--color-text-faint);
  font-size: 12px;
}

/* --- link_card(汎用リンクカード / OGP プレビュー): a.link-card --- */
.link-card {
  display: flex;
  margin: 16px 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.link-card:hover {
  background: #f8f9fa;
}

.link-card-thumb {
  flex: 0 0 140px;
  background: var(--color-bg);
  overflow: hidden;
}

.link-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.link-card-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link-card-domain {
  font-size: 11px;
  color: var(--color-text-faint);
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.link-card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--color-text);
  /* 2 行で省略。overflow-wrap で長い URL・単語も折り返す。 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.link-card-desc {
  font-size: 12px;
  line-height: 1.55;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* サムネなしの link_card は幅全体を body が使う。 */
.link-card:not(:has(.link-card-thumb)) .link-card-body {
  padding: 14px 16px;
}

@media (max-width: 560px) {
  .link-card {
    flex-direction: column;
  }

  .link-card-thumb {
    flex: 0 0 auto;
    aspect-ratio: 16 / 9;
    width: 100%;
  }
}

/* --- 記事内広告枠(renderArticle が挿入): .ad-slot-top / -mid / -bottom --- */
.article-body .ad-slot-top,
.article-body .ad-slot-mid,
.article-body .ad-slot-bottom {
  padding: 16px 0;
  border-top: 1px dashed var(--color-border);
  border-bottom: 1px dashed var(--color-border);
}

/* ==========================================================================
   12. 広告枠共通(.ad-slot.ad-slot-*)— 空なら描画されないので固定高さは持たせない
   ========================================================================== */
.ad-slot {
  margin: 20px auto;
  text-align: center;
}

.ad-slot::before {
  content: "\5e83\544a";
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--color-text-faint);
}

.ad-slot-header {
  max-width: var(--max-width);
  margin: 10px auto 0;
  padding: 0 16px 12px;
}

.ad-slot-sidebar {
  margin: 0;
  padding: 16px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* ==========================================================================
   13. 法的ページ / 404(section.static-page / section.error-page)
   ========================================================================== */
.static-page {
  padding: 24px 20px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.static-title {
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--color-accent);
  font-size: 22px;
  font-weight: 800;
}

.static-heading {
  margin: 24px 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.static-page p {
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.9;
}

.static-page a {
  color: var(--color-link);
  text-decoration: underline;
}

.static-page a:hover {
  color: var(--color-accent);
}

.contact-email {
  font-size: 16px;
  font-weight: 700;
}

.error-page {
  padding: 56px 20px;
  text-align: center;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.error-code {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  color: var(--color-accent);
}

.error-title {
  margin: 12px 0 16px;
  font-size: 20px;
  font-weight: 800;
}

.error-page p {
  color: var(--color-text-muted);
}

.error-page .back-to-list {
  margin-top: 20px;
}

/* ==========================================================================
   14. 戻るボタン(JS 挿入。app.js 参照。ビューは出力しない)
   ========================================================================== */
#back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--color-accent);
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background 0.15s ease;
}

#back-to-top.is-visible {
  display: flex;
}

#back-to-top:hover {
  background: var(--color-accent-dark);
}

/* ==========================================================================
   15. 管理画面(/admin)— noindex。オーナー専用の運用 UI なので装飾は最小限。
   ========================================================================== */
.admin-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 16px 64px;
  color: var(--color-text);
}

.admin-shell h1 {
  font-size: 22px;
  margin: 0 0 20px;
}

.admin-login {
  max-width: 360px;
  margin: 80px auto;
  padding: 32px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.admin-login h1 {
  text-align: center;
  font-size: 18px;
}

.admin-back {
  margin: 0 0 12px;
  font-size: 13px;
}

.admin-back a {
  color: var(--color-link);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-header-actions a {
  color: var(--color-link);
  font-size: 14px;
}

.admin-error {
  padding: 10px 14px;
  margin: 0 0 16px;
  background: #fdecea;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  color: var(--color-accent-dark);
  font-size: 14px;
}

.admin-slug {
  color: var(--color-text-faint);
  font-size: 12px;
}

/* --- 記事一覧テーブル --- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.admin-table tbody tr:hover {
  background: var(--color-bg);
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.admin-row-actions a {
  color: var(--color-link);
}

.admin-row-actions form {
  margin: 0;
  display: inline;
}

/* --- 状態バッジ --- */
.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.admin-badge-published {
  background: #e6f4ea;
  color: #1e7e34;
}

.admin-badge-draft {
  background: #fff4e0;
  color: #a5701f;
}

.admin-badge-hidden {
  background: #eeeeee;
  color: var(--color-text-muted);
}

/* --- ページネーション --- */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.admin-pagination-links {
  display: flex;
  gap: 14px;
}

.admin-pagination-links a {
  color: var(--color-link);
}

/* --- フォーム(ログイン / 編集) --- */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-field label {
  font-size: 13px;
  color: var(--color-text-muted);
}

.admin-field input[type="text"],
.admin-field input[type="password"],
.admin-field input[type="number"],
.admin-field select,
.admin-field textarea {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 14px;
}

.admin-field textarea {
  resize: vertical;
}

.admin-field-row {
  flex-direction: row;
  gap: 20px;
}

.admin-field-row > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-field-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-size: 14px;
}

.admin-actions {
  margin-top: 4px;
}

/* --- ボタン --- */
.admin-btn {
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.admin-btn:hover {
  background: var(--color-bg);
}

.admin-btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
}

.admin-btn-primary:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}

.admin-btn-danger {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--color-accent-dark);
  border-color: var(--color-accent);
}

.admin-btn-danger:hover {
  background: #fdecea;
}

.admin-help {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.admin-warn {
  padding: 10px 14px;
  margin: 0 0 4px;
  background: #fff4e0;
  border: 1px solid #a5701f;
  border-radius: var(--radius-sm);
  color: #a5701f;
  font-size: 13px;
}

.admin-notice {
  padding: 10px 14px;
  margin: 0 0 16px;
  background: #e6f4ea;
  border: 1px solid #1e7e34;
  border-radius: var(--radius-sm);
  color: #1e7e34;
  font-size: 14px;
}

.admin-code {
  width: 100%;
  resize: vertical;
  font-family: var(--font-mono, monospace);
}
