:root {
  --bg-color: #ffffff;
  --text-color: #0f172a;
  --text-muted: #64748b;
  --navy: #004466;
  --navy-light: #337399;
  --accent-color: #7f1d2e;
  --accent-light: #a13a4a;
  --card-bg: #f8fafc;
  --border-color: #e2e8f0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
section { scroll-margin-top: 90px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

.logo-text, h1, h2, .btn, .hero-eyebrow, .brand-tag, .ct-title, .ct-year, .data-mark, .badge {
  font-family: 'Inter', 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
}

::selection { background-color: var(--accent-color); color: #fff; }

/* ヘッダー・ナビゲーション */
header {
  position: fixed; top: 0; width: 100%; padding: 1.5rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color); z-index: 1000;
}
.logo-text { color: var(--text-color); text-decoration: none; font-weight: bold; font-size: 1.2rem; letter-spacing: -0.5px; white-space: nowrap; }
nav a { color: var(--text-color); text-decoration: none; margin-left: 1.5rem; font-size: 0.9rem; transition: color 0.3s; }
nav a:hover { color: var(--accent-light); }

/* レイアウト・見出し */
section { padding: 6rem 2rem; max-width: 1000px; margin: 0 auto; position: relative; }
h2 { font-size: 2rem; margin-bottom: 3rem; display: flex; align-items: center; gap: 1rem; }
h2 .spacer { flex: 1; }

/* 見出し前の正方形マーク(スクロールで1つずつポップインする) */
.accent-marks { display: inline-flex; gap: 5px; }
.accent-marks span { width: 9px; height: 9px; border-radius: 25%; background-color: var(--navy); display: inline-block; transform: scale(0); transition: transform 0.45s cubic-bezier(.34, 1.56, .64, 1); }
.accent-marks span:nth-child(3) { background-color: var(--accent-color); }
h2.is-visible .accent-marks span { transform: scale(1); }
h2.is-visible .accent-marks span:nth-child(1) { transition-delay: .05s; }
h2.is-visible .accent-marks span:nth-child(2) { transition-delay: .15s; }
h2.is-visible .accent-marks span:nth-child(3) { transition-delay: .25s; }
h2.is-visible .accent-marks span:nth-child(4) { transition-delay: .35s; }

/* スクロールでのフェード＆スライドイン(共通) */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.22, 1, .36, 1); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Skills見出し横の棒グラフが下から伸びる */
.bars-reveal .u { transform: scaleY(0); transform-origin: bottom; transition: transform 0.6s cubic-bezier(.22, 1, .36, 1); }
.bars-reveal.is-visible .u { transform: scaleY(1); }
.bars-reveal.is-visible .u:nth-child(1) { transition-delay: 0s; }
.bars-reveal.is-visible .u:nth-child(2) { transition-delay: .1s; }
.bars-reveal.is-visible .u:nth-child(3) { transition-delay: .2s; }
.bars-reveal.is-visible .u:nth-child(4) { transition-delay: .3s; }
.bars-reveal.is-visible .u:nth-child(5) { transition-delay: .4s; }

/* 共通フォント（等幅） */
.link-text { font-family: monospace; }

/* 共通Flex中央揃え */
.modal-overlay, .dashboard {
  display: flex; justify-content: center; align-items: center;
}

/* 共通カードデザイン */
.card, .about-container {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

/* インタラクティブなカードの共通設定 */
.card {
  text-decoration: none; color: inherit; transition: all 0.3s ease;
}
.card:hover {
  transform: translateY(-4px);
}

/* ヒーローセクション */
#hero { min-height: 100vh; display: flex; align-items: center; padding: 8rem 5% 4rem; position: relative; overflow: hidden; }
.hero-content { flex: 1; position: relative; z-index: 2; }
.hero-eyebrow { font-weight: 600; font-size: 0.9rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--navy-light); margin-bottom: 1.2rem; }
.hero-content h1 { font-size: 5rem; letter-spacing: -2px; margin-bottom: 0.5rem; white-space: nowrap; }
.hero-tagline { font-size: 1.5rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.hero-lead { font-size: 1.05rem; line-height: 1.85; color: #334155; max-width: 460px; margin-bottom: 2rem; }
.hero-cta-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-visual { flex: 1; display: flex; justify-content: flex-end; align-items: center; position: relative; z-index: 2; }

/* サイト全体で使う、散りばめ正方形モチーフ(全セクションの背景に薄く配置する) */
.bg-field { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-sq { position: absolute; border-radius: 22%; background-color: var(--navy); animation: sqDrift ease-in-out infinite; }
.bg-sq.accent { background-color: var(--accent-color); }
@keyframes sqDrift { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-12px) rotate(var(--r, 0deg)); } }
section > *:not(.bg-field) { position: relative; z-index: 1; }

/* ロゴアニメーション */
.hero-logo-grid { display: grid; grid-template-columns: repeat(3, 1fr); --logo-size: 240px; width: var(--logo-size); gap: calc(var(--logo-size) / 15); animation: float 6s ease-in-out infinite; will-change: transform; }
.hero-logo-block { width: 100%; aspect-ratio: 1; background-color: var(--navy); border-radius: 18%; transition: transform 0.3s ease; cursor: pointer; }
.hero-logo-block:hover { transform: scale(1.05); }
.hero-logo-block.empty { background-color: transparent; cursor: default; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }

/* ロゴのブロックをクリックすると、そのブロックだけがぷにっとしゅっと消え、少し間を置いて元に戻る */
.hero-logo-block.popped {
  animation: puniPop 0.22s cubic-bezier(.55, 0, .85, .4) forwards;
}
.hero-logo-block.popping-in {
  animation: puniPopIn 0.5s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

@keyframes puniPop {
  0% { transform: scale(1, 1); opacity: 1; }
  35% { transform: scale(1.2, 0.8); opacity: 1; }
  100% { transform: scale(0, 0); opacity: 0; }
}

@keyframes puniPopIn {
  0% { transform: scale(0, 0); opacity: 0; }
  55% { transform: scale(1.2, 1.2); opacity: 1; }
  75% { transform: scale(0.9, 0.9); }
  100% { transform: scale(1, 1); opacity: 1; }
}

/* Worksセクション */
.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.card { padding: 2rem; cursor: pointer; }
.card:hover { border-color: var(--accent-color); }
.card h3 { font-size: 1.5rem; margin-bottom: 0.5rem; transition: color 0.3s; }
.card:hover h3 { color: var(--accent-light); }
.card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.link-text { font-size: 0.8rem; color: var(--text-muted); }

/* Aboutセクション(シンプル) */
.about-simple { display: grid; grid-template-columns: 1fr 340px; gap: 3rem; align-items: center; }
.about-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; display: block; }
.about-quote { font-family: 'Inter', 'Noto Sans JP', sans-serif; font-weight: 900; font-size: 2.6rem; letter-spacing: -0.01em; margin-bottom: 1.8rem; }
.about-quote .hl { color: var(--accent-color); }
.about-text { border-left: 2px solid var(--text-color); padding-left: 1.4rem; }
.about-text p { font-size: 1rem; line-height: 2; color: #334155; }
.about-text p + p { margin-top: 1.2rem; }

/* 常時表示のリンク(PC: 左端に縦並び / スマホ: 下端に横並び) */
.side-links { position: fixed; left: 1.2rem; bottom: 2.5rem; z-index: 900; display: flex; flex-direction: column; gap: 0.4rem; }
.side-links { transition: opacity 0.4s ease, transform 0.4s ease; }
.side-links.is-hidden { opacity: 0; pointer-events: none; }
.sl { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text-color); transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease; }
.sl-icon { width: 22px; height: 22px; filter: brightness(0); opacity: 0.4; transition: filter 0.25s ease, opacity 0.25s ease; }
.sl:hover, .sl:focus-visible { background-color: var(--text-color); transform: scale(1.08); }
.sl:hover .sl-icon, .sl:focus-visible .sl-icon { filter: brightness(0) invert(1); opacity: 1; }
@media (min-width: 769px) and (max-width: 1160px) { main { padding-left: 3.4rem; } }

/* モーダル */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); z-index: 2000; opacity: 1; transition: opacity 0.3s ease; }
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content { background: var(--bg-color); padding: 2.5rem; width: 90%; max-width: 500px; position: relative; transform: translateY(0); transition: transform 0.3s ease; }
.modal-overlay.hidden .modal-content { transform: translateY(20px); }
.modal-close-btn { position: absolute; top: 1rem; right: 1.5rem; background: none; border: none; font-size: 2rem; cursor: pointer; color: var(--text-muted); }
#modal-title { font-size: 1.8rem; color: var(--accent-color); margin-bottom: 1rem; }
#modal-desc { margin-bottom: 2rem; color: var(--text-color); }
.modal-actions { display: flex; gap: 1rem; }
.btn { padding: 0.8rem 1rem; border-radius: 8px; text-decoration: none; font-weight: bold; text-align: center; flex: 1; transition: all 0.3s; font-size: 0.9rem; }
.btn-primary { background-color: var(--accent-color); color: white; }
.btn-primary:hover { background-color: var(--accent-light); }
.btn-outline { border: 1px solid var(--accent-color); color: var(--accent-color); }
.btn-outline:hover { background-color: rgba(127, 29, 46, 0.05); }
.hero-cta-row .btn { flex: none; }

