/* =========================================================
   Chillarin Blog - style.css (cleaned / consolidated)
   - Hugo: Home / Category(term) / Single + Sidebar/TOC
   - Chinchilla(term): video right-top + sidebar under it
   - Mobile: content media (img/gif/iframe) always fit width
   - Mermaid: client-side render, no layout break
   ========================================================= */

/* =========================
   Theme / Global Variables
   ========================= */

:root {
  --bg: #050505;
  --bg-card: #0d0d0d;

  --text-main: #f5f5f5;
  --text-muted: #aaaaaa;

  --border: #2a2a2a;
  --accent: #f5f5f5;

  /* Term pages: sidebar offset (Tech/Life/Gadget etc. exclude Chinchilla) */
  --term-sidebar-offset: 285px;

  /* Background roamers */
  --bg-chinchilla-size: 64px;
  --bg-chinchilla-opacity: 0.22;
  --bg-chinchilla-glow:
    drop-shadow(0 0 2px rgba(255,255,255,0.55))
    drop-shadow(0 0 6px rgba(255,255,255,0.25))
    drop-shadow(0 0 10px rgba(0,0,0,0.65));
}

/* =========================
   Reset / Base
   ========================= */

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.6;

  /* 念のため：横はみ出しで全体縮小(overview)になるのを抑制 */
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

/* 記事本文内のリンクのみアクセント色で強調 */
.single-content a,
.post-content a,
.content a {
  color: var(--accent);
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px;
}

/* 背景レイヤの上に本体を乗せる */
.site-header,
.main-layout,
.site-footer {
  position: relative;
  z-index: 2;
}

/* =========================
   Header (renewal v2)
   ========================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 60px;
  padding: 10px 0;
  min-width: 0;
}

/* Brand */
.brand { display: flex; align-items: center; min-width: 0; }

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand-link:hover { text-decoration: none; }

.brand-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

.brand-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--text);
}

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.site-nav a {
  position: relative;
  padding-bottom: 4px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s ease;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.site-nav a.is-active { color: var(--accent); }

.site-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* Search */
.site-search {
  flex: 0 0 auto;
  position: relative;
  min-width: 180px;
  max-width: 260px;
}

.site-search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a96a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat center / contain;
  pointer-events: none;
  z-index: 1;
}

.site-search .pagefind-ui__search-input {
  width: 100%;
  padding: 6px 14px 6px 34px;
  border-radius: 22px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border-str);
  font-size: 0.82rem;
  font-family: inherit;
  transition: border-color .15s ease;
}

.site-search .pagefind-ui__search-input:focus {
  outline: none;
  border-color: var(--accent-line);
}

.site-search .pagefind-ui__search-input::placeholder {
  color: var(--muted);
}

.site-search .pagefind-ui__results-container {
  position: absolute;
  z-index: 100;
  background: var(--bg-elev);
  border: 1px solid var(--border-str);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  max-height: 60vh;
  overflow-y: auto;
  max-width: 400px;
  right: 0;
}

/* Mode toggle (dark/light pill) */
.mode-toggle {
  flex: 0 0 auto;
  position: relative;
  width: 60px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-str);
  border-radius: 22px;
  background: var(--bg-elev);
  cursor: pointer;
  transition: border-color .15s ease;
}

.mode-toggle:hover { border-color: var(--accent-line); }

.mode-toggle:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.mode-toggle__track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 0 7px;
}

.mode-toggle__icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
  display: block;
  z-index: 0;
  pointer-events: none;
}

.mode-toggle__thumb {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow), 0 1px 2px rgba(0, 0, 0, .35);
  transform: translate(30px, -50%);
  transition: transform 280ms cubic-bezier(.5, 1.4, .55, 1);
  pointer-events: none;
}

:root.light .mode-toggle__thumb {
  transform: translate(0, -50%);
}

/* Reading progress bar (header下辺に張り付く) */
.site-header__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}

/* Mobile */
@media (max-width: 840px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
  }
  .brand-name { font-size: 0.95rem; }
  .site-nav {
    flex: 0 0 100%;
    justify-content: flex-start;
    gap: 12px;
    font-size: 0.78rem;
    order: 3;
  }
  .site-search {
    margin-left: auto;
    min-width: 140px;
    max-width: 200px;
  }
}

@media (max-width: 600px) {
  .site-search { min-width: 120px; }
}

/* =========================
   Main Layout (Grid)
   ========================= */

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(280px, 1fr);
  grid-auto-rows: auto;
  gap: 24px;
  padding: 24px 0 40px;
  align-items: flex-start;
}

