:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --accent: #6ea8fe;
  --border: #272b35;
  --max: 1164px;        /* 920px +15% +10% */
  --radius: 12px;
  --gap: 1.5rem;
  --hero-h: 210px;      /* photo diameter (graph height matches the photo + name block) */
}

/* Light palette — applied when the user explicitly picks light, or when
   the system prefers light and the user has made no explicit choice. */
:root[data-theme="light"] {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1a1d23;
  --muted: #5b6472;
  --accent: #2563eb;
  --border: #e3e6ec;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --text: #1a1d23;
    --muted: #5b6472;
    --accent: #2563eb;
    --border: #e3e6ec;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

/* --- Nav --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
/* Inner row shares main's max-width + padding so the brand lines up with
   the page content (the hero) instead of sitting at the viewport edge. */
.nav__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav__brand { font-weight: 700; color: var(--text); }
.nav__right { display: flex; align-items: center; gap: 1.1rem; }
.nav__links { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.nav__links a { color: var(--muted); font-size: 0.92rem; }
.nav__links a:hover { color: var(--text); text-decoration: none; }

.theme-toggle {
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 1rem; line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); }
/* Text dingbats (always render, unlike the emoji moon). */
.theme-toggle::after { content: "\263E"; } /* ☾ shown while dark is active */
:root[data-theme="light"] .theme-toggle::after { content: "\2600"; } /* ☀ */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle::after { content: "\2600"; }
}

