/* ============================================================
   Yuji Hatada / yunolv3 — Personal Site
   デザイン原理: 「焚き火を囲んで語り合う」
   - テキストの背後には色を置かない（本文域は静かな地のまま）
   - 装飾は周縁のみ: 下辺の熾火・舞い上がる火の粉・縁の残照
   - テーマ二層: dark = 夜の焚き火 ／ light = 和紙の上の残り火
   ============================================================ */

/* ---------- ページ遷移（対応ブラウザのみ）: ブワッと燃えて消え、じわっと滲んで現れる。背景の焚き火とトーンを揃える ---------- */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation-duration: .7s; }
::view-transition-old(root) {
  animation: vt-blaze-out .7s cubic-bezier(.22, .7, .25, 1) both;
}
::view-transition-new(root) {
  animation: vt-bloom-in .72s cubic-bezier(.22, .7, .25, 1) both;
}
@keyframes vt-blaze-out {
  0%   { opacity: 1; filter: blur(0) brightness(1) saturate(1); }
  32%  { opacity: .88; filter: blur(2px) brightness(1.3) saturate(1.25); }
  100% { opacity: 0; filter: blur(14px) brightness(1.6) saturate(1.4); }
}
@keyframes vt-bloom-in {
  0%   { opacity: 0; filter: blur(10px) brightness(1.35) saturate(1.2); }
  55%  { opacity: .75; filter: blur(3px) brightness(1.08); }
  100% { opacity: 1; filter: blur(0) brightness(1) saturate(1); }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

/* ---------- ダーク（夜の焚き火・既定） ---------- */
:root {
  --bg: #161814;            /* 緑がかった夜の黒 */
  --veil-bg: #101210;
  --ink: #e8e0d2;           /* 火に照らされた紙の白 */
  --ink-head: #f4ecdd;
  --mute: #9d968a;
  --mute-2: #6e685f;
  --hairline: rgba(232, 224, 210, .14);
  --hairline-soft: rgba(232, 224, 210, .08);
  --ember: #d97c3f;         /* 熾火 */
  --ember-l: #eda05f;
  --flame: #f0b877;         /* 炎の金（装飾・ピル背景用） */
  --gold: #c9a35c;          /* 見出しオーバーライン */
  --gold-l: #e2c68c;
  --link-hover: #f0b877;    /* リンクホバー文字色 */
  --glass: rgba(18, 20, 17, .62);
  --menu-bg: rgba(14, 16, 13, .97);
  --panel: rgba(255, 250, 240, .035);
  --panel-2: rgba(255, 250, 240, .06);
  --card-shadow: 0 16px 38px -20px rgba(255, 130, 40, .35);
  --focus-ring: rgba(217, 124, 63, .16);
  --sel: rgba(217, 124, 63, .45);
  --name-glow: 0 0 34px rgba(255, 150, 60, .16);
  --grain-blend: screen;
  --grain-op: .05;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --sans: "Zen Kaku Gothic New", -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --en: "EB Garamond", "Shippori Mincho", serif;
  --ease-out: cubic-bezier(.22, .7, .25, 1);
  --bar-h: 58px;
  --measure: 40rem;
}

/* ---------- ライト（和紙の上の残り火） ---------- */
html[data-theme="light"] {
  --bg: #f7f4ed;
  --veil-bg: #f7f4ed;
  --ink: #35312a;
  --ink-head: #262420;
  --mute: #847d71;
  --mute-2: #aaa295;
  --hairline: rgba(53, 49, 42, .15);
  --hairline-soft: rgba(53, 49, 42, .07);
  --ember: #c4642a;
  --ember-l: #d97c3f;
  --flame: #f0b877;
  --gold: #a98d4b;
  --gold-l: #c9a35c;
  --link-hover: #a8541f;
  --glass: rgba(252, 250, 245, .66);
  --menu-bg: rgba(252, 250, 245, .97);
  --panel: rgba(255, 255, 255, .55);
  --panel-2: rgba(255, 255, 255, .85);
  --card-shadow: 0 14px 34px -18px rgba(196, 100, 42, .28);
  --focus-ring: rgba(196, 100, 42, .15);
  --sel: rgba(217, 124, 63, .30);
  --name-glow: 0 0 34px rgba(214, 106, 44, .14);
  --grain-blend: multiply;
  --grain-op: .05;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.9;
  transition: background .5s var(--ease-out), color .5s var(--ease-out);
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
em { font-style: normal; }
::selection { background: var(--sel); }

/* ---------- 入場の帳 ---------- */
#veil {
  position: fixed; inset: 0; z-index: 100;
  background: var(--veil-bg);
  pointer-events: none;
  animation: veil-lift 1.2s .1s var(--ease-out) forwards;
}
@keyframes veil-lift { to { opacity: 0; visibility: hidden; } }

/* ---------- 周縁の装飾レイヤー ---------- */
/* 縁の残照: 四隅にだけ火の照り返しと夜（昼）の深み。中央の本文域には色を置かない */
#wash {
  position: fixed; inset: -6%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(34% 30% at 0% 100%, rgba(214, 106, 44, .16), transparent 68%),
    radial-gradient(34% 30% at 100% 100%, rgba(190, 82, 34, .13), transparent 68%),
    radial-gradient(30% 26% at 100% 0%, rgba(64, 84, 60, .18), transparent 66%),
    radial-gradient(30% 26% at 0% 0%, rgba(52, 74, 68, .15), transparent 66%);
  filter: url(#ink-bleed) blur(9px);
}
html[data-theme="light"] #wash {
  background:
    radial-gradient(34% 30% at 0% 100%, rgba(214, 106, 44, .13), transparent 68%),
    radial-gradient(34% 30% at 100% 100%, rgba(196, 82, 30, .11), transparent 68%),
    radial-gradient(30% 26% at 100% 0%, rgba(122, 138, 100, .12), transparent 66%),
    radial-gradient(30% 26% at 0% 0%, rgba(96, 122, 112, .10), transparent 66%);
}

