/* === Site / Preview Presentation ======================================= */
@font-face {
  font-family: "Material Symbols Outlined";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("fonts/MaterialSymbolsOutlined%5BFILL%2CGRAD%2Copsz%2Cwght%5D.woff2") format("woff2");
}
#preview-wrap, #preview-wrap * { box-sizing: border-box; }
/* プレビュー列: 共通ヘッダー・本文・共通フッター。CSS 変数は子の #preview / .preview-shell へ継承 */
#preview-wrap {
  display: flex;
  flex-direction: column;
  container: site / inline-size;
  background: #fafaf2;
  color: #1b1c1c;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: system-ui, -apple-system, "Segoe UI", sans-serif, ui-monospace,
    "Cascadia Code", "SF Mono", Consolas, monospace;
  font-family: var(--font-body);
  /* App chrome typography must not alter the rendered article. */
  font-size: 1rem;
  line-height: normal;
  --accent-color: #006b56;
  --tag-accent-color: #006b56;
  --text-font-size: 1.2rem;
  --text-line-height: 2.0;
  --list-line-height: 1.5;
  --list-font-size: 1.2rem;
  --list-indent: 1.35em;
  --nested-indent: 1.25rem;
  --nested-border-width: 2px;
  --list-item-gap: 0.85rem;
  --list-nested-gap: 0.45rem;
  --bullet-size-1: 0.5em;
  --bullet-size-2: 0.55em;
  --bullet-size-3: 0.5em;
  --bullet-char-1: "●";
  --bullet-char-2: "○";
  --bullet-char-3: "▪";
  --header-h1-size: 3rem;
  --header-h1-margin-bottom: 1rem;
  --prose-h1-size: 2.25rem;
  --prose-h1-margin-top: 2rem;
  --prose-h1-margin-bottom: 1rem;
  --h2-size: 1.5rem;
  --h3-size: 1.25rem;
  --h4-size: 1.2rem;
  --h5-size: 1.15rem;
  --h6-size: 1.1rem;
  --h2-margin-top: 4rem;
  --h3-margin-top: 2.5rem;
  --h4-margin-top: 2rem;
  --h5-margin-top: 1.75rem;
  --h6-margin-top: 1.5rem;
  --h2-margin-bottom: 1.5rem;
  --h3-margin-bottom: 1rem;
  --h4-margin-bottom: 0.75rem;
  --h5-margin-bottom: 0.65rem;
  --h6-margin-bottom: 0.5rem;
  --h2-accent-width: 4px;
  --h2-accent-style: solid;
  --h2-accent-padding: 1rem;
  --paragraph-spacing: 1.5rem;
  --section-spacing: 2rem;
  --max-content-width: 768px;
  --index-content-width: 56rem;
  --index-card-min-width: 240px;
  --content-padding-top: 2rem;
  --content-padding-x: 1.5rem;
  --content-padding-bottom: 6rem;
  /* ヘッダー・フッター用（本文 --max-content-width とは独立） */
  --shell-side-padding: clamp(0.75rem, 4cqw, 2.5rem);
  --preview-scrollbar-width: 0px;
  --text-muted-contrast: #5f6a65;
  --text-subtle-contrast: #4d5853;
}

/* header.md / footer.md レンダリ結果（#preview 外・同期対象外） */
#preview-wrap .preview-shell {
  flex-shrink: 0;
  background: #fafaf2;
  color: #1a1c18;
}

/* 共通ヘッダー: 記事スクロールに連動して隠す（JS が .shell-header-hidden を付与） */
#preview-wrap .preview-shell-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 0.28s ease, opacity 0.22s ease, visibility 0.28s;
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

#preview-wrap .preview-shell-header.shell-header-hidden {
  transform: none;
}

/* 先頭へ戻る（プレビュー・エクスポート共通。位置はコンテキストで上書き） */
.mdrw-back-to-top {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: color-mix(
    in srgb,
    var(--accent-color, #006b56) 14%,
    rgba(255, 255, 255, 0.06)
  );
  color: color-mix(in srgb, var(--accent-color, #006b56) 72%, #3a403d);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.mdrw-back-to-top.mdrw-back-to-top--visible {
  opacity: 0.78;
  pointer-events: auto;
  transform: translateY(0);
}

.mdrw-back-to-top:hover {
  opacity: 0.95;
}

.mdrw-back-to-top:focus {
  outline: none;
}

.mdrw-back-to-top:focus-visible {
  box-shadow: 0 0 0 2px
    color-mix(in srgb, var(--accent-color, #006b56) 40%, transparent);
}

/* プレビュー列内: 先頭へ戻る（#preview-wrap が containing block） */
#preview-wrap .mdrw-back-to-top {
  position: absolute;
  right: calc(0.5rem + var(--preview-scrollbar-width, 0px));
  bottom: 1rem;
  z-index: 25;
}

#preview-wrap.mdrw-preview-map-active {
  background: #f4f1ea;
}

#preview-wrap.mdrw-preview-map-active .mdrw-back-to-top {
  display: none !important;
}

#preview-wrap.mdrw-preview-map-active #preview-scroll {
  overflow-y: auto;
  background: #f4f1ea;
}

#preview-wrap.mdrw-preview-map-active #preview {
  width: 100%;
  padding-right: 0;
  padding-left: 0;
  overflow: visible;
}

#preview-wrap.mdrw-preview-map-active .mdrw-map-embed-root {
  width: 100%;
  height: min(78vh, 900px);
  min-height: 640px;
  border-radius: 0;
}

@container site (max-width: 700px) {
  #preview-wrap.mdrw-preview-map-active .mdrw-map-embed-root {
    height: 75vh;
    min-height: 560px;
  }
}

/* ヘッダー分の余白（オーバーレイのため本文が隠れないように） */
#preview-wrap #preview {
  padding-top: 0;
}

