/* ============ Tokens ============ */
:root {
  --bg: #FAFAF6;
  --bg-raised: #F1F1EB;
  --text: #1C1D1A;
  --text-muted: #5B5C56;
  --line: #DEDED4;
  --accent: #3E5C50;
  --accent-soft: #E4E9E4;
  --serif: "Inter", -apple-system, sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max: 640px;
}

[data-theme="dark"] {
  --bg: #15160F;
  --bg-raised: #1D1F17;
  --text: #ECEBE3;
  --text-muted: #9B9C90;
  --line: #33352A;
  --accent: #9BC9A9;
  --accent-soft: #22271F;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; font-optical-sizing: auto; margin: 0; color: var(--text); }

a {
  color: inherit;
  text-decoration: none;
}

/* ============ Theme toggle ============ */
#theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: border-color 0.2s ease;
}
#theme-toggle:hover { border-color: var(--accent); }
#theme-toggle .dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.2s ease;
}

/* ============ Hero ============ */
.hero {
  padding: 6rem 0 3.5rem;
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.7s ease forwards;
}
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hero { animation: none; opacity: 1; transform: none; }
}

.hero h1 {
  font-size: clamp(2.8rem, 9vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.hero .role {
  margin: 1.1rem 0 0;
  font-size: 1.05rem;
  color: var(--accent);
}

.hero .tagline {
  max-width: 46ch;
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.hero-links {
  margin-top: 1.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
}
.hero-links a {
  font-size: 0.92rem;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.hero-links a:hover { color: var(--accent); border-color: var(--accent); }

/* ============ Sections ============ */
.section {
  padding: 3rem 0;
  border-top: 1px solid var(--line);
}

.section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.3rem;
}

.section > p {
  color: var(--text-muted);
  max-width: 60ch;
}

/* ============ Skills ============ */
.skill-list {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skill-list li {
  font-size: 0.86rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
}

/* ============ Timeline ============ */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}
.timeline li {
  position: relative;
  padding: 0 0 2.4rem 1.6rem;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -4.5px;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-period {
  font-size: 0.84rem;
  color: var(--text-muted);
}
.timeline-body h3 {
  font-size: 1.15rem;
  margin-top: 0.25rem;
}
.timeline-org {
  font-size: 0.92rem;
  color: var(--accent);
  margin: 0.15rem 0 0.6rem;
}
.timeline-body p { margin: 0.4rem 0; color: var(--text-muted); }
.timeline-body ul {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}
.timeline-body li { padding: 0; }
.timeline-body li::before { display: none; }
.timeline-body li + li { margin-top: 0.25rem; }

/* ============ Projects ============ */
.project-list {
  display: flex;
  flex-direction: column;
}
.project {
  display: block;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}
.project:first-child { border-top: none; }
.project h3 {
  font-size: 1.1rem;
  transition: color 0.2s ease;
}
.project:hover h3 { color: var(--accent); }
.project p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.project-tags {
  font-size: 0.82rem !important;
  color: var(--accent) !important;
  margin-top: 0.5rem !important;
}

/* ============ Contact ============ */
.contact-email {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.4rem;
  border-bottom: 1px solid var(--accent);
}

.contact-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.2rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.92rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.contact-button .arrow {
  color: var(--accent);
  transition: transform 0.15s ease;
}
.contact-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.contact-button:hover .arrow {
  transform: translateX(3px);
}

/* ============ Footer ============ */
footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}
footer a { border-bottom: 1px solid var(--line); }
footer a:hover { color: var(--accent); border-color: var(--accent); }

/* ============ Responsive ============ */
@media (max-width: 480px) {
  .hero { padding-top: 5rem; }
  footer { flex-direction: column; gap: 0.5rem; }
}