/* 右下隅で燃える焚き火（後景。z-index 0 で常にテキストより奥）
   近景(#fire)＋遠景(#fire-far)の二重で空間の奥行きを出す。
   水彩タッチ: にじむグラデーションを乱流フィルタで崩し、輪郭を曖昧にする */
.fire { z-index: 0; pointer-events: none; isolation: isolate; }
.fire > * { position: absolute; }
/* 近景: 右下の隅に大きくダイナミックに */
#fire {
  position: fixed; right: -4%; bottom: -3%; left: auto;
  width: min(440px, 60vw); height: clamp(230px, 34vh, 440px);
}
/* 遠景: さらに右奥・小さく・地面の少し上（＝遠く）で、強くぼかして後退させる */
#fire-far {
  position: fixed; right: clamp(140px, 24vw, 340px); bottom: clamp(30px, 7vh, 92px); left: auto;
  width: min(150px, 22vw); height: clamp(90px, 14vh, 170px);
  filter: blur(3px); opacity: .5;
}
/* 遠火のにじむ照り（最も奥・広くやわらか） */
.fire .fglow {
  right: -60%; bottom: -20%; width: 330%; height: 215%;
  background: radial-gradient(46% 56% at 60% 100%, rgba(255, 150, 62, .22), rgba(214, 84, 30, .07) 48%, transparent 78%);
  filter: blur(28px);
  animation: glow-breath 6.8s ease-in-out infinite alternate;
}
/* 炎レイヤー（縦に伸ばした半透明のにじみを乱流で炎の形に崩す） */
.fire .flame { inset: 0; transform-origin: 50% 100%; mix-blend-mode: screen; }
.fire .flame-a {
  background:
    radial-gradient(21% 64% at 50% 100%, rgba(240, 120, 40, .52), rgba(214, 84, 30, .22) 44%, transparent 78%),
    radial-gradient(14% 78% at 42% 100%, rgba(255, 150, 60, .44), transparent 76%),
    radial-gradient(13% 70% at 60% 100%, rgba(230, 92, 30, .40), transparent 74%);
  filter: url(#flame-warp-a) blur(5px);
  animation: flame-sway-a 3.7s ease-in-out infinite alternate;
}
.fire .flame-b {
  background:
    radial-gradient(12% 60% at 50% 100%, rgba(255, 206, 122, .60), rgba(255, 150, 60, .26) 50%, transparent 72%),
    radial-gradient(8% 52% at 46% 100%, rgba(255, 236, 172, .60), transparent 66%),
    radial-gradient(8% 56% at 56% 100%, rgba(255, 190, 92, .50), transparent 68%);
  filter: url(#flame-warp-b) blur(4px);
  animation: flame-sway-b 2.8s ease-in-out infinite alternate;
}
/* 遠景の炎は少し速く・小さく揺らして「奥」の空気感を出す */
#fire-far .flame-a { animation-duration: 3.1s; }
#fire-far .flame-b { animation-duration: 2.3s; }
@keyframes flame-sway-a {
  0%   { transform: scaleY(1) skewX(0); opacity: .88; }
  50%  { transform: scaleY(1.09) skewX(2.6deg); opacity: 1; }
  100% { transform: scaleY(.96) skewX(-1.9deg); opacity: .92; }
}
@keyframes flame-sway-b {
  0%   { transform: scaleY(1.04) skewX(-1.4deg); opacity: .82; }
  50%  { transform: scaleY(.94) skewX(2.1deg); opacity: 1; }
  100% { transform: scaleY(1.07) skewX(-.7deg); opacity: .9; }
}
@keyframes glow-breath { from { opacity: .78; } to { opacity: 1; } }

/* ライト: 透明なガラスでできた炎（白のコア＋ピンクと黄の分光・虹色の屈折） */
html[data-theme="light"] .fire .fglow {
  background: radial-gradient(46% 56% at 60% 100%, rgba(250, 214, 224, .16), rgba(246, 226, 168, .08) 50%, transparent 80%);
  filter: blur(30px);
}
html[data-theme="light"] .fire .flame { mix-blend-mode: normal; }
html[data-theme="light"] .fire .flame-a {
  background:
    radial-gradient(23% 60% at 50% 100%, rgba(255, 238, 246, .32), rgba(250, 240, 224, .12) 46%, transparent 76%),
    radial-gradient(15% 70% at 40% 100%, rgba(244, 178, 210, .40), transparent 72%),
    radial-gradient(14% 64% at 61% 100%, rgba(248, 224, 148, .40), transparent 70%),
    radial-gradient(11% 52% at 53% 100%, rgba(226, 196, 240, .22), transparent 64%);
  filter: url(#flame-warp-a) blur(4px);
}
html[data-theme="light"] .fire .flame-b {
  background:
    radial-gradient(12% 58% at 50% 100%, rgba(255, 255, 255, .85), rgba(255, 246, 250, .32) 50%, transparent 66%),
    radial-gradient(7% 50% at 44% 100%, rgba(250, 184, 212, .66), transparent 60%),
    radial-gradient(7% 50% at 58% 100%, rgba(252, 228, 142, .64), transparent 62%);
  filter: url(#flame-warp-b) blur(3px);
}

/* 火の粉: 周縁バンドのみを舞い上がる */
#sparks { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
#sparks i {
  position: absolute; bottom: -2vh;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--spark-c, #f0b877);
  background: radial-gradient(circle, #fff8e8 0%, var(--spark-c, #f0b877) 35%, color-mix(in srgb, var(--spark-c, #f0b877) 45%, transparent) 65%, transparent 80%);
  opacity: 0;
  box-shadow: 0 0 9px 1px color-mix(in srgb, var(--spark-c, #f0b877) 65%, transparent);
  animation: spark-rise var(--spark-t, 9s) linear var(--spark-d, 0s) infinite, spark-twinkle 1.7s ease-in-out var(--spark-d, 0s) infinite;
}
html[data-theme="light"] #sparks i {
  background: var(--spark-c-l, #e2812f);
  background: radial-gradient(circle, #fff4de 0%, var(--spark-c-l, #e2812f) 40%, color-mix(in srgb, var(--spark-c-l, #e2812f) 45%, transparent) 68%, transparent 82%);
  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--spark-c-l, #e2812f) 55%, transparent);
}
@keyframes spark-rise {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: 0; }
  8%   { opacity: .95; }
  45%  { transform: translate3d(var(--spark-x1, 8px), -32vh, 0) scale(.75); opacity: .6; }
  80%  { opacity: .3; }
  100% { transform: translate3d(var(--spark-x2, -6px), -62vh, 0) scale(.35); opacity: 0; }
}
@keyframes spark-twinkle {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.5) saturate(1.3); }
}

/* 粒子（テクスチャ） */
#grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: var(--grain-op); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='240' height='240' filter='url(%23n)' opacity='0.9'/></svg>");
}

/* ---------- ヘッダー ---------- */
#bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 clamp(14px, 3vw, 30px);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid var(--hairline-soft);
  transition: transform .5s var(--ease-out), background .5s var(--ease-out);
}
@supports not ((backdrop-filter: blur(4px))) {
  #bar { background: var(--menu-bg); }
}
#bar.hidden { transform: translateY(-100%); }

/* ブランド＝ホームボタン（電球の水彩イラスト。輪郭をマスクでぼかし、周囲の焚き火背景に溶け込ませる。
   本文の名前と二重にならないよう文字は置かない。light/darkでlamp画像自体をクロスフェード） */
.brand {
  position: relative; display: flex; align-items: center; justify-content: center;
  flex: none; width: 46px; height: 46px; margin-left: -10px;
}
.brand-lamp {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  transition: opacity .5s var(--ease-out), transform .4s var(--ease-out);
  opacity: 0;
}
.brand-lamp-light { opacity: 1; }
html[data-theme="dark"] .brand-lamp-light { opacity: 0; }
html[data-theme="dark"] .brand-lamp-night { opacity: 1; }
.brand:hover .brand-lamp { transform: scale(1.06); }

.bar-right { display: flex; align-items: center; gap: clamp(8px, 1.4vw, 16px); min-width: 0; }

nav.menu { display: flex; align-items: center; gap: clamp(8px, 1.6vw, 20px); }
nav.menu a, nav.menu .nav-link {
  font-family: inherit; font-size: 12px; letter-spacing: .1em; color: var(--mute);
  padding: 6px 2px; position: relative; white-space: nowrap;
  transition: color .3s; background: none; border: none; cursor: pointer;
}
nav.menu > a::after, .nav-item > .nav-link::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px; background: var(--ember);
  transition: right .4s var(--ease-out);
}
nav.menu > a:hover, nav.menu > a.active,
.nav-item > .nav-link:hover, .nav-item.active > .nav-link { color: var(--ink-head); }
nav.menu > a:hover::after, nav.menu > a.active::after,
.nav-item > .nav-link:hover::after, .nav-item.active > .nav-link::after { right: 0; }

/* Research プルダウン */
.nav-item { position: relative; display: inline-flex; align-items: center; }
.nav-item .drop-toggle { display: inline-flex; align-items: center; gap: 5px; }
.nav-item .caret { width: 8px; height: 5px; opacity: .7; transition: transform .35s var(--ease-out); }
.nav-item.open .caret { transform: rotate(180deg); }
.dropdown {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(-6px);
  display: flex; flex-direction: column; min-width: 168px; padding: 8px;
  background: var(--menu-bg); border: 1px solid var(--hairline-soft); border-radius: 8px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .28s var(--ease-out), transform .28s var(--ease-out), visibility .28s;
  z-index: 50;
}
.nav-item.open .dropdown, .nav-item.has-dropdown:hover .dropdown {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
.dropdown a {
  font-size: 12px; letter-spacing: .08em; color: var(--mute);
  padding: 9px 12px; border-radius: 5px; white-space: nowrap;
  transition: color .25s, background .25s;
}
.dropdown a:hover, .dropdown a.active { color: var(--ink-head); background: rgba(217, 124, 63, .12); }

.lang-switch {
  display: flex; align-items: center; height: 30px; padding: 2px;
  background: var(--panel);
  border: 1px solid var(--hairline); border-radius: 999px;
  font-family: var(--en); font-size: 11px; letter-spacing: .12em;
}
.lang-switch a, .lang-switch span {
  height: 100%; display: flex; align-items: center;
  padding: 0 11px; border-radius: 999px; color: var(--mute);
  transition: color .3s, background .3s;
}
.lang-switch .current { color: #241f18; background: var(--flame); font-weight: 500; }
.lang-switch a:hover { color: var(--link-hover); }

/* テーマ切替（右上・焚き火のオンオフ） */
#theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none;
  color: var(--mute);
  border: 1px solid var(--hairline); border-radius: 50%;
  background: var(--panel);
  transition: color .3s, border-color .3s, background .3s, transform .5s var(--ease-out);
}
#theme-toggle:hover {
  color: var(--link-hover); border-color: rgba(217, 124, 63, .5);
  transform: rotate(24deg);
}
#theme-toggle svg { width: 15px; height: 15px; }
#theme-toggle .ico-sun { display: none; }
#theme-toggle .ico-moon { display: block; }
html[data-theme="light"] #theme-toggle .ico-sun { display: block; }
html[data-theme="light"] #theme-toggle .ico-moon { display: none; }

/* ハンバーガー（モバイル） */
#menu-btn { display: none; }
@media (max-width: 860px) {
  #menu-btn { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
  #menu-btn i { width: 18px; height: 1.4px; background: var(--ink-head); transition: transform .35s var(--ease-out), opacity .3s; }
  body.menu-open #menu-btn i:nth-child(1) { transform: translateY(5.4px) rotate(45deg); }
  body.menu-open #menu-btn i:nth-child(2) { opacity: 0; }
  body.menu-open #menu-btn i:nth-child(3) { transform: translateY(-5.4px) rotate(-45deg); }
  nav.menu {
    position: fixed; top: var(--bar-h); left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--menu-bg);
    border-bottom: 1px solid var(--hairline);
    padding: 8px clamp(14px, 5vw, 30px) 16px;
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: transform .4s var(--ease-out), opacity .3s, visibility .3s;
  }
  body.menu-open nav.menu { transform: none; opacity: 1; visibility: visible; }
  nav.menu > a, .nav-item .drop-toggle { font-size: 14px; padding: 10px 0; width: 100%; }
  /* モバイルではプルダウンをインラインのアコーディオンに */
  .nav-item { width: 100%; flex-direction: column; align-items: flex-start; }
  .nav-item .drop-toggle { justify-content: space-between; }
  .dropdown {
    position: static; transform: none; min-width: 0; width: 100%;
    background: none; border: none; box-shadow: none; padding: 0 0 8px 14px;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    display: none; opacity: 1; visibility: visible; pointer-events: auto;
  }
  .nav-item.open .dropdown { display: flex; }
  .dropdown a { font-size: 13px; padding: 8px 0; }
}

