:root {
  --bg: #fff;
  --fg: #111;
  --muted: #555;
  --line: #ddd;
  --max-w: 760px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 1.6;
  font-size: clamp(15px, 1vw + 13px, 17px);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--fg);
  color: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

a { color: var(--fg); }
a:hover { color: var(--muted); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h2 {
  font-size: 1.3rem;
  border-bottom: 2px solid var(--fg);
  padding-bottom: 0.4rem;
  margin-bottom: 1.2rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { font-weight: 700; margin-right: auto; order: 1; }
.lang-switch { display: flex; gap: 0.3rem; order: 2; flex-shrink: 0; }
.site-nav {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  order: 3;
  flex-basis: 100%;
}
.site-nav a { text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.lang-switch button {
  background: none;
  border: 1px solid var(--fg);
  color: var(--fg);
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 3px;
}
.lang-switch button[aria-current="true"] {
  background: var(--fg);
  color: var(--bg);
}

/* Main layout */
main { max-width: var(--max-w); margin: 0 auto; padding: 0 1.2rem; }
section { padding: 2.5rem 0; border-bottom: 1px solid var(--line); }
section:last-child { border-bottom: none; }

/* Hero */
.hero {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-top: 2rem;
}
.hero-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--fg);
  flex-shrink: 0;
}
.hero-text { flex: 1; min-width: 240px; }
.hero-tagline { font-size: 1.1rem; color: var(--muted); margin: 0.2rem 0; }
.hero-location { color: var(--muted); margin: 0 0 0.8rem; font-size: 0.9rem; }
.hero-contact { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.9rem; }
.hero-summary { margin: 0; }

/* Entry list (experience, education, org, achievements) */
.entry-list { display: flex; flex-direction: column; gap: 1.5rem; }
.entry-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-weight: 700;
}
.entry-period { font-weight: 400; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.entry-meta { color: var(--muted); font-size: 0.9rem; margin: 0.1rem 0 0.5rem; }
.entry-list ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.entry-list li { margin-bottom: 0.3rem; }

/* Project cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
}
.card {
  border: 1px solid var(--line);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card h3 { font-size: 1rem; }
.card p { margin: 0; font-size: 0.9rem; color: var(--muted); flex: 1; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.card-link {
  align-self: flex-start;
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid var(--fg);
}

/* Publications */
.plain-list { padding-left: 1.2rem; margin: 0; }
.plain-list li { margin-bottom: 0.6rem; }

/* Skills */
.skills-block { display: flex; flex-direction: column; gap: 0.8rem; }
.skills-row strong { display: inline-block; min-width: 140px; }

/* Footer */
footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.2rem 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-contact { list-style: none; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem; margin: 0.6rem 0; }
.copyright { margin-top: 1rem; font-size: 0.8rem; }

@media (max-width: 480px) {
  .hero { flex-direction: column; align-items: center; text-align: center; }
  .hero-contact { justify-content: center; }
  .entry-header { flex-direction: column; gap: 0.2rem; }
}