/* 本文＋フッターをまとめて縦スクロール（フッターはコンテンツ末尾） */
#preview-scroll {
  flex: 1;
  min-height: 0;
  background: #fafaf2;
  color: inherit;
  font-family: inherit;
  display: flex;
  flex-direction: column;
}

/* プレビューモードで画像をドラッグ中のフィードバック */
#preview-scroll.preview-drop-active {
  outline: 2px dashed var(--accent-color, #006b56);
  outline-offset: -4px;
  background: color-mix(in srgb, var(--accent-color, #006b56) 10%, #fafaf2);
}

/* 共通フッター: #preview-scroll 内で記事の直後（長文は最後までスクロールで表示） */
#preview-wrap .preview-shell-footer {
  margin-top: auto;
  flex-shrink: 0;
  border-top: none;
  background: #f4f4ec;
}

/* Rust が包む .preview-shell-inner: 本文カラム幅に縛らずプレビュー列いっぱい */
#preview-wrap .preview-shell-inner {
  max-width: none;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  padding: 0.65rem var(--shell-side-padding);
}

#preview-wrap .preview-shell-header .preview-shell-inner {
  padding-right: calc(
    var(--shell-side-padding) + var(--preview-scrollbar-width)
  );
}

#preview-wrap .preview-shell .prose-content {
  font-size: 0.9rem;
  line-height: 1.5;
}

#preview-wrap .preview-shell .prose-content h1 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: #1b1c1c;
}

#preview-wrap .preview-shell .prose-content h2,
#preview-wrap .preview-shell .prose-content h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin: 0.35rem 0 0;
  color: #2d3330;
}

#preview-wrap .preview-shell .prose-content p {
  margin: 0.25rem 0 0;
}

#preview-wrap .preview-shell .prose-content p:first-child {
  margin-top: 0;
}

#preview-wrap .preview-shell .prose-content a {
  color: var(--accent-color);
  text-decoration: none;
}

#preview-wrap .preview-shell .prose-content a:hover {
  text-decoration: underline;
}

#preview-wrap .preview-shell-error {
  margin: 0;
  font-size: 0.8rem;
  color: #b42318;
}

/* --- site-header（header.md 内 HTML） --- */
#preview-wrap .site-header {
  min-height: 3.25rem;
  --site-control-height: 2.58rem;
  --site-control-radius: 14px;
  container-type: inline-size;
}

#preview-wrap .site-header.site-header--glass {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(250, 250, 242, 0.94);
}

#preview-wrap .site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  /* 横余白は .preview-shell-inner が担当 */
  padding: 0.75rem 0;
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}

#preview-wrap .site-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  text-decoration: none;
}

#preview-wrap .site-logo:hover .site-logo-img {
  opacity: 0.92;
}

#preview-wrap .site-logo-img {
  display: block;
  height: 2.9rem;
  width: auto;
  max-width: min(16rem, 58cqw);
  object-fit: contain;
  object-position: left center;
}

#preview-wrap .site-header-right {
  display: grid;
  grid-template-columns: minmax(0, 18rem) auto;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 24rem;
  justify-content: flex-end;
  min-width: min(100%, 24rem);
}

#preview-wrap .site-nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

#preview-wrap .site-nav-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--site-control-height);
  padding: 0 1rem;
  border: 1px solid #1a1c18;
  border-radius: var(--site-control-radius);
  color: #fff;
  background: #1a1c18;
  box-shadow: 0 8px 18px rgba(26, 28, 24, 0.14);
  font: 800 0.86rem/1 var(--font-ui), system-ui, sans-serif;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

#preview-wrap .preview-shell .prose-content a.site-nav-primary,
#preview-wrap .preview-shell .prose-content a.site-nav-primary:visited {
  color: #fff;
  text-decoration: none;
  border-bottom: none;
}

#preview-wrap .site-nav-primary:hover {
  color: #fff;
  background: #2a2d27;
  border-color: #2a2d27;
  box-shadow: 0 12px 24px rgba(26, 28, 24, 0.18);
  transform: translateY(-1px);
  text-decoration: none;
}

#preview-wrap .site-nav-primary:focus-visible {
  outline: 2px solid rgba(15, 23, 42, 0.28);
  outline-offset: 3px;
}

#preview-wrap .site-search {
  display: flex;
  align-items: stretch;
  min-height: var(--site-control-height);
  padding: 0.18rem;
  border: 1px solid rgba(26, 28, 24, 0.12);
  border-radius: var(--site-control-radius);
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(26, 28, 24, 0.06);
  min-width: 0;
  width: 100%;
  max-width: 18rem;
  flex: 1;
}

#preview-wrap .site-search input[type="search"] {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
  background: transparent;
  color: #1a1c18;
}

#preview-wrap .site-search input[type="search"]::placeholder {
  color: #6e7a75;
}

#preview-wrap .site-search input[type="search"]:focus {
  outline: none;
}

#preview-wrap .site-search-btn {
  flex-shrink: 0;
  min-width: 4.15rem;
  padding: 0 0.75rem;
  border: none;
  border-radius: calc(var(--site-control-radius) - 4px);
  background: #1a1c18;
  cursor: pointer;
  font: 800 0.86rem/1 var(--font-ui), system-ui, sans-serif;
  color: #ffffff;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

#preview-wrap .site-search-btn:hover {
  background: #2a2d27;
  color: #ffffff;
  transform: translateY(-1px);
}

@container (max-width: 560px) {
  #preview-wrap .site-header-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    column-gap: 0.75rem;
    row-gap: 0.4rem;
    flex-wrap: nowrap;
  }

  #preview-wrap .site-header-right {
    display: contents;
  }

  #preview-wrap .site-search {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    max-width: none;
  }

  #preview-wrap .site-search input[type="search"] {
    padding: 0 0.55rem;
  }

  #preview-wrap .site-search-btn {
    min-width: 3.25rem;
    padding: 0 0.5rem;
  }

  #preview-wrap .site-nav-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  #preview-wrap .site-nav-primary {
    width: 100%;
    padding: 0 0.85rem;
  }
}