/* ---------- レイアウト ---------- */
main { position: relative; z-index: 2; }
.page {
  max-width: 46rem; margin: 0 auto;
  padding: calc(var(--bar-h) + clamp(48px, 9vh, 96px)) clamp(20px, 5vw, 32px) 96px;
}
.page.wide { max-width: 62rem; }

/* ページ見出し */
.page-head { margin-bottom: clamp(36px, 7vh, 64px); position: relative; }
.page-over {
  font-family: var(--en); font-size: 11px; letter-spacing: .34em;
  color: var(--gold); text-transform: uppercase; margin-bottom: 14px;
}
.page-title {
  font-family: var(--serif); font-weight: 600; color: var(--ink-head);
  font-size: clamp(26px, 4.6vw, 38px); line-height: 1.5; letter-spacing: .06em;
}
/* Work のサブ見出し（ハイフン以降のわかりやすい言い換え） */
.page-subtitle {
  margin-top: 12px; font-family: var(--serif); font-weight: 500;
  font-size: clamp(15px, 2.2vw, 18px); letter-spacing: .05em; line-height: 1.7;
  color: var(--mute);
}
.page-lede {
  margin-top: 18px; color: var(--mute); font-size: 14.5px; line-height: 2.1;
  max-width: var(--measure);
}
.page-lede a { color: var(--ink); border-bottom: 1px solid rgba(217, 124, 63, .4); }
.page-lede a:hover { color: var(--link-hover); }
.rule {
  width: 54px; height: 1px; background: var(--ember);
  margin-top: 26px; position: relative;
}
.rule::after {
  content: ""; position: absolute; left: 0; top: -1.5px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--flame);
  box-shadow: 0 0 8px 1px rgba(240, 184, 119, .55);
}

