:root {
  --mint: #ECF7F5;
  --mint-strong: #D9EEE8;
  --ink: #0A0A0A;
  --gray: #666666;
  --gray-soft: #8A8A8A;
  --bg: #FFFFFF;
  --card-bg: #FFFFFF;
  --rule: #E6E6E6;
  --shadow: 0 20px 60px -20px rgba(10, 20, 20, 0.18);
  --radius-lg: 32px;
  --radius-md: 16px;
  --max-width: 1100px;
  color-scheme: light;
}

html.dark {
  --mint: #17251F;
  --mint-strong: #1E2E27;
  --ink: #F2F4F3;
  --gray: #A7B0AC;
  --gray-soft: #7D8985;
  --bg: #0F1412;
  --card-bg: #16201C;
  --rule: #26332D;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  margin: 0 0 0.4em;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 60px;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 56px 48px;
  isolation: isolate;
}

.hero-bg {
  position: absolute;
  inset: -22px;
  background: var(--mint);
  overflow: hidden;
  z-index: -1;
  transform: rotate(1.4deg);
  transform-origin: center;
  animation: morph 16s ease-in-out infinite;
}

@keyframes morph {
  0%, 100% { border-radius: 32px 32px 32px 32px; }
  25% { border-radius: 64px 24px 48px 36px; }
  50% { border-radius: 36px 56px 24px 64px; }
  75% { border-radius: 48px 36px 64px 24px; }
}

.hero-blob {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle at 30% 30%, var(--mint-strong), transparent 70%);
  border-radius: 50%;
  animation: float 12s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, 30px) scale(1.05); }
}

.hero-inner {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.portrait {
  width: 180px;
  height: 220px;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
  background: #ddd;
}

.hero-text {
  flex: 1;
  min-width: 280px;
}

.hero-text h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.05;
}

.role {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 12px;
}

.contact-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 0;
  margin: 0 0 20px;
  color: var(--gray);
  font-size: 0.95rem;
}

.contact-row li:not(:first-child)::before {
  content: '·';
  margin-right: 12px;
  color: var(--gray-soft);
}

.contact-row a {
  text-decoration: none;
  color: var(--gray);
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.contact-row a:hover {
  color: var(--ink);
  border-color: currentColor;
}

.intro {
  max-width: 60ch;
  margin: 0 0 24px;
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.closing {
  text-align: center;
  margin-top: 56px;
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--card-bg);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
}

.theme-toggle:hover { transform: scale(1.06); }

.theme-toggle svg { width: 20px; height: 20px; }

.theme-toggle .icon-moon { display: none; }
html.dark .theme-toggle .icon-sun { display: none; }
html.dark .theme-toggle .icon-moon { display: block; }

/* ---------- Site nav ---------- */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.site-nav.visible {
  transform: translateY(0);
  opacity: 1;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}

.nav-logo {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
  padding: 0;
  margin: 0;
}

.nav-link {
  color: var(--gray);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
}

#experience,
#skills {
  scroll-margin-top: 84px;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 260px 1px 1fr;
  gap: 40px;
  margin-top: 56px;
}

.divider {
  background: var(--rule);
  width: 1px;
}

.sidebar h2,
.content h2 {
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar hr {
  border: none;
  border-top: 1px solid var(--rule);
  width: 48px;
  margin: 24px 0;
}

.edu-title {
  font-weight: 700;
  margin: 0 0 4px;
}

.edu-sub {
  margin: 4px 0 0;
  color: var(--ink);
}

.meta {
  color: var(--gray-soft);
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.plain-list, .other-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plain-list li, .other-list li {
  position: relative;
  padding-left: 18px;
}

.plain-list li::before, .other-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-soft);
}

.plain-list li em {
  color: var(--gray);
  font-style: italic;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list li {
  background: var(--mint);
  color: var(--ink);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
}

/* ---------- Timeline ---------- */

.timeline {
  list-style: none;
  padding: 0;
  margin: 24px 0 40px;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 27px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--rule);
}

.timeline-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 20px;
  position: relative;
  margin-bottom: 36px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline.spy .timeline-item .timeline-body {
  opacity: 0.45;
  transition: opacity 0.35s ease;
}

.timeline.spy .timeline-item .badge img {
  filter: grayscale(1) opacity(0.5);
  transition: filter 0.35s ease;
}

.timeline.spy .timeline-item.active .timeline-body {
  opacity: 1;
}

.timeline.spy .timeline-item.active .badge img {
  filter: none;
}

.badge {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  box-shadow: var(--shadow);
  flex-shrink: 0;
  background: #fff;
  padding: 6px;
}

.badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.timeline-body h3 {
  font-size: 1.05rem;
  margin-bottom: 2px;
}

.dot {
  color: var(--gray-soft);
}

.timeline-body .dot {
  font-weight: 400;
  margin: 0 2px;
}

.timeline-body ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--ink);
}

.timeline-body li {
  margin-bottom: 8px;
}

.other-list li strong { margin-right: 2px; }
.other-list .dot { color: var(--gray-soft); margin: 0 4px; }
.other-list em { color: var(--gray); font-style: normal; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  color: var(--gray);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer a {
  color: var(--gray);
  text-decoration: underline;
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-blob, .hero-bg { animation: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .divider { display: none; }
  .hero { padding: 40px 28px; }
  .hero-inner { gap: 24px; }
  .portrait { width: 140px; height: 140px; }
}

@media (max-width: 480px) {
  .page { padding: 40px 16px 48px; }
  .contact-row { flex-direction: column; gap: 4px; }
  .nav-inner { padding: 10px 16px; gap: 12px; }
  .nav-links { gap: 14px; }
  .nav-link { font-size: 0.8rem; }
  .nav-name { display: none; }
}

/* ---------- Print ---------- */

@media print {
  .theme-toggle, .btn, .site-nav { display: none; }
  html.dark { color-scheme: light; }
  body { background: #fff; color: #000; }
  .hero-bg { background: #ECF7F5 !important; animation: none; transform: rotate(1.4deg); border-radius: 32px; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .layout { gap: 24px; }
  .timeline-item { break-inside: avoid; }
  .timeline-body { opacity: 1 !important; }
  .badge img { filter: none !important; }
}
