/* ========================================
   Theme Variables
   ======================================== */

:root {
  --bg-primary: #fbfbfd;
  --bg-secondary: #f5f5f7;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: rgba(0, 0, 0, 0.06);
  --card-bg: #ffffff;
  --nav-bg: rgba(251, 251, 253, 0.72);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --tag-bg: #f0f0f3;
  --diagram-stroke: #d2d2d7;
  --diagram-dot: #0071e3;
  --diagram-text: #86868b;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 52px;
  --content-w: 980px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
    'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
}

[data-theme='dark'] {
  --bg-primary: #000000;
  --bg-secondary: #111111;
  --text-primary: #f5f5f7;
  --text-secondary: #86868b;
  --accent: #2997ff;
  --accent-hover: #40a9ff;
  --border: rgba(255, 255, 255, 0.08);
  --card-bg: #1c1c1e;
  --nav-bg: rgba(0, 0, 0, 0.72);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
  --tag-bg: #2c2c2e;
  --diagram-stroke: #424245;
  --diagram-dot: #2997ff;
  --diagram-text: #86868b;
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  -webkit-text-size-adjust: 100%;
}

@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s ease, color 0.4s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

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

ul {
  list-style: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* ========================================
   Navigation
   ======================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 1000;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s ease, background 0.4s ease;
}

.nav.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: var(--content-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

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

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  letter-spacing: -0.01em;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
  color: var(--text-secondary);
}

.ctrl-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.lang-btn {
  width: auto;
  padding: 0 12px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-theme='light'] .icon-moon,
[data-theme='dark'] .icon-sun {
  display: none;
}

[data-theme='light'] .icon-sun,
[data-theme='dark'] .icon-moon {
  display: block;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 8px;
}

.nav-hamburger span {
  display: block;
  height: 1.5px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-hamburger.open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ========================================
   Hero
   ======================================== */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(var(--nav-h) + 40px) 24px 60px;
  position: relative;
}

.hero-inner {
  max-width: var(--content-w);
  width: 100%;
  display: flex;
  align-items: center;
  gap: 80px;
}

.hero-text {
  flex: 1;
}

.hero-greeting {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.hero-name {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
}

.hero-photo {
  flex-shrink: 0;
}

.photo-frame {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: box-shadow 0.3s ease;
}

.photo-frame:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme='dark'] .photo-placeholder {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-secondary);
  animation: bounce 2s ease infinite;
  opacity: 0.5;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-8px); }
  60% { transform: translateX(-50%) translateY(-4px); }
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 980px;
  transition: all 0.2s ease;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-ghost:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

/* ========================================
   Sections
   ======================================== */

.section {
  padding: 120px 24px;
}

.section--alt {
  background: var(--bg-secondary);
  transition: background 0.4s ease;
}

.section-inner {
  max-width: var(--content-w);
  margin: 0 auto;
}

.section-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.section-subtitle {
  font-size: 19px;
  color: var(--text-secondary);
  margin-bottom: 56px;
  max-width: 560px;
  line-height: 1.5;
}

/* ========================================
   Research Cards
   ======================================== */

.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 60px;
}

.research-grid--two {
  grid-template-columns: repeat(2, 1fr);
}

.rc-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.45;
}

.research-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.4s ease;
}

.research-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.rc-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--bg-secondary);
  margin-bottom: 20px;
  color: var(--accent);
  transition: background 0.4s ease;
}

.rc-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.rc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rc-list li {
  font-size: 15px;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}

.rc-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* Research Diagram */

.research-diagram {
  display: flex;
  justify-content: center;
}

.diagram-svg {
  width: 100%;
  max-width: 520px;
  height: auto;
}

.diagram-line {
  stroke: var(--diagram-stroke);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  transition: stroke 0.4s ease;
}

.diagram-line--arc {
  opacity: 0.3;
}

.diagram-dot {
  fill: var(--diagram-dot);
  transition: fill 0.4s ease;
}

.diagram-label {
  fill: var(--diagram-text);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  transition: fill 0.4s ease;
}

/* ========================================
   Blog Grid
   ======================================== */

.blog-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 40px;
}

.filter-btn {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 980px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.4s ease;
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.bc-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.bc-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 980px;
  background: var(--accent);
  color: #fff;
}