/* ---------- Research サブナビ（3グループを行き来する） ---------- */
.research-subnav {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: clamp(30px, 6vh, 52px);
}
.research-subnav a {
  font-family: var(--en); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--mute); padding: 8px 16px;
  border: 1px solid var(--hairline); border-radius: 999px;
  background: var(--panel);
  transition: color .3s, border-color .3s, background .3s;
}
.research-subnav a:hover { color: var(--link-hover); border-color: rgba(217, 124, 63, .5); }
.research-subnav a.active { color: #241f18; background: var(--flame); border-color: transparent; font-weight: 500; }
html[data-theme="light"] .research-subnav a.active { color: #fff; background: var(--ember); }

/* ---------- Research ハブ（3グループの大カテゴリ） ---------- */
.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; margin-top: clamp(30px, 6vh, 52px);
}
.cat-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 32px 28px 28px; min-height: 220px; justify-content: flex-end;
  background: var(--panel); border: 1px solid var(--hairline-soft); border-radius: 4px;
  transition: transform .5s var(--ease-out), border-color .4s, background .4s, box-shadow .5s var(--ease-out);
}
.cat-card:hover {
  transform: translateY(-4px); border-color: rgba(217, 124, 63, .45);
  background: var(--panel-2); box-shadow: var(--card-shadow);
}
.cat-card .num { font-family: var(--en); font-size: 12px; letter-spacing: .3em; color: var(--gold); }
.cat-card h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: .06em; color: var(--ink-head); line-height: 1.5; }
.cat-card .en { font-family: var(--en); font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--mute); margin-top: -6px; }
.cat-card .desc { font-size: 12.5px; line-height: 1.95; color: var(--mute); }
.cat-card .go { margin-top: 4px; font-family: var(--en); font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--ember-l); }
html[data-theme="light"] .cat-card .go { color: var(--ember); }
.cat-card .go::after { content: " →"; transition: none; }

