:root {
  --bg: #fbfaf7;
  --panel: #ffffff;
  --line: #e7e3da;
  --text: #1b2430;
  --body: #3a4552;
  --muted: #667180;
  --accent: #0a66c2;
  --accent-soft: #e8f1fb;
  --max: 960px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
}

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* Header */
header.site {
  position: sticky; top: 0; z-index: 10;
  background: rgba(251, 250, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header.site .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand { color: var(--text); font-weight: 700; letter-spacing: 0.2px; }
.brand:hover { text-decoration: none; }
.brand .cred { color: var(--muted); font-weight: 600; }
header.site nav a { color: var(--muted); margin-left: 22px; font-size: 0.95rem; }
header.site nav a:hover { color: var(--text); text-decoration: none; }

/* Hero */
.hero {
  padding: 96px 0 72px;
  display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center;
}
.hero .portrait {
  width: 260px; height: 260px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--panel); box-shadow: 0 0 0 6px var(--accent-soft), 0 12px 30px rgba(27, 36, 48, 0.12);
}
.eyebrow { color: var(--accent); font-size: 0.9rem; letter-spacing: 1.5px; text-transform: uppercase; }
.hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.5rem); line-height: 1.1; margin: 12px 0 18px; }
.hero p.lead { color: var(--body); font-size: 1.15rem; max-width: 640px; }
.cta { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--text); font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn { background: var(--panel); }
.btn:hover { text-decoration: none; filter: brightness(0.96); }