@container site (max-width: 720px) {
  #preview-wrap .site-header-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    column-gap: 0.75rem;
    row-gap: 0.4rem;
    flex-wrap: nowrap;
  }

  #preview-wrap .site-header-right {
    display: contents;
  }

  #preview-wrap .site-search {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    max-width: none;
  }

  #preview-wrap .site-search input[type="search"] {
    padding: 0 0.55rem;
  }

  #preview-wrap .site-search-btn {
    min-width: 3.25rem;
    padding: 0 0.5rem;
  }

  #preview-wrap .site-nav-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  #preview-wrap .site-nav-primary {
    width: 100%;
    padding: 0 0.85rem;
  }
}

/* --- site-footer（footer.md 内 HTML） --- */
#preview-wrap .site-footer {
  width: 100%;
}

#preview-wrap .site-footer-inner {
  /* 横余白は .preview-shell-inner が担当 */
  padding: 1.75rem 0 2rem;
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}

@container site (min-width: 1200px) {
  #preview-wrap .site-footer-inner {
    padding: 2rem 0 2.25rem;
  }
}

#preview-wrap .site-footer.site-footer--editorial {
  background: #f4f4ec;
}

#preview-wrap .footer-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem 1.5rem;
}

@container site (max-width: 640px) {
  #preview-wrap .footer-columns {
    grid-template-columns: 1fr;
  }
}

#preview-wrap .footer-col h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #52625d;
  margin: 0 0 0.5rem;
}

#preview-wrap .footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#preview-wrap .footer-col li {
  margin: 0.25rem 0;
}

#preview-wrap .footer-col a {
  font-size: 0.85rem;
  color: #2d4038;
  text-decoration: none;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
}

#preview-wrap .footer-col a:hover {
  color: #005140;
  text-decoration: underline;
}

#preview-wrap .footer-copyright {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: none;
  font-size: 0.8125rem;
  color: #52625d;
  text-align: center;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
}

#preview-wrap .footer-editorial-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: center;
}

@container site (min-width: 768px) {
  #preview-wrap .footer-editorial-row {
    flex-direction: row;
    text-align: left;
  }
}

#preview-wrap .footer-editorial-note {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #52625d;
  max-width: 36rem;
}

#preview-wrap .footer-editorial-note a {
  color: #1f3f37;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, #1f3f37 38%, transparent);
}

#preview-wrap .footer-editorial-note a:hover {
  color: #0f172a;
  border-bottom-color: #0f172a;
}

#preview-label {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  color: #888;
  border-bottom: 1px solid #3c3c3c;
}

/* --- The Curator デザイン: Material Design 3 + Tailwind --- */
/* プレビュー調整は JS（設定メニュー）から #preview-wrap に上書き（子へ継承） */
/* 縦スクロールは親 #preview-scroll に任せ、本文は内容高さで伸びる */
#preview {
  flex-shrink: 0;
  min-height: min-content;
  overflow-x: auto;
  overflow-y: visible;
  background: transparent;
  color: inherit;
  font-family: inherit;
}

#preview [data-preview-body][contenteditable="true"] {
  outline: none;
  box-shadow: none;
}

/* title / description の編集時フォーカス枠は表示しない */
#preview [data-preview-field][contenteditable="true"],
#preview [data-preview-field][contenteditable="true"]:focus,
#preview [data-preview-field][contenteditable="true"]:focus-visible {
  outline: none;
  box-shadow: none;
}

/* プレビュー内部のスタイル（Tailwindが読めない場合のフォールバック） */
#preview > .preview-article {
  max-width: var(--index-content-width);
  margin: 0 auto;
  padding: var(--content-padding-top) var(--content-padding-x)
    var(--content-padding-bottom);
}

#preview > .preview-article:not([data-preview-layout="index"]) {
  width: min(
    calc(var(--max-content-width) + clamp(3rem, 12cqw, 9rem)),
    calc(100% - clamp(1rem, 5cqw, 4rem))
  );
  max-width: none;
  padding: clamp(3rem, 5cqw, 4.75rem) clamp(1.5rem, 6cqw, 4.5rem)
    clamp(6rem, 9cqw, 8rem);
  background: #fff;
}

#preview > .preview-article[data-preview-layout="index"] {
  width: 100%;
  max-width: none;
  margin: 0;
  padding-left: var(--shell-side-padding);
  padding-right: var(--shell-side-padding);
}

#preview header.preview-frontmatter-header {
  text-align: center;
  margin-bottom: var(--section-spacing);
}

#preview .preview-frontmatter-meta {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  margin: 0 0 0.9rem;
}

#preview header.preview-frontmatter-header h1.preview-frontmatter-title {
  font-family: var(--font-heading);
  /* 設定ドロワー開閉でプレビュー幅が変わっても、ヘッダーサイズが変わらないよう
     純粋な CSS 変数値を使用（12cqw との min は除去） */
  font-size: var(--header-h1-size);
  font-weight: 700;
  color: #1b1c1c;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 var(--header-h1-margin-bottom);
  text-align: left;
}

/* プレビューから title / description を編集するときの空プレースホルダー */
#preview h1.preview-frontmatter-title[data-preview-field="title"]:empty::before {
  content: "タイトル";
  color: color-mix(in srgb, #1b1c1c 38%, #78847f);
  pointer-events: none;
}

#preview p.preview-frontmatter-description[data-preview-field="description"]:empty::before {
  content: "説明（任意）";
  color: color-mix(in srgb, #56635e 45%, #78847f);
  pointer-events: none;
}

#preview .preview-frontmatter-date {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-subtle-contrast);
  text-align: right;
}

#preview .preview-draft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.22rem 0.55rem;
  margin-bottom: 0;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  background: #b42318;
  border-radius: 999px;
}