/* ---------- 本文タイポグラフィ（背後は無色） ---------- */
.prose { font-size: 15px; line-height: 2.15; }
.prose p { margin: 0 0 1.9em; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 700; color: var(--ink-head); }
.prose em.hl { font-style: normal; background: linear-gradient(transparent 70%, rgba(217, 124, 63, .35) 70%); }
.prose h2 {
  font-family: var(--serif); font-weight: 600; color: var(--ink-head);
  font-size: 20px; letter-spacing: .08em; line-height: 1.7;
  margin: 3.2em 0 1.2em; padding-top: 1.6em;
  border-top: 1px solid var(--hairline-soft);
}
.prose ol, .prose ul { padding-left: 1.4em; margin: 0 0 1.9em; }
.prose li { margin-bottom: .6em; }
.prose a { border-bottom: 1px solid rgba(217, 124, 63, .45); transition: color .3s, border-color .3s; }
.prose a:hover { color: var(--link-hover); border-color: var(--link-hover); }
.prose blockquote {
  margin: 0 0 1.9em; padding: 4px 0 4px 20px;
  border-left: 2px solid var(--ember); color: var(--mute);
}

/* ---------- リビール ---------- */
.rv { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.rv.in { opacity: 1; transform: none; }

/* ---------- セクションラベル・カード ---------- */
.section-label {
  display: flex; align-items: baseline; gap: 14px;
  margin: clamp(48px, 9vh, 80px) 0 26px;
}
.section-label .ja { font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: .1em; color: var(--ink-head); }
.section-label .en { font-family: var(--en); font-size: 10.5px; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--hairline-soft); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 26px 24px 22px;
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: 3px;
  transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out), border-color .4s, background .4s;
}
.card:hover {
  transform: translateY(-3px);
  background: var(--panel-2);
  border-color: rgba(217, 124, 63, .45);
  box-shadow: var(--card-shadow);
}
.card .tag {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--en); font-size: 9.5px; letter-spacing: .26em;
  color: var(--gold); text-transform: uppercase;
}
.card .tag .scheme { min-width: 0; }
/* 役割バッジ（代表/分担/協力） */
.role {
  font-family: var(--sans); font-size: 10px; letter-spacing: .12em; text-transform: none;
  color: var(--ember-l); border: 1px solid rgba(217, 124, 63, .5);
  border-radius: 999px; padding: 1px 9px; white-space: nowrap; line-height: 1.7;
}
html[data-theme="light"] .role { color: var(--ember); border-color: rgba(196, 100, 42, .5); }
.page-over .role { vertical-align: middle; }
.card h3 {
  font-family: var(--serif); font-weight: 600; font-size: 16.5px;
  line-height: 1.75; letter-spacing: .04em; color: var(--ink-head);
}
/* Grant のタイトルは少しだけ目立たせる */
.card-grant h3 { font-size: 17.5px; line-height: 1.7; letter-spacing: .045em; }
.card .desc { font-size: 12.5px; line-height: 1.95; color: var(--mute); flex: 1; }
.card .more {
  font-family: var(--en); font-size: 10.5px; letter-spacing: .22em;
  color: var(--ember-l); text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px;
}
html[data-theme="light"] .card .more { color: var(--ember); }
.card .more::after { content: "→"; transition: transform .4s var(--ease-out); }
.card:hover .more::after { transform: translateX(4px); }

