@import url("gill.css");
/* Layout: a dark "vector-space" hero echoing the portrait, then a single reading column
   of sections on cool paper; charts span the column, lists sit in two-column grids. */
:root {
  --paper: #f4f5f9;
  --surface: #ffffff;
  --ink: #17182b;
  --muted: #565a74;
  --line: #d8dae6;
  --accent: #4a3a8e;
  --accent-soft: #e7e3f6;
  --gold: #9a7621;
  --teal: #237a70;
  --s-pala: #b4472f;
  --s-dh: #3567a8;
  --s-dls: #7a55b8;
  --s-jadh: #237a70;
  --s-jaecs: #a07a1c;
  --s-other: #8a8ea6;
  --hero-bg: #10111c;
  --hero-ink: #ecebf4;
  --hero-muted: #a6a8c0;
  --hero-line: rgba(220, 222, 255, .16);
  --font-display: "TT Gill Sans", "Gill Sans", "Gill Sans MT", "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-body: "TT Gill Sans", "Gill Sans", "Gill Sans MT", "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-mono: "TT Gill Sans", "Gill Sans", "Gill Sans MT", "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --step--1: .82rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.55rem;
  --step-3: 2.1rem;
  --step-4: clamp(2.3rem, 5vw, 3.4rem);
  --radius: 6px;
  --col: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12131e; --surface: #1a1b2a; --ink: #e8e8f1; --muted: #a2a5bf; --line: #2c2e45;
    --accent: #a99bf0; --accent-soft: #2a2550; --gold: #d6b25a; --teal: #5cc2b4;
    --s-pala: #e3785f; --s-dh: #6f9de0; --s-dls: #ad8ef0; --s-jadh: #5cc2b4; --s-jaecs: #d6b25a; --s-other: #8d91ab;
    --hero-bg: #0b0c15;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12131e; --surface: #1a1b2a; --ink: #e8e8f1; --muted: #a2a5bf; --line: #2c2e45;
  --accent: #a99bf0; --accent-soft: #2a2550; --gold: #d6b25a; --teal: #5cc2b4;
  --s-pala: #e3785f; --s-dh: #6f9de0; --s-dls: #ad8ef0; --s-jadh: #5cc2b4; --s-jaecs: #d6b25a; --s-other: #8d91ab;
  --hero-bg: #0b0c15;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--hero-bg); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; text-wrap: balance; line-height: 1.3; margin: 0; }
.wrap { max-width: var(--col); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.en { font-family: var(--font-body); font-size: .62em; font-weight: 400; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; display: block; margin-top: .25em; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- top nav ---------- */
.topnav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--hero-bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--hero-line); }
.topnav .wrap { display: flex; align-items: center; gap: 18px; min-height: 52px; }
.brand { color: var(--hero-ink); font-family: var(--font-display); font-size: 1.05rem; text-decoration: none; white-space: nowrap; }
.navlinks { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.navlinks::-webkit-scrollbar { display: none; }
.navlinks a { color: var(--hero-muted); text-decoration: none; font-size: var(--step--1); padding: 6px 10px; border-radius: 99px; white-space: nowrap; }
.navlinks a:hover, .navlinks a.on { color: var(--hero-ink); background: rgba(255,255,255,.08); }
.lang-toggle { border: 1px solid var(--hero-line); background: transparent; color: var(--hero-ink); border-radius: 99px; padding: 4px 12px; font: inherit; font-size: var(--step--1); cursor: pointer; }

/* ---------- hero ---------- */
.hero { position: relative; background: var(--hero-bg); color: var(--hero-ink); overflow: hidden; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.hero .wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 48px; align-items: center; padding-block: 64px 56px; }
.hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); letter-spacing: .04em; }
.hero h1 small { display: block; font-family: var(--font-body); font-size: .5em; letter-spacing: .14em; color: var(--hero-muted); font-weight: 400; margin-top: 8px; text-transform: uppercase; }
.hero .role { margin: 18px 0 0; color: var(--hero-ink); font-size: var(--step-1); line-height: 1.6; }
.hero .role span { display: block; color: var(--hero-muted); font-size: var(--step--1); letter-spacing: .03em; }
.hero .lede { margin: 22px 0 0; color: var(--hero-muted); max-width: 36em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding: 0; list-style: none; }
.hero .chips li { border: 1px solid var(--hero-line); border-radius: 99px; padding: 3px 12px; font-size: var(--step--1); color: var(--hero-ink); }
.portrait { justify-self: end; width: min(180px, 100%); position: relative; }
.portrait img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; filter: contrast(1.02); box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.portrait figcaption { font-size: .72rem; color: var(--hero-muted); margin-top: 8px; letter-spacing: .06em; }
.statrow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 34px; background: var(--hero-line); border: 1px solid var(--hero-line); border-radius: var(--radius); overflow: hidden; }
.stat { background: color-mix(in srgb, var(--hero-bg) 88%, #fff 0%); padding: 14px 14px 12px; }
.stat b { display: block; font-family: var(--font-display); font-size: var(--step-3); line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: .74rem; color: var(--hero-muted); letter-spacing: .04em; }
.profile-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 22px; font-size: var(--step--1); }
.profile-links a { color: var(--hero-ink); text-decoration-color: rgba(255,255,255,.35); }

/* ---------- sections ---------- */
section.block { padding-block: 72px 24px; scroll-margin-top: 60px; }
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: end; margin-bottom: 30px; }
.sec-head h2 { font-size: var(--step-3); }
.sec-head p { margin: 0; color: var(--muted); max-width: 40em; }
.kicker { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; margin-bottom: 10px; display: block; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.note { font-size: var(--step--1); color: var(--muted); }

/* themes */
.themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.theme { padding: 18px 18px 18px 0; border-bottom: 1px solid var(--line); }
.theme + .theme { padding-left: 18px; border-left: 1px solid var(--line); }
.theme h3 { font-size: var(--step-1); margin-bottom: 6px; }
.theme .years { font-family: var(--font-mono); font-size: .72rem; color: var(--gold); letter-spacing: .06em; }
.theme p { margin: 6px 0 0; font-size: .92rem; color: var(--muted); }

/* drift explorer */
.drift-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.drift-stats div { border-left: 2px solid var(--accent); padding-left: 12px; }
.drift-stats b { font-family: var(--font-display); font-size: var(--step-2); display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.drift-stats span { font-size: .78rem; color: var(--muted); }
.wordtabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.wordtabs button { font-family: var(--font-mono); font-size: .9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 6px 14px; border-radius: 99px; cursor: pointer; }
.wordtabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.drift-pair { display: grid; grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr); gap: 0; align-items: stretch; }
.drift-col h4 { margin: 0 0 10px; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .1em; color: var(--muted); font-weight: 500; }
.nbrs { display: flex; flex-wrap: wrap; gap: 6px; }
.nbrs span { font-family: var(--font-mono); font-size: .86rem; padding: 2px 9px; border-radius: 4px; background: var(--accent-soft); color: var(--ink); }
.drift-col.c18 .nbrs span { background: color-mix(in srgb, var(--gold) 16%, transparent); }
.drift-arrow { display: grid; place-items: center; }
.drift-arrow svg { width: 56px; height: 24px; }
.drift-gloss { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: .95rem; }
.drift-gloss strong { font-family: var(--font-display); font-size: var(--step-1); display: block; margin-bottom: 4px; }
.toplist { display: flex; flex-wrap: wrap; gap: 4px 6px; font-family: var(--font-mono); font-size: .88rem; padding: 0; margin: 0; list-style: none; counter-reset: r; }
.toplist li { counter-increment: r; padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; }
.toplist li::before { content: counter(r); color: var(--muted); font-size: .7rem; margin-right: 6px; }
.toplist li.case { border-color: var(--accent); color: var(--accent); }
figure.fig { margin: 0; }
figure.fig img { border-radius: 4px; border: 1px solid var(--line); background: #fff; width: 100%; }
figure.fig figcaption { font-size: var(--step--1); color: var(--muted); margin-top: 8px; }

/* materials */
.mat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.mat .thumb { aspect-ratio: 16/10; background: var(--line); overflow: hidden; }
.mat .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
#matgrid { align-items: start; }
.mat .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.mat .meta { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); letter-spacing: .04em; }
.mat h3 { font-size: 1.05rem; line-height: 1.45; }
.mat .links { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 6px; font-size: var(--step--1); padding: 5px 12px; border-radius: 99px; border: 1px solid var(--accent); color: var(--accent); text-decoration: none; background: transparent; cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--accent); color: var(--paper); }
.oldres { margin-top: 20px; }
.oldres ul { margin: 6px 0 0; padding-left: 1.2em; font-size: .92rem; }

