/* ============================================================
   IWAHIBA — 三億年を、手のひらに。
   Design System v2 (iwahiba-site)
   モード: body[data-mode="dark"] 闇 / "washi" 和紙 / "zukan" 図鑑
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --sumi: #0c120c;          /* 墨 */
  --sumi-2: #131b13;
  --shinryoku: #1a2e1a;     /* 深緑 */
  --kin: #c9a86a;           /* 金 */
  --kin-bright: #e3c98f;
  --washi: #f5f1e6;         /* 和紙 */
  --washi-2: #ede7d6;
  --washi-3: #e3dcc6;
  --koyo: #a84432;          /* 紅葉 */
  --wakaba: #6a8f5f;        /* 若葉 */
  --ink: #2a2620;           /* 墨文字(紙上) */
  --ink-soft: #5a544a;
  --paper-line: #d8cfb8;
  --white-soft: #f2efe6;
  --green-line: rgba(201, 168, 106, .25);
  --kin-deep: #7d6434;        /* 紙面上で読める金 */

  --serif-jp: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans-jp: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  --serif-en: "Cormorant Garamond", Georgia, serif;

  --maxw: 1200px;
  --maxw-text: 860px;
  --sp: clamp(16px, 4vw, 32px);
  --radius: 6px;
  --shadow: 0 10px 40px rgba(10, 14, 10, .18);
  --dur: .7s;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--serif-jp);
  line-height: 1.9;
  letter-spacing: .04em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- page modes ---------- */
body[data-mode="dark"]  { background: var(--sumi); color: var(--white-soft); }
body[data-mode="washi"] { background: var(--washi); color: var(--ink); }
body[data-mode="zukan"] { background: var(--washi-2); color: var(--ink); }

body[data-mode="washi"]::before, body[data-mode="zukan"]::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(140, 120, 80, .05) 1px, transparent 1.5px);
  background-size: 22px 22px;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--kin); color: var(--sumi); }

/* ---------- light-mode contrast (WCAG) ---------- */
body[data-mode="washi"] .ch-no, body[data-mode="zukan"] .ch-no { color: var(--kin-deep); border-top-color: var(--kin-deep); }
body[data-mode="washi"] .ch-title .en-sub, body[data-mode="zukan"] .ch-title .en-sub { opacity: .78; }
body[data-mode="washi"] .src::before, body[data-mode="zukan"] .src::before { color: var(--kin-deep); }
body[data-mode="washi"] .tl-item .y small, body[data-mode="zukan"] .tl-item .y small { color: #4e4940; }

/* ---------- typography ---------- */
.en { font-family: var(--serif-en); letter-spacing: .08em; }
h1, h2, h3 { font-weight: 600; line-height: 1.4; }

.ch-head { text-align: center; margin: 0 auto clamp(36px, 6vw, 64px); max-width: var(--maxw-text); }
.ch-no {
  display: inline-block; font-family: var(--serif-en); font-size: .8rem;
  letter-spacing: .5em; text-transform: uppercase; color: var(--kin);
  border-top: 1px solid var(--kin); padding-top: 10px; margin-bottom: 14px;
}
.ch-title { font-size: clamp(1.7rem, 4.2vw, 2.6rem); letter-spacing: .14em; }
.ch-title .en-sub {
  display: block; font-family: var(--serif-en); font-size: .95rem; font-weight: 400;
  letter-spacing: .35em; text-transform: uppercase; margin-top: 10px; opacity: .55;
}
.ch-lead { margin: 22px auto 0; max-width: 640px; font-size: .98rem; opacity: .85; }
.ch-lead .en-lead { display: block; font-family: var(--serif-en); font-size: .85rem; font-style: italic; opacity: .7; margin-top: 8px; }

/* ---------- layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp); position: relative; z-index: 1; }
.container-text { max-width: var(--maxw-text); margin: 0 auto; padding: 0 var(--sp); position: relative; z-index: 1; }
.section { padding: clamp(64px, 10vw, 130px) 0; position: relative; }

/* ---------- header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(14px, 3vw, 30px); height: 64px;
  background: rgba(12, 18, 12, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--green-line);
  transition: transform .35s ease;
}
.site-header.hidden { transform: translateY(-100%); }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--white-soft); }
.brand .kanji { font-size: 1.25rem; letter-spacing: .3em; }
.brand .roman { font-family: var(--serif-en); font-size: .72rem; letter-spacing: .4em; color: var(--kin); text-transform: uppercase; }
.gnav { display: flex; gap: clamp(10px, 1.6vw, 22px); align-items: center; }
.gnav a {
  text-decoration: none; font-size: .82rem; letter-spacing: .12em; color: var(--white-soft);
  opacity: .78; padding: 6px 2px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.gnav a:hover { opacity: 1; color: var(--kin-bright); }
.gnav a[aria-current="page"] { opacity: 1; color: var(--kin); border-bottom-color: var(--kin); }
.gnav a .n { font-family: var(--serif-en); font-size: .62rem; color: var(--kin); margin-right: 4px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--green-line); color: var(--white-soft); border-radius: 4px; padding: 8px 10px; font-family: var(--sans-jp); font-size: .8rem; cursor: pointer; }
@media (max-width: 980px) {
  .nav-toggle { display: block; }
  .gnav {
    position: fixed; top: 64px; right: 0; flex-direction: column; align-items: flex-end;
    background: rgba(12, 18, 12, .97); padding: 22px 26px; gap: 16px;
    border-left: 1px solid var(--green-line); border-bottom: 1px solid var(--green-line);
    transform: translateX(110%); transition: transform .3s ease; min-width: 230px;
  }
  .gnav.open { transform: none; }
  .gnav a { font-size: .95rem; }
}

/* ---------- footer ---------- */
.site-footer {
  background: var(--sumi); color: var(--white-soft);
  border-top: 1px solid var(--green-line);
  padding: clamp(40px, 6vw, 70px) 0 90px; font-size: .85rem;
}
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 36px; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr; } }
.site-footer h4 { color: var(--kin); font-size: .9rem; letter-spacing: .2em; margin-bottom: 14px; }
.site-footer a { color: var(--white-soft); opacity: .75; text-decoration: none; }
.site-footer a:hover { opacity: 1; color: var(--kin-bright); }
.site-footer ul { list-style: none; } .site-footer li { margin-bottom: 8px; }
.footer-note { opacity: .55; font-size: .76rem; margin-top: 26px; line-height: 1.8; }

