:root {
  color-scheme: dark light;
  --bg: #0b0d10;
  --bg-alt: #12151a;
  --fg: #e8ebef;
  --fg-dim: #9aa4b2;
  --accent: #5eb1ff;
  --border: #21262d;
  --max-w: 720px;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* Light mode: same editorial layout, just the palette flips. Kept as a
   single overriding block rather than duplicating every rule, so the two
   themes can never drift out of sync on spacing/typography — only color. */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --bg-alt: #f4f5f7;
    --fg: #14171a;
    --fg-dim: #5b6472;
    --accent: #0969da;
    --border: #dde1e6;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
  /* Drives the "01 / 02 / 03…" section numbers below — add or remove a
     top-level <section> and the numbering stays correct with zero
     template changes. */
  counter-reset: section;
}

section { margin-bottom: 3.5rem; }
section:last-of-type { margin-bottom: 0; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: 2.1rem; }

/* Section headers: a monospace ordinal + the label, on one thin rule.
   No card, no background — the rule is the only container. */
main > section > h2 {
  counter-increment: section;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}
main > section > h2::before {
  content: counter(section, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0;
}
h3 { font-size: 1.05rem; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

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

.hero {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.hero-text {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.hero .title { color: var(--fg-dim); font-size: 1.05rem; }
.hero .location { color: var(--fg-dim); font-size: 0.9rem; }
.hero .tagline { max-width: 46ch; }

.avatar {
  width: 176px;
  height: auto;
  /* No border/card: the source image already fades to transparent at
     the bottom edge, matching --bg, so it dissolves straight into the
     page instead of sitting in a box. */
}

/* Wide enough to fit a right-aligned photo beside the text without
   squeezing the tagline into an awkward wrap — below this, stacked
   (photo above text) reads better than a cramped two-column attempt. */
@media (min-width: 640px) {
  .hero {
    flex-direction: row-reverse;
    align-items: center;
    gap: 2.5rem;
  }
  .avatar {
    width: 200px;
    flex-shrink: 0;
  }
}

.links {
  display: flex;
  gap: 0.9rem;
  margin-top: 0.5rem;
}
.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--fg);
}
.links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.links svg { width: 1.05rem; height: 1.05rem; }

/* Org logo: a flat single-color silhouette (see THIRD_PARTY_NOTICES.md —
   re-processed from each org's own mark, background discarded) so five
   different brands render as one uniform row: same size, same color,
   same treatment, regardless of the original logo's own colors or
   whether it baked in its own background chip. No card, no background,
   no border — just the glyph. */
.org-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

/* --- Experience: grouped by org, one heading + icon per org block --- */
.org-block {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.org-block:last-child { border-bottom: none; padding-bottom: 0; }
.org-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.org-header .org { margin: 0; }

.role { padding: 0.6rem 0 0.6rem 2.5rem; }
.role:first-of-type { padding-top: 0; }
.role-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.role-title { font-weight: 600; }
.period {
  color: var(--fg-dim);
  font-size: 0.85rem;
  font-family: var(--mono);
  white-space: nowrap;
}
.role .location {
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-top: 0.1rem;
}
.role ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--fg-dim);
  font-size: 0.92rem;
}

/* --- Education: single entries, same icon language as experience --- */
.entry {
  display: flex;
  gap: 0.9rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.entry:last-child { border-bottom: none; padding-bottom: 0; }
.entry .body { flex: 1; }
.entry .org { font-weight: 600; }
.entry .degree-line, .entry .location {
  color: var(--fg-dim);
  font-size: 0.85rem;
}
/* .link-row: shared by Experience org-level links, Education entries,
   and Projects — a small row of plain text links, not buttons/badges. */
.link-row {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  display: flex;
  gap: 1rem;
}

/* --- Skills: a plain grid of cells, not a row of pills. Dividers do the
   grouping instead of a background/border per item. --- */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.skills span {
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--mono);
  color: var(--fg-dim);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.pub {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; padding-bottom: 0; }
.pub .venue { color: var(--fg-dim); font-size: 0.85rem; }
.pub .summary { font-size: 0.92rem; color: var(--fg-dim); margin-top: 0.3rem; }

.project {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.project:last-child { border-bottom: none; padding-bottom: 0; }
.project .summary { font-size: 0.92rem; color: var(--fg-dim); margin-top: 0.3rem; }
.project .stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
}
.project .stack span::before { content: "· "; }
.project .stack span:first-child::before { content: ""; }

footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  color: var(--fg-dim);
  font-size: 0.8rem;
  text-align: center;
}
