/* ---------------------------------------------------------------
   Palette. Light values live on bare :root so they are always
   defined; dark mode only overrides the tokens.
   --------------------------------------------------------------- */
:root {
  --bg:        #fcfcfb;
  --panel:     #ffffff;
  --text:      #16181d;
  --text-soft: #4a5058;
  --muted:     #7c838d;
  --rule:      #e3e5e9;
  --accent:    #1f4fd8;
  --accent-bg: #eef2fe;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0f1115;
    --panel:     #151920;
    --text:      #e8eaee;
    --text-soft: #b2b8c2;
    --muted:     #7d848f;
    --rule:      #262b34;
    --accent:    #7ba2ff;
    --accent-bg: #1a2233;
  }
}

:root[data-theme="dark"] {
  --bg:        #0f1115;
  --panel:     #151920;
  --text:      #e8eaee;
  --text-soft: #b2b8c2;
  --muted:     #7d848f;
  --rule:      #262b34;
  --accent:    #7ba2ff;
  --accent-bg: #1a2233;
}

/* --------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-color: currentColor; }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}

/* --- hero ------------------------------------------------------ */

.hero { margin-bottom: 3.5rem; }

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 2.9rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.role {
  margin: 0.6rem 0 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.summary {
  margin: 1.5rem 0 0;
  max-width: 38rem;
  color: var(--text-soft);
  font-size: 1.02rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.links a {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-soft);
  font-size: 0.875rem;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.links a:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

/* --- sections -------------------------------------------------- */

section { margin-bottom: 3.25rem; }

h2 {
  margin: 0 0 1.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- experience & education ------------------------------------ */

.job, .edu { margin-bottom: 2rem; }
.job:last-child, .edu:last-child { margin-bottom: 0; }

.job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.15rem 1.25rem;
}

.job-head h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.at {
  font-weight: 400;
  color: var(--text-soft);
}

.meta {
  margin: 0;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.place::before {
  content: "·";
  margin: 0 0.45em;
}

.job ul {
  margin: 0.6rem 0 0;
  padding-left: 1.05rem;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.job li { margin-bottom: 0.3rem; }
.job li::marker { color: var(--muted); }

.thesis {
  margin: 0.35rem 0 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

/* --- skills ---------------------------------------------------- */

.skills {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 0.85rem 1.5rem;
  margin: 0;
}

.skills dt {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 0.12rem;
}

.skills dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* --- certifications -------------------------------------------- */

ul.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}

ul.plain li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

ul.plain strong { font-weight: 600; }

.muted, ul.plain a {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

ul.plain a { color: var(--accent); }

/* --- footer ---------------------------------------------------- */

footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--muted);
}

footer p { margin: 0; }

/* --- theme toggle ---------------------------------------------- */

.theme-toggle {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* --- responsive ------------------------------------------------ */

@media (max-width: 34rem) {
  .wrap { padding-top: 3.5rem; }

  .job-head { display: block; }

  .meta {
    margin-top: 0.15rem;
    white-space: normal;
  }

  .skills {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .skills dd { margin-bottom: 0.85rem; }
}

@media print {
  .theme-toggle, footer { display: none; }
  body { background: #fff; color: #000; }
  .wrap { max-width: none; padding: 0; }
}