#preview .preview-frontmatter-description {
  max-width: min(100%, var(--index-content-width));
  margin: 0 0 1.25rem;
  font-size: var(--text-font-size) !important;
  line-height: var(--text-line-height) !important;
  color: #56635e;
  text-align: left;
}

#preview .preview-tag-list {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0 auto;
  max-width: min(100%, 28rem);
}

#preview .preview-tag-chip {
  display: inline-block;
  padding: 0.25rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: color-mix(in srgb, var(--tag-accent-color) 70%, #1b1c1c);
  background: color-mix(in srgb, var(--tag-accent-color) 15%, #f0f5f2);
  border-radius: 999px;
  text-decoration: none;
  border-bottom: none;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

#preview .preview-tag-chip:hover {
  transform: translateY(-1px);
  color: color-mix(in srgb, var(--tag-accent-color) 84%, #1b1c1c);
  background: color-mix(in srgb, var(--tag-accent-color) 22%, #f0f5f2);
  border-bottom: none;
}

#preview .preview-index-page {
  display: grid;
  align-content: start;
  gap: 1.25rem;
  max-width: var(--index-content-width);
  margin-left: auto;
  margin-right: auto;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
}

#preview .preview-index-page-articles {
  width: min(
    calc(var(--max-content-width) + clamp(3rem, 12cqw, 9rem)),
    calc(100% - clamp(1rem, 5cqw, 4rem))
  );
  max-width: none;
  padding: clamp(2.25rem, 4cqw, 3.25rem) clamp(1.25rem, 5cqw, 3.25rem)
    clamp(4.5rem, 7cqw, 6.5rem);
  background: #fff;
}

#preview .preview-index-page-header {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  margin: 0;
}

#preview .preview-index-page-articles .preview-index-page-header {
  gap: 0.55rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid rgba(26, 28, 24, 0.1);
}

#preview .preview-index-filter-summary {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5;
  color: #44524d;
}

#preview .preview-index-page-articles .preview-index-filter-summary {
  width: fit-content;
  max-width: 100%;
  padding: 0.42rem 0.75rem;
  border: 1px solid rgba(26, 28, 24, 0.1);
  border-radius: 999px;
  background: #f4f4ec;
  color: #44524d;
}

#preview .preview-index-filter-summary[hidden] {
  display: none !important;
}

#preview .preview-index-empty[hidden] {
  display: none !important;
}

#preview .preview-index-page .preview-index-page-header > h1 {
  margin: 0;
  font-family: "Plus Jakarta Sans", var(--font-heading), system-ui, sans-serif;
  font-size: clamp(1.9rem, calc(var(--header-h1-size) * 0.72), 2.35rem);
  font-weight: 700;
  color: #1a1c18;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

#preview .preview-index-page-articles .preview-index-page-header > h1 {
  font-size: clamp(2rem, calc(var(--header-h1-size) * 0.72), 2.45rem);
}

#preview .preview-home-section {
  display: grid;
  align-content: start;
  gap: 0.78rem;
  margin: 0;
}

#preview .preview-home-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
}

#preview .preview-home-section-title {
  margin: 0;
  font-family: "Plus Jakarta Sans", var(--font-heading), system-ui, sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1a1c18;
}

#preview .preview-home-tag-groups {
  display: grid;
  align-content: start;
  gap: 1rem;
}

#preview .preview-index-empty {
  margin: 0;
  color: #66736d;
}

#preview .preview-index-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(
      min(100%, var(--index-card-min-width)),
      min(100%, var(--index-card-min-width))
    )
  );
  justify-content: start;
  gap: 10px;
}

/* 縦並びフィード（横長カード） */
#preview .preview-index-feed {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  width: 100%;
}

#preview .preview-index-page-articles .preview-index-feed {
  gap: 0.9rem;
}

#preview .preview-hero-wrap {
  width: 100%;
  margin-bottom: 0.25rem;
}

#preview .preview-feed-section-title {
  margin: 2rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6e7a75;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
}

#preview .preview-index-card-item {
  margin: 0;
  min-width: 0;
  padding: 0;
  max-width: none;
}

/* --- 横並びカード --- */
#preview .preview-index-card.preview-index-card--horizontal {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-decoration: none;
  color: inherit;
  border-bottom: none;
  border-radius: 0;
  background: transparent;
}

#preview .preview-index-page-articles
  .preview-index-card.preview-index-card--horizontal {
  padding: clamp(0.75rem, 2cqw, 1rem);
  border: 1px solid rgba(26, 28, 24, 0.09);
  border-radius: 8px;
  background: #fbfbf7;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

@container site (min-width: 768px) {
  #preview .preview-index-card.preview-index-card--horizontal {
    flex-direction: row;
    align-items: stretch;
    gap: 2rem;
  }
}

#preview .preview-index-page-articles
  .preview-index-card.preview-index-card--horizontal:hover {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--accent-color, #006b56) 28%, #d9d6cd);
  box-shadow: 0 12px 26px rgba(26, 28, 24, 0.08);
  transform: translateY(-1px);
}

#preview .preview-index-card.preview-index-card--horizontal:hover
  .preview-index-card-title {
  color: #005140;
}

#preview .preview-index-card.preview-index-card--horizontal:hover
  .preview-index-card-image {
  transform: scale(1.08);
}

#preview .preview-index-card.preview-index-card--horizontal .preview-index-card-media {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 0.5rem;
  background: #f4f4ec;
}

@container site (min-width: 768px) {
  #preview .preview-index-card.preview-index-card--horizontal .preview-index-card-media {
    width: 14rem;
    max-width: 38%;
    aspect-ratio: 1 / 1;
  }
}

#preview .preview-index-card.preview-index-card--horizontal .preview-index-card-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  padding: 0.15rem 0;
}

#preview .preview-index-tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

#preview .preview-index-tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.15rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #005140;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
}

