/*
 * alt4l.dev（古川 樹）
 * 配色と書体は hub.alt4l.dev と揃えている。動きは「何かが分かる」ためだけに、控えめに。
 */
:root {
  --bg: #F4F6F4;
  --surface: #FFFFFF;
  --sunken: #EAEEEC;
  --ink: #1D2A2B;
  --muted: #5B6B6D;
  --line: #D8E0DD;
  --accent: #2C6E5F;
  --accent-deep: #22594C;
  --accent-weak: #E1EEE9;
  --now: #B8741A;
  --now-weak: #F6EAD8;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.85; -webkit-font-smoothing: antialiased; word-break: auto-phrase;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-deep); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
p { margin: 0 0 1em; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- レイアウト：PC は左にプロフィールを固定し、右を広く使う ---------- */
.layout {
  width: min(1240px, 100% - 64px); margin: 0 auto;
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 72px; align-items: start;
  padding: 64px 0 40px;
}
.profile { position: sticky; top: 48px; }
.avatar { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: var(--now-weak); }
.who { margin-top: 22px; }
.name { font-size: 34px; font-weight: 900; letter-spacing: .04em; }
.name-en { margin: 2px 0 0; color: var(--muted); font-size: 15px; letter-spacing: .04em; }
.role { margin: 18px 0 0; font-size: 15px; line-height: 1.75; }
.role a { color: var(--ink); text-decoration-color: var(--line); }
.role a:hover { color: var(--accent); text-decoration-color: currentColor; }
.interests { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.interests li { font-size: 13px; font-weight: 500; padding: 2px 11px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); }
.links { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.links a, .link-btn {
  display: inline-flex; align-items: center; min-height: 38px; padding: 6px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: border-color .2s var(--ease);
}
.links a:hover, .link-btn:hover { border-color: var(--muted); color: var(--ink); }
.toc { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.toc a { color: var(--muted); text-decoration: none; font-size: 15px; padding: 2px 0 2px 14px; border-left: 2px solid transparent; transition: color .2s var(--ease), border-color .2s var(--ease); }
.toc a:hover { color: var(--ink); }
.toc a.is-current { color: var(--ink); border-left-color: var(--now); font-weight: 700; }

/* ---------- セクション ---------- */
.block { padding: 8px 0 64px; }
.block + .block { border-top: 1px solid var(--line); padding-top: 56px; }
.block-title { font-size: clamp(24px, 2.6vw, 30px); font-weight: 900; margin-bottom: 24px; }
.block-lead { color: var(--muted); margin-bottom: 28px; max-width: 40em; }

/* 研究 */
.research { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
.lead { font-size: clamp(20px, 2vw, 24px); font-weight: 700; line-height: 1.6; margin-bottom: 20px; }
/* スローガン：一段大きく、アクセントの色で */
.slogan > span { display: inline-block; } /* 語の途中で改行しない */
.slogan { display: inline-block; margin-top: 4px; font-size: clamp(26px, 2.8vw, 34px); font-weight: 900; color: var(--accent); letter-spacing: .02em; line-height: 1.4; }
.research-text p:not(.lead) { color: var(--muted); }
.research-text strong { color: var(--ink); }
/* 文献：本文より小さく */
.ref { font-size: .7em; line-height: 0; margin-left: 1px; }
.ref a { text-decoration: none; }
.research-text .cite { margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.cite i { font-style: italic; }
.research-media { margin: 0; }
.lenia { width: 100%; aspect-ratio: 1; border-radius: 14px; background: #000; object-fit: cover; }
.research-media figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* 論文・発表 */
.papers { list-style: none; margin: 0; padding: 0; }
.paper { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 28px; padding: 22px 0; border-top: 1px solid var(--line); }
.paper:first-child { border-top: 0; padding-top: 0; }
.paper > :not(.paper-meta) { grid-column: 2; }
.paper-meta { grid-column: 1; grid-row: 1 / span 4; margin: 2px 0 0; display: flex; flex-direction: column; gap: 2px; }
.venue { font-weight: 700; color: var(--accent); font-size: 14px; }
.date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.paper-title { font-size: 17px; font-weight: 700; line-height: 1.6; margin-bottom: 6px; }
.authors { margin: 0 0 2px; font-size: 14.5px; }
.authors b { font-weight: 700; }
.pub { margin: 0; color: var(--muted); font-size: 14px; }
.paper-links { margin: 8px 0 0; display: flex; gap: 14px; font-size: 14px; font-weight: 500; }

/* つくったもの：プレビュー付きのカード。PC では2列 */
.projects { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 32px; }
.project { display: flex; flex-direction: column; }
.shot {
  display: block; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--sunken);
  box-shadow: 0 24px 48px -36px rgba(29, 42, 43, .45);
}
.shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.project-body { padding-top: 16px; }
.project-meta { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge { font-size: 12px; font-weight: 500; padding: 0 9px; border-radius: 999px; background: var(--now-weak); color: var(--now); }
.project h3 { font-size: 19px; margin-bottom: 8px; }
.project h3 a { color: var(--ink); text-decoration: none; }
.project h3 a:hover { color: var(--accent); text-decoration: underline; }
.project-body > p:not(.project-meta):not(.project-links) { color: var(--muted); font-size: 15px; margin-bottom: 10px; }
.tags { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 12px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.project-links { margin: 0; display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; font-weight: 500; }

/* 経歴 */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 28px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.when { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.license-note { margin: 24px 0 0; display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 28px; }
.license-note .label { color: var(--muted); font-size: 14px; padding-top: 2px; }

.site-footer { width: min(1240px, 100% - 64px); margin: 0 auto; padding: 28px 0 48px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.site-footer p { margin: 0; }

/* ---------- 見出しと画像の控えめな登場（JS が動き、動きを減らす設定でないときだけ） ---------- */
.motion .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.motion .reveal.is-in { opacity: 1; transform: none; }

/* ---------- 開いたときの小さな Lenia（同じタブで最初の1回だけ．クリックで飛ばせる） ---------- */
.intro { display: none; }
.is-intro .intro, .intro.is-leaving {
  display: flex; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: var(--bg); cursor: pointer;
}
.intro.is-leaving { animation: intro-out .55s var(--ease) forwards; pointer-events: none; }
.intro-dish {
  width: 168px; height: 168px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg);
  box-shadow: 0 24px 48px -32px rgba(29, 42, 43, .45);
}
.intro-word { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .08em; color: var(--muted); animation: rise .6s .25s var(--ease) both; }
@keyframes intro-out { to { opacity: 0; transform: scale(1.02); visibility: hidden; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ページを開いたとき：プロフィールと冒頭の文が順に現れる（Lenia のあとに） */
.motion .profile, .motion #research { animation: rise .7s var(--ease) both; }
.motion #research { animation-delay: .1s; }
.motion .slogan > span { animation: rise .6s var(--ease) both; }
.motion .slogan > span:nth-child(1) { animation-delay: .35s; }
.motion .slogan > span:nth-child(2) { animation-delay: .5s; }
.motion .slogan > span:nth-child(3) { animation-delay: .65s; }
.is-intro .profile, .is-intro #research, .is-intro .slogan > span { animation-play-state: paused; }

/* ---------- 中くらいの幅：プロフィールを細く ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); gap: 48px; }
  .research { grid-template-columns: minmax(0, 1fr) 240px; gap: 32px; }
}

/* ---------- タブレット・スマホ：1列。プロフィールは先頭に横並びで ---------- */
@media (max-width: 860px) {
  .layout { width: min(680px, 100% - 40px); grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 32px; }
  .profile {
    position: static; display: grid; grid-template-columns: 88px minmax(0, 1fr); column-gap: 18px; align-items: center;
    padding-bottom: 28px; margin-bottom: 36px; border-bottom: 1px solid var(--line);
  }
  .avatar { width: 88px; height: 88px; grid-row: span 2; }
  .who { margin: 0; }
  .name { font-size: 28px; }
  .role { grid-column: 2; margin: 6px 0 0; font-size: 14px; }
  .interests, .links { grid-column: 1 / -1; }
  .interests { margin-top: 18px; }
  .links { margin-top: 14px; }
  .toc {
    grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 18px; padding-top: 0; border-top: 0;
    overflow-x: auto; scrollbar-width: none;
  }
  .toc::-webkit-scrollbar { display: none; }
  .toc a, .toc a.is-current { border-left: 0; padding: 4px 14px; border-radius: 999px; background: var(--sunken); color: var(--ink); white-space: nowrap; font-weight: 500; font-size: 14px; }
  .research { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .research-media { max-width: 360px; }
  .projects { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .site-footer { width: min(680px, 100% - 40px); }
}
@media (max-width: 560px) {
  .paper, .timeline li, .license-note { grid-template-columns: minmax(0, 1fr); }
  .paper > :not(.paper-meta) { grid-column: 1; }
  .paper-meta { grid-row: auto; flex-direction: row; gap: 10px; align-items: baseline; margin-bottom: 4px; }
  .when, .license-note .label { padding-top: 0; }
  .block { padding-bottom: 48px; }
  .block + .block { padding-top: 44px; }
}

/* ---------- 動きを減らす設定：すべて止めて最終状態を表示 ---------- */
@media (prefers-reduced-motion: reduce) {
  .motion .reveal { opacity: 1; transform: none; transition: none; }
  .motion .profile, .motion #research, .motion .slogan > span { animation: none; }
  .is-intro .intro { display: none; }
  .toc a, .links a, .link-btn { transition: none; }
}