/* ---------- プロジェクト詳細 ---------- */
.proj-meta {
  margin: clamp(40px, 7vh, 60px) 0 0;
  padding: 24px 26px;
  background: var(--panel);
  border: 1px solid var(--hairline-soft); border-radius: 3px;
  font-size: 13px; line-height: 2;
}
.proj-meta dt {
  font-family: var(--en); font-size: 10px; letter-spacing: .26em;
  color: var(--gold); text-transform: uppercase; margin-top: 14px;
}
.proj-meta dt:first-child { margin-top: 0; }
.proj-meta dd { margin: 2px 0 0; color: var(--ink); }
.proj-meta dd ul { list-style: none; }
.proj-meta dd li { padding-left: 1.1em; text-indent: -1.1em; margin-bottom: .55em; }
.proj-meta dd li::before { content: "— "; color: var(--mute-2); }
.proj-meta a { border-bottom: 1px solid rgba(217, 124, 63, .4); }
.proj-meta a:hover { color: var(--link-hover); }
.award { color: var(--gold-l); font-weight: 500; }
html[data-theme="light"] .award { color: var(--gold); }

.proj-nav { margin-top: 56px; display: flex; flex-wrap: wrap; gap: 12px; }
.proj-nav a, .btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .08em; color: var(--mute);
  height: 38px; padding: 0 18px;
  background: var(--panel);
  border: 1px solid var(--hairline); border-radius: 999px;
  transition: color .3s, border-color .3s, background .3s;
}
.proj-nav a:hover, .btn:hover {
  color: var(--link-hover); border-color: rgba(217, 124, 63, .5);
  background: rgba(217, 124, 63, .10);
}

