/* Self-hosted fonts (SIL Open Font License, see fonts/README.md) */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
}

:root {
  --bg: #0B0D0E;              /* graphite, no colour tint */
  --bg-alt: #131618;
  --card-alt: #1B1F22;
  --border: #24292C;
  --text-main: #EDEFEF;       /* headings and body — ~17:1 on --bg */
  --text-muted: #9BA3A7;      /* secondary copy, dates, tags — ~7.6:1 on --bg */
  --accent: #7AA7F5;          /* steel blue: links, CTAs, focus — 8:1 on --bg */
  --on-accent: #0B0D0E;       /* text drawn on top of accent-filled buttons */
  --max-width: 1120px;
  --font-head: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; text-wrap: balance; }

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  z-index: 50;
}
.skip-link:focus { top: 0.5rem; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header — name + the three things a recruiter needs, always in reach */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 13, 14, 0.88);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 0.75rem;
}

.nav-name {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
  margin-right: auto;
}

/* In-page section links; the one you're reading gets aria-current */
.nav-sections { display: flex; gap: 1rem; }
.nav-sections a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 150ms, border-color 150ms;
}
.nav-sections a:hover { color: var(--text-main); }
.nav-sections a[aria-current] { color: var(--text-main); border-bottom-color: var(--text-main); }

/* Keep headings clear of the sticky header when jumping to a section */
section[id], main, .project[id] { scroll-margin-top: 4.5rem; }
main:focus { outline: none; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

/* Phones: section links drop to their own scrollable row under the name */
@media (max-width: 640px) {
  .nav { flex-wrap: wrap; row-gap: 0.5rem; }
  .nav-sections { order: 3; width: 100%; overflow-x: auto; gap: 1.25rem; }
  .nav-actions { padding-left: 0; border-left: 0; }
  section[id], main, .project[id] { scroll-margin-top: 7rem; }
}

.nav-actions a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
}
.nav-actions a:hover { color: var(--text-main); }

.nav-actions .nav-resume { color: var(--text-main); }

/* Hero — the one screen every recruiter actually reads */
.hero {
  position: relative;
  padding: clamp(3rem, 9vw, 5.5rem) 0 clamp(2.5rem, 6vw, 3.5rem);
}
.hero .proof { margin-top: clamp(2rem, 5vw, 3rem); }
@media (min-width: 960px) {
  .hero-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 4rem; align-items: center; }
  .hero .proof { grid-template-columns: 1fr; margin-top: 0; border-top: 0; padding: 0 0 0 2.5rem; border-left: 1px solid var(--border); gap: 1.75rem; }
}

h1 { font-size: clamp(2.3rem, 7vw, 4rem); line-height: 1.1; margin-bottom: 1rem; }

.hero-tagline {
  font-size: clamp(1.1rem, 2.6vw, 1.35rem);
  color: var(--text-muted);
  max-width: 36rem;
  margin-bottom: 1.5rem;
  text-wrap: pretty; /* no single word stranded on the last line */
}
.hero-tagline strong { color: var(--text-main); font-weight: 600; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.hero .hero-actions { margin-bottom: 0; }

/* Availability: what recruiters filter on, first thing in the hero */
.hero-status {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.hero-status strong { color: var(--text-main); font-weight: 600; white-space: nowrap; }
.status-dot {
  display: inline-block;
  vertical-align: middle;
  margin: -2px 0.5rem 0 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3DD68C; /* status light stays green, independent of --accent */
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  font-weight: 600;
  text-decoration: none;
  transition: background 150ms, border-color 150ms, transform 150ms;
}
.btn:hover { border-color: var(--accent); background: var(--card-alt); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(0.88); }

/* Page header on Projects / Experience */
.page-hero { padding: clamp(2.75rem, 8vw, 4.5rem) 0 clamp(1.5rem, 4vw, 2.25rem); }
.page-hero h1 { font-size: clamp(2.3rem, 6.5vw, 3.6rem); margin-bottom: 0.75rem; }
.page-hero .lede { margin: 0; }
.page-hero-grid { display: grid; gap: 2rem; }
@media (min-width: 900px) { .page-hero-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: center; } }
.edu-card { background: var(--card-alt); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem; }
.edu-card h3 { font-size: 1.3rem; }
.edu-card .entry-sub { margin-bottom: 0.75rem; }
.edu-card .also { margin-top: 0; }
.edu-label { font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; }

.more-link { display: inline-block; margin-top: 1.25rem; font-weight: 600; }

/* Section rhythm — soft alternating bands instead of boxed-in cards */
section { padding: clamp(2.5rem, 6vw, 3.75rem) 0; }
section.band { background: var(--bg-alt); }

.section-label {
  font-size: clamp(1.5rem, 3.5vw, 1.9rem);
  margin-bottom: 1.25rem;
}

.lede { font-size: 1.15rem; color: var(--text-muted); max-width: 40rem; }
.project p, .status-list, .bullets, .highlight, .skill-row p, .entry-sub { max-width: 68ch; }
.lede strong { color: var(--text-main); font-weight: 600; }

.entry + .entry { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--border); }

