/* ---------------------------------------------------------------
   梅津 光 ポートフォリオ

   設計の軸は「経路」。
   最初のキャリアがナビゲーションアプリ、いちばん使われている OSS が
   点線を描くパッケージ、そしてキャリア自体が一度離れて戻ってくる経路。
   縦に走る破線はページを読み進める経路を表す。
   線は必ず経路を表す。装飾として線を引かない。

   囲みの規則: 枠線は押せるもの、塗りは押せないもの。
   間隔と文字の大きさは下のスケールから選ぶ。個別の値を足さない。
   --------------------------------------------------------------- */

:root {
  /* 色 */
  --paper: #f8f3ea;
  --card: #fffdf6;
  --ink: #201a13;
  --ink-2: #4d443a;
  --muted: #6f6353;
  --rule: #e3dac8;
  --fill: #efe7d6;
  --ph: #ece4d2;
  --ph-ink: #a29584;
  --route: #2a6a45;
  --route-ink: #fffdf6;

  /* 間隔 */
  --s1: 6px;
  --s2: 12px;
  --s3: 20px;
  --s4: 32px;
  --s5: clamp(36px, 4vw, 52px);
  --s6: clamp(56px, 8vw, 88px);

  /* 文字 */
  --t-label: 12px;
  --t-meta: 13px;
  --t-body: 15px;
  --t-sub: 17px;
  --t-title: clamp(26px, 3vw, 34px);
  --t-lead: clamp(26px, 3.4vw, 44px);

  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", YuMincho, serif;
  --sans: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont,
          "Hiragino Kaku Gothic ProN", "Yu Gothic Medium", "Yu Gothic", Meiryo, sans-serif;

  --gutter: clamp(20px, 5vw, 104px);
  --rail: clamp(22px, 2.6vw, 36px);
  --measure: 44rem;

  /* 配色はライトだけで組む。暖色の地色がこのサイトの前提なので、
     OSのダーク設定でも切り替えない。スクロールバーやフォーム部品まで
     ライトに揃えるため color-scheme も宣言する。 */
  color-scheme: light;
}

*, *::before, *::after { 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(--sans);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.95;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 行末に1文字だけ残さない */
  line-break: strict;
  text-wrap: pretty;
}

img { max-width: 100%; height: auto; display: block; }

/* 見出しは文節で折り返す。本文に効かせると行長が不揃いになるため見出しだけに当てる */
h1, h2, h3, .card__title, .hero__now { word-break: auto-phrase; }

a { color: var(--route); }
a:hover { text-decoration: none; }

:focus-visible { outline: 2px solid var(--route); outline-offset: 3px; }

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: var(--gutter);
  top: var(--s2);
  z-index: 10;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  text-decoration: none;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
/* 経路の分だけ本文を右へ寄せる */
.wrap--route { padding-left: calc(var(--gutter) + var(--rail)); }

/* --- 経路 --------------------------------------------------------
   セクションは縦に隣り合っているので、各セクションが引く破線が
   そのままつながって1本の経路になる。x 座標は .wrap の内容左端に合わせる。 */

.hero, .section { position: relative; }
.hero::before,
.section::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(max(0px, (100% - 1200px) / 2) + var(--gutter));
  width: 2px;
  background: repeating-linear-gradient(to bottom, var(--route) 0 5px, transparent 5px 13px);
  opacity: 0.55;
}
/* 経路の終点 */
.section--contact::before { bottom: auto; height: 96px; }

/* 経路上の駅 */
.section__title, .hero__lead { position: relative; }
.section__title::before,
.hero__lead::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--rail) - 3.5px);
  top: 0.72em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--route);
}

/* --- ヘッダー --- */

.site-head {
  --head-pad: 18px;
  /* 経路図の線の y（ヘッダーの余白を除いた位置）。
     バス（高さ16px、車輪の中心が下から3px）が線の上に乗って収まる位置 */
  --line-y: 16px;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 5;
}
/* ヘッダーの下端は線で区切らず、紙の色を本文へ溶かす */
.site-head::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, var(--paper), transparent);
  pointer-events: none;
}
.site-head__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding-block: var(--head-pad);
}
/* 縦の経路を走るバス。画面に対して固定し、JS が --rail-x と --bus-y を更新する。
   同期スクリプトが動いていないときは出さない */
