/* nkinahamira.com — palette drawn from lanthanide oxide chemistry:
   violet-biased neutrals (Nd), dysprosium-region teal accent. */

:root {
  --ink: #1A1730;
  --paper: #FCFCFD;
  --surface: #FFFFFF;
  --line: #E3E0EB;
  --line-strong: #C9C4D8;
  --muted: #66627A;
  --accent: #0E7C74;
  --accent-soft: #E3F0EE;

  --display: "Charter", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --measure: 68ch;
  --wide: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ECEAF3;
    --paper: #131120;
    --surface: #1B1830;
    --line: #2E2A47;
    --line-strong: #443E64;
    --muted: #9B96AF;
    --accent: #55BEB3;
    --accent-soft: #14322F;
  }
}

* { box-sizing: border-box; }

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

/* ---------------------------------------------------------------- motion
   Only applies once JS confirms motion is wanted (html.motion), so content
   is never hidden behind an animation that cannot run. */
.motion .reveal {
  opacity: 0;
  transform: translateY(12px);
  /* Kept short on purpose: a long transition plus stagger means a fast
     scroller can reach a card before it has faded in. ~600ms worst case. */
  transition: opacity 460ms cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 460ms cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 65ms);
}
.motion .reveal.in { opacity: 1; transform: none; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.02rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: clamp(1.95rem, 1.6rem + 1.5vw, 2.85rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.35rem, 1.2rem + 0.6vw, 1.75rem); letter-spacing: -0.01em; }
h3 { font-size: 1.08rem; }

p { margin: 0; }