/* Skillsセクション */
.data-mark { display: flex; align-items: flex-end; gap: 4px; height: 2.3rem; }
.data-mark .u { width: 10px; border-radius: 22%; background-color: var(--navy); }
.data-mark .u.accent { background-color: var(--accent-color); }
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 1.6rem; }
.badge { display: flex; align-items: center; justify-content: center; }
.badge-logo { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }

/* Timelineセクション(経歴カード) */
.career-timeline { position: relative; padding-left: 0.4rem; }
.ct-line { position: absolute; left: calc(0.4rem + 26px); top: 6px; bottom: 6px; width: 4px; background-image: radial-gradient(circle, var(--border-color) 1.7px, transparent 1.8px); background-size: 4px 10px; background-repeat: repeat-y; }
.ct-item { position: relative; display: flex; gap: 1.6rem; padding-bottom: 2rem; }
.ct-item:last-child { padding-bottom: 0; }
.ct-avatar { flex-shrink: 0; width: 56px; height: 56px; border-radius: 50%; background-color: #fff; border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; z-index: 1; font-weight: 700; font-size: 0.9rem; color: var(--text-color); overflow: hidden; }
.ct-logo { width: 62%; height: 62%; object-fit: contain; }
.ct-logo-wide { width: 82%; }
.ct-role { padding-top: 0.25rem; }
.ct-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }
.ct-badge { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; margin-left: 0.6rem; background-color: #eef2ff; color: #4338ca; }
.ct-company { font-size: 0.9rem; color: #475569; margin-bottom: 0.5rem; }
.ct-meta { display: flex; gap: 1.1rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.ct-meta span { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-muted); }
.ct-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.75; max-width: 620px; }

/* Qualificationsセクション(資格・学業成績を箇条書きで) */
.quals-list { list-style: none; }
.quals-list li { position: relative; padding-left: 1.6rem; margin-bottom: 1.1rem; font-size: 1.05rem; color: var(--text-color); line-height: 1.6; }
.quals-list li::before { content: ''; position: absolute; left: 0; top: 0.65em; width: 8px; height: 8px; border-radius: 22%; background-color: var(--navy); }
.quals-list li:last-child { margin-bottom: 0; }
.quals-date { font-family: monospace; color: var(--text-muted); font-size: 0.9rem; margin-right: 0.7rem; }
.quals-highlight { font-weight: 800; font-size: 1.2rem; margin-left: 0.3rem; }
.ct-company-node .ct-title { font-size: 1rem; }
.ct-company-node .ct-desc { font-size: 0.85rem; }

/* Articlesセクション */
.articles-sub { color: var(--text-muted); font-size: 0.9rem; margin-top: -2rem; margin-bottom: 2.5rem; }
.articles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.article-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; transition: all 0.25s ease; }
.article-card:hover { transform: translateY(-4px); border-color: var(--accent-color); }
.a-thumb { width: 100%; aspect-ratio: 16 / 9; background-color: #e2e8f0; overflow: hidden; }
.a-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.article-card:hover .a-thumb img { transform: scale(1.05); }
.a-title { font-size: 1rem; font-weight: 700; line-height: 1.55; padding: 1.1rem 1.3rem; }

@media (prefers-reduced-motion: reduce) {
  .hero-logo-grid, .bg-sq { animation: none; }
  .reveal, .accent-marks span, .bars-reveal .u { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* スマホ向けレスポンシブ（メディアクエリを最後に統合） */
@media (max-width: 768px) {
  header { flex-direction: column; }
  header { padding: 0.8rem 1rem 0.6rem; gap: 0.5rem; }
  nav { display: flex; gap: 1rem; max-width: 100%; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav a { margin: 0; font-size: 0.8rem; flex-shrink: 0; }
  section { padding: 4rem 1.5rem; }
  #hero { flex-direction: column; justify-content: center; text-align: center; padding-top: 8rem; gap: 3rem; }
  .hero-content h1 { font-size: 2.8rem; white-space: normal; text-align: center; }
  .hero-tagline, .hero-lead { text-align: center; }
  .hero-lead { margin-left: auto; margin-right: auto; }
  .hero-cta-row { justify-content: center; }
  .hero-visual { justify-content: center; }
  .hero-logo-grid { --logo-size: 160px; }
  .about-quote { font-size: 2rem; }
  .about-simple { grid-template-columns: 1fr; gap: 2rem; }
  .about-photo { aspect-ratio: 4 / 3; }
  .side-links { left: 0; right: 0; top: auto; bottom: 0; transform: none; flex-direction: row; justify-content: center; gap: 0.8rem; padding: 0.5rem; background: rgba(255,255,255,0.9); backdrop-filter: blur(10px); border-top: 1px solid var(--border-color); }
  body { padding-bottom: 4rem; }
  .sl-icon { opacity: 0.7; }
  h2 { flex-wrap: wrap; }
  .career-timeline { padding-left: 0; }
  .ct-item { gap: 1rem; }
  .ct-avatar { width: 44px; height: 44px; font-size: 0.75rem; }
  .ct-line { left: 20px; }
  .modal-actions { flex-direction: column; }
}
