/*
  B-study トップのページ（受講者向け）。
  - 白と紺黒だけ（差し色なし）
  - 英語の見出しは細い Roboto を大きく、日本語は字間を広く取って小さく添える
  - 中身は全部中央揃え（ヘッダーのロゴは左・メニューは右）
    右上に英語の大文字のメニューを縦に並べる
  - 背景はページ全体に点と線が漂う canvas（#bg-dots。触っても反応しない）
  状態: body[data-state="guest"]（ログイン前）/ body[data-state="member"]（ログイン後）
*/
:root {
  --paper: #ffffff;
  --ink: #16202c;
  --ink-2: #6b7178;
  --ink-3: #a3a8ad;
  --line: #e3e6e9;
  --en: "Roboto", "Helvetica Neue", Arial, sans-serif;
  --ja: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --gutter: clamp(20px, 6vw, 96px);
  --max: 1240px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --head: 50%; /* 18 章の帯の基準点の位置（見えている範囲の真ん中。50vw だとスクロールバーの分だけ右へずれる） */
  /* 栞の形（下の端が燕尾）。ロゴの栞と同じ切り込み */
  --shiori: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ja);
  font-size: 15px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* 背景: 点と線が漂う（画面に固定。中身はその上に乗る） */
.bg-dots { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
main, .site-footer { position: relative; z-index: 1; }

/* ページのどこまで読んだか（画面の上端の細い線） */
.header-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; }
.header-progress i { display: block; height: 100%; width: 0; background: var(--ink); }