/* 重要：グリッド子要素が横幅を押し広げないように */
.main-layout > * { min-width: 0; }

.main-layout > .sidebar {
  grid-column: 2 / 3;
  align-self: flex-start;
}

.main-layout > :not(.sidebar):not(.sidebar-chinchilla-top) {
  grid-column: 1 / 2;
}

/* No sidebar pages */
.main-layout.no-sidebar { grid-template-columns: 1fr; }
.main-layout.no-sidebar > .sidebar { display: none; }

/* Mobile: 1 column */
@media (max-width: 840px) {
  .main-layout { grid-template-columns: 1fr; }

  .main-layout > .sidebar,
  .main-layout > :not(.sidebar):not(.sidebar-chinchilla-top),
  .main-layout > .sidebar-chinchilla-top {
    grid-column: 1 / 2;
    grid-row: auto;
  }
}

/* =========================
   Sidebar (cards / list)
   ========================= */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 40px;
  min-width: 0;
}

.kind-page .main-layout > .sidebar { margin-top: 0; } /* Single pages: tighter */

.sidebar-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 14px;
  font-size: 0.9rem;
}

.sidebar-card h2 { margin: 0 0 8px; font-size: 0.95rem; }

.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-list li + li { margin-top: 4px; }

.sidebar-social { margin-top: 6px; }
.sidebar-social li + li { margin-top: 6px; }

.follow-card .sidebar-social a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.01);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.follow-card .sidebar-social a:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}

.social-icon { width: 20px; height: 20px; display: block; }

.profile-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
  min-width: 0;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 24px;
}

/* TOC card */
.toc-card #TableOfContents {
  font-size: 0.92rem;
  margin-top: 8px;
  padding-top: 2px;
  max-height: 380px;
  overflow: auto;
}

.toc-card #TableOfContents ul { list-style: none; padding-left: 0; margin: 0; }
.toc-card #TableOfContents li { margin: 6px 0; }

.toc-card #TableOfContents a {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.35;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.toc-card #TableOfContents a:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.toc-card #TableOfContents > ul > li > a {
  font-weight: 600;
  color: #d7d7d7;
}

.toc-card #TableOfContents ul ul {
  margin-top: 6px;
  padding-left: 12px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
}
.toc-card #TableOfContents ul ul a {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.86rem;
  opacity: 0.95;
}

/* =========================
   Home Layout Overrides
   ========================= */

.page-home .main-layout > .hero-dark { grid-column: 1 / -1; }
.page-home .main-layout > .section.category-cards { grid-column: 1 / 2; }
.page-home .main-layout > .sidebar { grid-column: 2 / 3; grid-row: 2 / span 2; }

@media (max-width: 840px) {
  .page-home .main-layout > .hero-dark,
  .page-home .main-layout > .section,
  .page-home .main-layout > .sidebar {
    grid-column: 1 / 2;
    grid-row: auto;
  }
}

/* =========================
   Hero (Home)
   ========================= */

.hero-dark {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr);
  gap: 24px;
  padding: 64px 40px;
  margin-top: 0;
  border-radius: 0;
  border: none;
  background: radial-gradient(circle at 20% 20%, #222222 0, #050505 45%, #000000 100%);
  color: #f5f5f5;
}

.hero-main-dark h1 {
  margin: 0 0 12px;
  font-size: clamp(2.6rem, 4vw, 3.4rem);
  letter-spacing: 0.04em;
}

.hero-main-dark .hero-lead-dark {
  margin: 0;
  font-size: 0.95rem;
  color: #cccccc;
}

.hero-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #888888;
  margin-bottom: 4px;
}

.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

/* Chinchilla silhouette */
.hero-chinchilla-image {
  width: min(420px, 80vw);
  height: min(260px, 50vw);
  border-radius: 999px;
  position: relative;
  transform: translateX(-22%);
  background: radial-gradient(circle at 50% 50%, rgba(120, 220, 255, 0.25), transparent 60%);
  filter: drop-shadow(0 0 14px rgba(120, 220, 255, 0.35));
  transition: transform 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.8);
  z-index: 1;
}

.hero-chinchilla-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/images/hero-chinchilla.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.hero-chinchilla-image:hover {
  transform: translateX(-8%) scale(1.03);
  filter: drop-shadow(0 0 26px rgba(140, 240, 255, 0.85));
  box-shadow:
    0 0 40px rgba(120, 220, 255, 0.4),
    0 0 80px rgba(120, 220, 255, 0.25);
}

