/* =========================================================
   戸田研究室 HP スタイル
   使い方: pandoc -s index.md -c style.css -o index.html
   テーマ: 「検証・論理・離散構造」
     - ヒーロー: グラフ（頂点と辺）の格子模様
     - 見出し: 論理記号 ⊢（証明可能）
     - 区切り線: 証明終了記号 ∎
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@400;500;700;900&display=swap");

/* ---------- デザイントークン ---------- */
:root {
  --ink: #172036;          /* ヒーローの紺 */
  --paper: #f5f6fa;        /* 背景 */
  --surface: #ffffff;      /* 表・カード面 */
  --text: #1f2638;
  --muted: #5d667a;
  --rule: #dde2ec;
  --accent: #2f4fd8;       /* コバルト */
  --accent-soft: #e9edfd;

  --font: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Hiragino Sans",
          "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
  --math: "STIX Two Math", "Cambria Math", "Latin Modern Math", "Times New Roman", serif;

  --measure: 58rem;       /* 本文の最大幅 */
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0b101c;
    --paper: #0f1421;
    --surface: #161d2d;
    --text: #e3e7f0;
    --muted: #9aa3b7;
    --rule: #28314a;
    --accent: #8fa3ff;
    --accent-soft: #1c2546;
    color-scheme: dark;
  }
}

/* ---------- ベース ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 100%;
  line-height: 1.85;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
  font-feature-settings: "palt" 0;
  overflow-wrap: anywhere;
  line-break: strict;
}

p, ul, ol, table, blockquote, details { margin: 0 0 1.25rem; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-thickness 0.15s;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

strong { font-weight: 700; }
del { color: var(--muted); text-decoration-color: var(--muted); }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.1em 0.4em;
  background: var(--accent-soft);
  border-radius: 4px;
}

[id] { scroll-margin-top: 1.5rem; }

/* ---------- ヒーロー（h1 と所属行） ---------- */
/* 本文幅の外まで紺の帯を広げる */
body > h1:first-of-type,
body > h1:first-of-type + p {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: max(1.5rem, calc(50vw - var(--measure) / 2 + 1.5rem));
  padding-right: max(1.5rem, calc(50vw - var(--measure) / 2 + 1.5rem));
  color: #fff;
  background-color: var(--ink);
}

body > h1:first-of-type {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: clamp(4rem, 11vw, 7.5rem);
  padding-bottom: 0.5rem;
  font-size: clamp(2rem, 5.6vw, 3.4rem);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.02em;
  /* 頂点と辺の格子（離散構造）を右側にだけ見せる */
  background-image:
    linear-gradient(100deg, var(--ink) 30%, color-mix(in srgb, var(--ink) 55%, transparent) 68%, transparent 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cg stroke='%23ffffff' stroke-opacity='.16' fill='none'%3E%3Cpath d='M0 0L48 48L96 0M0 96L48 48L96 96M48 0V96M0 48H96'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.45'%3E%3Ccircle cx='48' cy='48' r='2.6'/%3E%3Ccircle cx='0' cy='0' r='2.6'/%3E%3Ccircle cx='96' cy='0' r='2.6'/%3E%3Ccircle cx='0' cy='96' r='2.6'/%3E%3Ccircle cx='96' cy='96' r='2.6'/%3E%3C/g%3E%3Cg fill='%238fa3ff'%3E%3Ccircle cx='48' cy='0' r='2'/%3E%3Ccircle cx='48' cy='96' r='2'/%3E%3C/g%3E%3C/svg%3E");
  background-position: 0 0, right -12px top -12px;
}

/* 日本語の見出しを文節単位で折り返す（Chrome 119+、他は通常の折り返し） */
h1, h2, h3, h4 { word-break: auto-phrase; }

body > h1:first-of-type + p {
  margin-top: 0;
  padding-top: 0.75rem;
  padding-bottom: clamp(3rem, 8vw, 5rem);
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
  color: rgb(255 255 255 / 0.72);
  background-image:
    linear-gradient(100deg, var(--ink) 30%, color-mix(in srgb, var(--ink) 55%, transparent) 68%, transparent 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cg stroke='%23ffffff' stroke-opacity='.16' fill='none'%3E%3Cpath d='M0 0L48 48L96 0M0 96L48 48L96 96M48 0V96M0 48H96'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.45'%3E%3Ccircle cx='48' cy='48' r='2.6'/%3E%3Ccircle cx='0' cy='0' r='2.6'/%3E%3Ccircle cx='96' cy='0' r='2.6'/%3E%3Ccircle cx='0' cy='96' r='2.6'/%3E%3Ccircle cx='96' cy='96' r='2.6'/%3E%3C/g%3E%3Cg fill='%238fa3ff'%3E%3Ccircle cx='48' cy='0' r='2'/%3E%3Ccircle cx='48' cy='96' r='2'/%3E%3C/g%3E%3C/svg%3E");
  background-position: 0 0, right -12px bottom -12px;
}

/* ---------- お知らせ（ヒーロー直後の引用） ---------- */
body > h1:first-of-type + p + blockquote {
  margin: 0 0 3rem;
  padding: 1.1rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  font-style: normal;
}
body > h1:first-of-type + p + blockquote p:last-child { margin-bottom: 0; }

/* ---------- 見出し ---------- */
h2, h3, h4 {
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  text-wrap: balance;
}

h2 {
  position: relative;
  margin: 3.5rem 0 1.5rem;
  padding-left: 2.1rem;
  font-size: clamp(1.45rem, 3.4vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0.03em;
}
/* ⊢ : 「証明できる」を表す論理記号 */
h2::before {
  content: "⊢";
  position: absolute;
  left: 0;
  top: 0.02em;
  font-family: var(--math);
  font-weight: 400;
  color: var(--accent);
}

h3 {
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.45rem;
  font-size: 1.2rem;
  border-bottom: 1px solid var(--rule);
}

h4 { margin: 1.75rem 0 0.5rem; font-size: 1.02rem; }

/* ---------- 区切り線: ∎（証明終わり） ---------- */
hr {
  border: 0;
  height: auto;
  margin: 3.5rem 0;
  text-align: center;
  overflow: visible;
}
hr::after {
  content: "∎";
  font-family: var(--math);
  font-size: 1.1rem;
  color: var(--muted);
  opacity: 0.7;
}

/* ---------- 研究テーマのリード（研究紹介直下の引用） ---------- */
blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 0 0 0 1.25rem;
  border-left: 3px solid var(--rule);
  color: var(--text);
}

h2#研究紹介 + blockquote {
  padding: 1.75rem 1.75rem 0.5rem;
  background: var(--accent-soft);
  border: 0;
  border-radius: var(--radius);
}
h2#研究紹介 + blockquote h3 {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
  font-size: clamp(1.3rem, 3.2vw, 1.65rem);
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: 0.02em;
}
h2#研究紹介 + blockquote p { color: var(--muted); font-size: 0.95rem; }
h2#研究紹介 + blockquote strong { color: var(--text); }