a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, .skip:focus {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  background: var(--accent);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------------------------------------------------------------- chrome */

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.4rem;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
header.site .brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
header.site nav { display: flex; flex-wrap: wrap; gap: 1.2rem; }
header.site nav a {
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
}
header.site nav a:hover { color: var(--ink); }
header.site nav a.on { color: var(--accent); font-weight: 600; }

footer.site {
  margin-top: 4rem;
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
footer.site .links { display: flex; flex-wrap: wrap; gap: 1rem; }
footer.site .fine { font-size: 0.8rem; opacity: 0.8; }

/* ---------------------------------------------------------------- layout */

main { display: block; }

.band {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.band:last-of-type { border-bottom: 0; }
.band--tight { padding-bottom: 1.5rem; }
.band p, .band .summary { max-width: var(--measure); }

.summary { font-family: var(--display); font-size: 1.15rem; color: var(--muted); }

.figure {
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
}
.fine { font-size: 0.85rem; color: var(--muted); }
.more { font-size: 0.92rem; }

/* ------------------------------------------------------------------ hero */

.hero {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 3rem clamp(1rem, 4vw, 2.5rem) 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
.hero__portrait {
  width: clamp(120px, 17vw, 168px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line);
  /* faint lanthanide-teal halo, not a drop shadow */
  box-shadow: 0 0 0 6px var(--accent-soft);
}
@media (max-width: 620px) {
  .hero { grid-template-columns: 1fr; justify-items: start; }
  .hero__portrait { order: -1; }
}
.hero__title {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  margin-top: 0.45rem;
}
.hero__pitch {
  margin-top: 1rem;
  font-size: 1.08rem;
  max-width: 48ch;
}

.metrics {
  max-width: var(--wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.metrics div {
  padding: 1.15rem clamp(1rem, 4vw, 2.5rem);
  border-right: 1px solid var(--line);
}
.metrics div:last-child { border-right: 0; }
.metrics .n {
  display: block;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.metrics .l {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------- pillars */

.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.pillar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 3px;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pillar p { font-size: 0.9rem; color: var(--muted); }

/* ----------------------------------------------------------------- works */

.works { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.6rem 1.3rem; }
.work { display: flex; flex-direction: column; gap: 0.55rem; }
.work__finding { font-size: 0.95rem; }
.work__cite { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* graphical abstract */
.work__fig {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  aspect-ratio: 16 / 10;
}
.work__fig img {
  width: 100%;
  height: 100%;
  /* contain, not cover: a graphical abstract is a diagram — cropping it
     removes labelled content, which is worse than letterboxing. */
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 0.4rem;
  transform: scale(1.001);
  transition: transform 620ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.work:hover .work__fig img,
.work:focus-within .work__fig img { transform: scale(1.045); }

/* cards with no graphical abstract yet: lead with the finding instead */
.work--text {
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}
.work--text .work__finding {
  font-family: var(--display);
  font-size: 1.08rem;
  line-height: 1.4;
}

.role {
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ------------------------------------------------------------ pub lists */

.year {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}

ol.pubs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.4rem; }
ol.pubs li { display: flex; flex-direction: column; gap: 0.28rem; max-width: var(--measure); }
.pub__authors { font-size: 0.86rem; color: var(--muted); }
.pub__authors strong { color: var(--ink); }
.pub__title { font-family: var(--display); font-size: 1.03rem; line-height: 1.35; }
.pub__title a { color: var(--ink); text-decoration-color: var(--line-strong); }
.pub__title a:hover { color: var(--accent); }
.pub__meta { font-size: 0.84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.if {
  font-family: var(--mono);
  font-size: 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 1px 6px;
}

ul.keyworks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
ul.keyworks li { display: flex; flex-direction: column; gap: 0.2rem; max-width: var(--measure); }
ul.keyworks .src { font-size: 0.82rem; color: var(--muted); }
ul.keyworks .res { font-size: 0.9rem; }

ul.plain { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; max-width: var(--measure); }
ul.plain li::marker { color: var(--accent); }

/* ------------------------------------------------------------ structures */

ul.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }
ul.timeline li { display: grid; grid-template-columns: 11rem 1fr; gap: 0.2rem 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line); }
ul.timeline li:last-child { border-bottom: 0; }
ul.timeline .when { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); padding-top: 0.15rem; }
ul.timeline .where { color: var(--muted); font-size: 0.93rem; }
ul.timeline .detail { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.92rem; max-width: var(--measure); }

/* download button */
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; margin-top: 0.4rem; }
.cta {
  display: inline-block;
  background: var(--accent);
  color: var(--paper);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 3px;
}
.cta:hover { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .cta { color: #0B1A19; } }

dl.caps { margin: 0; display: flex; flex-direction: column; gap: 0.8rem; }
dl.caps > div { display: grid; grid-template-columns: 11rem 1fr; gap: 0.2rem 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--line); }
dl.caps > div:last-child { border-bottom: 0; }
dl.caps dt { font-weight: 600; font-size: 0.92rem; }
dl.caps dd { margin: 0; color: var(--muted); font-size: 0.92rem; }

@media (max-width: 640px) {
  ul.timeline li, dl.caps > div { grid-template-columns: 1fr; }
}

table.grants { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
table.grants th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
table.grants td { padding: 0.75rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grants td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grants tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------------ print
   Used both by Ctrl+P and by make-cv-pdf.mjs, so the downloadable CV and the
   web page never drift apart. Forces the light palette because printers and
   PDF renderers should not inherit a dark theme. */
@media print {
  :root {
    --ink: #14121F; --paper: #FFFFFF; --surface: #FFFFFF;
    --line: #CCC8D8; --line-strong: #AAA5BC; --muted: #4A4760; --accent: #0A5F59;
  }
  body { font-size: 10.5pt; line-height: 1.45; }

  header.site nav,
  .cta-row,
  .skip,
  footer.site .links { display: none; }

  header.site { border-bottom: 2px solid var(--ink); padding: 0 0 0.4rem; }
  header.site .brand { font-size: 15pt; }

  .band, .hero, .metrics {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    page-break-inside: avoid;
  }
  .band { padding-top: 0.9rem; padding-bottom: 0.6rem; }
  h1 { font-size: 20pt; }
  h2 { font-size: 12.5pt; page-break-after: avoid; }

  ul.timeline li { page-break-inside: avoid; }
  a { color: var(--ink); text-decoration: none; }

  /* reveal animation must never leave printed content invisible */
  .motion .reveal, .reveal { opacity: 1 !important; transform: none !important; }

  /* the footer's 4rem top margin used to spill past the last page break and
     emit a blank trailing sheet */
  footer.site {
    margin-top: 1rem;
    padding: 0.6rem 0 0;
    page-break-inside: avoid;
  }
  .band:last-of-type { padding-bottom: 0.2rem; }
  main { margin-bottom: 0; }
}

/* ------------------------------------------------------------------ share */

.share {
  max-width: var(--wide);
  margin: 2.5rem auto 0;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.1rem;
  font-size: 0.88rem;
}
.share__label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.2rem;
}
.share a,
.share__copy {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.share a:hover,
.share__copy:hover { border-bottom-color: var(--accent); }

/* the copy control is a button, but should read as a peer of the links */
.share__copy {
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.share__copy:focus-visible,
.share a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.share__status { color: var(--muted); font-size: 0.82rem; }

.qr { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem; }
.qr img {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #FFFFFF;   /* scanners need the light quiet zone, even in dark mode */
  padding: 8px;
}
.qr p { max-width: 42ch; }

@media print { .share { display: none; } }

/* ----------------------------------------------------------------- mobile */

@media (max-width: 640px) {
  /* A four-column grants table cannot fit a phone. Restack each row as a
     labelled block rather than making the whole page scroll sideways. */
  table.grants,
  table.grants tbody,
  table.grants tr,
  table.grants td { display: block; width: 100%; }

  table.grants thead { display: none; }

  table.grants tr {
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.9rem;
    background: var(--surface);
  }
  table.grants td {
    border: 0;
    padding: 0.25rem 0;
    white-space: normal;
  }
  table.grants td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.1rem;
  }
  table.grants td[data-label="Project"] { font-weight: 600; }

  /* Tap targets. The links stay visually the same size; the padding grows the
     touch area toward the 44px guideline without inflating the header. */
  header.site nav { gap: 0.2rem 1.1rem; }
  header.site nav a { padding: 0.55rem 0; }
  header.site .brand { padding: 0.35rem 0; }
  footer.site .links { gap: 0.2rem 1.1rem; }
  footer.site .links a { padding: 0.5rem 0; }
  .share { gap: 0.2rem 1rem; }
  .share a, .share__copy { padding: 0.5rem 0; }
  ul.plain li { padding: 0.15rem 0; }

  /* metrics read better as two rows of two than four cramped columns */
  .metrics div:nth-child(2n) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
