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

:root {
  --bg: #ffffff;
  --text: #111111;
  --text-muted: #888888;
  --border: #e4e4e4;
  --hover: #f5f5f5;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Navigation ── */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Language toggle */

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.15rem 0;
  transition: color 0.2s ease;
}

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

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

.divider {
  font-size: 0.75rem;
  color: var(--border);
  user-select: none;
}

/* CV button */

.cv-wrapper {
  position: relative;
}

.cv-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  padding: 0.65rem 1.3rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cv-btn:hover {
  background: var(--hover);
  border-color: #ccc;
}

.cv-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  min-width: 160px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cv-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.cv-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.cv-option:hover {
  background: var(--hover);
}

.cv-option + .cv-option {
  border-top: 1px solid var(--border);
}

.cv-flag {
  font-size: 1rem;
  line-height: 1;
}

/* ── Main / Hero ── */

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7rem 2rem 4rem;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

/* Avatar */

.avatar-wrap {
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.1s forwards;
}

.avatar {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: grayscale(8%);
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Name */

.name {
  font-size: 2.8rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.6rem;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.2s forwards;
}

/* Role & Location */

.role {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.3s forwards;
}

.location-link {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid #ccc;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.location-link:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

.location {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.35s forwards;
}

/* ── Timeline ── */

.timeline {
  width: 100%;
  max-width: 580px;
  margin-bottom: 2.25rem;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.4s forwards;
}

.timeline::-webkit-scrollbar { display: none; }

.tl-row {
  display: flex;
  min-width: 500px;
}

.tl-row > * {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tl-years {
  margin-bottom: 0.6rem;
}

.tl-years > span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.tl-dots-row {
  position: relative;
  height: 22px;
}

.tl-track {
  position: absolute;
  left: 0;
  right: calc(100% / 12);
  top: 50%;
  height: 1.5px;
  background: var(--border);
  transform: translateY(-50%);
  overflow: hidden;
  pointer-events: none;
}

.tl-fill {
  height: 100%;
  background: linear-gradient(to right, #14532d, #166534);
  width: 0;
  transition: width 1.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.tl-dot-wrap {
  position: relative;
  z-index: 1;
}

.tl-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d0d0d0;
  border: 3px solid var(--bg);
  flex-shrink: 0;
  transform: scale(0);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.3s ease,
              box-shadow 0.3s ease;
}

.tl-active .tl-dot {
  background: #166534;
}

.tl-future .tl-dot {
  background: var(--bg);
  border: 2px dashed #e53e3e;
}

.tl-labels {
  margin-top: 0.65rem;
}

.tl-labels > span {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.tl-labels > span.tl-label-future {
  font-style: italic;
  opacity: 0;
}

.tl-years > span.tl-year-future {
  opacity: 0.45;
  font-style: italic;
}

/* ── Animated state ── */

/* Line fills to 80% — covers past + active dots (5 of 6) */
.timeline.animated .tl-fill { width: 80%; }

/* Dots appear staggered */
.timeline.animated .tl-dot-wrap:nth-child(2) .tl-dot { transform: scale(1); transition-delay: 0.05s; }
.timeline.animated .tl-dot-wrap:nth-child(3) .tl-dot { transform: scale(1); transition-delay: 0.35s; }
.timeline.animated .tl-dot-wrap:nth-child(4) .tl-dot { transform: scale(1); transition-delay: 0.65s; }
.timeline.animated .tl-dot-wrap:nth-child(5) .tl-dot { transform: scale(1); transition-delay: 0.95s; }
.timeline.animated .tl-dot-wrap:nth-child(6) .tl-dot { transform: scale(1); transition-delay: 1.25s; }
.timeline.animated .tl-dot-wrap:nth-child(7) .tl-dot { transform: scale(1); transition-delay: 1.65s; }

/* Labels fade up staggered */
.timeline.animated .tl-labels > span:nth-child(1) { opacity: 1; transform: none; transition-delay: 0.2s; }
.timeline.animated .tl-labels > span:nth-child(2) { opacity: 1; transform: none; transition-delay: 0.5s; }
.timeline.animated .tl-labels > span:nth-child(3) { opacity: 1; transform: none; transition-delay: 0.8s; }
.timeline.animated .tl-labels > span:nth-child(4) { opacity: 1; transform: none; transition-delay: 1.1s; }
.timeline.animated .tl-labels > span:nth-child(5) { opacity: 1; transform: none; transition-delay: 1.4s; }
.timeline.animated .tl-labels > span:nth-child(6) { opacity: 0.5; transform: none; transition-delay: 1.8s; }

/* Glow on current dots after they appear */
.timeline.animated .tl-dot-wrap.tl-active:nth-child(5) .tl-dot {
  animation: tlGlow 2.5s ease-in-out 1.8s infinite;
}
.timeline.animated .tl-dot-wrap.tl-active:nth-child(6) .tl-dot {
  animation: tlGlow 2.5s ease-in-out 2.1s infinite;
}

/* Pulse on future dot */
.timeline.animated .tl-dot-wrap.tl-future .tl-dot {
  animation: tlPulse 2.2s ease-in-out 2.4s infinite;
}

@keyframes tlGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22,101,52,0); }
  50%       { box-shadow: 0 0 0 5px rgba(22,101,52,0.25); }
}

@keyframes tlPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,62,62,0); border-color: #e53e3e; }
  50%       { box-shadow: 0 0 0 5px rgba(229,62,62,0.15); border-color: #c53030; }
}

/* Social links */

.socials {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.45s forwards;
}

.socials-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.social-link:hover {
  background: var(--hover);
  transform: translateY(-2px);
  opacity: 1 !important;
}

.social-link[aria-label="GitHub"]     { color: #181717; }
.social-link[aria-label="LinkedIn"]   { color: #0A66C2; }
.social-link[aria-label="X (Twitter)"]{ color: #000000; }
.social-link[aria-label="YouTube"]    { color: #FF0000; }
.social-link[aria-label="Email"]      { color: #EA4335; }
.social-link[aria-label="LeetCode"]   { color: #FFA116; }

/* ── Animations ── */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Language transition */

.hero.transitioning {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.hero.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease 0.05s, transform 0.2s ease 0.05s;
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .avatar {
    width: 150px;
    height: 150px;
  }

  .name {
    font-size: 1.9rem;
  }

  .tl-row {
    min-width: 0;
  }

  .tl-years > span {
    font-size: 0.6rem;
  }

  .tl-labels > span {
    font-size: 0.58rem;
  }

  .tl-dot {
    width: 11px;
    height: 11px;
  }

  .tl-dots-row {
    height: 18px;
  }
}

@media (max-width: 480px) {
  nav {
    padding: 0.9rem 1.25rem;
  }

  .lang-btn {
    font-size: 0.8rem;
  }

  .cv-btn {
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
  }

  .avatar {
    width: 130px;
    height: 130px;
  }

  .name {
    font-size: 1.65rem;
  }

  .role {
    font-size: 0.95rem;
  }

  .location {
    font-size: 0.85rem;
  }

  .tl-years > span {
    font-size: 0.55rem;
  }

  .tl-labels > span {
    font-size: 0.52rem;
  }

  .tl-dot {
    width: 9px;
    height: 9px;
  }

  .tl-dots-row {
    height: 16px;
  }

  .socials-row {
    gap: 0;
  }

  .social-link {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 360px) {
  .avatar {
    width: 110px;
    height: 110px;
  }

  .name {
    font-size: 1.45rem;
  }

  .tl-years > span {
    font-size: 0.48rem;
  }

  .tl-labels > span {
    font-size: 0.45rem;
  }

  .tl-dot {
    width: 8px;
    height: 8px;
  }

  .tl-dots-row {
    height: 14px;
  }

  .social-link {
    width: 36px;
    height: 36px;
  }
}

/* ── Footer ── */

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

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

footer span {
  opacity: 0.4;
}

/* ── Legal pages ── */

.legal-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.back-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s ease;
}

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

.legal-main {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;
  display: block;
  text-align: left;
  word-break: break-word;
}

.legal-main h1 {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 2.5rem;
}

.legal-main h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

.legal-main p,
.legal-main address {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #444;
  font-style: normal;
  margin-bottom: 0.5rem;
}

.legal-main a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-main ul {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #444;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.legal-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.legal-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}