#preview .preview-index-card.preview-index-card--horizontal .preview-index-tag-chip {
  background: #eef4f1;
  border-radius: 999px;
  padding-left: 0.62rem;
  padding-right: 0.62rem;
  margin-bottom: 0;
}

#preview .preview-index-card.preview-index-card--hero .preview-index-tag-chip {
  background: #d2e4dd;
  color: #566661;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
}

#preview .preview-index-card .preview-index-card-title {
  margin: 0;
  font-family: "Plus Jakarta Sans", var(--font-heading), system-ui, sans-serif;
  font-size: clamp(1.25rem, 2.8cqw, 1.5rem);
  line-height: 1.3;
  font-weight: 700;
  color: #1a1c18;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
  transition: color 0.3s ease;
}

#preview .preview-index-card-description {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #3e4945;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
}

#preview .preview-index-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6e7a75;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
}

#preview .preview-index-card-date {
  font-variant-numeric: tabular-nums;
}

#preview .preview-index-card-media > .preview-index-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  max-width: none;
  border-radius: 0;
  transition: transform 0.5s ease;
}

#preview .preview-index-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.9rem;
  background: #f4f4ec;
  color: #6e7a75;
}

#preview .preview-index-card-placeholder-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5rem;
  padding: 0.24rem 0.55rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
}

/* --- ヒーロー --- */
#preview .preview-index-card.preview-index-card--hero {
  display: block;
  text-decoration: none;
  color: inherit;
  border-bottom: none;
}

#preview .preview-hero-media {
  margin-bottom: 1.5rem;
}

#preview .preview-hero-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 0.75rem;
  background: #f4f4ec;
  transition: transform 0.5s ease;
}

#preview .preview-index-card--hero:hover .preview-hero-image-wrap {
  transform: scale(1.01);
}

#preview .preview-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
}

#preview .preview-hero-content {
  gap: 0.65rem;
}

#preview .preview-hero-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

#preview .preview-hero-title {
  margin: 0;
  font-family: "Plus Jakarta Sans", var(--font-heading), system-ui, sans-serif;
  font-size: clamp(2rem, 5cqw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #1a1c18;
  transition: color 0.3s ease;
}

#preview .preview-index-card--hero:hover .preview-hero-title {
  color: #005140;
}

#preview .preview-hero-description {
  max-width: min(100%, var(--index-content-width));
  font-size: 1.0625rem;
  -webkit-line-clamp: 4;
}

#preview .preview-hero-footer-meta {
  padding-top: 0.35rem;
}

#preview .preview-tag-directory {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
}

#preview .preview-tag-directory-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: #566661;
  background: #d2e4dd;
  border: none;
  font-family: "Inter", var(--font-ui), system-ui, sans-serif;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

#preview .preview-tag-directory-link:hover {
  color: #005140;
  background: color-mix(in srgb, #005140 12%, #d2e4dd);
  border-bottom: none;
  transform: translateY(-1px);
}

#preview .preview-tag-directory-name {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#preview .preview-tag-directory-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: #52625d;
}

#preview .preview-tag-section {
  margin: 0;
  display: grid;
  align-content: start;
  gap: 0.78rem;
  scroll-margin-top: calc(var(--site-header-offset, 3.5rem) + 0.9rem);
}

#preview .preview-tag-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
}

#preview .preview-tag-section .preview-tag-section-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1b1c1c;
  border-left: none;
  padding-left: 0;
}

#preview .preview-tag-section-count {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  color: #73807a;
}

@container site (max-width: 720px) {
  #preview {
    --header-h1-size: clamp(1.85rem, 8.2cqw, 2.15rem);
    --header-h1-margin-bottom: 0.85rem;
    --prose-h1-size: clamp(1.5rem, 6.4cqw, 1.8rem);
    --prose-h1-margin-top: 1.75rem;
    --prose-h1-margin-bottom: 0.85rem;
  }

  #preview header.preview-frontmatter-header h1.preview-frontmatter-title {
    line-height: 1.18;
    letter-spacing: 0;
  }

  #preview .preview-index-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  #preview .preview-index-feed {
    gap: 2rem;
  }

  #preview .preview-tag-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  #preview .preview-home-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

#preview .prose-content h1 {
  font-family: var(--font-heading);
  font-size: var(--prose-h1-size);
  font-weight: 700;
  color: #1b1c1c;
  line-height: 1.25;
  margin-top: var(--prose-h1-margin-top);
  margin-bottom: var(--prose-h1-margin-bottom);
}

#preview .preview-date-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #ffffff;
  background: var(--accent-color);
  border-radius: 999px;
}

#preview .preview-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

#preview .preview-tag {
  display: inline-block;
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--tag-accent-color) 70%, #1b1c1c);
  background: color-mix(in srgb, var(--tag-accent-color) 15%, #f0f5f2);
  border-radius: 999px;
  text-decoration: none;
}

#preview .preview-featured-image {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 0.75rem;
  background: #eae8e7;
  margin-top: 0;
  margin-bottom: var(--section-spacing);
}

#preview .preview-featured-image.preview-featured-image-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed color-mix(in srgb, var(--accent-color) 40%, #bccac3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(238, 241, 239, 0.92)),
    #eef1ef;
}

#preview .preview-featured-image-placeholder {
  padding: 1.5rem;
  text-align: center;
}

#preview .preview-featured-image-label {
  margin: 0;
  font-size: 1rem !important;
  font-weight: 700;
  color: #1b1c1c;
}

#preview .preview-featured-image-help {
  margin: 0.45rem 0 0 !important;
  font-size: 0.9rem !important;
  color: #56635e;
}

#preview .preview-featured-image.featured-image-drop-active {
  outline: 3px dashed var(--accent-color, #006b56);
  outline-offset: -4px;
  background: color-mix(in srgb, var(--accent-color, #006b56) 15%, #eae8e7);
  cursor: copy;
}

#preview .preview-featured-image.featured-image-drop-active::after {
  content: "Drop to replace featured image";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-color, #006b56);
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
  z-index: 2;
}

#preview .preview-featured-image-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  max-width: none;
  border-radius: 0;
  box-shadow: 0 0 0 1px rgba(107, 114, 128, 0.18);
}