/* --- Layout --- */
main { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
.section { padding: 3.5rem 0; border-bottom: 1px solid var(--border); }
.section--hero { border-bottom: none; }
.section__heading { font-size: 1.6rem; margin: 0 0 1.25rem; }
.section__intro { color: var(--muted); margin-top: -0.5rem; }
.subheading { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* --- Hero --- */
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem;
  align-items: stretch; padding: 3rem 0;
}
/* Photo stacked above the name/text block. */
.hero__intro { display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; }
.hero__photo {
  flex: 0 0 var(--hero-h); height: var(--hero-h); width: var(--hero-h);
  border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; color: var(--muted);
  border: 1px solid var(--border);
}
.hero__body { flex: 1; min-width: 0; }

/* Graph panel — fills the column height (matches the left intro block) */
.hero__graph-wrap {
  display: flex; flex-direction: column; gap: 0.5rem; min-width: 0;
}
.hero__graph {
  margin: 0; position: relative; flex: 1 1 auto; min-height: 220px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.hero__graph svg { display: block; width: 100%; height: 100%; }
.gnode--theme .gnode__label { font-weight: 600; }
.gnode, .graph-links line { transition: opacity 0.15s ease; }
.gnode:hover circle, .gnode:focus circle { filter: brightness(1.15); }
.gnode:focus { outline: none; }
.gnode:focus circle { stroke: var(--accent); stroke-width: 2.5; }
/* Hover/focus highlighting: dim everything not connected to the active node. */
.hero__graph.is-hovering .gnode.is-dim { opacity: 0.15; }
.hero__graph.is-hovering .graph-links line.is-dim { opacity: 0.04; }

.graph-tip {
  position: absolute; z-index: 5; pointer-events: none;
  max-width: 220px; padding: 0.5rem 0.65rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.8rem; line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; gap: 0.25rem;
}
.graph-tip[hidden] { display: none; }
.graph-tip strong { font-size: 0.85rem; }
.graph-tip span { color: var(--muted); }
.graph-tip em { color: var(--accent); font-style: normal; font-size: 0.75rem; }

.hero__graph-cap {
  margin: 0; text-align: center;
  font-size: 0.72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.hero__name { font-size: 2.4rem; margin: 0 0 0.4rem; }
.hero__tagline { font-size: 1.2rem; color: var(--text); margin: 0 0 0.6rem; }
.hero__meta, .hero__availability { color: var(--muted); margin: 0.15rem 0; }
.hero__ctas { display: flex; gap: 0.6rem; margin-top: 1.2rem; flex-wrap: wrap; }

.btn {
  display: inline-block; padding: 0.55rem 1.1rem; border-radius: 8px;
  font-size: 0.92rem; border: 1px solid var(--border);
}
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--ghost { background: transparent; color: var(--text); }
.btn:hover { text-decoration: none; filter: brightness(1.08); }

/* --- Metrics --- */
.metrics {
  list-style: none; padding: 0; margin: 1rem 0 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.75rem;
}
.metrics--inline { grid-template-columns: repeat(2, auto); justify-content: start; gap: 1.25rem; }
.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.9rem; text-align: center;
}
.metric__value { display: block; font-size: 1.5rem; font-weight: 700; }
.metric__label { display: block; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; }

/* --- Timeline --- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline__item { padding: 1rem 0; border-top: 1px solid var(--border); }
.timeline__item:first-child { border-top: none; }
.timeline__head { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: baseline; }
.timeline__role { font-weight: 600; }
.timeline__org { color: var(--accent); }
.timeline__dates { color: var(--muted); font-size: 0.85rem; margin-left: auto; }
.timeline__bullets { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--muted); }

/* --- Cards --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
}
.card__title { margin: 0 0 0.5rem; font-size: 1.1rem; }
.card__summary { color: var(--muted); margin: 0 0 0.75rem; }
.card__link { font-size: 0.9rem; }
.pub__meta { display: flex; gap: 0.6rem; color: var(--muted); font-size: 0.85rem; margin-bottom: 0.35rem; }
.pub__role { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.5rem; }

.tags { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.78rem; color: var(--muted);
}

/* --- Contact --- */
.contact__availability { color: var(--accent); font-weight: 600; }
.contact__methods { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.6rem; }
.contact__method { display: flex; gap: 0.8rem; }
.contact__platform { width: 130px; color: var(--muted); }

/* --- Footer --- */
.footer {
  max-width: var(--max); margin: 0 auto; padding: 2rem 1.25rem 3rem;
  color: var(--muted); font-size: 0.88rem;
}
.footer__links { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.footer__links a { color: var(--muted); }

/* --- Nav dropdown (Work) --- */
.nav__dd { position: relative; }
.nav__dd-toggle { display: inline-flex; align-items: center; gap: 0.2rem; }
.nav__caret { font-size: 0.7em; }
.nav__menu {
  position: absolute; top: 100%; left: 0; min-width: 200px;
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.35rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease; z-index: 20;
}
.nav__dd:hover .nav__menu,
.nav__dd:focus-within .nav__menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.nav__menu a {
  color: var(--muted); font-size: 0.9rem;
  padding: 0.4rem 0.55rem; border-radius: 6px;
}
.nav__menu a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

/* --- About "Get in touch" card --- */
.about__touch {
  align-self: start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem;
}
.touch { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.touch__row {
  display: grid; grid-template-columns: 92px 1fr;
  align-items: baseline; gap: 0.15rem 0.6rem;
}
.touch__platform { color: var(--muted); font-size: 0.85rem; }
.touch__note { grid-column: 2; color: var(--muted); font-size: 0.75rem; }

/* --- CV page --- */
.cv__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.cv__contact {
  list-style: none; padding: 0; margin: 1.25rem 0 1rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.6rem 1.5rem;
}
.cv__contact li { display: flex; flex-direction: column; }
.cv__contact span { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
.cv__block { margin: 2.25rem 0; }
.cv__note { color: var(--muted); margin: 0.3rem 0 0; }

/* CV body + skills sidebar */
.cv__grid { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; align-items: start; }
.cv__main > .cv__contact { margin-top: 0; }
.cv__main > .section:first-of-type { padding-top: 0; }
.cv__aside { position: sticky; top: 80px; }
.skills-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
}
.skills-box .section__heading { font-size: 1.2rem; margin-bottom: 1rem; }
.skills__group { margin-bottom: 1rem; }
.skills__group:last-child { margin-bottom: 0; }
.skills__group .subheading { margin: 0 0 0.4rem; }

/* --- Subpages (project / theme) --- */
.subpage { border-bottom: none; }
.crumbs { color: var(--muted); font-size: 0.88rem; margin: 0 0 1rem; }
.subpage__title { font-size: 2rem; margin: 0 0 0.75rem; }
.prose { margin: 1.5rem 0; max-width: 70ch; }
.prose h1 { font-size: 1.6rem; margin: 1.5rem 0 0.75rem; }
.prose h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
.prose h3 { font-size: 1.05rem; margin: 1.25rem 0 0.5rem; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 0.1rem 0.35rem; font-size: 0.88em;
}
.prose pre {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; overflow-x: auto;
}
.prose pre code { background: none; border: none; padding: 0; }

/* --- Responsive --- */
@media (max-width: 760px) {
  :root { --hero-h: 150px; }
  .about { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 1.5rem 0; }
  .cv__grid { grid-template-columns: 1fr; }
  .cv__aside { position: static; }
  .timeline__dates { margin-left: 0; }
}
