/* ==========================================================================
   Measure Lab — 共通スタイル
   ブランド名・色を変えたいときは :root の変数だけ書き換えてください。
   ========================================================================== */

:root {
  /* Brand */
  --accent:        #e8710a;
  --accent-dark:   #c25c04;
  --accent-soft:   #fff3e6;

  /* Neutrals */
  --ink:           #14181f;
  --ink-2:         #3d444f;
  --text:          #2b3138;
  --text-muted:    #6b7480;
  --line:          #e4e7ec;
  --line-soft:     #eef0f4;
  --bg:            #ffffff;
  --bg-soft:       #f7f8fa;
  --sidebar-bg:    #ffffff;

  /* Layout */
  --nav-w:         224px;
  --rail-w:        292px;
  --radius:        12px;
  --radius-lg:     16px;

  --font-sans: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN",
               "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

/* ---------- Layout shell -------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

/* ---------- Left navigation ---------------------------------------------- */

.nav {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  padding: 26px 20px 32px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: block; margin-bottom: 30px; }
.brand-mark {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
}
.brand-mark em { font-style: normal; color: var(--accent); }
.brand-sub {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.nav-group { margin-bottom: 26px; }
.nav-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 10px;
  text-transform: uppercase;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list li { margin-bottom: 2px; }
.nav-list a {
  display: block;
  padding: 7px 10px;
  font-size: 13.5px;
  border-radius: 8px;
  color: var(--text);
}
.nav-list a:hover { background: var(--bg-soft); color: var(--accent); }
.nav-list a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
}

.nav-cta { display: grid; gap: 8px; margin-top: 30px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }

/* ---------- Main column --------------------------------------------------- */

.main {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg-soft);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.crumbs {
  flex: 1 1 240px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.crumbs li::after { content: "›"; margin-left: 6px; color: #b9c0ca; }
.crumbs li:last-child::after { content: ""; }
.crumbs a:hover { color: var(--accent); }

.topbar-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.search {
  position: relative;
  width: 230px;
  max-width: 100%;
}
.search input {
  width: 100%;
  padding: 9px 14px 9px 34px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text);
}
.search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: #fff;
}
.search svg {
  position: absolute;
  left: 12px; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.lang {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
}
.lang a { padding: 7px 12px; color: var(--text-muted); }
.lang a[aria-current="true"] { background: var(--ink); color: #fff; }
.lang a:not([aria-current]):hover { background: var(--bg-soft); color: var(--accent); }

/* ---------- Content + right rail ------------------------------------------ */

.content {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  padding: 30px 32px 64px;
}
.content > .col-main { flex: 1 1 auto; min-width: 0; }
.rail { width: var(--rail-w); flex: 0 0 var(--rail-w); }

.page-title {
  font-size: 25px;
  line-height: 1.45;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 6px;
}
.page-lede { margin: 0 0 22px; color: var(--text-muted); font-size: 14px; }

/* ---------- Category chips ------------------------------------------------ */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }
.chip {
  display: inline-block;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Article card grid --------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 24px 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card { display: flex; flex-direction: column; }
.card.is-hidden { display: none; }
.card > a { display: block; }

.card-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 20px;
  text-align: center;
  background: linear-gradient(135deg, #2b3138, #14181f);
  color: #fff;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.card-thumb span {
  position: relative;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.card-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: inherit;
}
/* テーマ別サムネイル背景（画像を用意したら <img> を入れて上書きされます） */
.t-setup   { background: linear-gradient(135deg, #ffb44d, #e8710a); }
.t-event   { background: linear-gradient(135deg, #6fb1ff, #1f5fd0); }
.t-convert { background: linear-gradient(135deg, #7fd6a8, #1f8f5d); }
.t-ads     { background: linear-gradient(135deg, #f38ba0, #c2185b); }
.t-data    { background: linear-gradient(135deg, #9d8bf3, #4a33b5); }
.t-debug   { background: linear-gradient(135deg, #4b5563, #14181f); }

.card-body { display: block; padding-top: 12px; }
.card-cat {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent);
  margin-bottom: 6px;
}
.card-title {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 8px;
  transition: color .15s ease;
}
.card:hover .card-title { color: var(--accent); }
.card-date { display: block; font-size: 12px; color: var(--text-muted); }

.empty {
  display: none;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 14px;
}
.empty.is-shown { display: block; }

/* ---------- Right rail widgets -------------------------------------------- */

.widget { margin-bottom: 30px; }
.widget-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

.promo {
  display: block;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  background: linear-gradient(140deg, var(--accent), #b64d02);
  color: #fff;
}
.promo strong { display: block; font-size: 17px; font-weight: 800; line-height: 1.55; }
.promo p { margin: 8px 0 16px; font-size: 12.5px; opacity: .92; line-height: 1.7; }
.promo .btn { background: #fff; color: var(--accent); width: 100%; }

.rail-list { list-style: none; margin: 0; padding: 0; }
.rail-list li { border-bottom: 1px solid var(--line-soft); }
.rail-list a { display: block; padding: 9px 2px; font-size: 13px; }
.rail-list a:hover { color: var(--accent); }

.rank { counter-reset: rank; }
.rank li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.rank li::before {
  counter-increment: rank;
  content: counter(rank);
  flex: 0 0 20px;
  height: 20px;
  margin-top: 3px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 20px;
}
.rank a { font-size: 13px; line-height: 1.6; }
.rank a:hover { color: var(--accent); }

/* ---------- Article page -------------------------------------------------- */

.article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 44px 48px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}
.article h1 {
  font-size: 27px;
  line-height: 1.55;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 24px;
}
.article h2 {
  font-size: 20px;
  line-height: 1.6;
  font-weight: 800;
  color: var(--ink);
  margin: 44px 0 16px;
  padding-left: 14px;
  border-left: 4px solid var(--accent);
}
.article h3 {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 32px 0 12px;
}
.article p { margin: 0 0 18px; }
.article ul, .article ol { margin: 0 0 20px; padding-left: 1.4em; }
.article li { margin-bottom: 7px; }
.article strong { font-weight: 700; color: var(--ink); }
.article a:not(.btn) { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }

.article hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

.toc {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 0 0 34px;
}
.toc p { font-weight: 800; color: var(--ink); margin: 0 0 10px; font-size: 14px; }
.toc ol { margin: 0; padding-left: 1.3em; font-size: 13.5px; }
.toc li { margin-bottom: 6px; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--accent); text-decoration: underline; }

.note {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 0 0 24px;
  font-size: 14px;
}
.note p:last-child { margin-bottom: 0; }

.article pre {
  background: var(--ink);
  color: #e8ecf2;
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  margin: 0 0 24px;
}
.article :not(pre) > code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--line-soft);
  border-radius: 5px;
  padding: 2px 6px;
}

.table-wrap { overflow-x: auto; margin: 0 0 24px; }
.article table { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 420px; }
.article th, .article td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; vertical-align: top; }
.article th { background: var(--bg-soft); font-weight: 700; color: var(--ink); }

.article-cta {
  margin-top: 44px;
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: #fff;
  padding: 30px 32px;
  text-align: center;
}
.article-cta strong { display: block; font-size: 18px; margin-bottom: 8px; color: #fff; }
.article-cta p { color: #b9c0ca; font-size: 13.5px; margin-bottom: 18px; }

.prevnext {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 26px;
}
.prevnext a {
  flex: 1 1 220px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.6;
}
.prevnext a:hover { border-color: var(--accent); color: var(--accent); }
.prevnext span { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; font-weight: 700; }

/* ---------- Footer -------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 28px 32px;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
}
.foot a:hover { color: var(--accent); }
.foot .spacer { margin-left: auto; }

/* ---------- Mobile -------------------------------------------------------- */

@media (max-width: 1180px) {
  .rail { display: none; }
}

@media (max-width: 880px) {
  .shell { display: block; }
  .nav {
    width: auto;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 16px 20px;
  }
  .brand { margin-bottom: 16px; }
  .nav-group { margin-bottom: 16px; }
  .nav-list { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-list a { padding: 6px 12px; background: var(--bg-soft); }
  .nav-cta { grid-template-columns: 1fr 1fr; margin-top: 16px; }
  .topbar { padding: 14px 16px; gap: 12px; }
  .crumbs { flex: 1 1 100%; }
  .topbar-tools { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .search { flex: 1 1 100%; width: auto; order: 3; }
  .lang { flex: 0 0 auto; }
  .content { padding: 22px 16px 48px; }
  .page-title { font-size: 21px; }
  .article { padding: 26px 20px 34px; border-radius: var(--radius); }
  .article h1 { font-size: 22px; }
  .article h2 { font-size: 18px; }
  .article-cta { padding: 24px 20px; }
  .foot { padding: 22px 16px; }
  .foot .spacer { margin-left: 0; width: 100%; }
}

/* ==========================================================================
   モーション・インタラクション
   すべて「OSでアニメーションを減らす設定」を尊重します（ファイル末尾を参照）。
   ========================================================================== */

html { scroll-behavior: smooth; }

/* キーボード操作時のフォーカス表示 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 1. スクロールで要素をふわっと表示 ----------------------------- */
/* JSが .reveal-init を付けるので、JS無効でも普通に表示されます */
[data-reveal].reveal-init { opacity: 0; transform: translateY(16px); }
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  transition: opacity .6s cubic-bezier(.22,.61,.36,1),
              transform .6s cubic-bezier(.22,.61,.36,1);
  transition-delay: calc(var(--d, 0) * 65ms);
}

/* ---------- 2. 記事カードのホバー ---------------------------------------- */
.card > a { transition: transform .28s cubic-bezier(.22,.61,.36,1); }
.card:hover > a { transform: translateY(-5px); }
.card-thumb {
  transition: box-shadow .28s ease;
  will-change: box-shadow;
}
.card:hover .card-thumb { box-shadow: 0 14px 30px -8px rgba(20,24,31,.35); }
.card-thumb > span { transition: transform .45s cubic-bezier(.22,.61,.36,1); }
.card:hover .card-thumb > span { transform: scale(1.04); }
.card-thumb img { transition: transform .5s cubic-bezier(.22,.61,.36,1); }
.card:hover .card-thumb img { transform: scale(1.06); }

/* 絞り込み直後に残ったカードを順に出す */
@keyframes cardPop {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.card.is-pop {
  animation: cardPop .42s cubic-bezier(.22,.61,.36,1) both;
  animation-delay: calc(var(--d, 0) * 45ms);
}

/* ---------- 3. ボタン・チップの微妙な反応 -------------------------------- */
.btn { transition: background .15s ease, color .15s ease, border-color .15s ease,
                   transform .15s ease, box-shadow .2s ease; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -6px rgba(232,113,10,.6); }
.btn:active { transform: translateY(0); }
.chip { transition: background .18s ease, color .18s ease, border-color .18s ease, transform .15s ease; }
.chip:active { transform: scale(.96); }
.nav-list a { transition: background .15s ease, color .15s ease, padding-left .15s ease; }
.nav-list a:hover { padding-left: 14px; }

/* ---------- 4. 上部バーの追従と読了プログレス ---------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  transition: box-shadow .22s ease;
}
.topbar.is-stuck { box-shadow: 0 2px 16px -4px rgba(20,24,31,.16); }

.progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  pointer-events: none;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, var(--accent), #ffb44d);
  transition: width .12s linear;
}

/* 追従バーの下に見出しが隠れないように */
.article h2[id], .article h3[id] { scroll-margin-top: 88px; }

/* ---------- 5. 目次（本文内＋サイドバー追従） ---------------------------- */
.toc a { transition: color .15s ease; }
.toc a.is-active { color: var(--accent); font-weight: 700; }

.rail.is-sticky {
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.rail.is-sticky::-webkit-scrollbar { width: 6px; }
.rail.is-sticky::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.toc-widget ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc-widget li {
  border-left: 2px solid var(--line);
  transition: border-color .22s ease;
}
.toc-widget li.is-active { border-left-color: var(--accent); }
.toc-widget a {
  display: block;
  padding: 8px 0 8px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  transition: color .18s ease, transform .18s ease;
}
.toc-widget a:hover { color: var(--accent); }
.toc-widget li.is-active > a { color: var(--ink); font-weight: 700; }

/* ---------- 6. コードブロックのコピーボタン ------------------------------ */
.code-block { position: relative; }
.code-block pre { margin-bottom: 0; }
.code-block + * { margin-top: 24px; }
.copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  padding: 5px 12px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: #cdd5e0;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 7px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .2s ease, transform .2s ease, background .15s ease, color .15s ease;
}
.code-block:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; transform: none; }
.copy-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.copy-btn.is-done { background: var(--accent); border-color: var(--accent); color: #fff; opacity: 1; transform: none; }
@media (hover: none) {
  .copy-btn { opacity: 1; transform: none; }
}

/* ---------- 7. トップへ戻る ---------------------------------------------- */
.to-top {
  position: fixed;
  right: 22px; bottom: 22px;
  width: 46px; height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.9);
  box-shadow: 0 10px 24px -8px rgba(20,24,31,.5);
  transition: opacity .26s ease, transform .26s cubic-bezier(.22,.61,.36,1),
              visibility .26s, background .15s ease;
}
.to-top.is-on { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--accent); }
.to-top svg { width: 18px; height: 18px; }

/* ---------- 8. 検索結果の件数表示 ---------------------------------------- */
.result-count {
  min-height: 20px;
  margin: -8px 0 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity .2s ease;
}
.result-count.is-on { opacity: 1; }

/* ---------- 9. モバイルのメニュー開閉 ------------------------------------ */
.nav-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
}
.nav-toggle span {
  position: relative;
  display: block;
  width: 18px; height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: background .2s ease;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px; height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .26s cubic-bezier(.22,.61,.36,1);
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after  { top: 6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav-toggle { display: inline-flex; }
  .brand { margin-bottom: 0; }
  /* .is-collapsible は JS が付けるので、JS無効ならメニューは開いたまま */
  .nav.is-collapsible .nav-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .34s cubic-bezier(.22,.61,.36,1), opacity .25s ease;
    opacity: 0;
  }
  .nav.is-collapsible .nav-body.is-open {
    max-height: 520px;
    opacity: 1;
    margin-top: 18px;
  }
  .to-top { right: 14px; bottom: 14px; width: 42px; height: 42px; }
  .article h2[id], .article h3[id] { scroll-margin-top: 140px; }
}

/* ---------- 10. アニメーションを減らす設定への対応 ------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal].reveal-init { opacity: 1; transform: none; }
  .card:hover > a { transform: none; }
}

/* ==========================================================================
   画像
   ========================================================================== */

/* ---------- アイキャッチ（記事の先頭） ----------------------------------- */
.article-hero {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-soft);
  margin: 0 0 30px;
  cursor: zoom-in;
}

/* ---------- 本文中の図版 -------------------------------------------------- */
.article figure {
  margin: 0 0 28px;
}
.article figure img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  cursor: zoom-in;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.article figure img:hover {
  border-color: #cfd5dd;
  box-shadow: 0 6px 18px -8px rgba(20,24,31,.28);
}
.article figcaption {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-muted);
}
.article figcaption::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2px;
  margin: 0 8px 4px 0;
  background: var(--accent);
  vertical-align: middle;
}

/* 横に2枚並べたいとき: <div class="figure-row"><figure>…</figure>×2</div> */
.figure-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.figure-row figure { margin: 0; }

/* 画像が読み込まれるまでの領域確保（レイアウトのガタつき防止） */
.article img[width][height] { height: auto; }

/* ---------- クリックで拡大（ライトボックス） ------------------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px 64px;
  background: rgba(10,13,18,.9);
  opacity: 0;
  visibility: hidden;
  transition: opacity .26s ease, visibility .26s;
  cursor: zoom-out;
}
.lightbox.is-on { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 10px;
  background: #fff;
  transform: scale(.965);
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
  cursor: default;
}
.lightbox.is-on img { transform: none; }
.lightbox-cap {
  position: absolute;
  left: 32px; right: 32px; bottom: 22px;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: #cdd5e0;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
}
.lightbox-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 42px; height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.lightbox-close:hover { background: rgba(255,255,255,.2); }
.lightbox-close svg { width: 17px; height: 17px; }

body.is-locked { overflow: hidden; }

@media (max-width: 880px) {
  .lightbox { padding: 56px 14px 56px; }
  .article-hero { margin-bottom: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox img { transform: none; }
}
