/* ============================================================
   Personal CV site — minimal theme
   Dark is the default; [data-theme="light"] overrides.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg:        #0e1116;
  --surface:   #161b23;
  --surface-2: #1c222c;
  --text:      #e6e9ef;
  --muted:     #97a1b0;
  --border:    #262d38;
  --accent:    #7c93ff;
  --accent-ink:#0e1116;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  --wrap:  760px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.18);
  --ring:  0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

[data-theme="light"] {
  --bg:        #ffffff;
  --surface:   #f7f8fa;
  --surface-2: #f0f2f5;
  --text:      #1a1f27;
  --muted:     #5b6572;
  --border:    #e4e7ec;
  --accent:    #4353d6;
  --accent-ink:#ffffff;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.topbar-brand {
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  letter-spacing: -0.01em;
}
.topbar-brand:hover { text-decoration: none; color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
[data-theme="dark"]  .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 8vw, 5.5rem) 0 2rem; }
.hero-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.hero-text { min-width: 0; }
.hero-photo {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hero-name {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
}
.hero-tagline {
  margin: .55rem 0 0;
  font-size: clamp(1rem, 2.4vw, 1.18rem);
  color: var(--accent);
  font-weight: 550;
}
.hero-location {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .95rem;
}

/* Social row */
.social {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.4rem;
}
.social-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  font-weight: 500;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.social-link:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.social-link svg { display: block; }

.btn {
  display: inline-block;
  margin-top: 1.25rem;
  padding: .6rem 1.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: 10px;
  transition: filter .15s ease, transform .1s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); transform: translateY(-1px); }

/* ---------- Sections ---------- */
.section { padding: 1.6rem 0; }
.section-title {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 650;
  margin: 0 0 1.1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.prose p { margin: 0 0 1rem; }
.prose { color: var(--text); }

/* ---------- Timeline (experience / education) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.timeline-item { display: flex; align-items: flex-start; gap: .9rem; }
.timeline-body { flex: 1; min-width: 0; }
.entry-logo {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #fff;               /* keeps dark logos legible in dark mode */
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}
.entry-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.timeline-role { font-weight: 600; }
.timeline-org { color: var(--accent); font-weight: 600; }
.timeline-date {
  color: var(--muted);
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timeline-sub, .timeline-note { color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.bullets { margin: .55rem 0 0; padding-left: 1.1rem; color: var(--text); }
.bullets li { margin: .25rem 0; }
.bullets li p { display: inline; margin: 0; }   /* markdownify wraps in <p>; keep inline */

/* ---------- Publications / patents ---------- */
.pub-list { list-style: none; counter-reset: pub; margin: 0; padding: 0; display: grid; gap: 1.3rem; }
.pub { position: relative; }
.pub-title { font-weight: 600; line-height: 1.4; }
.pub-meta { margin-top: .2rem; color: var(--muted); font-size: .92rem; }
.pub-authors { color: var(--text); }
.pub-authors strong { color: var(--text); }
.pub-venue::before, .pub-year::before { content: "·"; margin: 0 .45rem; color: var(--border); }
.pub-venue { font-style: italic; }

/* Publication card with thumbnail (image left, text right) */
.pub--media { display: flex; gap: 1.15rem; align-items: flex-start; }
.pub-thumb {
  flex-shrink: 0;
  width: 190px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.pub-thumb img { display: block; width: 100%; height: auto; }
.pub-body { flex: 1; min-width: 0; }

/* Link pills (publications, patents, projects) */
.link-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.pill {
  display: inline-block;
  padding: .18rem .6rem;
  font-size: .78rem;
  font-weight: 550;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  transition: color .15s, border-color .15s, background .15s;
}
.pill:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); background: var(--surface); }

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-title { margin: 0 0 .4rem; font-size: 1.02rem; font-weight: 650; }
.card-desc { margin: 0 0 .7rem; color: var(--muted); font-size: .92rem; }

/* ---------- Tags / skills ---------- */
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  font-size: .76rem;
  padding: .16rem .55rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.skills { display: grid; gap: 1rem; }
.skill-group { display: grid; gap: .45rem; }
.skill-name { font-weight: 600; font-size: .92rem; }

/* ---------- Definition lists (languages / certifications) ---------- */
.deflist { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.deflist li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--border);
}
.deflist li:last-child { border-bottom: 0; padding-bottom: 0; }
.deflist-term { font-weight: 550; }
.deflist-val { color: var(--muted); font-size: .9rem; text-align: right; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding: 1.6rem 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  color: var(--muted);
  font-size: .85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .social-label { display: none; }
  .social-link { padding: .5rem; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .hero-photo { width: 108px; height: 108px; }
  .pub--media { flex-direction: column; gap: .8rem; }
  .pub-thumb { width: 100%; max-width: 320px; }
}