/* Hero video placeholder */
.hero-video {
  position: absolute;
  right: -4%;
  bottom: -10%;
  width: min(260px, 55%);
  transform: translateY(18%);
  z-index: 2;
}

.hero-video-inner {
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2a2a2a;
  background: radial-gradient(circle at top left, #202020 0, #050505 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaaaaa;
  font-size: 0.8rem;
}
.hero-video-inner iframe { width: 100%; height: 100%; border: 0; display: block; }
.hero-video-inner span { padding: 0 8px; text-align: center; }

@media (max-width: 840px) {
  .hero-dark { grid-template-columns: 1fr; padding: 40px 20px 32px; }
  .hero-visual { order: -1; margin-bottom: 16px; }
  .hero-video { position: static; width: 100%; transform: none; margin-top: 12px; }
  .hero-chinchilla-image { transform: translateX(-14%); }
}
@media (max-width: 480px) {
  .hero-chinchilla-image { transform: translateX(-4%); }
}

/* =========================
   Sections
   ========================= */

.section { margin-top: 24px; }
.section-title { font-size: 1.1rem; margin: 0 0 12px; }

/* Home category cards */
.section.category-cards { margin-top: 0; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.category-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  min-height: 220px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.category-card-image {
  height: 160px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transition: transform 0.25s ease;
}

/* トップのカテゴリカード: ダーク既定、:root.light で light 画像に差し替え。
   light 画像が未整備の slug (life) は dark のままフォールバック。 */
.category-tech .category-card-image       { background-image: url("/images/category-tech-dark.webp"); }
.category-chinchilla .category-card-image { background-image: url("/images/category-chinchilla-dark.webp"); }
.category-gadget .category-card-image     { background-image: url("/images/category-gadget-dark.webp"); }
.category-life .category-card-image       { background-image: url("/images/category-life-dark.webp"); }
.category-rin .category-card-image        { background-image: url("/images/category-rin-dark.webp"); }

:root.light .category-tech .category-card-image       { background-image: url("/images/category-tech-light.webp"); }
:root.light .category-chinchilla .category-card-image { background-image: url("/images/category-chinchilla-light.webp"); }
:root.light .category-gadget .category-card-image     { background-image: url("/images/category-gadget-light.webp"); }
:root.light .category-rin .category-card-image        { background-image: url("/images/category-rin-light.webp"); }

.category-card-body { padding: 12px 14px 14px; }
.category-card-body h3 { margin: 0 0 4px; font-size: 1rem; }
.category-card-body p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.category-card:hover {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.9), 0 0 12px rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}
.category-card:hover .category-card-image { transform: scale(1.06); }

@media (max-width: 520px) {
  .category-grid { grid-template-columns: 1fr; }
}

/* =========================
   Home: News section (最新ダイジェスト)
   ========================= */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.section-head .section-title { margin: 0; }

.section-more {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.section-more:hover { color: var(--accent); }

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}

.news-item { border-bottom: 1px solid var(--border); }

.news-item-link {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 14px 4px;
  color: inherit;
  text-decoration: none;
  transition: background-color .15s ease;
}

.news-item-link:hover {
  background: var(--bg-card);
  text-decoration: none;
}

.news-item-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 2px;
}

.news-item-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
}

.news-item-link:hover .news-item-title { color: var(--accent); }

@media (max-width: 520px) {
  .news-item-link {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* =========================
   Home: Extras (Games / Members)
   ========================= */

.extras-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.extras-grid--3col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .extras-grid--3col { grid-template-columns: 1fr; }
}

.extra-card {
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s ease, transform .12s ease;
}

.extra-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  text-decoration: none;
}

.extra-card-kicker {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.extra-card-body h3 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.extra-card-desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-dim);
}

@media (max-width: 520px) {
  .extras-grid { grid-template-columns: 1fr; }
}

/* =========================
   Study section grid
   セクション/章/記事のカード一覧。1個でも違和感なく、複数で自動的に2-3列に。
   ========================= */

.study-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* Study 系記事の画像は本文枠とほぼ同じ幅で表示する（図解の可読性確保） */
.article--study .a-body img,
.article--study-page .a-body img {
  max-width: 100%;
  margin: 24px auto;
  display: block;
}