.route-bus {
  display: none;
  position: fixed;
  left: var(--rail-x, 0px);
  top: var(--bus-y, 0px);
  z-index: 4;
  width: 18px;
  height: 18px;
  color: var(--route);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.route-sync .route-bus { display: block; }
.route-bus svg { display: block; }

/* --- 経路図 ------------------------------------------------------
   縦の経路を横に写した地図。駅はセクション見出しと同じ。
   起点の駅は本文の縦の経路と同じ x に置き、そこから横へ分岐して見せる。
   横の破線も経路なので、装飾ではない。
   現在地（塗り）は押せない。駅（枠線）は押せる。 */

.route-map { flex: 1 1 auto; min-width: 0; max-width: 640px; }
.route-map__viewport {
  --dot: 8px;
  /* 右の余白。終点の駅名を中央揃えにしたときの右半分と、終点に着いたバスの右半分が枠に収まる幅 */
  --pad-right: 24px;
  /* 左は画面の端まで広げ、起点の駅の中心を縦の経路（幅 2px の中心）に重ねる。
     起点の駅名が経路の左へはみ出しても切れないようにするため */
  --pad-left: calc(var(--gutter) + 1px);
  position: relative;
  margin-left: calc(-1 * var(--gutter));
  overflow: hidden;
  /* 横のドラッグを経路図が受け取る。ブラウザの横スクロールには渡さない */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.route-map__track {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
  min-width: 560px;
  /* 上: 駅の中心が --line-y に来るぶんだけ空ける。
     左右: 両端の駅に着いたバスが枠に収まるぶんだけ空ける */
  padding: calc(var(--line-y) - var(--dot) / 2) var(--pad-right) 0 var(--pad-left);
}
/* 横の経路。最初の駅と最後の駅の中心を結ぶ */
.route-map__track::before {
  content: "";
  position: absolute;
  top: var(--line-y);
  left: var(--pad-left);
  right: var(--pad-right);
  height: 2px;
  background: repeating-linear-gradient(to right, var(--route) 0 4px, transparent 4px 9px);
  opacity: 0.55;
}
/* 駅は幅 0 の点として等間隔に置き、丸の中心をその点に合わせる。名前は丸を中心に広げる */
.route-map__station { flex: 0 0 auto; width: 0; }
.route-map__station a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: max-content;
  transform: translateX(-50%);
  font-size: var(--t-label);
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 2px;
}
/* 起点の駅名は、画面の左端からはみ出す分だけ右へ寄せる（余白が狭い画面向け） */
.route-map__station:first-child .route-map__name { transform: translateX(max(0px, calc(50% - var(--gutter) - 1px))); }
.route-map__name { padding-inline: 3px; }
.route-map__dot {
  position: relative;
  z-index: 1;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--route);
}
.route-map__station a:hover { color: var(--ink); }
.route-map__station.is-current a { color: var(--ink); font-weight: 700; }

/* 現在地のバス。JS が --x を駅の中心座標に合わせて更新する。
   車輪の中心（svg の y=13）が線に乗るよう、線から 13px 上に置く */
.route-map__here {
  position: absolute;
  z-index: 2;
  top: calc(var(--line-y) - 13px);
  left: var(--x, var(--pad-left));
  width: 26px;
  height: 16px;
  color: var(--route);
  transform: translateX(-50%);
  pointer-events: none;
}
.route-map__bus { display: block; }
/* 上へ戻るときは進行方向を反転する */
.route-map__here.is-back .route-map__bus { transform: scaleX(-1); }

/* 読んでいるセクション以外は文字を薄くする。
   同期スクリプトが動いているときだけ効かせ、JS 無しでは全文を通常の濃さで出す */
.route-sync .hero > .wrap,
.route-sync .section > .wrap { transition: opacity 0.35s ease; }
.route-sync .hero:not(.is-current) > .wrap,
.route-sync .section:not(.is-current) > .wrap { opacity: 0.55; }
@media (prefers-reduced-motion: reduce) {
  .route-sync .hero > .wrap,
  .route-sync .section > .wrap { transition: none; }
}

/* 駅へ飛ぶとき、固定ヘッダーの裏に見出しが潜らないようにする。
   ヘッダーの高さは JS が --head-h に入れる */
.hero, .section { scroll-margin-top: var(--head-h, 0px); }
.route-map__viewport { cursor: grab; }
.route-map__viewport.is-dragging { cursor: grabbing; }

@media (max-width: 720px) {
  .site-head { --head-pad: 14px; }
  .route-map { max-width: none; }
}

/* --- ヒーロー --- */

.hero { padding-block: var(--s6) var(--s6); }
.hero__body { max-width: var(--measure); }

.hero__lead {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-lead);
  line-height: 1.6;
  letter-spacing: 0.01em;
  margin: 0;
  max-width: 16em;
  line-break: strict;
  word-break: auto-phrase;
  text-wrap: pretty;
}