/* ---------- リスト ---------- */
ul, ol { padding-left: 1.4rem; }
li { margin: 0.35rem 0; }
li > ul, li > ol { margin: 0.4rem 0 0.6rem; }
ul > li::marker { color: var(--accent); }
ol > li::marker { color: var(--accent); font-weight: 700; }

/* 入れ子の詳細リストは控えめに */
li li { font-size: 0.95rem; }
li li::marker { color: var(--muted); }

/* ---------- 表 ---------- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.95rem;
}
th, td {
  padding: 0.6rem 0.6rem;
  vertical-align: top;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}
tr:last-child td { border-bottom: 0; }
thead th {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--paper);
}
td:first-child { white-space: nowrap; width: 1%; }
tbody tr:hover td { background: var(--accent-soft); }
/* pandoc が出す列幅指定を無効化 */
colgroup col { width: auto !important; }

/* 年間行事: 月の列を細く中央寄せ */
h3#研究室の年間行事 + table td:first-child,
h3#研究室の年間行事 + table th:first-child {
  width: 4rem;
  text-align: center;
}

/* メンバー専用のリンク表は詰めて表示 */
h2#メンバー専用 + table { font-size: 0.88rem; line-height: 1.9; }
h2#メンバー専用 + table a { white-space: nowrap; }

/* ---------- Q&A（details） ---------- */
details {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
summary {
  cursor: pointer;
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  list-style-position: inside;
}
summary::marker { color: var(--accent); }
summary:hover { color: var(--accent); }
details[open] > summary { border-bottom: 1px solid var(--rule); }
details > :not(summary) { margin-left: 1.2rem; margin-right: 1.2rem; }
details > :last-child { margin-bottom: 1.2rem; }
details h4 {
  color: var(--accent);
  margin-top: 1.5rem;
}
details[open] > :not(summary) { animation: reveal 0.25s ease-out; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 画像 ---------- */
img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ---------- レスポンシブ ---------- */
/* 大きなディスプレイでは文字ごと少し拡大して余白を減らす */
@media (min-width: 1600px) {
  html { font-size: 106.25%; }
}
@media (min-width: 2200px) {
  html { font-size: 118.75%; }
}

@media (max-width: 640px) {
  html { font-size: 93.75%; }
  body { padding: 0 1.1rem 4rem; }
  table { display: block; overflow-x: auto; }
  td:first-child { white-space: normal; width: auto; }
  h2 { padding-left: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 印刷 ---------- */
@media print {
  html { background: #fff; color: #000; }
  body > h1:first-of-type,
  body > h1:first-of-type + p {
    margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0;
    background: none; color: #000;
  }
  a { color: #000; }
  details > :not(summary) { display: block; }
}