#preview .preview-youtube-embed {
  display: block;
  margin: 0 0 var(--paragraph-spacing);
  border-radius: 1rem;
  overflow: hidden;
  background: #111;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14);
  user-select: none;
}

#preview .preview-youtube-embed-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.14), transparent 48%),
    #000;
}

#preview .preview-youtube-activate {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.42)),
    transparent;
  cursor: pointer;
}

#preview .preview-youtube-activate:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -6px;
}

#preview .preview-youtube-thumb {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#preview .preview-youtube-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 64px;
  border-radius: 20px;
  transform: translate(-50%, -50%);
  background: rgba(18, 18, 18, 0.74);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

#preview .preview-youtube-play::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-38%, -50%);
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fff;
}

#preview .preview-youtube-activate:hover .preview-youtube-play,
#preview .preview-youtube-activate:focus-visible .preview-youtube-play {
  transform: translate(-50%, -50%) scale(1.06);
  background: #ff0033;
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.3);
}

#preview .preview-youtube-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: auto;
}

#preview .preview-body img.preview-image-selected {
  outline: 3px solid var(--accent-color, #006b56);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px
    color-mix(in srgb, var(--accent-color, #006b56) 14%, transparent);
  cursor: pointer;
}

#preview .preview-md-copy-row {
  margin: 1.25rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid color-mix(in srgb, var(--accent-color) 18%, #d4d4d4);
  font-size: 0.82rem;
  color: #66736d;
  line-height: 1.5;
}

#preview .preview-md-copy-row--in-header {
  margin-top: 0.65rem;
  padding-top: 0;
  border-top: none;
  text-align: left;
}

#preview .preview-md-copy-btn {
  margin-right: 0.5rem;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #2d4038;
  background: #eef1ef;
  border: 1px solid #c5d1cb;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-ui);
}

#preview .preview-md-copy-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: color-mix(in srgb, var(--accent-color) 8%, #fff);
}

#preview .preview-md-copy-hint {
  font-size: 0.78rem;
  color: var(--text-muted-contrast);
}

/* エクスポート記事末尾: 記事一覧・更新履歴（バックアップ）・関連記事（自動生成） */
#preview .article-map-navigation,
#preview .article-version-history,
#preview .article-related,
#preview .article-x-contact {
  margin-top: var(--section-spacing, 2rem);
  padding-top: 1.25rem;
  border-top: 1px solid color-mix(in srgb, var(--accent-color) 12%, #d4d4d4);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-color, #2d4038);
}

#preview .article-map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 14px;
  color: #fff;
  background: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  font-family: var(--font-ui);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

#preview .article-map-link:hover {
  background: #334155;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
}

#preview .article-version-history h2,
#preview .article-related h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.65rem;
}

#preview .article-version-history ul,
#preview .article-related ul {
  margin: 0;
  padding-left: 1.25rem;
}

#preview .article-version-history li,
#preview .article-related li {
  margin: 0.2rem 0;
}

#preview .article-related a {
  color: var(--accent-color, #006b56);
  text-decoration: underline;
  text-underline-offset: 2px;
}

#preview .article-x-contact p {
  margin: 0;
  color: var(--text-muted-contrast, #52625d);
}

#preview .article-x-contact a {
  color: var(--accent-color, #006b56);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* エディタプレビュー: 記事末尾の自動フッター（編集不可・本文同期の対象外） */
#preview .preview-article-footer {
  cursor: default;
  user-select: text;
}

#preview .preview-youtube-embed-meta {
  display: block;
  padding: 0.85rem 1rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    #111;
  overflow-wrap: anywhere;
}

#preview .preview-youtube-embed-meta a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

#preview .preview-youtube-embed-meta a:hover,
#preview .preview-youtube-embed-meta a:focus-visible {
  color: #fff;
}

#preview .preview-youtube-embed.preview-youtube-selected {
  outline: 3px solid var(--accent-color, #006b56);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px
    color-mix(in srgb, var(--accent-color, #006b56) 14%, transparent);
  cursor: pointer;
}

#preview img[data-md-image-index].body-image-drop-active {
  outline: 3px dashed var(--accent-color, #006b56);
  outline-offset: 4px;
  cursor: copy;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-color, #006b56) 18%, transparent);
}

/* 本文スタイル */
#preview .prose-content {
  line-height: var(--text-line-height);
}

/* 記事内ローカル動画（Markdown の ![](*.webm) から生成） */
.prose-content video {
  max-width: 100%;
  height: auto;
}

/* 本文見出し（.prose-content 内のみ。設定の CSS 変数が確実に効くよう具体化） */
#preview .prose-content h2 {
  font-family: var(--font-heading);
  font-size: var(--h2-size);
  font-weight: 700;
  color: #1b1c1c;
  border-left: var(--h2-accent-width) var(--h2-accent-style) var(--accent-color);
  padding-left: var(--h2-accent-padding);
  margin-top: var(--h2-margin-top);
  margin-bottom: var(--h2-margin-bottom);
}

#preview .prose-content h3 {
  font-family: var(--font-heading);
  font-size: var(--h3-size);
  font-weight: 700;
  color: #1b1c1c;
  margin-top: var(--h3-margin-top);
  margin-bottom: var(--h3-margin-bottom);
}

#preview .prose-content h4 {
  font-family: var(--font-heading);
  font-size: var(--h4-size);
  font-weight: 700;
  color: #1b1c1c;
  margin-top: var(--h4-margin-top);
  margin-bottom: var(--h4-margin-bottom);
}

#preview .prose-content h5 {
  font-family: var(--font-heading);
  font-size: var(--h5-size);
  font-weight: 700;
  color: #1b1c1c;
  margin-top: var(--h5-margin-top);
  margin-bottom: var(--h5-margin-bottom);
}

