:root {
  --ink:         #0f0e0c;
  --paper:       #f5f2ec;
  --muted:       #7a7468;
  --accent:      #c9960c;
  --accent-dark: #9a7200;
  --rule:        #d6d0c4;
  --col-l:       320px;
  --serif:       'Cormorant Garamond', Georgia, serif;
  --mono:        'DM Mono', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 300;
  font-size: 13px;
  line-height: 1.75;
  min-height: 100vh;
}
.shell {
  display: grid;
  grid-template-columns: var(--col-l) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--ink);
  color: var(--paper);
  padding: 40px 40px 56px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.sidebar::-webkit-scrollbar { display: none; }

.avatar-wrap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #2e2c29;
  flex-shrink: 0;
}
.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.name {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.name em { display: block; font-style: italic; color: var(--accent); }
.title-line {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9a9488;
  margin-top: 8px;
}

.contact-block { display: flex; flex-direction: column; gap: 8px; }
.contact-block a,
.contact-block span {
  color: #b0a898;
  text-decoration: none;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color 0.2s;
}
.contact-block a:hover { color: var(--accent); }
.contact-block .ico { font-size: 14px; width: 16px; text-align: center; }

.s-section { border-top: 1px solid #2e2c29; padding-top: 22px; }
.s-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.skill-list { display: flex; flex-wrap: wrap; gap: 7px; }
.skill-tag {
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid #2e2c29;
  color: #9a9488;
  border-radius: 2px;
  transition: border-color 0.2s, color 0.2s;
}
.skill-tag:hover { border-color: var(--accent); color: var(--paper); background: rgba(201, 150, 12, 0.18); }

.lang-row { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 12px; color: #b0a898; }
.lang-row span { color: var(--accent); font-size: 11px; }

.lang-toggle { display: flex; align-items: center; gap: 8px; }
.lang-opt {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
}
.lang-opt.active { color: var(--accent); font-weight: 400; }

/* Sidebar variant (mobile) */
.lang-toggle--sidebar .lang-opt { color: #9a9488; }
.lang-toggle--sidebar .lang-opt.active { color: var(--accent); }
.lang-toggle--sidebar .lang-opt:hover { color: var(--paper); }
.lang-toggle--sidebar .lang-sep { color: #2e2c29; font-size: 11px; }

/* Fixed variant (desktop) — outside overflow container */
.lang-toggle--fixed {
  position: fixed;
  top: 20px;
  right: 32px;
  z-index: 200;
  display: none;
}
.lang-toggle--fixed .lang-opt { color: var(--muted); }
.lang-toggle--fixed .lang-opt:hover { color: var(--accent); }
.lang-toggle--fixed .lang-opt.active { color: var(--accent); font-weight: 500; }
.lang-toggle--fixed .lang-sep { color: var(--muted); font-size: 11px; }

.pdf-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: #9a9488; font-size: 12px; font-family: var(--mono); font-weight: 300;
  display: flex; gap: 10px; align-items: center;
  transition: color 0.2s;
}
.pdf-btn:hover { color: var(--accent); }

/* ── Main ────────────────────────────────────────────────── */
.main {
  padding: 56px 60px 80px;
  max-width: 780px;
}

.section { margin-bottom: 56px; opacity: 0; transform: translateY(16px); transition: opacity 0.55s ease, transform 0.55s ease; }
.section.visible { opacity: 1; transform: translateY(0); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 300;
  letter-spacing: -0.3px;
}
.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.section-num { font-size: 10px; letter-spacing: 0.15em; color: var(--accent-dark); }

/* About */
.about-text {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 300;
  line-height: 1.65;
  color: #2a2722;
  max-width: 600px;
}
.about-text strong { font-weight: 600; color: var(--accent-dark); }

/* Currently working on */
.now-card {
  border-left: 3px solid var(--accent-dark);
  padding: 18px 22px;
  background: #faf7f1;
  margin-bottom: 0;
}
.now-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
}
.now-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}
.now-desc { font-size: 12px; color: #3a3630; line-height: 1.65; }

/* Now — detail link */
.now-detail-btn {
  background: none;
  border: none;
  padding: 0;
  margin-top: 14px;
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent-dark);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.now-detail-btn:hover { border-color: var(--accent-dark); }

/* Experience */
.job { margin-bottom: 40px; position: relative; padding-left: 12px; }
.job:last-child { margin-bottom: 0; }
.job::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 2px; height: 0;
  background: var(--accent);
  transition: height 0.35s ease;
}
.job:hover::before { height: 100%; }
.job-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.job-title { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.job-period { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; white-space: nowrap; }
.job-company { font-size: 12px; color: var(--accent-dark); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 10px; }
.job ul { padding-left: 18px; }
.job li { margin-bottom: 5px; color: #3a3630; }
.job li::marker { color: var(--accent-dark); }

/* Publications */
.pub-item {
  border: 1px solid var(--rule);
  padding: 20px 22px;
  margin-bottom: 16px;
  position: relative;
}
.pub-item:last-child { margin-bottom: 0; }
.pub-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent-dark);
  padding: 2px 8px;
  border-radius: 2px;
  margin-bottom: 10px;
}
.pub-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
}
.pub-venue { font-size: 12px; color: var(--muted); }
.pub-venue strong { color: var(--accent); font-weight: 400; }

/* Education */
.edu-item {
  margin-bottom: 26px;
  position: relative;
  padding-left: 12px;
}
.edu-item:last-child { margin-bottom: 0; }
.edu-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 2px; height: 0;
  background: var(--accent);
  transition: height 0.35s ease;
}
.edu-item:hover::before { height: 100%; }
.edu-degree { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.edu-school { font-size: 12px; color: var(--accent-dark); letter-spacing: 0.1em; text-transform: uppercase; margin: 2px 0; }
.edu-year { font-size: 11px; color: var(--muted); }
.edu-detail { font-size: 12px; color: #5a5450; margin-top: 4px; line-height: 1.6; }

/* Projects */
.project-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.project-card {
  border: 1px solid var(--rule);
  padding: 22px;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 0;
  background: var(--accent);
  transition: height 0.3s;
}
.project-card:hover::before { height: 100%; }
.proj-name { font-family: var(--serif); font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.proj-stack { font-size: 10px; color: var(--accent-dark); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 10px; }
.proj-desc { color: var(--muted); font-size: 12px; line-height: 1.6; }

.footer {
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

/* ── Back to top (mobile) ────────────────────────────────── */
.back-to-top {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  z-index: 200;
  transition: background 0.2s;
}
.back-to-top:hover { background: var(--accent-dark); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes sidebarIn {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
.sidebar > * { animation: sidebarIn 0.5s ease both; }
.sidebar > *:nth-child(1) { animation-delay: 0.05s; }
.sidebar > *:nth-child(2) { animation-delay: 0.15s; }
.sidebar > *:nth-child(3) { animation-delay: 0.26s; }
.sidebar > *:nth-child(4) { animation-delay: 0.36s; }
.sidebar > *:nth-child(5) { animation-delay: 0.44s; }
.sidebar > *:nth-child(6) { animation-delay: 0.52s; }
.sidebar > *:nth-child(7) { animation-delay: 0.58s; }

.avatar-wrap { transition: transform 0.3s ease; }
.avatar-wrap:hover { transform: scale(1.05); }

@keyframes itemIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section.visible .project-card { animation: itemIn 0.4s ease both; }
.section.visible .project-card:nth-child(1) { animation-delay: 0.12s; }
.section.visible .project-card:nth-child(2) { animation-delay: 0.22s; }
.section.visible .project-card:nth-child(3) { animation-delay: 0.32s; }
.section.visible .project-card:nth-child(4) { animation-delay: 0.42s; }

.section.visible .pub-item { animation: itemIn 0.4s ease both; }
.section.visible .pub-item:nth-child(2) { animation-delay: 0.1s; }
.section.visible .pub-item:nth-child(3) { animation-delay: 0.2s; }
.section.visible .pub-item:nth-child(4) { animation-delay: 0.3s; }
.section.visible .pub-item:nth-child(5) { animation-delay: 0.4s; }

@media (prefers-reduced-motion: reduce) {
  .sidebar > * { animation: none; }
  .avatar-wrap { transition: none; }
  .section.visible .project-card,
  .section.visible .pub-item { animation: none; }
  .page-nav-label { transition: none; }
  .page-nav-item svg line,
  .page-nav-item svg polyline { transition: none; }
  .job::before, .edu-item::before { transition: none; }
}

/* ── Right-side section nav ──────────────────────────────── */
.page-nav {
  position: fixed;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
}
.page-nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 5px 0;
  text-decoration: none;
  color: var(--rule);
  transition: color 0.2s;
}
.page-nav-item:hover,
.page-nav-item.active { color: var(--accent); }

.page-nav-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: font-size 0.2s ease, color 0.2s;
}
.page-nav-item.active .page-nav-label { color: var(--accent); }
.page-nav-item:hover .page-nav-label,
.page-nav-item.active .page-nav-label { font-size: 13px; }

.page-nav-item svg { flex-shrink: 0; overflow: visible; }
.page-nav-item svg line {
  transition: transform 0.3s ease;
  transform-box: fill-box;
  transform-origin: left center;
}
.page-nav-item svg polyline { transition: transform 0.3s ease; }
.page-nav-item:hover svg line,
.page-nav-item.active svg line     { transform: scaleX(1.25); }
.page-nav-item:hover svg polyline,
.page-nav-item.active svg polyline { transform: translateX(5px); }

/* ── Detail view ─────────────────────────────────────────── */
#cv-view.hidden    { display: none; }
#detail-view       { display: none; }
#detail-view.active { display: block; }

.job-detail-btn {
  background: none;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 0 0 1px;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.job-detail-btn::after { content: '→' / ''; }
.job-detail-btn:hover { color: var(--accent-dark); border-color: var(--accent); }

.detail-top { margin-bottom: 40px; }

.detail-back {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 32px;
  display: inline-block;
  transition: color 0.2s;
}
.detail-back:hover { color: var(--accent-dark); }

.detail-role-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
}
.detail-role-title {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 300;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}
.detail-role-company {
  font-size: 12px;
  color: var(--accent-dark);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.detail-role-period { font-size: 11px; color: var(--muted); }

.detail-divider {
  height: 1px;
  background: var(--rule);
  margin-top: 24px;
}

.detail-block { margin-bottom: 40px; }
.detail-block-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 14px;
}
.detail-block p  { font-size: 13px; color: #3a3630; line-height: 1.75; margin-bottom: 12px; }
.detail-block ul { padding-left: 18px; }
.detail-block li { font-size: 13px; color: #3a3630; margin-bottom: 7px; line-height: 1.65; }
.detail-block li::marker { color: var(--accent-dark); }

.detail-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  padding-top: 32px;
  margin-top: 56px;
}
.detail-nav-btn {
  background: none;
  border: 1px solid var(--rule);
  padding: 14px 18px;
  text-align: left;
  cursor: pointer;
  font-family: var(--mono);
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 140px;
}
.detail-nav-btn:hover,
.detail-nav-btn.active { border-color: var(--accent); }
.detail-nav-org  { font-size: 12px; font-weight: 400; color: var(--ink); }
.detail-nav-role { font-size: 11px; color: var(--muted); }
.detail-nav-period { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }
.detail-nav-btn.active .detail-nav-org { color: var(--accent-dark); }

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .shell { grid-template-columns: 240px 1fr; }
  .sidebar { position: relative; height: auto; }
  .section { opacity: 1 !important; transform: none !important; animation: none !important; }
  .project-card { break-inside: avoid; }
  .job { break-inside: avoid; }
  .edu-item { break-inside: avoid; }
  .page-nav { display: none; }
  .back-to-top { display: none; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (min-width: 721px) {
  .lang-toggle--sidebar { display: none; }
  .lang-toggle--fixed   { display: flex; }
}

@media (max-width: 1180px) {
  .back-to-top { display: block; }
  .page-nav    { display: none; }
}

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .main { padding: 40px 28px 60px; }
  .project-grid { grid-template-columns: 1fr; }
}
