/* ===== デザイントークン ===== */
:root {
  --bg: #131518;
  --bg-raised: #1a1d21;
  --text: #e4e7eb;
  --text-muted: #8b929d;
  --text-faint: #5c636d;
  --accent: #7aa2f7;
  --line: #2a2e35;
  --blink-interval: 500ms;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  --font-heading: "IBM Plex Sans", var(--font-body);
  --font-mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas,
    "Noto Sans Mono CJK JP", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--font-mono);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--bg-raised);
  color: var(--text);
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

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

/* ===== カーソル (装飾) ===== */
.cursor {
  color: var(--accent);
  animation: blink calc(var(--blink-interval) * 2) steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ===== イントロ ===== */
.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 1;
  transition: opacity 0.5s ease;
}

.intro.hide {
  opacity: 0;
  pointer-events: none;
}

.intro-title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ===== エラー表示 ===== */
.load-error {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}

/* hidden属性が display 指定に負けないようにする */
.load-error[hidden],
.layout[hidden] {
  display: none;
}

/* ===== レイアウト ===== */
.layout {
  display: grid;
  grid-template-columns: minmax(320px, 42%) 1fr;
  max-width: 1400px;
  margin: 0 auto;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.layout.visible {
  opacity: 1;
}

/* ===== 左カラム (固定) ===== */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6rem 3rem 3rem 4rem;
}

.profile-name {
  margin: 0 0 0.5rem;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.25;
}

.profile-role {
  margin: 0 0 1.5rem;
  color: var(--accent);
  font-size: 0.95rem;
}

.profile-tagline {
  margin: 0 0 3rem;
  max-width: 34ch;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== ナビゲーション ===== */
.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  color: var(--text-faint);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav-link::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: var(--text-faint);
  transition: width 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--text);
  font-weight: 500;
}

.nav-link.active::before {
  width: 2.5rem;
  background: var(--accent);
}

.nav-index {
  font-size: 0.8rem;
  color: var(--text-faint);
}

.nav-link.active .nav-index {
  color: var(--accent);
}

/* ===== サイドバー下部 ===== */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ===== 言語スイッチャー ===== */
.lang-switch {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.lang-btn {
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0 0 2px;
  color: var(--text-faint);
  font: inherit;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.lang-sep {
  color: var(--text-faint);
}

.resume-link {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  width: fit-content;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.resume-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.scroll-hint {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

/* ===== 右カラム (コンテンツ) ===== */
.content {
  max-width: 72ch;
  padding: 0 4rem 8rem 3rem;
}

.section-heading-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 5rem 0 2rem;
  background: var(--bg);
}

.section-heading {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section {
  scroll-margin-top: 9rem;
  padding-bottom: 8rem;
}

/* ===== About ===== */
.about-content p {
  margin: 0 0 1.5rem;
  max-width: 62ch;
  color: var(--text-muted);
}

.about-content p:first-child {
  color: var(--text);
}

/* ===== Experience ===== */
.experience-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.experience-item {
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
}

.experience-item:first-child {
  border-top: none;
  padding-top: 0;
}

.exp-period {
  margin: 0 0 0.5rem;
  color: var(--text-faint);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.exp-title {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.exp-role {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.85rem;
}

.exp-summary {
  margin: 0 0 1.25rem;
  max-width: 62ch;
  color: var(--text-muted);
}

.exp-tasks {
  margin: 0 0 1.25rem;
  color: var(--text-faint);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.exp-details {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.exp-details li {
  margin-bottom: 0.4rem;
}

.exp-details li::marker {
  color: var(--accent);
}

.exp-skills {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

/* ===== レスポンシブ (タブレット・モバイル) ===== */
@media (max-width: 1023px) {
  .layout {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 4rem 1.5rem 0;
  }

  .profile-name {
    font-size: 1.75rem;
  }

  .profile-tagline {
    margin-bottom: 2rem;
    max-width: 52ch;
  }

  .nav {
    flex-direction: row;
    gap: 1.75rem;
  }

  .nav-link::before {
    display: none;
  }

  .sidebar-footer {
    flex-direction: row;
    align-items: baseline;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-bottom: 1.5rem;
  }

  .scroll-hint {
    display: none;
  }

  .content {
    padding: 0 1.5rem 6rem;
  }

  .section-heading-wrap {
    padding: 1.25rem 0 1.25rem;
  }

  .section {
    scroll-margin-top: 5rem;
    padding-bottom: 5rem;
  }
}

/* ===== 低モーション設定への対応 ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cursor {
    animation: none;
  }

  .intro,
  .layout {
    transition: opacity 0.15s linear;
  }

  .nav-link,
  .nav-link::before,
  .lang-btn,
  .resume-link {
    transition: none;
  }
}