/* Study 系の図解はサイズクラスで上限を絞る（D2 図など本文幅一杯だと大きすぎる場合用） */
.article--study-page .a-body figure.fig-sm img { max-width: 580px; }
.article--study-page .a-body figure.fig-md img { max-width: 760px; }
.article--study-page .a-body figure.fig-lg img { max-width: 900px; }
.article--study-page .a-body figure.fig-xl img { max-width: 1200px; }
.article--study-page .a-body figure.fig-sm,
.article--study-page .a-body figure.fig-md,
.article--study-page .a-body figure.fig-lg,
.article--study-page .a-body figure.fig-xl { text-align: center; }
/* fig-xl は本文 max-width を超えるので、figure 自体を画面中央寄せして
   左右の余白を負マージンで突破させる (本文幅外まで広げる) */
.article--study-page .a-body figure.fig-xl {
  max-width: min(1200px, 100vw - 32px);
  margin-left: 50%;
  transform: translateX(-50%);
}

/* ===== Collapse (details/summary) — Study 系で利用 ===== */
.a-body .a-collapse {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  overflow: hidden;
}
.a-body .a-collapse__summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: .94rem;
  color: var(--text);
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color .15s ease;
}
.a-body .a-collapse__summary::-webkit-details-marker { display: none; }
.a-body .a-collapse__summary::before {
  content: "▶";
  font-size: .7rem;
  color: var(--accent);
  transition: transform .2s ease;
}
.a-body .a-collapse[open] .a-collapse__summary::before { transform: rotate(90deg); }
.a-body .a-collapse__summary:hover { background: var(--bg-hover, var(--bg-card)); }
.a-body .a-collapse__body {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--border);
  font-size: .94rem;
  line-height: 1.75;
}
.a-body .a-collapse__body > :first-child { margin-top: 12px; }
.a-body .a-collapse__body > :last-child { margin-bottom: 0; }

/* パンくず（記事上部・list 上部） */
.study-breadcrumb {
  margin: 8px 0 24px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.study-breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  padding: 0;
  margin: 0;
}
.study-breadcrumb li {
  display: inline-flex;
  align-items: center;
}
.study-breadcrumb li:not(:last-child)::after {
  content: "/";
  margin: 0 10px;
  color: var(--text-dim);
  opacity: 0.5;
}
.study-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.study-breadcrumb a:hover { text-decoration: underline; }
.study-breadcrumb [aria-current="page"] {
  color: var(--text-dim);
}

/* 記事末尾の前後ページナビ + 章戻り */
.study-pager {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.study-pager-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.study-pager-link {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.study-pager-link:hover { border-color: var(--accent); }
.study-pager-link.next { text-align: right; }
.study-pager-link .dir {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 6px;
}
.study-pager-link .title {
  font-weight: 700;
  font-size: 0.95rem;
}
.study-pager-empty { /* prev/next なし時の placeholder */ }
.study-pager-up {
  display: block;
  margin-top: 20px;
  text-align: center;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92rem;
}
.study-pager-up:hover { text-decoration: underline; }

@media (max-width: 520px) {
  .study-pager-row { grid-template-columns: 1fr; }
}

/* =========================
   Category Term Pages (Tech/Life/Gadget + Chinchilla)
   ========================= */

.category-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 560px);
  gap: 56px;
  padding: 8px 0 18px;
  align-items: center;
}

.category-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #888888;
  margin: 0 0 6px;
}