/* ---------- 出典 (citation) ---------- */
.src {
  display: inline-block; font-family: var(--sans-jp); font-style: normal;
  font-size: .72rem; letter-spacing: .05em; line-height: 1.5;
  color: var(--ink-soft); background: rgba(140, 120, 80, .1);
  border: 1px solid rgba(140, 120, 80, .25); border-radius: 999px;
  padding: 1px 10px; margin: 4px 4px 0 0; vertical-align: middle;
}
body[data-mode="dark"] .src { color: #cfc8b4; background: rgba(201, 168, 106, .08); border-color: rgba(201, 168, 106, .3); }
.src::before { content: "出典 "; color: var(--kin); font-size: .68rem; letter-spacing: .15em; }
.src.en-src::before { content: "Source "; }

/* ---------- theory cards (諸説併記) ---------- */
.theory-group { margin: 30px 0 44px; }
.theory-topic {
  font-size: 1.25rem; letter-spacing: .2em; border-left: 4px solid var(--kin);
  padding: 4px 0 4px 16px; margin-bottom: 6px;
}
.theory-topic .en-sub { font-family: var(--serif-en); font-size: .78rem; letter-spacing: .25em; opacity: .6; margin-left: 12px; text-transform: uppercase; }
.editor-note {
  background: linear-gradient(135deg, rgba(106, 143, 95, .12), rgba(201, 168, 106, .1));
  border: 1px solid rgba(106, 143, 95, .35); border-radius: var(--radius);
  padding: 18px 22px; margin: 14px 0 18px; font-size: .95rem;
}
.editor-note .tag { font-family: var(--sans-jp); font-size: .72rem; color: var(--wakaba); letter-spacing: .2em; display: block; margin-bottom: 6px; }
body[data-mode="dark"] .editor-note .tag { color: #9fc492; }
.theories { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.theory {
  background: #fffdf6; border: 1px solid var(--paper-line); border-radius: var(--radius);
  padding: 18px 20px 14px; font-size: .92rem; line-height: 1.95;
  box-shadow: 0 3px 14px rgba(80, 70, 40, .07);
}
body[data-mode="dark"] .theory { background: var(--sumi-2); border-color: rgba(201, 168, 106, .2); }
.theory h4 { font-size: .98rem; letter-spacing: .08em; margin-bottom: 8px; color: var(--koyo); }
body[data-mode="dark"] .theory h4 { color: var(--kin-bright); }
.theory blockquote { border-left: 3px solid var(--kin); margin: 10px 0; padding: 2px 0 2px 12px; font-style: normal; opacity: .9; }

/* ---------- timeline (絵巻年表) ---------- */
.scroll-tl { position: relative; margin: 40px 0; }
.scroll-tl::before {
  content: ""; position: absolute; left: clamp(70px, 9vw, 110px); top: 0; bottom: 0;
  width: 1px; background: linear-gradient(var(--kin) 60%, transparent); opacity: .5;
}
.tl-item { position: relative; display: grid; grid-template-columns: clamp(70px, 9vw, 110px) 1fr; gap: clamp(16px, 3vw, 34px); padding: 22px 0; }
.tl-item .y { text-align: right; padding-right: clamp(14px, 2vw, 26px); font-family: var(--serif-en); font-size: clamp(1.1rem, 2.4vw, 1.5rem); color: var(--koyo); line-height: 1.3; }
body[data-mode="dark"] .tl-item .y { color: var(--kin); }
.tl-item .y small { display: block; font-family: var(--serif-jp); font-size: .72rem; color: var(--ink-soft); letter-spacing: .1em; }
body[data-mode="dark"] .tl-item .y small { color: #b9b29c; }
.tl-item .c::before {
  content: ""; position: absolute; left: clamp(70px, 9vw, 110px); top: 36px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--kin); transform: translateX(-4px);
  box-shadow: 0 0 0 4px rgba(201, 168, 106, .18);
}
.tl-item .t { font-size: 1.06rem; letter-spacing: .1em; margin-bottom: 6px; }
.tl-item .d { font-size: .9rem; opacity: .85; max-width: 740px; }
.tl-item.major .t { font-size: 1.25rem; color: var(--koyo); }
body[data-mode="dark"] .tl-item.major .t { color: var(--kin-bright); }

/* ---------- column (こぼれ話) ---------- */
.kobore {
  background: #fbf8ee; border: 1px solid var(--paper-line); border-radius: var(--radius);
  padding: 24px 28px; margin: 34px 0; position: relative; box-shadow: var(--shadow);
}
body[data-mode="dark"] .kobore { background: var(--sumi-2); border-color: rgba(201, 168, 106, .25); }
.kobore::before {
  content: "こぼれ話"; position: absolute; top: -12px; left: 22px;
  background: var(--koyo); color: #fff; font-size: .72rem; letter-spacing: .25em;
  padding: 2px 12px; border-radius: 999px; font-family: var(--sans-jp);
}
.kobore h4 { font-size: 1.05rem; letter-spacing: .12em; margin-bottom: 10px; }
.kobore p { font-size: .92rem; }

/* ---------- card grids (図鑑) ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); }
.card {
  background: #fffdf6; border: 1px solid var(--paper-line); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 3px 12px rgba(80, 70, 40, .06);
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(80, 70, 40, .14); }
.card .ph { aspect-ratio: 4 / 3; overflow: hidden; background: var(--washi-3); cursor: zoom-in; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .ph img { transform: scale(1.05); }
.card .bd { padding: 12px 14px 14px; }
.card .nm { font-size: 1.02rem; letter-spacing: .1em; }
.card .nm .kana { display: block; font-size: .72rem; color: var(--ink-soft); letter-spacing: .15em; margin-top: 2px; }
.card .ds { font-size: .8rem; line-height: 1.75; margin-top: 8px; color: var(--ink-soft); }
.card .meta { margin-top: 8px; }

/* ---------- filter bar ---------- */
.filterbar {
  position: sticky; top: 64px; z-index: 40;
  background: rgba(245, 241, 230, .92); backdrop-filter: blur(10px);
  border: 1px solid var(--paper-line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 22px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.filterbar input[type="search"] {
  font-family: var(--sans-jp); font-size: .9rem; padding: 8px 14px;
  border: 1px solid var(--paper-line); border-radius: 999px; background: #fff; min-width: 200px;
}
.fbtn {
  font-family: var(--sans-jp); font-size: .8rem; letter-spacing: .08em; cursor: pointer;
  background: #fff; color: var(--ink); border: 1px solid var(--paper-line);
  border-radius: 999px; padding: 6px 14px; transition: all .2s;
}
.fbtn:hover { border-color: var(--kin); }
.fbtn.active { background: var(--shinryoku); color: #fff; border-color: var(--shinryoku); }
.fcount { font-family: var(--sans-jp); font-size: .8rem; color: var(--ink-soft); margin-left: auto; }

/* ---------- meikan viewer ---------- */
.mk-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 30px; }
.mk-tab {
  font-family: var(--serif-jp); font-size: .92rem; letter-spacing: .15em; cursor: pointer;
  background: transparent; color: var(--white-soft); border: 1px solid rgba(201, 168, 106, .4);
  border-radius: 999px; padding: 8px 22px; transition: all .25s;
}
.mk-tab:hover { border-color: var(--kin); color: var(--kin-bright); }
.mk-tab.active { background: var(--kin); color: var(--sumi); border-color: var(--kin); }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.mk-item { cursor: zoom-in; background: var(--sumi-2); border: 1px solid rgba(201, 168, 106, .2); border-radius: var(--radius); overflow: hidden; transition: transform .2s, border-color .2s; }
.mk-item:hover { transform: translateY(-3px); border-color: var(--kin); }
.mk-item .im { aspect-ratio: 3 / 4; overflow: hidden; display:flex; align-items:center; justify-content:center; background:#0a0e0a; }
.mk-item .im img { width: 100%; height: 100%; object-fit: contain; }
.mk-item .lb { padding: 10px 12px; font-size: .82rem; letter-spacing: .08em; }
.mk-item .lb .own { display: block; font-family: var(--sans-jp); font-size: .68rem; color: #b9b29c; margin-top: 3px; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(8, 11, 8, .96); align-items: center; justify-content: center; flex-direction: column;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 94vw; max-height: 82vh; object-fit: contain; box-shadow: 0 20px 80px rgba(0,0,0,.6); cursor: grab; transition: transform .15s ease-out; }
.lightbox .cap { color: var(--white-soft); font-size: .88rem; letter-spacing: .1em; margin-top: 16px; text-align: center; padding: 0 20px; }
.lightbox .cap .src { margin-top: 6px; }
.lightbox .close {
  position: absolute; top: 18px; right: 22px; background: none; border: 1px solid rgba(255,255,255,.4);
  color: #fff; font-size: 1rem; border-radius: 999px; width: 44px; height: 44px; cursor: pointer;
}
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.3); color: #fff; font-size: 1.4rem; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; }
.lightbox .lb-prev { left: 16px; } .lightbox .lb-next { right: 16px; }
.lightbox .zoom-hint { position: absolute; bottom: 16px; right: 22px; color: rgba(255,255,255,.5); font-size: .72rem; font-family: var(--sans-jp); }

/* ---------- season slider ---------- */
.season-stage { display: grid; grid-template-columns: 1fr; gap: 18px; max-width: 760px; margin: 0 auto; }
.season-frame { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000; aspect-ratio: 4 / 3; }
.season-frame img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease; }
.season-frame img.on { opacity: 1; }
.season-frame .mlabel {
  position: absolute; left: 18px; top: 14px; z-index: 2; color: #fff;
  font-size: 1.6rem; letter-spacing: .2em; text-shadow: 0 2px 14px rgba(0,0,0,.7);
}
.season-frame .mlabel small { display: block; font-family: var(--serif-en); font-size: .8rem; letter-spacing: .35em; opacity: .8; }
.season-ctl { display: flex; align-items: center; gap: 14px; }
.season-ctl input[type="range"] { flex: 1; accent-color: var(--kin); }
.season-months { display: flex; justify-content: space-between; font-family: var(--serif-en); font-size: .7rem; opacity: .6; }
.season-pick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--paper-line); border-radius: var(--radius); background: #fffdf6; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; font-family: var(--sans-jp); }
.tbl th { background: var(--shinryoku); color: #fff; font-weight: 600; letter-spacing: .1em; padding: 10px 14px; text-align: left; white-space: nowrap; }
.tbl td { padding: 9px 14px; border-top: 1px solid var(--paper-line); vertical-align: top; }
.tbl tr:hover td { background: rgba(201, 168, 106, .07); }

/* ---------- calendar (年間管理暦) ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.cal-month { background: #fffdf6; border: 1px solid var(--paper-line); border-radius: var(--radius); padding: 16px 18px; font-size: .86rem; }
.cal-month h4 { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px dashed var(--paper-line); padding-bottom: 8px; margin-bottom: 10px; }
.cal-month h4 .mn { font-family: var(--serif-en); font-size: 1.4rem; color: var(--koyo); }
.cal-month ul { list-style: none; }
.cal-month li { padding-left: 1.1em; text-indent: -1.1em; margin-bottom: 5px; }
.cal-month li::before { content: "・"; color: var(--kin); }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hero video, .hero > img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero .veil { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(10, 14, 10, .25), rgba(10, 14, 10, .82) 90%); }
.hero .inner { position: relative; z-index: 2; text-align: center; padding: 0 var(--sp); }
.hero .tate {
  writing-mode: vertical-rl; margin: 0 auto; font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: .35em; line-height: 1.7; height: clamp(280px, 46vh, 460px);
  text-shadow: 0 4px 30px rgba(0, 0, 0, .65);
}
.hero .tate .gold { color: var(--kin-bright); }
.hero .sub { margin-top: 26px; font-size: clamp(.9rem, 2vw, 1.05rem); letter-spacing: .25em; opacity: .9; }
.hero .sub .en-line { display: block; font-family: var(--serif-en); font-size: .85em; font-style: italic; letter-spacing: .15em; opacity: .75; margin-top: 10px; }
.hero .scroll-cue { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); font-family: var(--serif-en); font-size: .68rem; letter-spacing: .5em; opacity: .65; text-transform: uppercase; }
.hero .scroll-cue::after { content: ""; display: block; width: 1px; height: 46px; background: linear-gradient(var(--kin), transparent); margin: 10px auto 0; animation: cueDrop 2.2s ease infinite; }
@keyframes cueDrop { 0% { transform: scaleY(0); transform-origin: top; } 55% { transform: scaleY(1); } 100% { opacity: 0; } }

/* ---------- chapter cards (index 入口) ---------- */
.gateway { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 18px; }
.gate {
  position: relative; display: block; text-decoration: none; color: #fff;
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; box-shadow: var(--shadow);
}
.gate img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.gate:hover img { transform: scale(1.06); }
.gate .veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,14,10,.05), rgba(10,14,10,.78)); }
.gate .tx { position: absolute; left: 18px; bottom: 14px; right: 18px; }
.gate .tx .t { font-size: 1.2rem; letter-spacing: .2em; }
.gate .tx .e { font-family: var(--serif-en); font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: var(--kin-bright); }
.gate .tx .d { font-size: .78rem; opacity: .85; margin-top: 4px; font-family: var(--sans-jp); }

/* ---------- stats ---------- */
.stats { display: flex; flex-wrap: wrap; gap: clamp(20px, 5vw, 60px); justify-content: center; text-align: center; }
.stat .n { font-family: var(--serif-en); font-size: clamp(2.2rem, 6vw, 3.6rem); color: var(--kin); line-height: 1.2; }
.stat .l { font-size: .82rem; letter-spacing: .2em; opacity: .8; }

/* ---------- FAQ / disclosure ---------- */
details.qa { border-bottom: 1px solid var(--paper-line); padding: 4px 0; }
body[data-mode="dark"] details.qa { border-color: var(--green-line); }
details.qa summary {
  cursor: pointer; list-style: none; display: flex; gap: 14px; align-items: baseline;
  font-size: 1.02rem; letter-spacing: .08em; padding: 16px 4px;
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::before { content: "問"; color: var(--koyo); font-size: .85rem; flex: none; border: 1px solid currentColor; border-radius: 50%; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; }
body[data-mode="dark"] details.qa summary::before { color: var(--kin); }
details.qa .a { padding: 0 4px 18px 40px; font-size: .92rem; opacity: .9; }
details.qa[open] summary { color: var(--koyo); }
body[data-mode="dark"] details.qa[open] summary { color: var(--kin-bright); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font-family: var(--serif-jp); font-size: .92rem; letter-spacing: .25em;
  color: var(--kin-bright); background: transparent; border: 1px solid var(--kin);
  padding: 13px 36px; border-radius: 2px; transition: all .3s ease;
}
.btn:hover { background: var(--kin); color: var(--sumi); }
.btn.on-paper { color: var(--shinryoku); border-color: var(--shinryoku); }
.btn.on-paper:hover { background: var(--shinryoku); color: #fff; }

/* ---------- ghost buttons (dark sections) ---------- */
.fbtn.ghost { background: transparent; color: inherit; border-color: rgba(201, 168, 106, .45); }
.fbtn.ghost:hover { border-color: var(--kin); color: var(--kin-bright); }
.fbtn.ghost.active, .fbtn.ghost[aria-pressed="true"] { background: var(--kin); color: var(--sumi); border-color: var(--kin); }

/* ---------- perf: offscreen card rendering ---------- */
.card, .mk-item { content-visibility: auto; contain-intrinsic-size: 320px 300px; }
.tbl tbody tr { content-visibility: auto; contain-intrinsic-size: auto 44px; }

/* ---------- nav EN sub labels ---------- */
.gnav a .sub-en { display: block; font-family: var(--serif-en); font-size: .58rem; letter-spacing: .22em; text-transform: uppercase; opacity: .55; line-height: 1.1; margin-top: 1px; }
@media (max-width: 980px) { .gnav a .sub-en { display: inline; margin-left: 8px; } }

/* ---------- noscript note ---------- */
.noscript-note { background: var(--koyo); color: #fff; font-family: var(--sans-jp); font-size: .85rem; padding: 10px 16px; text-align: center; }

/* ---------- focusable lightbox triggers ---------- */
[data-lb-src] { cursor: zoom-in; }
[data-lb-src]:focus-visible { outline: 3px solid var(--kin); outline-offset: 2px; }

/* ---------- reveal animation ---------- */
html.js .fade-up { opacity: 0; transform: translateY(26px); transition: opacity var(--dur) ease, transform var(--dur) ease; }
html.js .fade-up.d1 { transition-delay: .1s; } html.js .fade-up.d2 { transition-delay: .22s; }
html.js .fade-up.d3 { transition-delay: .34s; } html.js .fade-up.d4 { transition-delay: .46s; }
html.js .fade-up.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .fade-up { opacity: 1; transform: none; } }

/* ---------- helpers ---------- */
.tag {
  display: inline-block; font-family: var(--sans-jp); font-size: .7rem; letter-spacing: .1em;
  border-radius: 999px; padding: 1px 10px; border: 1px solid var(--paper-line); color: var(--ink-soft);
  background: #fff; margin: 2px 2px 0 0;
}
.tag.t-koyo { color: var(--koyo); border-color: rgba(168, 68, 50, .4); }
.tag.t-waka { color: #4f7344; border-color: rgba(106, 143, 95, .5); }
.tag.t-kin { color: #8a6f3c; border-color: rgba(201, 168, 106, .6); }
.note-soft { font-size: .8rem; opacity: .7; font-family: var(--sans-jp); }
.center { text-align: center; }
.mt-l { margin-top: clamp(30px, 5vw, 54px); }
.divider-leaf { text-align: center; color: var(--kin); letter-spacing: 1.2em; opacity: .6; margin: clamp(30px, 6vw, 56px) 0; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--kin); color: var(--sumi); padding: 10px 18px; z-index: 999; font-family: var(--sans-jp); }
.skip-link:focus { left: 10px; top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

/* page top progress bar */
.readbar { position: fixed; top: 0; left: 0; height: 2px; background: var(--kin); z-index: 200; width: 0; }

/* back-to-top */
.totop {
  position: fixed; right: 18px; bottom: 18px; z-index: 90; width: 46px; height: 46px;
  border-radius: 50%; border: 1px solid var(--kin); background: rgba(12, 18, 12, .8);
  color: var(--kin-bright); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.totop.show { opacity: 1; pointer-events: auto; }