.hero__now { margin: var(--s1) 0 0; font-size: var(--t-body); color: var(--muted); }
.hero__lead + .hero__now { margin-top: var(--s4); }

@media (max-width: 720px) {
  .hero__lead { max-width: none; }
}

/* --- ボタン（押せる＝枠線） --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 var(--s3);
  border: 1px solid var(--rule);
  color: var(--muted);
  font-size: var(--t-body);
  text-decoration: none;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn--primary { border-color: var(--route); color: var(--route); }
.btn--primary:hover { background: var(--route); color: var(--route-ink); }

/* --- セクション共通 --- */

.section { padding-block: var(--s6) 0; }
.section:last-of-type { padding-bottom: var(--s6); }

.section__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-title);
  line-height: 1.5;
  letter-spacing: 0.03em;
  margin: 0;
}
.section__note { margin: var(--s2) 0 0; font-size: var(--t-meta); color: var(--muted); }

.prose { max-width: var(--measure); margin-top: var(--s5); }
.prose h3 { font-size: var(--t-sub); font-weight: 700; line-height: 1.65; margin: var(--s5) 0 0; }
.prose h3:first-child { margin-top: 0; }
.prose p { margin: var(--s2) 0 0; color: var(--ink-2); line-height: 2.05; text-wrap: pretty; }
.prose .bullets { margin-top: var(--s3); }

/* --- 参照リンク（押せる＝枠線） --- */

.refs { display: flex; flex-direction: column; gap: var(--s2); max-width: var(--measure); margin-top: var(--s5); }
.ref { display: block; border: 1px solid var(--rule); padding: var(--s3); text-decoration: none; color: var(--ink); }
a.ref:hover { border-color: var(--route); }
a.ref:hover .ref__title { color: var(--route); }
.ref__label { display: block; margin: 0; font-size: var(--t-meta); color: var(--muted); }
.ref__title { display: block; margin: var(--s1) 0 0; font-size: var(--t-body); font-weight: 500; }
.ref__desc { display: block; margin: 2px 0 0; font-size: var(--t-meta); color: var(--muted); }
/* ひとつの登壇に、動画と資料という2つの入口を置く */
.ref__links,
.card__links { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s3) 0 0; font-size: var(--t-meta); }
/* リンクは色で示し、下線はホバー時だけ出す（サイト内の他のリンクと揃える） */
.ref__links a,
.card__links a { text-decoration: none; }
.ref__links a:hover,
.card__links a:hover { text-decoration: underline; }
.ref--media { display: flex; gap: var(--s3); align-items: flex-start; }
.ref__shot { display: block; width: 200px; aspect-ratio: 16 / 9; object-fit: cover; flex-shrink: 0; border: 1px solid var(--rule); }
.ref__body { min-width: 0; }

@media (max-width: 640px) {
  .ref--media { flex-direction: column; }
  .ref__shot { width: 100%; }
}

/* --- 職務経歴 ---
   各社の行が経路上の駅になる。 */

.jobs { list-style: none; margin: var(--s5) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s5); }
.job { position: relative; display: flex; gap: var(--s5); }

/* 駅 */
.job::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--rail) - 3.5px);
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--route);
}
/* 経路から行へ渡る破線。経路を外れた行では長くなる */
.job::after {
  content: "";
  position: absolute;
  left: calc(4px - var(--rail));
  top: 13px;
  height: 2px;
  width: calc(var(--rail) - 12px);
  background: repeating-linear-gradient(to right, var(--route) 0 4px, transparent 4px 9px);
  opacity: 0.55;
}

.job__meta { width: 200px; flex-shrink: 0; }
.job__term { margin: 0; font-size: var(--t-meta); color: var(--muted); }
.job__role { margin: var(--s1) 0 0; font-size: var(--t-sub); font-weight: 700; }
.job__org { margin: 2px 0 0; font-size: var(--t-meta); }
.job__org a { color: var(--muted); text-decoration: none; }
.job__org a:hover { color: var(--route); text-decoration: underline; }
.job__what { margin: 2px 0 0; font-size: var(--t-label); color: var(--muted); }

.job__body { flex-grow: 1; max-width: 42rem; min-width: 0; }
.job__body p { margin: 0 0 var(--s2); color: var(--ink-2); text-wrap: pretty; }
.job__body p:last-child { margin-bottom: 0; }
.job__lead { margin-top: var(--s3); }
/* .job__body p が margin-top:0 を上書きするため、箇条書きの直後だけ間隔を持たせる */
.bullets + .job__lead { margin-top: var(--s3); }