.entry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
}
.entry-head h3 { font-size: 1.3rem; }
.entry-date { font-variant-numeric: tabular-nums; font-family: var(--font-mono); color: var(--text-muted); font-size: 0.88rem; white-space: nowrap; }
.entry-sub { color: var(--text-muted); margin: 0.25rem 0 1rem; }
.entry-role { color: var(--accent); font-weight: 600; margin: 0.25rem 0 1rem; }
.bullets li strong { color: var(--text-main); font-weight: 600; }
.entry .tech { margin-top: 1rem; }

/* One-line outcome above the details: "From hours to minutes." */
.outcome {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: clamp(1.15rem, 2.6vw, 1.3rem);
  line-height: 1.3;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}
.project .outcome { color: var(--text-main); margin-bottom: 0.75rem; }

.highlight {
  font-size: 1.05rem;
  margin-bottom: 1rem;
}
.highlight strong { color: var(--accent); }

.bullets { list-style: none; }
.bullets li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}

.also {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

/* Other roles: one line each, title on the left, dates on the right */
.also-list { list-style: none; margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.also-label { font-family: var(--font-head); font-weight: 600; color: var(--text-main); margin-bottom: 0.5rem; }
.also-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.1rem 1rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.also-list li strong { color: var(--text-main); font-weight: 600; }

/* Projects */
/* Stacked cards; the featured ones carry a full-width diagram */
.project-grid { display: grid; gap: 1.25rem; }
.project {
  display: flex;
  flex-direction: column;
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: clamp(1.25rem, 2.5vw, 2rem);
}
.project .project-links, .project > .project-link { margin-top: auto; }
/* Status chip: where each project stands, before the copy */
.project .badge { width: fit-content; align-self: flex-start; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.75rem; margin-bottom: 0.75rem; }
.project .badge-live { color: var(--accent); border-color: rgba(122, 167, 245, 0.4); }
.project-body > :last-child, .project-text > :last-child { margin-bottom: 0; }

/* Wide screens: two cards a row; featured ones take the full row */
@media (min-width: 760px) {
  .project-grid { grid-template-columns: 1fr 1fr; }
  .project.lead, .project.featured { grid-column: 1 / -1; }
}
/* Home lead card: text left, its diagram right */
@media (min-width: 1000px) {
  .project.lead { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2.5rem; align-items: center; }
  .project.lead .diagram { margin: 0; }
  /* Projects page: description left, status right, diagram full width below */
  .project.featured { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2.5rem; }
  .project.featured > h2, .project.featured > .outcome, .project.featured > .diagram, .project.featured > .badge { grid-column: 1 / -1; justify-self: start; }
  .project.featured > .diagram { justify-self: stretch; }
  .project.featured > .project-body { grid-column: 1; }
  .project.featured > .status-list { grid-column: 2; }
}
.project h2, .project h3 { font-size: clamp(1.3rem, 3vw, 1.5rem); margin-bottom: 0.5rem; }
.project p { color: var(--text-muted); margin-bottom: 0.75rem; }
.project > :last-child { margin-bottom: 0; }

/* Built / In progress / Next, so the status of each part is clear at a glance */
.status-list { list-style: none; margin-bottom: 0.75rem; }
.status-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0 1rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.status-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-main);
  padding-top: 0.25rem;
}
@media (max-width: 480px) {
  .status-list li { grid-template-columns: 1fr; margin-bottom: 0.75rem; }
}

