/* ---------- Tokens ---------- */
:root {
  --bg: #15181c;          /* charcoal */
  --surface: #1c2027;     /* raised panels */
  --line: #2b313a;        /* borders, rules */
  --text: #e4e8ed;
  --muted: #98a2ae;
  --accent: #7fa9d4;      /* steel blue */
  --accent-strong: #a6c6e8;
  --accent-ink: #0f1a26;  /* text on accent */

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-hero: clamp(2.25rem, 5.2vw + 0.5rem, 4.25rem);

  --radius: 10px;
  --gutter: 16px;
  --maxw: 1200px;
  --label-col: 160px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
code {
  font-size: 0.92em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.35em;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 720px) { :root { --gutter: 32px; } }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 6px; z-index: 100;
}
.skip:focus { left: 8px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(21, 24, 28, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav__name { color: var(--text); font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.nav__links { display: flex; gap: 28px; }
.nav__links a { color: var(--muted); text-decoration: none; font-size: var(--step--1); font-weight: 500; }
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__toggle { display: none; }

@media (max-width: 640px) {
  .nav__toggle {
    display: inline-block; background: none; border: 1px solid var(--line); color: var(--text);
    font: inherit; font-size: var(--step--1); padding: 6px 12px; border-radius: 6px; cursor: pointer;
  }
  .nav__links {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 14px var(--gutter); font-size: var(--step-0); border-top: 1px solid var(--line); }
  /* single-link nav (charts.html) stays inline instead of collapsing into a menu */
  .nav__links--static { display: flex; position: static; flex-direction: row; background: none; border: 0; }
  .nav__links--static a { padding: 0; font-size: var(--step--1); border: 0; }
}

/* ---------- Hero ---------- */
.hero { padding-top: clamp(64px, 12vw, 132px); }
.hero__title {
  font-size: var(--step-hero);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  max-width: 15ch;
}
.hero__role { margin-top: 28px; color: var(--muted); font-size: var(--step-1); }
.hero__loc { display: block; font-size: var(--step-0); margin-top: 2px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 22px; border-radius: 8px;
  font-weight: 600; font-size: var(--step--1); text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn--solid { background: var(--accent); color: var(--accent-ink); }
.btn--solid:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn--ghost { border: 1px solid var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--text); }

/* The signal trace: the one moving thing on the page */
.trace { margin: clamp(48px, 8vw, 88px) 0 0; }
.trace canvas {
  display: block; width: 100%; height: 140px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.trace figcaption { color: var(--muted); font-size: var(--step--1); padding-top: 10px; }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 104px) 0 0; }
.section__grid { display: grid; gap: 20px; }
.section__title { font-size: var(--step-1); font-weight: 600; color: var(--accent); }
@media (min-width: 860px) {
  .section__grid { grid-template-columns: var(--label-col) 1fr; gap: 40px; }
  .section__title { padding-top: 3px; position: sticky; top: 84px; align-self: start; }
}
.prose { max-width: 66ch; }
.prose p { font-size: var(--step-1); line-height: 1.55; }
.prose p + p { color: var(--muted); }

/* Skills */
.skills { display: grid; gap: 28px; }
@media (min-width: 640px) { .skills { grid-template-columns: 1fr 1fr; gap: 32px 40px; } }
.skills__group h3 { font-size: var(--step-0); font-weight: 600; margin-bottom: 12px; }
.chips, .tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-size: var(--step--1); padding: 5px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
}
.chips--learning li { background: transparent; border-style: dashed; color: var(--muted); }

/* Projects */
.projects { display: grid; gap: 24px; }
.project {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px;
}
.project h3 { font-size: var(--step-1); font-weight: 600; }
.project p { color: var(--muted); }
.project__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.status {
  font-size: 0.8125rem; font-weight: 500; color: var(--accent-strong);
  border: 1px solid rgba(127, 169, 212, 0.4); border-radius: 999px; padding: 1px 10px;
}
.tags { margin-bottom: 4px; }
.tags li { font-size: 0.8125rem; color: var(--text); padding: 2px 10px; border-radius: 6px; background: rgba(127, 169, 212, 0.1); }
.link { display: inline-block; margin-top: 16px; font-size: var(--step--1); font-weight: 500; }

.project--feature { padding: 0; overflow: hidden; display: grid; }
.project__media { background: #0d1014; border-bottom: 1px solid var(--line); }
.project__media img { width: 100%; height: 260px; object-fit: cover; object-position: center; opacity: 0.92; }
.project--feature .project__text { padding: 24px; }
@media (min-width: 900px) {
  .project--feature { grid-template-columns: 0.9fr 1.1fr; }
  .project__media { border-bottom: 0; border-right: 1px solid var(--line); }
  .project__media img { height: 100%; min-height: 340px; }
  .project--feature .project__text { padding: 32px; }
}

.project__details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.project__details summary {
  cursor: pointer; font-weight: 500; font-size: var(--step--1); color: var(--text);
  list-style: none; display: inline-flex; align-items: center; gap: 8px;
}
.project__details summary::-webkit-details-marker { display: none; }
.project__details summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg); transition: transform 0.2s;
}
.project__details[open] summary::before { transform: rotate(45deg); }
.project__details dl { margin: 14px 0 0; }
.project__details dt { font-weight: 600; font-size: var(--step--1); margin-top: 12px; }
.project__details dd { margin: 4px 0 0; color: var(--muted); font-size: var(--step--1); }