/* demos */
.demo-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.demo-tabs button { font: inherit; font-size: var(--step--1); padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.demo-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
#net { width: 100%; height: 520px; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); touch-action: none; }
.net-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); margin-top: 10px; }
.net-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.kwic-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.kwic-controls input, .kwic-controls select { font: inherit; font-family: var(--font-code); font-size: .9rem; padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); min-width: 0; }
.kwic-controls input { flex: 1 1 200px; }
.kwic-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: 460px; overflow-y: auto; }
table.kwic { border-collapse: collapse; font-family: var(--font-code); font-size: .84rem; width: 100%; min-width: 760px; }
table.kwic td { padding: 4px 8px; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.kwic td.l { text-align: right; color: var(--muted); max-width: 34ch; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
table.kwic td.l span { direction: ltr; unicode-bidi: plaintext; }
table.kwic td.k { color: var(--accent); font-weight: 700; text-align: center; }
table.kwic td.r { color: var(--muted); max-width: 34ch; overflow: hidden; text-overflow: ellipsis; }
table.kwic td.src { font-size: .72rem; color: var(--muted); }
.kwic-count { font-size: var(--step--1); color: var(--muted); }

/* activity timeline */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.filters button { font: inherit; font-size: var(--step--1); padding: 4px 12px 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.filters button i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.filters button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.filters button .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-scroll { overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; min-width: 640px; }
svg.chart text { fill: var(--muted); font-family: var(--font-body); font-size: 11px; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .lab { fill: var(--ink); font-size: 12px; font-weight: 500; }
svg.chart circle.pt { stroke: var(--surface); stroke-width: 1.5; cursor: pointer; transition: r .15s; }
svg.chart circle.pt:hover, svg.chart circle.pt.hl { r: 8; }
svg.chart .bar { cursor: default; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--paper); font-size: .8rem; line-height: 1.5; padding: 8px 10px; border-radius: 4px; max-width: 320px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.tip[hidden] { display: none; }
.plist { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.plist li { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; min-width: 0; }
.plist .d { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); padding-top: 3px; }
.plist .t { font-size: .94rem; line-height: 1.55; overflow-wrap: anywhere; }
.plist .e { display: block; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.badge { display: inline-block; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .06em; padding: 0 6px; border-radius: 3px; color: #fff; margin-right: 6px; vertical-align: 1px; }
.tbadge { display: inline-block; font-size: .66rem; padding: 0 6px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); margin-left: 4px; }
.more { margin-top: 14px; }

/* roles gantt */
.series-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.scard { border-top: 3px solid var(--c); padding: 12px 2px 0; }
.scard b { font-family: var(--font-display); font-size: var(--step-2); display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.scard .nm { font-weight: 700; font-size: .92rem; }
.scard .yrs { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); display: block; margin-top: 4px; overflow-wrap: anywhere; }

/* events */
.event-feature { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: center; margin-bottom: 26px; }
.event-feature img { border-radius: 4px; width: 100%; height: auto; }
.project-feature { margin-top: 30px; grid-template-columns: 340px minmax(0, 1fr); }
.project-feature img { border: 1px solid var(--line); }
.event-feature h3 { font-size: var(--step-2); }
.evlist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.evlist li { border-bottom: 1px solid var(--line); padding: 12px 0; min-width: 0; }
.evlist .d { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); }
.evlist a { display: block; font-weight: 500; overflow-wrap: anywhere; }
.evlist span.r { font-size: .82rem; color: var(--muted); }

/* publications */
.pub-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 6px; }
.pub-tools input { font: inherit; padding: 7px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); flex: 1 1 220px; min-width: 0; }
.publist { list-style: none; padding: 0; margin: 10px 0 0; }
.publist li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.publist .y { font-family: var(--font-mono); font-size: .8rem; color: var(--gold); padding-top: 2px; }
.publist .t { font-size: .95rem; overflow-wrap: anywhere; }
.publist .v { display: block; font-size: .82rem; color: var(--muted); }

/* grants & career */
.cv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.cvlist { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.cvlist li { position: relative; padding: 0 0 16px 20px; }
.cvlist li::before { content: ""; position: absolute; left: -5px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.cvlist .d { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); display: block; }
.cvlist .p { font-size: .94rem; }

.linkgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.linkgrid a { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--ink); background: var(--surface); font-size: .92rem; min-width: 0; overflow-wrap: anywhere; }
.linkgrid a small { display: block; color: var(--muted); font-size: .72rem; }
.linkgrid a:hover { border-color: var(--accent); }

footer { margin-top: 80px; padding-block: 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--step--1); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 30px; justify-content: space-between; }

[data-lang="en"] .ja-only { display: none !important; }
[data-lang="ja"] .en-only { display: none !important; }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 28px; padding-block: 40px; }
  .portrait { justify-self: start; width: min(120px, 34%); order: -1; }
  .sec-head { grid-template-columns: 1fr; gap: 10px; }
  .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme:nth-child(3) { padding-left: 0; border-left: 0; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .series-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .linkgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event-feature { grid-template-columns: 160px minmax(0, 1fr); gap: 16px; }
  .project-feature { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .statrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .plist, .evlist, .cv { grid-template-columns: 1fr; }
  .themes { grid-template-columns: 1fr; }
  .theme, .theme + .theme { padding-left: 0; border-left: 0; }
  .drift-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drift-pair { grid-template-columns: 1fr; }
  .drift-arrow { padding: 8px 0; }
  .drift-arrow svg { transform: rotate(90deg); }
  .series-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #net { height: 420px; }
  section.block { padding-block: 52px 12px; }
}