/* Education */
.edu {
  display: grid; grid-template-columns: 170px 1fr; align-items: stretch;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.edu-logo-cell { display: grid; place-items: center; padding: 24px; border-right: 1px solid var(--line); }
.edu-logo { width: 120px; height: auto; }
.edu-degrees { padding: 22px 26px; }
.edu-degrees .job:last-child { margin-bottom: 0; }
@media (max-width: 560px) {
  .edu { grid-template-columns: 1fr; }
  .edu-logo-cell { border-right: 0; border-bottom: 1px solid var(--line); padding: 18px; }
  .edu-logo { width: 100px; }
  .edu-degrees { padding: 18px; }
}

/* Experience summary (home) */
.exp-summary { display: grid; gap: 4px; }
.exp-row { display: grid; grid-template-columns: 112px 1fr auto; gap: 20px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.exp-logo { width: 112px; height: 56px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.exp-row:last-child { border-bottom: 0; }
.exp-row h3 { margin: 0 0 4px; font-size: 1.05rem; }
.exp-row p { margin: 0; color: var(--body); font-size: 0.95rem; }
.exp-row .meta { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
@media (max-width: 560px) {
  .exp-row { grid-template-columns: 88px 1fr; gap: 4px 14px; align-items: start; }
  .exp-logo { width: 88px; height: 44px; grid-row: span 2; }
  .exp-row .meta { grid-column: 2; grid-row: 1; }
}
.exp-full { border-top: 0; padding-top: 8px; }
.job-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; margin-bottom: 22px; box-shadow: 0 1px 2px rgba(27, 36, 48, 0.04);
}
.job-head { display: flex; align-items: center; gap: 18px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.job-logo { width: 150px; height: 75px; object-fit: contain; flex: none; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.job-head h3 { margin: 0 0 2px; }
.sub-label { display: flex; align-items: center; gap: 8px; }
.icon {
  width: 26px; height: 26px; padding: 4px; border-radius: 50%; flex: none;
  background: var(--accent-soft); stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
@media (max-width: 560px) {
  .job-card { padding: 18px 16px; }
  .job-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .job-logo { width: 104px; height: 52px; }
}

/* Hero highlights */
.highlights {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 14px;
  margin: -24px 0 56px;
}
.highlights div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.highlights b { display: block; font-size: 1.5rem; line-height: 1.2; color: var(--accent); }
.highlights span { color: var(--body); font-size: 0.88rem; }

/* Previous / next project */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { display: block; max-width: 48%; font-weight: 600; color: var(--accent); }
.pager a small { display: block; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.pager .next { margin-left: auto; text-align: right; }

/* Sections */
section { padding: 56px 0; border-top: 1px solid var(--line); }
section h2 { font-size: 1.6rem; margin: 0 0 24px; }

/* Project cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 20px; }
.card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px; color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card { box-shadow: 0 1px 2px rgba(27, 36, 48, 0.04); }
.card:hover { box-shadow: 0 8px 24px rgba(27, 36, 48, 0.08); }
.card:hover { transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.card-img {
  display: block; width: calc(100% + 44px); height: auto; aspect-ratio: 16 / 9; object-fit: cover;
  margin: -22px -22px 18px; border-radius: 12px 12px 0 0; border-bottom: 1px solid var(--line); background: #fff;
}
.card { overflow: hidden; }
.card p { margin: 0 0 14px; color: var(--body); font-size: 0.95rem; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 0.78rem; color: var(--accent); background: var(--accent-soft); border: 1px solid transparent;
  padding: 2px 10px; border-radius: 999px;
}

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.skills h3 { font-size: 0.95rem; color: var(--accent); margin: 0 0 8px; text-transform: uppercase; letter-spacing: 1px; }
.skills ul { margin: 0; padding-left: 18px; color: var(--body); }

/* Experience */
.job { margin-bottom: 22px; }
.job h3 { margin: 0; font-size: 1.05rem; }
.job .meta { color: var(--muted); font-size: 0.9rem; }
h4.sub-label { font-size: 0.78rem; color: var(--text); text-transform: uppercase; letter-spacing: 1px; margin: 18px 0 2px; font-weight: 700; }
h3.group { font-size: 0.95rem; color: var(--accent); margin: 32px 0 14px; text-transform: uppercase; letter-spacing: 1px; }
.job ul { margin: 8px 0 0; padding-left: 20px; color: var(--body); font-size: 0.95rem; }
.job li { margin-bottom: 4px; }
.job .courses { margin: 6px 0 0; color: var(--body); font-size: 0.95rem; }
.job .courses b { color: var(--text); font-weight: 600; }

/* Project pages */
.project { padding-top: 64px; padding-bottom: 40px; }
.project h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 8px 0 10px; line-height: 1.15; }
.project .summary { color: var(--body); font-size: 1.1rem; margin: 0 0 4px; }
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin: 20px 0 32px; padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.facts dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.project h2 { font-size: 1.3rem; margin: 36px 0 10px; }
.project p, .project li { color: var(--body); }
.placeholder {
  border: 1px dashed var(--line); border-radius: 12px; padding: 36px;
  text-align: center; color: var(--muted); margin: 16px 0;
}
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); }
.project ul, .project ol { padding-left: 22px; }
.project h3 { font-size: 1.05rem; margin: 22px 0 6px; }

/* Figures */
figure { margin: 24px 0; }
figure img {
  display: block; width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
}
figure.photo img { background: var(--panel); }
figcaption { color: var(--muted); font-size: 0.88rem; margin-top: 8px; }
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 24px 0; }
.figs figure { margin: 0; }
.hero-img { max-width: 640px; margin-left: auto; margin-right: auto; }
.hero-img figcaption { text-align: center; }
.figs.tall img { aspect-ratio: 3 / 4; object-fit: cover; }
.figs.tall figure:not(.photo) img { object-fit: contain; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 20px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat b { display: block; font-size: 1.5rem; color: var(--text); line-height: 1.2; }
.stat span { color: var(--muted); font-size: 0.85rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.8px; }
td { color: var(--body); }

.note {
  border-left: 3px solid var(--accent); background: var(--panel);
  padding: 12px 16px; border-radius: 0 8px 8px 0; color: var(--body); margin: 20px 0;
}

/* Footer */
footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero .portrait { order: -1; width: 160px; height: 160px; }
}

@media (max-width: 560px) {
  header.site .wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; row-gap: 2px; }
  .brand { white-space: nowrap; }
  header.site nav { width: 100%; display: flex; flex-wrap: wrap; column-gap: 14px; }
  header.site nav a { margin-left: 0; font-size: 0.85rem; }
  .hero { padding: 48px 0 48px; }
}

/* Beyond the technical work */
.proof { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.proof a {
  display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; color: var(--text); transition: border-color 0.15s ease;
}
.proof a:hover { border-color: var(--accent); text-decoration: none; }
.proof b { display: block; margin-bottom: 4px; }
.proof span { color: var(--body); font-size: 0.93rem; }

/* Timeline (believed / heard / changed) */
.timeline { list-style: none; padding: 0; margin: 18px 0; counter-reset: step; }
.timeline li {
  position: relative; padding: 0 0 22px 46px; border-left: 2px solid var(--line); margin-left: 15px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  counter-increment: step; content: counter(step); position: absolute; left: -16px; top: -2px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  font-weight: 700; font-size: 0.9rem; display: grid; place-items: center;
}
.timeline b { display: block; color: var(--text); }
.timeline span { color: var(--body); }

/* Attribution */
.attribution {
  border: 2px solid #c98a12; background: #fff7e6; color: #3d2a05; border-radius: 10px;
  padding: 16px 18px; margin: 14px 0 22px; font-size: 1rem; line-height: 1.6;
}
.attribution a { color: #8a5a00; text-decoration: underline; }
.tag.attrib { color: #8a5a00; background: #fff1d6; font-weight: 600; }

/* Keyboard focus */
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.card:focus-visible { outline-offset: 2px; border-radius: 12px; }

/* Print: clean black-on-white pages */
@media print {
  header.site, .cta, .back, nav, footer, .btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .hero { padding: 0 0 16px; grid-template-columns: 1fr auto; }
  .hero .portrait { width: 110px; height: 110px; box-shadow: none; }
  section, .project { padding: 16px 0; }
  .card, .stat, .facts, figure, table, .job { break-inside: avoid; box-shadow: none; }
  .card:hover { transform: none; }
  a { color: #000; }
  .project a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
}