/* ---------- プロフィール ---------- */
.hero {
  min-height: calc(72vh);
  display: flex; flex-direction: column; justify-content: center;
  max-width: 62rem; margin: 0 auto;
  padding: calc(var(--bar-h) + 8vh) clamp(20px, 5vw, 32px) 6vh;
  position: relative; z-index: 2;
}
/* 名前の右手・周縁の焚き火のボケ */
.hero::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: 10%; right: -4%; width: min(46vw, 520px); aspect-ratio: 1 / 0.9;
  background:
    radial-gradient(20% 22% at 62% 40%, rgba(255, 170, 80, .34), transparent 62%),
    radial-gradient(12% 14% at 78% 62%, rgba(255, 140, 55, .28), transparent 60%),
    radial-gradient(9% 11% at 48% 66%, rgba(240, 184, 119, .24), transparent 58%),
    radial-gradient(34% 36% at 60% 50%, rgba(190, 84, 30, .16), transparent 68%);
  filter: url(#ink-bleed) blur(7px);
  animation: bloom-breath 8s ease-in-out infinite alternate;
}
html[data-theme="light"] .hero::before {
  background:
    radial-gradient(20% 22% at 62% 40%, rgba(230, 120, 40, .26), transparent 62%),
    radial-gradient(12% 14% at 78% 62%, rgba(214, 100, 40, .20), transparent 60%),
    radial-gradient(9% 11% at 48% 66%, rgba(224, 150, 70, .18), transparent 58%),
    radial-gradient(34% 36% at 60% 50%, rgba(196, 84, 26, .10), transparent 68%);
}
@keyframes bloom-breath { from { opacity: .8; } to { opacity: 1; } }
@media (max-width: 640px) {
  .hero::before { width: 80vw; top: 4%; right: -14%; opacity: .55; }
}
/* ポートレート（右手に配置。モバイルでは本文の下） */
.hero { gap: clamp(24px, 5vw, 56px); }
@media (min-width: 860px) {
  .hero { display: grid; grid-template-columns: 1.45fr .9fr; align-items: center; }
}
.hero-portrait {
  margin: 0; position: relative;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(14px, 2.5vh, 22px);
}
.hero-portrait img {
  display: block; width: 100%; max-width: 230px; height: auto; margin: 0 auto;
  max-height: 62vh; object-fit: contain;
  border-radius: 4px; border: 1px solid var(--hairline);
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, .55);
}
@media (max-width: 859px) {
  .hero-portrait { margin-top: 8px; }
  .hero-portrait img { max-width: 190px; }
}
.hero-over {
  font-family: var(--en); font-size: 11.5px; letter-spacing: .38em;
  color: var(--gold); text-transform: uppercase; margin-bottom: 20px;
}
.hero-name {
  font-family: var(--serif); font-weight: 600; color: var(--ink-head);
  font-size: clamp(34px, 7vw, 58px); letter-spacing: .1em; line-height: 1.35;
  text-shadow: var(--name-glow);
}
.hero-name .en { display: block; font-family: var(--en); font-weight: 400; font-size: clamp(15px, 2.4vw, 20px); letter-spacing: .3em; color: var(--mute); margin-top: 12px; text-shadow: none; }
.hero-lede { margin-top: 30px; max-width: var(--measure); color: var(--mute); font-size: 14.5px; line-height: 2.2; }
.hero-cue {
  position: absolute; left: 0; bottom: clamp(18px, 4vh, 40px);
  display: flex; flex-direction: column; gap: 10px; color: var(--mute-2);
}
@media (max-width: 859px) {
  /* モバイルでは縦積み（本文→ポートレート）になるため、下端固定だと写真に重なる。本文直後の通常フローに戻す */
  .hero-cue { position: static; margin-top: clamp(28px, 6vh, 48px); }
}
.hero-cue .cue-row { display: flex; align-items: center; gap: 12px; }
.hero-cue .cue-text { font-size: 10.5px; letter-spacing: .3em; }
.hero-cue .cue-line { width: 1px; height: 32px; background: var(--hairline); position: relative; overflow: hidden; }
.hero-cue .cue-line i { position: absolute; left: 0; top: -50%; width: 100%; height: 50%; background: var(--flame); animation: cue-drop 2.2s var(--ease-out) infinite; }
html[data-theme="light"] .hero-cue .cue-line i { background: var(--ember); }
.hero-cue .cue-chevron {
  width: 13px; height: 8px; color: var(--ember-l);
  animation: chev-bounce 1.8s var(--ease-out) infinite;
}
html[data-theme="light"] .hero-cue .cue-chevron { color: var(--ember); }
@keyframes cue-drop { to { top: 110%; } }
@keyframes chev-bounce {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50% { transform: translateY(6px); opacity: 1; }
}

.fact-list { list-style: none; font-size: 13.5px; }
.fact-list li {
  display: grid; grid-template-columns: 9.5em 1fr; gap: 14px;
  padding: 13px 2px; border-bottom: 1px solid var(--hairline-soft);
}
.fact-list .when { font-family: var(--en); font-size: 12px; letter-spacing: .06em; color: var(--mute); white-space: nowrap; }
@media (max-width: 560px) {
  .fact-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- 業績リスト ---------- */
.pub-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 6px; }
.pub-nav a {
  font-family: var(--en); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--mute); padding: 7px 14px;
  background: var(--panel);
  border: 1px solid var(--hairline); border-radius: 999px;
  transition: color .3s, border-color .3s, background .3s;
}
.pub-nav a:hover { color: var(--link-hover); border-color: rgba(217, 124, 63, .5); background: rgba(217, 124, 63, .10); }