.projects__grid { display: grid; gap: 24px; }
@media (min-width: 760px) { .projects__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .projects__grid { grid-template-columns: repeat(3, 1fr); } }
.project__meta { font-size: var(--step--1); margin: -4px 0 12px; }
.status--muted { color: var(--muted); border-color: var(--line); }

/* Site stats */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.stats__lead { max-width: 62ch; color: var(--muted); margin-bottom: 28px; }
.stats__note { color: var(--muted); font-size: var(--step--1); margin: 24px 0 0; max-width: 62ch; }
.stats__empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 28px 24px; color: var(--muted); margin: 0;
}
.stats__more { margin-top: 20px; }

.tiles {
  display: grid; grid-template-columns: repeat(2, 1fr); margin: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.tile { padding: 18px 16px 18px 0; display: flex; flex-direction: column-reverse; gap: 2px; }
.tile:nth-child(n+3) { border-top: 1px solid var(--line); }
.tile dt { color: var(--muted); font-size: var(--step--1); }
.tile dd { margin: 0; font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
@media (min-width: 760px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tile:nth-child(n+3) { border-top: 0; }
  .tile + .tile { padding-left: 20px; border-left: 1px solid var(--line); }
}
@media (max-width: 759px) {
  .tile:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
}

.chart { margin: 32px 0 0; }
.chart__title { font-weight: 600; margin-bottom: 14px; }
.chart__plot { position: relative; height: 180px; border-bottom: 1px solid var(--muted); }
.chart__plot::before { /* gridline at the max value */
  content: ""; position: absolute; left: 0; right: 0; top: 0; border-top: 1px dashed var(--line);
}
.chart__max {
  position: absolute; top: -9px; right: 0; padding-left: 6px;
  background: var(--bg); color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums;
}
.chart__bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; padding-right: 40px; }
.chart__bar {
  flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default;
  background: none; border: 0; padding: 0; min-width: 0;
}
.chart__bar span {
  display: block; width: 100%; min-height: 2px;
  background: var(--accent); border-radius: 4px 4px 0 0; opacity: 0.85;
}
.chart__bar[data-zero] span { background: var(--line); opacity: 1; }
.chart__bar:hover span, .chart__bar:focus-visible span, .chart__bar.is-active span { opacity: 1; background: var(--accent-strong); }
.chart__bar:focus-visible { outline-offset: 1px; }
.chart__axis {
  display: flex; justify-content: space-between; padding-right: 40px;
  color: var(--muted); font-size: 0.75rem; margin-top: 6px;
}
.chart__tip {
  position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px; font-size: var(--step--1); white-space: nowrap; pointer-events: none; z-index: 2;
}
.chart__tip strong { font-variant-numeric: tabular-nums; }

.breakdowns { display: grid; gap: 28px; margin-top: 36px; }
@media (min-width: 760px) { .breakdowns { grid-template-columns: 1fr 1fr; gap: 40px; } }
.breakdown h3 { font-size: var(--step-0); font-weight: 600; margin-bottom: 12px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: var(--step--1); }
.bars__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars__value { color: var(--muted); font-variant-numeric: tabular-nums; }
.bars__track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--line); }
.bars__fill { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.bars__none { color: var(--muted); }
.projects__grid .project { display: flex; flex-direction: column; }
.projects__grid .project .link { margin-top: auto; padding-top: 16px; }

/* Contact */
.section--contact { padding-bottom: clamp(64px, 9vw, 104px); }
.contact__lead { font-size: var(--step-2); line-height: 1.3; max-width: 26ch; margin-bottom: 28px; }
.contact__links { list-style: none; padding: 0; margin: 28px 0 0; display: flex; gap: 24px; flex-wrap: wrap; }
.contact__links a { font-weight: 500; }

.footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: var(--step--1); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