.bc-type--video {
  background: #e44;
}

[data-theme='dark'] .bc-type--video {
  background: #ff6b6b;
}

.bc-date {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.bc-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  line-height: 1.35;
  color: var(--text-primary);
}

.bc-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}

.bc-tags {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.bc-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 980px;
  background: var(--tag-bg);
  color: var(--text-secondary);
  transition: background 0.4s ease;
}

.blog-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 17px;
  padding: 60px 0;
}

/* ========================================
   Resume
   ======================================== */

.resume-block {
  margin-bottom: 56px;
}

.rb-heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-left: 24px;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.tl-item {
  display: flex;
  gap: 20px;
  position: relative;
}

.tl-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
  position: relative;
  z-index: 1;
  margin-left: -24px;
}

.tl-content {
  flex: 1;
}

.tl-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
  display: block;
}

.tl-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.tl-place {
  font-size: 15px;
  color: var(--text-secondary);
}

.tl-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 4px;
}

/* Skills */

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 980px;
  background: var(--tag-bg);
  color: var(--text-primary);
  transition: background 0.4s ease, color 0.4s ease;
}

.skill-group {
  margin-bottom: 20px;
}

.skill-group:last-child {
  margin-bottom: 0;
}

.skill-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}

.resume-download {
  margin-top: 48px;
  text-align: center;
}

.resume-download--top {
  margin-top: 12px;
  margin-bottom: 48px;
  text-align: left;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  padding: 40px 24px;
  border-top: 1px solid var(--border);
  transition: border-color 0.4s ease;
}

.footer-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-copy {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========================================
   Animations
   ======================================== */

.anim-item {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.anim-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.anim-item:nth-child(2) { transition-delay: 0.08s; }
.anim-item:nth-child(3) { transition-delay: 0.16s; }
.anim-item:nth-child(4) { transition-delay: 0.24s; }
.anim-item:nth-child(5) { transition-delay: 0.32s; }

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 16px;
    padding: 8px 0;
  }

  .nav-hamburger {
    display: flex;
  }

  .hero {
    min-height: calc(100vh - var(--nav-h));
    min-height: calc(100dvh - var(--nav-h));
  }

  .hero-inner {
    flex-direction: column-reverse;
    text-align: center;
    gap: 40px;
  }

  .hero-name {
    font-size: 42px;
  }

  .hero-tagline {
    font-size: 20px;
  }

  .hero-desc {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .btn {
    min-height: 44px;
    padding: 12px 22px;
  }

  .photo-frame {
    width: 200px;
    height: 200px;
  }

  .section {
    padding: 80px 20px;
  }

  .section-title {
    font-size: 36px;
  }

  .section-subtitle {
    font-size: 17px;
    margin-bottom: 40px;
  }

  .research-grid,
  .research-grid--two {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .research-card {
    padding: 28px 24px;
  }

  .research-card:hover {
    transform: none;
  }

  .blog-filters {
    flex-wrap: wrap;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-card {
    padding: 24px;
  }

  .blog-card:hover {
    transform: none;
  }

  .tl-title {
    font-size: 16px;
    word-break: break-word;
  }

  .tl-desc {
    font-size: 14px;
  }

  .tag {
    font-size: 13px;
    padding: 6px 14px;
  }

  .resume-download--top {
    text-align: center;
  }

  .footer-inner {
    flex-direction: column-reverse;
    gap: 12px;
    text-align: center;
  }

  .diagram-svg {
    max-width: 300px;
  }

  .scroll-hint {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-name {
    font-size: 34px;
  }

  .section-title {
    font-size: 30px;
  }

  .photo-frame {
    width: 160px;
    height: 160px;
  }

  .nav-inner {
    padding: 0 16px;
  }

  .section {
    padding: 60px 16px;
  }

  .research-card {
    padding: 24px 20px;
  }

  .blog-card {
    padding: 20px;
  }

  .bc-title {
    font-size: 17px;
  }

  .timeline {
    padding-left: 20px;
  }

  .tl-dot {
    margin-left: -20px;
  }

  .timeline::before {
    left: 4px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .research-card:hover,
  .blog-card:hover,
  .photo-frame:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
}
