:root {
  --accent: #0f6e66;
  --accent-soft: #e6f2f1;
  --ink: #1c2430;
  --muted: #5b6573;
  --rule: #dfe3e8;
  --page-bg: #eef1f4;
  --sidebar-bg: #f7f9fa;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 2.5rem 1rem;
  background: var(--page-bg);
  color: var(--ink);
  font: 400 9.6pt/1.4 var(--font);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

a { color: inherit; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
a:hover { color: var(--accent); border-bottom-color: var(--accent); }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; }

/* ---------- Toolbar (screen only) ---------- */
.toolbar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}
.toolbar button {
  font: 600 0.9rem var(--font);
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgb(15 110 102 / 0.3);
}
.toolbar button:hover { filter: brightness(1.1); }
.toolbar button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- Page ---------- */
.resume {
  max-width: 8.5in;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 10px 40px rgb(20 30 40 / 0.12);
  border-radius: 6px;
  overflow: hidden;
}

/* ---------- Masthead ---------- */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem 2rem;
  align-items: end;
  padding: 0.42in 0.5in 0.25in;
  border-top: 6px solid var(--accent);
  border-bottom: 1px solid var(--rule);
}
.masthead h1 {
  font-size: 26pt;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.headline {
  margin-top: 0.4rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 10.5pt;
}
.contact {
  list-style: none;
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.1rem 0.8rem;
  font-size: 8.75pt;
}
.contact li { display: contents; }
.contact .label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 7.5pt; align-self: center; }

/* ---------- Two-column body ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 2.45in;
}
.primary { padding: 0.25in 0.35in 0.35in 0.5in; }
.secondary {
  padding: 0.25in 0.4in 0.35in 0.28in;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--rule);
  font-size: 8.75pt;
}

section + section { margin-top: 1.1rem; }

h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  color: var(--accent);
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.summary p { color: #333c48; }

/* ---------- Jobs ---------- */
.job { break-inside: avoid; }
.job + .job { margin-top: 0.85rem; }
.job header {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1rem;
}
.job h3 { font-size: 10.5pt; font-weight: 700; }
.job .org { grid-row: 2; color: var(--muted); font-weight: 500; }
.job .dates {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: start;
  color: var(--accent);
  font-size: 8.5pt;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.job ul { margin-top: 0.3rem; list-style: none; }
.job li {
  position: relative;
  padding-left: 0.95rem;
}
.job li + li { margin-top: 0.12rem; }
.job li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.6em;
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  background: var(--accent);
}
.job.compact ul { margin-top: 0.15rem; }

/* ---------- Publications ---------- */
.publications { padding-left: 1.1rem; font-size: 9pt; color: #333c48; }
.publications li { break-inside: avoid; }
.publications li + li { margin-top: 0.4rem; }
.publications li::marker { color: var(--accent); font-weight: 600; }
.publications a { border-bottom: 0; }
.publications a:hover { text-decoration: underline; }

/* ---------- Sidebar ---------- */
.stats { display: grid; gap: 0.3rem; }
.stats div { display: grid; grid-template-columns: 2.4rem 1fr; align-items: baseline; }
.stats dt { color: var(--accent); font-weight: 800; font-size: 13pt; line-height: 1.1; }
.stats dd { color: var(--muted); }

.secondary h3 { font-size: 8.75pt; font-weight: 700; }
.secondary section > h3 + .tags { margin-top: 0.3rem; }
.tags + h3 { margin-top: 0.6rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.tags li {
  padding: 0.08rem 0.45rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: #0b4f49;
  font-size: 8pt;
  font-weight: 500;
}

.edu + .edu { margin-top: 0.45rem; }
.edu p { color: var(--muted); }

.oss, .plain { list-style: none; }
.oss li + li, .plain li + li { margin-top: 0.35rem; }
.oss a, .plain a { color: var(--ink); }

/* ---------- Small screens ---------- */
@media screen and (max-width: 760px) {
  body { padding: 0 0 4.5rem; background: #fff; }
  .resume { border-radius: 0; box-shadow: none; }
  .masthead, .layout { grid-template-columns: 1fr; }
  .masthead { align-items: start; }
  .masthead, .primary, .secondary { padding: 1.5rem 1.25rem; }
  .contact { grid-template-columns: auto 1fr; }
  .contact a { overflow-wrap: anywhere; }
  .secondary { border-left: 0; border-top: 1px solid var(--rule); }
  .toolbar { top: auto; bottom: 1rem; }
}

/* ---------- Print / PDF ---------- */
@page {
  size: letter;
  margin: 0.45in 0;
}
@page :first {
  margin-top: 0;
}
@media print {
  body { padding: 0; background: #fff; }
  .toolbar { display: none; }
  .resume { max-width: none; box-shadow: none; border-radius: 0; }
  a { border-bottom: 0; }
}