@media (max-width: 720px) {
  .job { flex-direction: column; gap: var(--s2); }
  .job__meta { width: auto; }
}

/* --- リスト類 --- */

.bullets { margin: 0; padding-left: 1.2em; color: var(--ink-2); }
.bullets li { margin-bottom: var(--s1); }
.bullets li:last-child { margin-bottom: 0; }
.bullets a { text-decoration: none; }
.bullets a:hover { text-decoration: underline; }

/* タグは押せない＝塗り */
.tags { list-style: none; margin: var(--s3) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1); }
.tags li { background: var(--fill); color: var(--ink-2); padding: 8px 14px; font-size: var(--t-meta); line-height: 1.6; }

/* --- できること --- */

.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); margin-top: var(--s5); max-width: 62rem; }
.skills__head { margin: 0; font-size: var(--t-label); font-weight: 400; color: var(--muted); letter-spacing: 0.04em; }
.note { margin: var(--s3) 0 0; font-size: var(--t-meta); line-height: 1.9; color: var(--muted); }

@media (max-width: 720px) { .skills { grid-template-columns: minmax(0, 1fr); } }

/* --- 作品カード（押せる＝枠線） --- */

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s5); }
.card { border: 1px solid var(--rule); background: var(--card); display: flex; flex-direction: column; }
.card:hover { border-color: var(--route); }
.card__shot { display: block; width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--fill); }
.card__body { padding: var(--s4); }
.card__title { margin: 0; font-size: var(--t-sub); font-weight: 700; line-height: 1.65; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--route); }
.card__meta { margin: 2px 0 0; font-size: var(--t-meta); color: var(--muted); }
.card__body > p:last-of-type { margin: var(--s2) 0 0; color: var(--ink-2); text-wrap: pretty; }

.stats { display: flex; gap: var(--s4); margin: var(--s3) 0 0; }
.stats div { margin: 0; }
.stats dt { font-size: var(--t-label); color: var(--muted); }
.stats dd { margin: 0; font-size: 26px; font-weight: 700; color: var(--route); line-height: 1.4; }

@media (max-width: 720px) { .cards { grid-template-columns: minmax(0, 1fr); } }

/* --- 記事・登壇の一覧 --- */

.writings { list-style: none; margin: var(--s4) 0 0; padding: 0; max-width: 62rem; }
.writings li {
  display: grid;
  grid-template-columns: 8rem 5rem minmax(0, 1fr);
  gap: var(--s1) var(--s3);
  align-items: baseline;
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule);
}
.writings__svc, .writings__year { font-size: var(--t-label); color: var(--muted); }
.writings a { font-size: var(--t-body); line-height: 1.7; text-decoration: none; }
.writings a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .writings li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .writings__svc, .writings__year { display: inline; }
}

/* --- 発信チャンネル（押せる＝枠線） --- */

.channels { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s4); }
.channel {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--rule);
  font-size: var(--t-meta);
  color: var(--muted);
  text-decoration: none;
}
.channel:hover { border-color: var(--ink); color: var(--ink); }
.channels__lead { margin: var(--s4) 0 0; font-size: var(--t-meta); color: var(--muted); }
.channels__lead + .channels { margin-top: var(--s2); }

/* --- 連絡先 --- */

.contact { margin-top: var(--s5); max-width: var(--measure); }
.contact__actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }

/* --- フッター --- */

.site-foot {
  margin-top: var(--s6);
  border-top: 1px solid var(--rule);
  padding-block: var(--s4) calc(var(--s4) + env(safe-area-inset-bottom, 0px));
}
.site-foot__inner { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; justify-content: space-between; }
.site-foot__links { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s3); margin: 0; padding: 0; font-size: var(--t-meta); }
.site-foot__links a { color: var(--muted); text-decoration: none; }
.site-foot__links a:hover { color: var(--ink); }
.site-foot__updated { margin: 0; font-size: var(--t-label); color: var(--muted); }

/* 目次。経路をたどり終えた先で、もう一度どこへでも行けるようにする。
   ヘッダーのナビが隠れる幅でだけ出す。ページ内ナビはどの幅でも1つだけにする。 */
.site-foot__index { display: none; }
@media (max-width: 720px) {
  .site-foot__index { display: flex; flex-direction: column; margin-bottom: var(--s4); font-size: var(--t-body); }
  .site-foot__index a { padding-block: 10px; color: var(--ink); text-decoration: none; }
}

/* --- 画像プレースホルダ（差し替えたら不要） --- */

.ph { background: var(--ph); display: flex; align-items: center; justify-content: center; }
.ph span { font-size: var(--t-label); color: var(--ph-ink); }