.category-hero-text { min-width: 0; }
.category-hero-text h1 {
  margin: 0;
  font-size: clamp(2.0rem, 3.2vw, 2.8rem);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.category-hero-note {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Hero image (all categories) */
.category-hero-image {
  width: 100%;
  max-width: 560px;
  height: 220px;

  border-radius: 28px;
  overflow: hidden;
  clip-path: inset(0 round 28px);

  border: 1px solid var(--border);
  background-position: right center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: #111;
  box-shadow:
    0 0 18px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* Chinchilla term page uses image-col (video is in sidebar area) */
.category-hero--chinchilla .category-hero-image-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.category-hero-image-caption,
.category-hero-embed-caption {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* Posts list */
.category-posts { margin-top: 0; padding-bottom: 10px; }

.category-post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.category-post-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}
.category-post-card:hover {
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 0 18px rgba(0,0,0,0.9), 0 0 12px rgba(255,255,255,0.22);
  transform: translateY(-1px);
}

.category-post-thumb {
  height: 86px;
  border-radius: 10px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  background-color: #111;
}

.category-post-title {
  margin: 0 0 6px;
  font-size: 1rem;
  line-height: 1.35;
}
.category-post-date { font-size: 0.75rem; color: var(--text-muted); }

/* Tablet: stack hero */
@media (max-width: 900px) {
  .category-hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 16px;
  }
  .category-hero-image {
    max-width: none;
    width: 100%;
    background-position: center;
  }
}

/* Mobile: hero image a bit shorter */
@media (max-width: 840px) {
  .category-hero-image { height: 180px; }
}

@media (max-width: 640px) {
  .category-post-card { grid-template-columns: 1fr; }
  .category-post-thumb { height: 160px; }
}

/* =========================
   Chinchilla(term) Layout Fix
   - Right top  : video (sidebar-chinchilla-top)
   - Right below: normal sidebar
   ========================= */

/* Video block is a right-column grid item */
.main-layout > .sidebar-chinchilla-top {
  grid-column: 2 / 3;
  grid-row: 1;
  align-self: flex-start;
}

/* Desktop: split hero/posts into separate grid items without changing HTML */
@media (min-width: 841px) {
  body.term-chinchilla.kind-term.type-categories .main-col { display: contents; }

  body.term-chinchilla.kind-term.type-categories .main-layout > .category-hero {
    grid-column: 1 / 2;
    grid-row: 1;
  }
  body.term-chinchilla.kind-term.type-categories .main-layout > .category-posts {
    grid-column: 1 / 2;
    grid-row: 2;
  }

  body.term-chinchilla.kind-term.type-categories .main-layout > .sidebar-chinchilla-top {
    grid-column: 2 / 3;
    grid-row: 1;
  }

  /* Term(カテゴリ) だけ sidebar を下げる：Chinchilla以外 */
  body.kind-term.type-categories:not(.term-chinchilla) .main-layout > .sidebar {
    margin-top: var(--term-sidebar-offset);
  }

  body.term-chinchilla.kind-term.type-categories .main-layout > .sidebar {
    grid-column: 2 / 3;
    grid-row: 2;
    margin-top: 40px;
  }
}

/* Mobile: order Hero -> Video -> Posts -> Sidebar */
@media (max-width: 840px) {
  body.term-chinchilla.kind-term.type-categories .main-col { display: contents; }

  body.term-chinchilla.kind-term.type-categories .category-hero { grid-row: 1; }
  body.term-chinchilla.kind-term.type-categories .sidebar-chinchilla-top {
    grid-row: 2;
    margin-top: 8px;
  }
  body.term-chinchilla.kind-term.type-categories .category-posts { grid-row: 3; }
  body.term-chinchilla.kind-term.type-categories .main-layout > .sidebar {
    grid-row: 4;
    margin-top: 16px;
  }
}

/* Chinchilla right-top video block styles */
.sidebar-chinchilla-top .sidebar-video-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.35);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.65) inset,
    0 10px 18px rgba(0,0,0,0.70);
  background: #0b0b0b;
}
.sidebar-chinchilla-top .sidebar-video-embed iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}
.sidebar-chinchilla-top .sidebar-video-caption {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* Live player container: force full width on mobile if inline styles exist */
@media (max-width: 840px) {
  body.term-chinchilla.kind-term.type-categories #nest-camera-container.sidebar-video-embed {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    min-height: 0 !important;
    background: transparent !important;
  }
}

/* =========================
   Single Post
   ========================= */

.single {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 24px 20px;
  min-width: 0;
}