.pub-list { list-style: none; font-size: 13.5px; }
.pub-list li {
  display: grid; grid-template-columns: 4.2em 1fr; gap: 14px;
  padding: 14px 2px; border-bottom: 1px solid var(--hairline-soft);
  line-height: 1.95;
}
.pub-list .year { font-family: var(--en); font-size: 12.5px; letter-spacing: .06em; color: var(--mute); padding-top: 2px; }
.pub-list .cite a { border-bottom: 1px solid rgba(217, 124, 63, .35); transition: color .3s, border-color .3s; }
.pub-list .cite a:hover { color: var(--link-hover); border-color: var(--link-hover); }
.pub-list .award { display: inline-block; margin-left: .5em; }
@media (max-width: 560px) {
  .pub-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- ギャラリー（図版・汎用） ---------- */
.gallery { columns: 3 260px; column-gap: 16px; margin-top: 8px; }
.gallery figure {
  break-inside: avoid; margin: 0 0 16px; overflow: hidden; border-radius: 3px;
  border: 1px solid var(--hairline-soft); background: var(--panel);
}
.gallery img {
  display: block; width: 100%; height: auto;
  transition: transform .6s var(--ease-out);
}
.gallery figure:hover img { transform: scale(1.03); }

/* ---------- Music & Movie: 作品一覧 ---------- */
.music-list { display: flex; flex-direction: column; gap: clamp(52px, 9vh, 88px); margin-top: 8px; }
.music-item .music-over { font-family: var(--en); font-size: 11px; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; margin-bottom: 10px; }
.music-item .music-title { font-family: var(--serif); font-weight: 600; font-size: clamp(19px, 3vw, 23px); letter-spacing: .05em; color: var(--ink-head); line-height: 1.6; }
.music-item .music-tagline { font-style: italic; color: var(--mute); font-size: 14px; margin-top: 14px; }
.music-item .music-desc { font-size: 14px; line-height: 2; color: var(--ink); margin-top: 14px; white-space: pre-line; max-width: var(--measure); }
.music-item .music-credits { font-size: 12.5px; color: var(--mute); line-height: 1.9; margin-top: 16px; }
.music-item .music-credits a { border-bottom: 1px solid rgba(217, 124, 63, .4); transition: color .3s; }
.music-item .music-credits a:hover { color: var(--link-hover); }
.music-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.music-thumb {
  display: block; margin-top: clamp(20px, 4vh, 32px);
  border-radius: 4px; overflow: hidden; border: 1px solid var(--hairline);
  background: var(--panel);
}
.music-thumb img { display: block; width: 100%; height: auto; transition: transform .6s var(--ease-out); }
.music-thumb:hover img { transform: scale(1.02); }

/* ---------- 動画埋め込み ---------- */
.embed {
  margin: clamp(28px, 5vh, 44px) 0 0;
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 4px; overflow: hidden; border: 1px solid var(--hairline);
  background: #000;
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed-cap { margin-top: 10px; font-size: 12px; color: var(--mute); }

/* ---------- 論文の図版（Workページ） ---------- */
.proj-figure {
  margin: clamp(28px, 5vh, 44px) 0 0;
  border-radius: 4px; overflow: hidden; border: 1px solid var(--hairline);
  background: var(--panel);
}
.proj-figure img { display: block; width: 100%; height: auto; }
.proj-figure figcaption { margin-top: 10px; font-size: 12px; color: var(--mute); }

/* ---------- フッター ---------- */
footer#foot {
  position: relative; z-index: 2;
  border-top: 1px solid var(--hairline-soft);
  padding: 40px clamp(20px, 5vw, 32px) 52px;
  text-align: center; color: var(--mute-2);
  font-size: 11.5px; letter-spacing: .06em;
}
footer#foot .sns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 22px; margin-bottom: 18px; }
footer#foot .sns a { color: var(--mute); font-family: var(--en); font-size: 11px; letter-spacing: .2em; transition: color .3s; }
footer#foot .sns a:hover { color: var(--link-hover); }

/* ---------- プレースホルダー ---------- */
.placeholder {
  margin-top: 40px; padding: 44px 30px; text-align: center;
  border: 1px dashed var(--hairline); border-radius: 3px;
  color: var(--mute); font-size: 13px; line-height: 2.1;
}
.placeholder a { color: var(--ink); border-bottom: 1px solid rgba(217, 124, 63, .4); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #veil { animation-duration: .01s; }
  .fire .flame, .fire .fglow { animation: none; }
  .hero-cue .cue-chevron { animation: none; }
  #sparks { display: none; }
  .hero::before { animation: none; }
  .rv { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  * { animation-duration: .01s !important; transition-duration: .01s !important; }
}