#preview .prose-content h6 {
  font-family: var(--font-heading);
  font-size: var(--h6-size);
  font-weight: 700;
  color: #1b1c1c;
  margin-top: var(--h6-margin-top);
  margin-bottom: var(--h6-margin-bottom);
}

#preview p {
  font-size: var(--text-font-size) !important;
  line-height: var(--text-line-height) !important;
  color: #3d4a45;
  margin-top: 0;
  margin-bottom: var(--paragraph-spacing);
}

#preview a {
  color: var(--accent-color);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

#preview a:hover {
  border-bottom-color: var(--accent-color);
}

/* 引用ブロック */
#preview blockquote {
  position: relative;
  padding: 2.5rem 2rem;
  background: color-mix(in srgb, var(--accent-color) 8%, transparent);
  border-left: 8px solid var(--accent-color);
  border-radius: 0 1rem 1rem 0;
  margin-top: 0;
  margin-bottom: var(--section-spacing);
  /* UA 既定の左右マージンを打ち消し、本文と同じ左端から始める */
  margin-left: 0;
  margin-right: 0;
}

#preview blockquote.preview-blockquote::after {
  content: "note";
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  line-height: 1;
  color: color-mix(in srgb, var(--accent-color) 45%, #3d4a45);
  pointer-events: none;
  user-select: none;
}

#preview blockquote p {
  font-size: var(--text-font-size) !important;
  line-height: var(--text-line-height) !important;
  font-style: italic;
  color: #3d4a45;
  margin: 0;
}

#preview details.preview-ai-comment {
  position: relative;
  margin: 0 0 var(--section-spacing);
  background: #ffffff;
  border: 1px solid #dfe7e2;
  border-radius: 6px;
  overflow: hidden;
}

#preview details.preview-ai-comment > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.2rem 0.8rem;
  padding: 0.9rem 1rem;
  color: #2f3e38;
  font-size: var(--text-font-size);
  line-height: var(--text-line-height);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background-color 0.16s ease, color 0.16s ease;
}

#preview details.preview-ai-comment > summary:hover {
  background: #f8faf9;
}

#preview details.preview-ai-comment[open] > summary {
  border-bottom: 1px solid #e8eeea;
}

#preview details.preview-ai-comment > summary::before {
  content: "AI";
  grid-column: 1;
  grid-row: 1;
  flex: 0 0 auto;
  color: var(--accent-color);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1;
}

#preview .preview-ai-comment-title {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

#preview details.preview-ai-comment > summary::-webkit-details-marker {
  display: none;
}

#preview details.preview-ai-comment > summary::after {
  content: "";
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  margin-left: auto;
  border-right: 1.5px solid #5f6f68;
  border-bottom: 1.5px solid #5f6f68;
  transform: translateY(-0.1rem) rotate(45deg);
  transition: transform 0.16s ease;
}

#preview details.preview-ai-comment[open] > summary::after {
  transform: translateY(0.15rem) rotate(225deg);
}

#preview .preview-ai-comment-teaser {
  grid-column: 2 / 4;
  grid-row: 2;
  display: -webkit-box;
  overflow: hidden;
  color: #33433d;
  font-size: var(--text-font-size);
  font-weight: 400;
  line-height: var(--text-line-height);
  opacity: 0.76;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 58%, transparent 100%);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

#preview details.preview-ai-comment[open] .preview-ai-comment-teaser {
  display: none;
}

#preview .preview-ai-comment-body {
  padding: 1rem;
  background: #ffffff;
  color: #33433d;
}

#preview .preview-ai-comment-body > *:first-child {
  margin-top: 0;
}

#preview .preview-ai-comment-body > *:last-child {
  margin-bottom: 0;
}

/* リスト（箇条書き: 行頭記号のコントラスト + ぶら下げ + 項目間／行間の差） */
/* flex + gap で項目間を一定に（隣接 margin の相殺・Tailwind space-y の片側だけ上マージンを避ける） */
#preview ul {
  list-style: none;
  padding: 0;
  margin-top: 0;
  margin-bottom: var(--paragraph-spacing);
  display: flex;
  flex-direction: column;
  gap: var(--list-item-gap);
}

#preview ul ul {
  margin: 0.35rem 0 0.35rem 0;
  padding-left: var(--nested-indent);
  border-left: var(--nested-border-width) solid
    color-mix(in srgb, var(--accent-color) 18%, transparent);
  gap: var(--list-nested-gap);
}

#preview ol {
  list-style: decimal;
  padding-left: 1.6rem;
  margin-top: 0;
  margin-bottom: var(--paragraph-spacing);
  display: flex;
  flex-direction: column;
  gap: var(--list-item-gap);
}

#preview ol ol {
  margin: 0.35rem 0 0.35rem 0;
  padding-left: 1.45rem;
}

/* 2行目以降は本文開始位置で揃い、● だけ左に張り出す（padding-left + 絶対配置） */
#preview ul li {
  position: relative;
  padding-left: var(--list-indent);
  margin: 0;
  line-height: var(--list-line-height);
  font-size: var(--list-font-size);
  color: #3d4a45;
}

#preview ul li > p {
  margin-top: 0;
  margin-bottom: 0.45rem;
  line-height: inherit;
}

#preview ol li {
  margin: 0;
  line-height: var(--list-line-height);
  font-size: var(--list-font-size);
  color: #3d4a45;
}

#preview ol li > p {
  margin-top: 0;
  margin-bottom: 0.45rem;
  line-height: inherit;
}

#preview ul li > p:last-child {
  margin-bottom: 0;
}

#preview ol li > p:last-child {
  margin-bottom: 0;
}

/* 主行頭記号: li 要素の縦中央（ルートの ul＝親が li でない ul 配下の li） */
#preview :not(li) > ul > li::before {
  content: var(--bullet-char-1);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--bullet-size-1);
  line-height: 1;
  color: var(--accent-color);
}