.single-header h1 {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.single-meta {
  margin: 0 0 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.single-content {
  font-size: 0.95rem;
  min-width: 0;

  /* 長いURL/英数字で横幅が壊れて全体縮小になるのを防ぐ */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.single-content h2 { margin-top: 1.6em; font-size: 1.1rem; }

/* Cover (background image) */
.single-cover {
  width: 100%;
  min-height: 220px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin-top: 14px;
  box-shadow:
    0 0 18px rgba(0,0,0,0.85),
    inset 0 0 0 1px rgba(255,255,255,0.03);
}

.single-cover-fallback { opacity: 0.92; }

/* Mobile: cover cropping mitigation */
@media (max-width: 840px) {
  .single-cover {
    min-height: 0;
    height: clamp(140px, 26vw, 190px);
    background-size: contain;       /* 切れを防ぐ（余白は出る） */
    background-repeat: no-repeat;
    background-position: center;
  }
}

/* =========================
   Single Content Media Normalization (IMG/GIF/IFRAME etc.)
   - 記事ごとに縮小表示になるのを防ぐ保険
   - 注意：svg は Mermaid と競合しやすいので対象外
   ========================= */

/* 画像/GIF/動画/埋め込みは必ず親幅に収める */
.single-content img,
.single-content video,
.single-content iframe,
.single-content embed,
.single-content object {
  max-width: 100% !important;
  height: auto !important;
}

/* iframe は幅も強制（高さは埋め込み側依存なので触りすぎない） */
.single-content iframe { width: 100% !important; }

/* figure系の余白を統一 */
.post-figure { margin: 18px 0 24px; }

.post-image,
.post-figure img,
.single-content img,
.single-content picture img,
.single-content video {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b0b0b;
  box-shadow:
    0 0 18px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* inline img (p直下) の時だけ余白を付ける */
.single-content p > img { margin: 18px 0 24px; }

/* キャプション */
.post-caption,
.post-figure figcaption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* テーブル：横スクロールで逃がす（縮小で文字が読めなくなるのを防ぐ） */
.single-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

/* 固定幅が来ても横はみ出ししにくくする保険 */
.single-content :where(div, section, figure) { max-width: 100%; }

/* =========================
   Mermaid (client-side)
   - 0x0/枠だけ 事故防止のため .mermaid は block 化
   - overflow は “wrap だけ” で受ける（全体縮小を防ぐ）
   ========================= */

.single-content .mermaid-wrap {
  width: 100%;
  margin: 18px 0 24px;
  padding: 12px;

  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b0b0b;

  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* 重要：inline-block/shrink-to-fit 由来の 0 幅を避ける */
.single-content .mermaid {
  display: block;
  width: 100%;
  margin: 0;
}

/* svg は “高さを潰さない”。表示は block に寄せる */
.single-content .mermaid svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

/* 最終保険：暗背景で text が消える環境向け */
.single-content .mermaid svg text {
  fill: var(--text-main) !important;
}

/* 生成前のコードブロックが残っても横崩れしない */
.single-content pre code.language-mermaid,
.single-content code.language-mermaid {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* =========================
   Code blocks (ASCII/罫線がズレない)
   ========================= */

pre, code, pre code,
.highlight pre, .highlight code,
.chroma, .chroma pre, .chroma code {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
  letter-spacing: 0;
  font-kerning: none;
  font-variant-ligatures: none;
}

pre, .highlight pre, .chroma pre {
  white-space: pre;
  overflow-x: auto;
  tab-size: 4;
  max-width: 100%;
}

/* =========================
   Markdown tables: visible borders
   ========================= */

article table, .post-content table, .content table, table {
  border-collapse: collapse;
  width: 100%;
}

article th, article td,
.post-content th, .post-content td,
.content th, .content td,
th, td {
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  padding: 0.6rem 0.8rem;
}

article thead th,
.post-content thead th,
.content thead th,
thead th {
  border-bottom: 2px solid rgba(255, 255, 255, 0.28) !important;
}

/* =========================
   Comments (Remark42)
   ========================= */

.comments {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.comments-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: var(--text-main);
}

#remark42 { min-height: 80px; }

/* =========================
   Footer
   ========================= */

.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.9);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0 8px;
  min-width: 0;
}

.footer-title { font-weight: 600; margin: 0 0 4px; }
.footer-text { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.footer-bottom {
  text-align: center;
  padding: 8px 0 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
   ========================= */

.bg-chinchilla {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-chinchilla-sprite {
  position: absolute;
  width: var(--bg-chinchilla-size);
  height: var(--bg-chinchilla-size);
  opacity: var(--bg-chinchilla-opacity);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  will-change: transform;
  filter: var(--bg-chinchilla-glow);
}

@media (prefers-reduced-motion: reduce) {
  .bg-chinchilla { display: none !important; }
}

.series-nav {
  margin-top: 28px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(0,0,0,.18);
}

.series-nav__meta {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-bottom: 10px;
}

.series-nav__links {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.series-nav__prev { text-align: left; }
.series-nav__toc  { text-align: center; }
.series-nav__next { text-align: right; }

.series-nav a {
  text-decoration: none;
}
.series-nav a:hover {
  text-decoration: underline;
}

@media (max-width: 820px) {
  .series-nav__links {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .series-nav__prev,
  .series-nav__toc,
  .series-nav__next {
    text-align: left;
  }
}

/* =========================
   AI Rin Category Page (カテゴリページ専用スタイル)
   ========================= */

/* ヒーローセクション */
.category-hero--rin {
  grid-template-columns: 1fr;
  background: linear-gradient(135deg, rgba(201,168,76,0.08) 0%, transparent 60%);
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: 20px;
  padding: 24px 28px;
}

.rin-kicker {
  color: var(--accent, #c9a84c) !important;
  letter-spacing: 0.15em;
}

.rin-title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin: 0 0 16px !important;
}

/* プロフィールカード */
.rin-profile-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 16px;
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 14px;
}

.rin-profile-avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(201,168,76,0.4);
  background: rgba(201,168,76,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  position: relative;
}
.rin-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0; left: 0;
}
.rin-avatar-fallback { line-height: 1; }

.rin-profile-note {
  margin: 0 0 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.rin-profile-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 0.82rem;
}

.rin-stat-label {
  display: inline-block;
  background: rgba(201,168,76,0.18);
  color: var(--accent, #c9a84c);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ヒーロー画像 */
.rin-hero-image {
  border: 1px solid rgba(201,168,76,0.3) !important;
  box-shadow:
    0 0 18px rgba(0,0,0,0.8),
    0 0 30px rgba(201,168,76,0.08) !important;
}

/* セクションタイトル */
.rin-section-title { color: var(--accent, #c9a84c); }

/* 投稿カード */
.rin-post-card {
  border-color: rgba(201,168,76,0.2) !important;
}
.rin-post-card:hover {
  border-color: rgba(201,168,76,0.6) !important;
  box-shadow: 0 0 18px rgba(0,0,0,0.9), 0 0 12px rgba(201,168,76,0.2) !important;
}

.rin-post-badge {
  display: inline-block;
  font-size: 0.72rem;
  background: rgba(201,168,76,0.15);
  color: var(--accent, #c9a84c);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 4px;
  font-weight: 600;
}

/* レスポンシブ */
@media (max-width: 600px) {
  .rin-profile-card { flex-direction: column; }
  .rin-profile-stats { grid-template-columns: 1fr; }
}

/* ===== BATCH-B: Related Posts [UX-03] ===== */
.related-posts {
  margin: 3rem 0 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color, #333);
}
.related-posts-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--text-muted, #aaa);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .related-posts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .related-posts-grid { grid-template-columns: 1fr; }
}

/* ===== BATCH-B: Breadcrumb [UX-05] ===== */
.breadcrumb {
  margin-bottom: 1.5rem;
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-muted, #aaa);
}
.breadcrumb ol li + li::before {
  content: "›";
  margin-right: 0.3rem;
  color: var(--text-muted, #aaa);
}
.breadcrumb a {
  color: var(--text-muted, #aaa);
  text-decoration: none;
}
.breadcrumb a:hover {
  text-decoration: underline;
}
.breadcrumb [aria-current="page"] {
  color: var(--text-primary, #eee);
}

   ========================= */
.post-box {
  border-left: 3px solid var(--border);
  background: var(--bg-card);
  padding: 0.9rem 1.2rem;
  margin: 1.5rem 0;
  border-radius: 4px;
}
.post-box--info  { border-left-color: #4a9eff; }
.post-box--warning { border-left-color: #f5a623; }
.post-box--danger  { border-left-color: #e74c3c; }
.post-box p:last-child { margin-bottom: 0; }

/* =========================
   Code blocks: ターミナル風スタイル
   ========================= */

pre, .highlight pre, .chroma pre {
  background: #0a1a0a;
  color: #00ff00;
  border: 1px solid #1a3a1a;
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
}

/* インラインコード */
code:not(pre code) {
  background: #0a1a0a;
  color: #00ff00;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* chroma シンタックスハイライトの色調整 */
.chroma { background: #0a1a0a; color: #00ff00; }
.chroma .c, .chroma .cm, .chroma .c1, .chroma .cs { color: #4a8a4a; }  /* コメント */
.chroma .k, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr { color: #55ff55; font-weight: bold; }  /* キーワード */
.chroma .s, .chroma .s1, .chroma .s2, .chroma .se, .chroma .sh, .chroma .si, .chroma .sx { color: #80ff80; }  /* 文字列 */
.chroma .m, .chroma .mi, .chroma .mf, .chroma .mh, .chroma .mo { color: #aaffaa; }  /* 数値 */
.chroma .nb, .chroma .bp { color: #33dd99; }  /* ビルトイン */
.chroma .nf, .chroma .nx { color: #44eebb; }  /* 関数名 */
.chroma .nn { color: #88ffcc; }  /* 名前空間 */
.chroma .err { color: #ff5555; }  /* エラー */

/* =========================
   Light mode overrides (renewal cleanup)
   ダーク前提の直値シャドウ・黒背景・白枠などをライト向けに上書き。
   対象外 (意図的に触らない):
   - .hero-dark / .hero-chinchilla-image (Home Hero、別ブランチでリニューアル予定)
   - .chroma / pre / code (README指示で両モード暗背景)
   - .category-hero--rin / .rin-* (AI Rin 金色アクセント、別タスクで扱う)
   ========================= */

:root.light {
  --bg-chinchilla-opacity: 0.3;
  --bg-chinchilla-glow:
    drop-shadow(0 0 2px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 6px rgba(0, 0, 0, 0.25))
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.6));
}

/* 画像・カバーの黒背景と濃いシャドウを落ち着いたものに */
:root.light .post-image,
:root.light .post-figure img,
:root.light .single-content img,
:root.light .single-content picture img,
:root.light .single-content video,
:root.light .single-cover,
:root.light .category-hero-image {
  background: var(--bg-elev);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

:root.light .category-hero-image,
:root.light .category-post-thumb {
  background-color: var(--bg-elev);
}

/* Mermaidラップの黒背景 */
:root.light .single-content .mermaid-wrap {
  background: var(--bg-elev);
}

/* Chinchilla video embed (サイドバー動画) */
:root.light .sidebar-chinchilla-top .sidebar-video-embed {
  border-color: var(--border-str);
  background: var(--bg-elev);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.08) inset,
    0 4px 12px rgba(0, 0, 0, 0.10);
}

/* Footer の真っ黒背景 */
:root.light .site-footer {
  background: color-mix(in oklab, var(--bg-elev) 90%, transparent);
}

/* カテゴリカード hover の白いグロー */
:root.light .category-card:hover,
:root.light .category-post-card:hover {
  border-color: var(--accent-line);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.08),
    0 0 12px rgba(0, 0, 0, 0.04);
}

/* ソーシャルリンク hover */
:root.light .follow-card .sidebar-social a {
  background: rgba(0, 0, 0, 0.02);
}
:root.light .follow-card .sidebar-social a:hover {
  background: rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* TOC 見出しリンク色(ダーク用 #d7d7d7 をライト用に) */
:root.light .toc-card #TableOfContents > ul > li > a {
  color: var(--text);
}

/* Markdown table の白枠ハードコード */
:root.light article th,
:root.light article td,
:root.light .post-content th,
:root.light .post-content td,
:root.light .content th,
:root.light .content td,
:root.light th,
:root.light td {
  border-color: rgba(0, 0, 0, 0.12) !important;
}

:root.light article thead th,
:root.light .post-content thead th,
:root.light .content thead th,
:root.light thead th {
  border-bottom-color: rgba(0, 0, 0, 0.22) !important;
}

/* post-box (info/warning/danger) の背景(bg-cardで代替) */
:root.light .post-box {
  background: var(--bg-elev);
  border-left-color: var(--border-str);
}

/* series-nav の黒系背景 */
:root.light .series-nav {
  border-color: var(--border);
  background: color-mix(in oklab, var(--bg-elev) 50%, transparent);
}

/* Home Hero: 暫定ライトモード対応 (正式な Home Hero リニューアル時に削除予定) */
:root.light .hero-dark {
  background: linear-gradient(135deg, var(--bg-elev) 0, var(--bg-card) 45%, var(--bg) 100%);
  color: var(--text);
}
:root.light .hero-main-dark .hero-lead-dark { color: var(--text-dim); }
:root.light .hero-kicker { color: var(--muted); }
:root.light .hero-chinchilla-image {
  background: none;
  box-shadow: none;
  filter: none;
  overflow: visible;
}

/* 本体シルエットに軽い立体感の drop-shadow */
:root.light .hero-chinchilla-image::after {
  filter: drop-shadow(2px 3px 2px rgba(15, 26, 34, 0.4));
}

/* 投影シャドウ: 3D transform で奥に倒れて遠くまで伸びる地面投影 */
:root.light .hero-chinchilla-image::before {
  content: "";
  position: absolute;
  left: 0%;
  right: 0%;
  bottom: 0%;
  height: 100%;
  background-image: url("/images/hero-chinchilla.png");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
  transform-origin: center bottom;
  /* perspective = 遠近感 / rotateX = 奥に倒す角度 / scaleY = 奥方向への伸び */
transform: perspective(700px) rotateX(65deg) rotateZ(10deg) scaleY(1.4);
  opacity: 0.3;
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0) 85%);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0) 85%);
  pointer-events: none;
  z-index: -1;
}

:root.light .hero-chinchilla-image:hover::before {
  opacity: 0.4;
}
:root.light .hero-video-inner {
  background: radial-gradient(circle at top left, var(--bg-elev) 0, var(--bg-card) 70%);
  color: var(--muted);
  border-color: var(--border);
}