/* ---------- ヘッダー（左にロゴ、右に縦のメニュー。背景は透明） ---------- */
.site-header {
  /* 中身と同じ幅の列にそろえる（横に広い画面でメニューだけ右端へ離れないように） */
  position: fixed; top: 0; left: 0; right: 0; margin: 0 auto; max-width: var(--max); z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 28px var(--gutter) 0; pointer-events: none;
}
.site-header a { pointer-events: auto; }
/* 上部のロゴが外れたあと（本文がヘッダーの下を通る間）だけ、画面の上端に白いぼかしを敷いて重なりを読みやすくする */
.site-header::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: 132px; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, .96) 55%, rgba(255, 255, 255, 0));
  opacity: 0; transition: opacity .4s var(--ease);
}
body.past-hero .site-header::before { opacity: 1; }
.brand img { display: block; height: 64px; width: auto; }
/* 上部の大きなロゴが見えている間は、ヘッダーのロゴを隠す（front.js が body に past-hero を付ける） */
.brand { opacity: 0; transition: opacity .4s var(--ease); }
body.past-hero .brand { opacity: 1; }
.nav { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.nav a {
  font-family: var(--en); font-size: 13px; font-weight: 400; letter-spacing: .06em;
  text-decoration: none; padding: 2px 0; background: rgba(255, 255, 255, .7);
}
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- ヒーロー ---------- */
.hero-inner {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; text-align: center;
  padding-top: 120px; padding-bottom: clamp(128px, 16vh, 176px);   /* 下の中央の SCROLL と重ならない余白 */
}
.hero-logo { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.hero-logo canvas { display: block; width: 100%; max-width: 560px; touch-action: pan-y; cursor: crosshair; }
.hero-logo canvas.clickable { cursor: pointer; }
.hero-copy { margin-top: clamp(24px, 4vh, 48px); max-width: 640px; width: 100%; display: flex; flex-direction: column; align-items: center; }
.hero-ja { margin: 0; font-size: clamp(20px, 2vw, 26px); font-weight: 400; letter-spacing: .2em; line-height: 1.7; padding-left: .2em; /* 最後の字の後ろにも字間が付いて左へ寄って見えるのを戻す */ }
.hero-en { margin: 18px 0 0; font-family: var(--en); font-size: 12px; font-weight: 400; line-height: 1.8; letter-spacing: .02em; }
.hero-note { margin: 10px 0 0; font-size: 12px; color: var(--ink-2); letter-spacing: .1em; }
.hero-welcome { margin: 0 0 12px; font-family: var(--en); font-weight: 200; font-size: clamp(44px, 6vw, 84px); line-height: 1; letter-spacing: -.02em; }
.scroll {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 20px;
  font-family: var(--en); font-size: 12px; letter-spacing: .08em; text-decoration: none;
  padding-bottom: 64px;
}
.scroll::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 52px; background: var(--ink);
  transform-origin: top;
}
@media (prefers-reduced-motion: no-preference) {
  .scroll::after { animation: scroll-line 2.2s var(--ease) infinite; }
}
@keyframes scroll-line { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* 進み具合の線（いまの所に栞が垂れる） */
.hero-line { position: relative; margin: 40px auto 0; height: 48px; --p: .08; width: 100%; max-width: 560px; }
.hero-line .rule, .hero-line .fill { position: absolute; left: 0; top: 12px; height: 1px; }
.hero-line .rule { right: 0; background: var(--ink-3); transform-origin: left; }
.hero-line .fill { width: calc(var(--p) * 100%); height: 2px; top: 11.5px; background: var(--ink); transform-origin: left; }
.hero-line .mark {
  position: absolute; top: 4px; left: calc(var(--p) * 100%);
  width: 12px; height: 24px; margin-left: -6px;
  background: var(--ink); clip-path: var(--shiori);
}
.hero-line .count { position: absolute; left: 0; right: 0; text-align: center; top: 34px; font-family: var(--en); font-size: 12px; color: var(--ink-2); font-feature-settings: "tnum"; letter-spacing: .04em; }

/* ---------- 区切り（英語の大見出し + 日本語の小さな添え書き → 中身） ---------- */
.block { padding: clamp(96px, 16vh, 180px) 0 0; }
.two-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: clamp(32px, 5vh, 56px); }
.display {
  margin: 0; font-family: var(--en); font-weight: 200; font-size: clamp(48px, 6.4vw, 96px);
  line-height: 1; letter-spacing: -.03em;
}
.ja-label { margin: 18px 0 0; font-size: 12px; letter-spacing: .2em; padding-left: .2em; color: var(--ink-2); }
.col-body { width: 100%; max-width: 720px; }

/* 続きから（ログイン後） */
.resume-course { margin: 0; font-size: 13px; color: var(--ink-2); letter-spacing: .06em; }
.resume-title { margin: 6px 0 28px; font-size: clamp(22px, 2.4vw, 30px); font-weight: 500; line-height: 1.5; letter-spacing: .04em; }

/* ボタン: 英語の大文字 + 日本語の小さな添え書き + 丸い矢印 */
.btn-go, .btn {
  display: inline-flex; align-items: center; gap: 16px; text-align: left; text-decoration: none; color: var(--ink);
  font-family: var(--en); font-weight: 700; font-size: 20px; letter-spacing: .02em; line-height: 1.2;
}
.btn-go small, .btn small { display: block; font-family: var(--ja); font-weight: 400; font-size: 11px; letter-spacing: .16em; color: var(--ink-2); margin-top: 4px; }
.go {
  position: relative; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; background: var(--ink);
  transition: transform .25s var(--ease);
}
.go::after { /* 右向きのくの字 */
  content: ""; position: absolute; left: 14px; top: 15px; width: 8px; height: 8px;
  border-top: 2px solid #fff; border-right: 2px solid #fff; transform: rotate(45deg);
}
.go-play::after { /* 再生の三角 */
  left: 16px; top: 13px; width: 0; height: 0; border: 0; transform: none;
  border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #fff;
}
.btn-go:hover .go, .btn:hover .go { transform: translateX(4px); }

/* ログイン（ログイン前） */
.login { max-width: 480px; text-align: left; }
.login-error { margin: 0 0 24px; padding: 12px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); font-size: 14px; }
.field { display: block; margin-bottom: 28px; }
.field span { display: flex; align-items: baseline; gap: 12px; font-family: var(--en); font-size: 12px; letter-spacing: .08em; }
.field small { font-family: var(--ja); font-size: 11px; letter-spacing: .16em; color: var(--ink-2); }
.field input {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 0; margin-top: 4px;
  border: 0; border-bottom: 1px solid var(--ink-3); border-radius: 0; background: transparent; color: var(--ink);
}
.field input:focus { outline: none; border-bottom-color: var(--ink); }
.remember { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); margin: -8px 0 32px; }
.btn {
  width: 100%; justify-content: space-between; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; padding: 18px 20px 18px 24px; text-align: left;
}
.btn small { color: #c5cad0; }
.go-light { background: #fff; }
.go-light::after { border-color: var(--ink); }
.login-lost { margin: 20px 0 0; font-size: 13px; }
.login-lost a { color: var(--ink); text-underline-offset: 3px; }
.login-lost + .login-help { margin-top: 6px; }
.login-help { margin: 20px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.8; }

/* 読み込み時の 1 回だけの動き（字がふわっと上がる） */
@media (prefers-reduced-motion: no-preference) {
  .hero-line .rule { animation: draw 1.2s var(--ease) both; }
  .hero-line .fill { animation: draw 1.2s .35s var(--ease) both; }
  .hero-line .mark { animation: travel 1.2s .35s var(--ease) both; }
  .hero-copy > * { animation: rise .9s var(--ease) both; }
  .hero-copy > *:nth-child(2) { animation-delay: .1s; }
  .hero-copy > *:nth-child(3) { animation-delay: .2s; }
}
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes travel { from { left: 0; opacity: 0; } 15% { opacity: 1; } to { left: calc(var(--p) * 100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- お知らせ（ログイン後） ---------- */
.notice { padding-top: clamp(64px, 10vh, 112px); }
.notice-inner {
  display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 28px 0;
  background: rgba(255, 255, 255, .75);
}
.notice .label { margin: 0; font-family: var(--en); font-size: 12px; letter-spacing: .08em; }
.notice-text { margin: 0; }
.notice strong { font-weight: 500; letter-spacing: .04em; }
.notice .sub { font-size: 13px; color: var(--ink-2); }

/* ---------- コース ---------- */
.courses { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.course { border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .72); }
/* 1 つずつ全体がリンク（そのコースのトップへ）。余白ごと押せるように、余白はリンクの側に持たせる */
.course-link { display: block; padding: 36px 0 32px; text-decoration: none; }
a.course-link { transition: opacity .3s; }
a.course-link:hover { opacity: .55; }
a.course-link:focus-visible { outline-offset: -2px; }
.course-en { margin: 0; font-family: var(--en); font-weight: 300; font-size: clamp(26px, 2.6vw, 36px); line-height: 1.2; letter-spacing: -.01em; }
.course h3 { margin: 10px 0 0; font-size: 15px; font-weight: 500; letter-spacing: .08em; line-height: 1.6; }
.course h3 small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-2); letter-spacing: .1em; }
.course .desc { margin: 14px 0 0; font-size: 13px; color: var(--ink-2); }
.course-foot { margin: 14px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; font-size: 13px; }
.course .meta { font-family: var(--en); letter-spacing: .02em; }
.course-state.ok { color: var(--ink); }
.course-state.todo { color: var(--ink); font-weight: 700; }
.course-state.todo::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); margin-right: 8px; vertical-align: 2px; }
.course-state.wait { color: var(--ink-2); }
/* コースの構成を刻みで見せる（章・本・手順の数そのもの） */
.ticks { display: flex; justify-content: center; gap: 3px; margin: 18px auto 0; max-width: 560px; }
.ticks i { flex: 1 1 0; height: 2px; background: var(--line); max-width: 48px; }
body[data-state="member"] .ticks i.done { background: var(--ink); }
body[data-state="member"] .ticks i.now { background: linear-gradient(90deg, var(--ink) 50%, var(--line) 50%); }

/* ---------- 18 章の帯（縦にスクロールすると横に流れる） ---------- */
.track { position: relative; margin-top: clamp(96px, 16vh, 180px); }
.track-sticky {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
}
.track-head { width: 100%; text-align: center; }
.track-stage { position: relative; margin-top: 64px; }
.track-rail {
  position: relative; display: flex; width: max-content;
  padding: 0 50vw 0 calc(var(--head) - 12px);
  will-change: transform;
}
.track-rail::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 1px; background: var(--ink-3); }
.rail-fill { display: none; position: absolute; left: 0; top: 11.5px; height: 2px; width: 0; background: var(--ink); }
body[data-state="member"] .rail-fill { display: block; }
.station { position: relative; flex: 0 0 clamp(220px, 22vw, 290px); padding-right: 32px; }
.station .dot {
  position: relative; display: block; width: 25px; height: 25px; border-radius: 50%;
  background: #fff; border: 1px solid var(--ink-3); transition: border-color .3s, background-color .3s, transform .3s var(--ease);
}
.station .no {
  display: block; margin-top: 20px; font-family: var(--en); font-size: 56px; font-weight: 200; line-height: 1;
  color: var(--ink-3); font-feature-settings: "tnum"; letter-spacing: -.02em; transition: color .3s;
}
.station h4 { margin: 12px 0 0; font-size: 15px; font-weight: 500; line-height: 1.6; letter-spacing: .06em; }
.station ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink-2); line-height: 1.8; }
.station.is-at .dot { border-color: var(--ink); transform: scale(1.2); }
.station.is-at .no { color: var(--ink); }
/* 点は円グラフ: 章の中で見終わった動画の割合（--p。front.js が入れる）だけ、12 時から時計回りに塗る */
body[data-state="member"] .station .dot { background: conic-gradient(var(--ink) calc(var(--p, 0) * 1turn), #fff 0); }
body[data-state="member"] .station.part .dot { border-color: var(--ink); }
body[data-state="member"] .station.done .dot { background: var(--ink); border-color: var(--ink); }
body[data-state="member"] .station.now .dot { border: 2px solid var(--ink); box-shadow: 0 0 0 6px rgba(22, 32, 44, .08); }
.station .here { display: none; margin-top: 8px; font-family: var(--en); font-size: 12px; font-weight: 500; letter-spacing: .08em; }
.station .here small { font-family: var(--ja); font-weight: 400; margin-left: 8px; letter-spacing: .12em; color: var(--ink-2); }
body[data-state="member"] .station.now .here { display: block; }
/* 進み具合（ログイン後）: 済んだ章は番号も黒く、見終わった動画に ✓、いまの章の点に栞を垂らす */
body[data-state="member"] .station.done .no, body[data-state="member"] .station.now .no { color: var(--ink); }
body[data-state="member"] .station ul { padding-left: 1.4em; }
.station li { position: relative; }
body[data-state="member"] .station li.done { color: var(--ink); }
body[data-state="member"] .station li.done::before { content: "✓"; position: absolute; left: -1.4em; font-family: var(--en); font-weight: 500; }
.station .flag {
  display: none; position: absolute; left: 5.5px; top: -40px; z-index: 1;
  width: 14px; height: 34px; background: var(--ink); clip-path: var(--shiori);
}
body[data-state="member"] .station.now .flag { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 真ん中の基準点。章がこの位置を通り過ぎ、一番近い章を強調する（front.js が位置を読む）。
   スクロールの位置であって進み具合ではないので、画面には出さず位置の基準としてだけ使う */
.playhead {
  position: absolute; top: -18px; left: var(--head); z-index: 2; pointer-events: none;
  width: 1px; height: 60px; margin-left: -.5px; visibility: hidden;
}
/* 18 章の帯の見出しの下の数字（ログイン後） */
.track-summary { display: flex; justify-content: center; gap: clamp(32px, 6vw, 72px); margin: 28px 0 0; font-family: var(--en); font-size: 16px; color: var(--ink-2); font-feature-settings: "tnum"; }
.track-summary b { font-weight: 300; font-size: 44px; color: var(--ink); letter-spacing: -.02em; margin-right: 4px; }
.track-summary small { display: block; font-size: 11px; letter-spacing: .16em; margin-top: 2px; }
.track-count { width: 100%; margin-top: 48px; text-align: center; font-family: var(--en); font-size: 12px; letter-spacing: .08em; color: var(--ink-2); font-feature-settings: "tnum"; }

/* ---------- 使い方（ログイン前） ---------- */
.steps { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 0; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .72); }
.steps .no { font-family: var(--en); font-size: 40px; font-weight: 200; line-height: 1; }
.steps h3 { margin: 0; font-family: var(--en); font-weight: 400; font-size: 22px; letter-spacing: .01em; }
.steps h3 small { font-family: var(--ja); font-size: 12px; font-weight: 400; color: var(--ink-2); letter-spacing: .14em; margin-left: 12px; }
.steps p { margin: 0; font-size: 13px; color: var(--ink-2); }
/* HOW IT WORKS の下のマニュアルのボタン（全体に合わせて中央揃え） */
.steps-guide { margin: 40px 0 0; text-align: center; }

/* ---------- フッター ---------- */
.site-footer { margin-top: clamp(120px, 18vh, 200px); padding: 40px 0 56px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .8); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.site-footer img { height: 52px; width: auto; display: block; }
.footer-meta { display: flex; flex-direction: column; align-items: center; gap: 8px; font-family: var(--en); font-size: 12px; letter-spacing: .06em; }
.footer-meta a { text-decoration: none; }
.footer-meta a small { font-family: var(--ja); color: var(--ink-2); margin-left: 10px; letter-spacing: .12em; }
.footer-meta .copy { color: var(--ink-2); }

/* ---------- 狭い画面 ---------- */
@media (max-width: 860px) {
  .station { flex-basis: 56vw; }
}
@media (max-width: 560px) {
  .site-header { padding-top: 18px; }
  .brand img { height: 48px; }
  .nav a { font-size: 12px; }
  .nav .nav-extra { display: none; }
  .hero-inner { padding-top: 96px; }
  .station { flex-basis: 70vw; padding-right: 20px; }
  .station .no { font-size: 44px; }
  .steps .no { font-size: 32px; }
}

/* 動きを減らす設定: 帯は普通の横スクロールにする */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .track-sticky { position: static; height: auto; overflow: visible; padding: 40px 0; }
  .track-stage { overflow-x: auto; }
  .track-rail { padding-right: var(--gutter); transform: none !important; }
  .playhead { display: none; }
}
