/* ---- Fonts (self-hosted) ---- */
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../assets/fonts/ibm-plex-sans-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../assets/fonts/ibm-plex-sans-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../assets/fonts/ibm-plex-sans-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../assets/fonts/ibm-plex-sans-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../assets/fonts/ibm-plex-mono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../assets/fonts/ibm-plex-mono-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

/* ---- Tokens ---- */
:root {
  --paper: #fafaf8;
  --paper-raised: #f2f1ec;
  --ink: #1b1b18;
  --muted: #6e6d66;
  --rule: #e1dfd7;
  --signal: #2f6b4f;
  --delta-neg: #9c4221;

  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --content-w: 880px;
  --gap: clamp(1rem, 2vw, 1.5rem);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }

::selection {
  background: var(--signal);
  color: var(--paper);
}
a { color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }

.wrap {
  max-width: var(--content-w);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1rem;
  z-index: 100;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}
.wordmark {
  font-family: var(--font-mono);
  font-size: 1rem;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.wordmark-dot { color: var(--signal); }

.site-nav {
  display: flex;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
}
.site-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:hover {
  color: var(--ink);
  border-color: var(--signal);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--ink);
}

/* ---- Eyebrow / headings ---- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--signal);
  letter-spacing: 0.02em;
  margin-bottom: 0.6rem;
}
.section h2 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.01em;
  margin-bottom: 2rem;
}

.metric {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.delta-pos,
.delta-neg {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.delta-pos { color: var(--signal); }
.delta-neg { color: var(--delta-neg); }

.metric-was {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 400;
  text-decoration: line-through;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
}

/* ---- Hero ---- */
.hero {
  padding-block: clamp(3.5rem, 8vw, 6rem) clamp(3.5rem, 8vw, 5rem);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}
.hero-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(2.6rem, 6vw, 3.9rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 1.2rem;
}
.hero-tagline {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  max-width: 36ch;
  margin-bottom: 1.1rem;
}
.hero-meta {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 1.85rem;
}
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.35rem;
}
.link-row a {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.link-row a:hover {
  color: var(--signal);
  border-color: var(--signal);
}

.hero-photo img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid var(--rule);
  filter: grayscale(1);
}

@keyframes hero-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-text > * {
  animation: hero-in 0.5s ease both;
}
.hero-text > *:nth-child(1) { animation-delay: 0s; }
.hero-text > *:nth-child(2) { animation-delay: 0.08s; }
.hero-text > *:nth-child(3) { animation-delay: 0.16s; }
.hero-text > *:nth-child(4) { animation-delay: 0.24s; }
.hero-text > *:nth-child(5) { animation-delay: 0.32s; }
.hero-photo {
  animation: hero-in 0.6s ease 0.15s both;
}

@media (prefers-reduced-motion: reduce) {
  .hero-text > *,
  .hero-photo {
    animation: none;
  }
}

/* ---- Sections ---- */
.section {
  padding-block: clamp(3.5rem, 7vw, 5.5rem);
  border-top: 1px solid var(--rule);
}

.about-text {
  max-width: 62ch;
  font-size: 1.05rem;
}

/* ---- Experience ---- */
.role { margin-bottom: 2.5rem; }
.role:last-child { margin-bottom: 0; }
.role-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}
.role-org { font-weight: 500; }
.role-dates { color: var(--muted); }
.role-title {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0.9rem;
}
.role-bullets li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 0.6rem;
  max-width: 62ch;
}
.role-bullets li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--muted);
}
.role-bullets li:last-child { margin-bottom: 0; }

/* ---- Projects ---- */
.project {
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
  padding-left: 1rem;
  margin-left: -1rem;
  border-top: 1px solid var(--rule);
  border-left: 2px solid transparent;
  transition: border-left-color 0.2s ease;
}
.project:first-child { border-top: none; padding-top: 0; }
.project:last-child { padding-bottom: 0; }
.project:hover { border-left-color: var(--signal); }
.project-metric {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--signal);
  margin-bottom: 0.6rem;
  font-variant-numeric: tabular-nums;
}
.project-name {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.project-desc {
  color: var(--muted);
  max-width: 62ch;
  margin-bottom: 0.75rem;
}
.project-bullets {
  margin-bottom: 1rem;
}
.project-bullets li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 0.5rem;
  max-width: 62ch;
  color: var(--muted);
  font-size: 0.95rem;
}
.project-bullets li::before {
  content: '—';
  position: absolute;
  left: 0;
}
.project-bullets li:last-child { margin-bottom: 0; }
.project-tags {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.project-link {
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.project-link:hover {
  color: var(--signal);
  border-color: var(--signal);
}

.projects-more {
  margin-top: 2.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--muted);
}
.projects-more a {
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  color: var(--ink);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.projects-more a:hover {
  color: var(--signal);
  border-color: var(--signal);
}

/* ---- Skills ---- */
.skills-list {
  display: grid;
  gap: 1.4rem;
}
.skills-group dt {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.skills-group dd {
  margin: 0;
  max-width: 62ch;
}

/* ---- Contact ---- */
.contact-line {
  max-width: 52ch;
  color: var(--muted);
  margin-bottom: 2rem;
}
.contact-list li {
  display: flex;
  gap: 1.25rem;
  padding-block: 0.6rem;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.contact-list li:last-child { border-bottom: 1px solid var(--rule); }
.contact-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  width: 5.5rem;
  flex-shrink: 0;
}
.contact-list a {
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.contact-list a:hover {
  color: var(--signal);
  border-color: var(--signal);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--rule);
}
.footer-inner {
  padding-block: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---- 404 ---- */
.error-page {
  min-height: calc(100vh - 77px);
  display: flex;
  align-items: center;
}
.error-back {
  margin-top: 1.5rem;
}
.error-back a {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.error-back a:hover {
  color: var(--signal);
  border-color: var(--signal);
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    flex-direction: column;
    padding: 1rem 1.5rem 1.5rem;
    gap: 1rem;
    display: none;
  }
  .site-nav.is-open { display: flex; }

  .hero-inner {
    grid-template-columns: 1fr;
  }
  .hero-photo { max-width: 220px; }

  .role-head { flex-direction: column; }
  .contact-label { width: 4.5rem; font-size: 0.75rem; }
}

/* ---- Print ---- */
@page {
  margin: 1.5cm;
}
@media print {
  body {
    font-size: 11pt;
    color: #000;
  }
  .site-header,
  .nav-toggle,
  .skip-link {
    display: none;
  }
  .hero-text > *,
  .hero-photo {
    animation: none;
    opacity: 1;
    transform: none;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
  .link-row a::after,
  .project-link::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #333;
  }
  .hero {
    padding-top: 0;
  }
  .hero-photo img {
    max-width: 130px;
    border-color: #000;
  }
  .eyebrow,
  .metric,
  .project-metric {
    color: #000;
  }
  .section {
    border-top-color: #999;
  }
  .role,
  .project {
    break-inside: avoid;
  }
  .project {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }
  .site-footer {
    border-top-color: #999;
  }
}