/* ネスト: 中空円で階層差（項目間は ul ul の gap） */
#preview ul ul li {
  padding-left: 1.2em;
  margin: 0;
  line-height: var(--list-line-height);
}

#preview li > ul > li::before {
  content: var(--bullet-char-2);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--bullet-size-2);
  line-height: 1;
  color: color-mix(in srgb, var(--accent-color) 72%, #3d4a45);
}

/* 3階層目: 小さめの角丸 */
#preview ul ul ul li {
  padding-left: 1.1em;
}

#preview li > ul > li > ul > li::before {
  content: var(--bullet-char-3);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--bullet-size-3);
  line-height: 1;
  color: color-mix(in srgb, var(--accent-color) 60%, #3d4a45);
}

/* タスクリストは横線マーカーを出さない */
#preview ul li.task-list-item::before,
#preview ul li:has(> input[type="checkbox"])::before {
  display: none;
}

#preview ul li.task-list-item,
#preview ul li:has(> input[type="checkbox"]) {
  padding-left: 0.35rem;
}

/* テーブル（GFM）: 外枠 + セル縦横線 */
#preview .preview-table-wrapper {
  margin-top: 0;
  margin-bottom: var(--section-spacing);
  border: 1px solid #bccac3;
  border-radius: 0.5rem;
  overflow: auto;
  box-shadow: 0 1px 3px rgba(27, 28, 28, 0.06);
  background: #fff;
}

#preview table,
#preview table.preview-table {
  width: 100%;
  margin-top: 0;
  margin-bottom: var(--section-spacing);
  border-collapse: collapse;
  font-size: 0.875rem;
  border: 1px solid #bccac3;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(27, 28, 28, 0.06);
  background: #fff;
}

#preview .preview-table-wrapper table,
#preview .preview-table-wrapper table.preview-table {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

#preview thead {
  background: #f0eded;
}

#preview th,
#preview td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-right: 1px solid rgba(188, 202, 195, 0.95);
  border-bottom: 1px solid rgba(188, 202, 195, 0.95);
}

#preview th:last-child,
#preview td:last-child {
  border-right: none;
}

#preview tbody tr:last-child td {
  border-bottom: none;
}

#preview thead tr:last-child th {
  border-bottom: 1px solid rgba(188, 202, 195, 0.95);
}

#preview th {
  font-weight: 700;
  color: #1b1c1c;
}

#preview td:first-child {
  color: var(--accent-color);
  font-weight: 600;
}

/* コードブロック */
#preview .preview-code-block {
  margin-top: 0;
  margin-bottom: var(--section-spacing);
}

#preview .preview-code-block-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.6rem 0.9rem;
  background: #17202d;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-bottom: none;
  border-radius: 0.75rem 0.75rem 0 0;
}

#preview .preview-code-block-language {
  display: block;
  width: min(100%, 7rem);
  padding: 0.24rem 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e5edf8;
  font-family: var(--font-code);
  font-size: 0.72rem;
  line-height: 1.3;
  outline: none;
}

#preview .preview-code-block-language::placeholder {
  color: rgba(229, 237, 248, 0.58);
}

#preview .preview-code-block-language:disabled {
  opacity: 0.65;
  cursor: default;
}

#preview pre,
#preview pre.preview-fenced-pre {
  margin-top: 0;
  margin-bottom: var(--section-spacing);
  padding: 1.25rem;
  background: #1f2937;
  color: #f9fafb;
  border-radius: 0.75rem;
  overflow: auto;
  font-family: var(--font-code);
  font-size: 0.875rem;
  line-height: 1.7;
}

#preview .preview-code-block pre.preview-fenced-pre {
  margin-bottom: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

#preview code.preview-inline-code {
  padding: 0.2rem 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  color: #1f2937;
  border-radius: 0.375rem;
  font-family: var(--font-code);
  font-size: 0.9em;
}

#preview pre code,
#preview pre code.preview-fenced-code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

#preview [data-md-code-content][contenteditable] {
  outline: none;
}

/* 画像 */
#preview img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  display: block;
  margin-top: 0;
  margin-bottom: 2rem;
  margin-left: auto;
  margin-right: auto;
}

#preview .preview-body img[data-md-image-index] {
  box-shadow: 0 0 0 1px rgba(107, 114, 128, 0.18);
}

/* 区切り線 */
#preview hr {
  margin-top: 0;
  margin-bottom: 3rem;
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, #bccac3, transparent);
}

/* エラー表示 */
.preview-error {
  color: #b42318;
  font-size: 0.95rem;
  padding: 1rem;
}

/* スクロールバースタイル */
#preview::-webkit-scrollbar {
  width: 8px;
}

#preview::-webkit-scrollbar-track {
  background: #f0eded;
}

#preview::-webkit-scrollbar-thumb {
  background: #bccac3;
  border-radius: 4px;
}

#preview::-webkit-scrollbar-thumb:hover {
  background: #6d7a74;
}


html,
body {
  min-height: 100%;
  height: auto;
  overflow: auto;
  background: #fafaf2;
  color: #1a1c18;
}

html {
  scrollbar-gutter: stable;
}

body.mdrw-export-page {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* サイトのテーマは編集表示と同じ #preview-wrap に定義する。 */
}

body.mdrw-export-page #preview-wrap {
  position: relative;
  inset: auto;
  min-height: 100vh;
  overflow: visible;
  background: #fafaf2;
}

body.mdrw-export-page #preview-scroll {
  min-height: 100vh;
  overflow: visible;
  scrollbar-gutter: auto;
}

/* 書き出し: ビューポート右下に固定（プレビュー列とは別レイアウト） */
body.mdrw-export-page .mdrw-back-to-top {
  position: fixed;
  right: 0.75rem;
  bottom: 1rem;
  z-index: 60;
}