.tech { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.tech li { font-size: 0.8rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: 4px; padding: 0.1rem 0.5rem; line-height: 1.6; }
.ext { display: inline-block; font-size: 0.85em; transition: transform 150ms; }
a:hover .ext { transform: translate(2px, -2px); }

.project-link { display: inline-block; padding: 0.5rem 0; font-size: 0.92rem; font-weight: 600; color: var(--text-main); }
.project-link:hover { color: var(--accent); }
.project-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* Diagram: dark frame to match the page; click opens it full size */
.diagram { margin: 1.25rem 0 0; }
.project .diagram:not(:last-child) { margin-bottom: 1.25rem; }
.diagram a {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
  transition: border-color 150ms;
}
.diagram a:hover { border-color: var(--text-muted); }
.diagram img, .diagram svg { display: block; width: 100%; height: auto; border-radius: 4px; }

/* Self-drawing diagram: boxes fade in, then each link traces itself */
.traced .trace-node { opacity: 0; transition: opacity 500ms ease; }
.traced .trace-line { transition: stroke-dashoffset 900ms var(--ease); }
.traced .trace-late { opacity: 0; transition: opacity 600ms ease; }
.traced.is-traced .trace-node, .traced.is-traced .trace-late { opacity: 1; }
/* Diagram lightbox: full width on the page; Esc, Close or the backdrop closes it */
.lightbox { width: min(96vw, 1600px); max-width: none; max-height: 94vh; padding: 0.75rem; margin: auto; background: var(--bg); color: var(--text-main); border: 1px solid var(--border); border-radius: 12px; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.78); }
.lightbox img { display: block; width: 100%; height: auto; max-height: calc(94vh - 5rem); object-fit: contain; border-radius: 4px; }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 0.75rem; }
.lightbox .btn { padding: 0.5rem 1rem; font: inherit; font-weight: 600; cursor: pointer; }

.diagram figcaption {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
  text-align: center;
}

/* Skills */
.skill-row {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 0.5rem 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.skill-row:last-child { border-bottom: 1px solid var(--border); }
.skill-row h3 { font-size: 1.02rem; }
.skill-row p { color: var(--text-muted); }
.skill-row .tech { margin: 0.5rem 0 0; }

@media (max-width: 640px) {
  .skill-row { grid-template-columns: 1fr; }
}

/* Final CTA */
.cta { text-align: center; }
.cta h2 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin-bottom: 0.5rem; }
.cta p { color: var(--text-muted); max-width: 32rem; margin: 0 auto 1.75rem; }
.cta p strong { color: var(--text-main); }
.cta .hero-actions { justify-content: center; margin-bottom: 0; }

/* Email you can read and copy, for people whose mail app doesn't open */
.email-line {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cta .email-line { margin-bottom: 1.25rem; }
.email-address { font-family: var(--font-mono); color: var(--text-main); font-size: 1.05rem; }
.no-js .copy-btn { display: none; }
.copy-btn {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
}
.copy-btn:hover { border-color: var(--text-muted); color: var(--text-main); }
.copy-btn.is-copied { border-color: var(--accent); color: var(--accent); }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}
.footer-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.75rem 2rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.25rem; }
.footer-links a { color: var(--text-main); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
@media (min-width: 760px) { .footer-row { justify-content: space-between; text-align: left; } }
.deploy-stamp { display: block; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 0.8rem; margin-bottom: 0.25rem; }
.deploy-stamp[hidden] { display: none; }

/* Proof strip: three numbers under the hero; stacks on phones */
.proof {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}
.proof li { display: flex; flex-direction: column; gap: 0.25rem; }
.proof-num {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  line-height: 1.1;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}
.proof-text { color: var(--text-muted); font-size: 0.95rem; line-height: 1.5; }
@media (max-width: 640px) {
  .proof { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 480px) {
  .nav-actions { gap: 0.75rem; }
  /* GitHub/LinkedIn sit right below in the hero; dropping them keeps the header to two rows */
  .nav-actions a:not(.nav-resume) { display: none; }
  .btn { flex: 1 1 calc(50% - 0.7rem); text-align: center; }
}

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

.nowrap { white-space: nowrap; }
