/* ==========================================================================
   Philip Chikontwe: site styles
   Palette: deep teal (primary) + coral (accent), with a matching dark mode.
   Change colours here only; everything else reads these tokens.
   ========================================================================== */

:root {
  --bg: #f7fafa;
  --surface: #ffffff;
  --surface-2: #eef4f3;
  --text: #16201f;
  --muted: #4b5c5a;
  --faint: #667674;
  --line: #dde7e5;

  --primary: #0f766e;        /* deep teal: links, active nav, headings accents */
  --primary-strong: #0b5e58;
  --primary-soft: #e0f2ef;
  --on-primary: #ffffff;

  --accent: #e4677e;         /* coral: highlights, badges, decoration */
  --accent-ink: #b63a55;     /* coral dark enough for text on light backgrounds */
  --accent-soft: #fce9ed;

  --shadow: 0 1px 2px rgba(16, 40, 38, .05), 0 8px 24px rgba(16, 40, 38, .06);
  --radius: 14px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Manrope", "Inter", system-ui, sans-serif;
  --wrap: 1040px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1414; --surface: #121d1d; --surface-2: #182727; --text: #e3eeec; --muted: #a3b6b3;
    --faint: #859996; --line: #223231;
    --primary: #2dd4bf; --primary-strong: #5eead4; --primary-soft: #11302d; --on-primary: #06201d;
    --accent: #f2879b; --accent-ink: #f59cad; --accent-soft: #3a1c24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1414; --surface: #121d1d; --surface-2: #182727; --text: #e3eeec; --muted: #a3b6b3;
  --faint: #859996; --line: #223231;
  --primary: #2dd4bf; --primary-strong: #5eead4; --primary-soft: #11302d; --on-primary: #06201d;
  --accent: #f2879b; --accent-ink: #f59cad; --accent-soft: #3a1c24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 var(--font-body); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--primary); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; letter-spacing: -.015em; }
p { margin: 0 0 1em; }
.muted { color: var(--faint); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 760px; }
.icon { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip-link:focus { left: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 700 1rem var(--font-head); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.is-home .brand img { display: none; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); font-size: .92rem; font-weight: 500; padding: 7px 12px; border-radius: 8px; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.is-active { color: var(--primary); background: var(--primary-soft); }
.theme-toggle {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line); font-size: 16px;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }
.when-dark { display: none; }
:root[data-theme="dark"] .when-dark { display: block; }
:root[data-theme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .when-dark { display: block; }
  :root:not([data-theme="light"]) .when-light { display: none; }
}

/* ---------- Home banner (uses your header image) ---------- */
.banner { position: relative; overflow: hidden; isolation: isolate; }
.banner::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: url("../img/header-bg.webp") center 40% / cover no-repeat;
}
.banner::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--primary) 22%, transparent), transparent 55%,
                    color-mix(in srgb, var(--accent) 18%, transparent)),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 20%, transparent) 0%,
                    color-mix(in srgb, var(--bg) 72%, transparent) 58%, var(--bg) 100%);
}
.banner-inner { display: flex; align-items: flex-end; gap: 28px; padding-top: 96px; padding-bottom: 28px; }
.avatar {
  width: 156px; height: 156px; flex: none; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--surface); box-shadow: 0 10px 30px rgba(8, 40, 38, .22);
}
.banner h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); font-weight: 800; margin: 0 0 4px; }
.role { color: var(--muted); margin: 0 0 14px; font-size: 1.02rem; }
.role strong { color: var(--text); font-weight: 600; }

.profile-links { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-links a {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px;
  font-size: .85rem; font-weight: 500; color: var(--text);
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line);
  transition: border-color .15s, color .15s, transform .15s;
}
.profile-links a:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; transform: translateY(-1px); }

/* ---------- Inner page hero ---------- */
.page-hero { position: relative; overflow: hidden; isolation: isolate; border-bottom: 1px solid var(--line); }
.page-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2; opacity: .45;
  background: url("../img/header-bg.webp") center 35% / cover no-repeat;
}
.page-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--bg) 25%, color-mix(in srgb, var(--bg) 70%, transparent) 70%, color-mix(in srgb, var(--bg) 40%, transparent));
}
.page-hero .wrap { padding-top: 52px; padding-bottom: 34px; }
.eyebrow { margin: 0 0 6px; color: var(--primary); font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.page-hero h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); font-weight: 800; margin: 0 0 8px; }
.lead { color: var(--muted); max-width: 62ch; margin: 0; font-size: 1.05rem; }

/* ---------- Common blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.section-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 18px; position: relative; padding-left: 14px; }
.section-title::before {
  content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 4px; border-radius: 4px;
  background: linear-gradient(var(--primary), var(--accent));
}
.block { padding: 38px 0 8px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.text-link { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 500; white-space: nowrap; }
.text-link .icon { transition: transform .15s; }
.text-link:hover .icon { transform: translateX(3px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; font-weight: 500; padding: 2px 9px; border-radius: 6px; color: var(--primary-strong); background: var(--primary-soft); }
.chip--soft { color: var(--muted); background: var(--surface-2); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: .92rem;
  color: var(--on-primary); background: var(--primary); border: 1px solid var(--primary);
}
.btn:hover { background: var(--primary-strong); text-decoration: none; }
.btn--ghost { color: var(--primary); background: transparent; }
.btn--ghost:hover { background: var(--primary-soft); }

/* ---------- Home: intro ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; padding-top: 22px; }
.bio p { max-width: 72ch; }
.glance { align-self: start; position: sticky; top: 84px; }
.glance-title { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 12px; font-family: var(--font-body); }
.glance dl { margin: 0 0 16px; }
.glance dt { font-size: .75rem; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin-top: 14px; }
.glance dd { margin: 4px 0 0; font-size: .93rem; line-height: 1.5; }

.spotlight {
  margin-top: 36px; padding: 20px 24px; border-radius: var(--radius); position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--accent-soft), var(--primary-soft));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}
.spotlight-label { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); }
.spotlight-title { display: block; margin: 6px 0 4px; font: 700 1.2rem/1.35 var(--font-head); color: var(--text); }
.spotlight-meta { margin: 0; color: var(--muted); font-size: .92rem; }

.cfp {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 16px; padding: 18px 24px;
  border-radius: var(--radius); background: var(--surface); border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--line));
}
.cfp-label { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
.cfp-label em { text-transform: none; letter-spacing: 0; }
.cfp-title { display: block; margin: 6px 0 4px; font: 700 1.05rem/1.4 var(--font-head); color: var(--text); }
.cfp-meta { margin: 0; color: var(--muted); font-size: .9rem; }
.cfp .btn { flex: none; }
@media (max-width: 640px) { .cfp { flex-direction: column; align-items: flex-start; } }

/* ---------- News ---------- */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.news-item:first-child { border-top: 0; }
.news-item time { color: var(--faint); font-size: .85rem; font-variant-numeric: tabular-nums; padding-top: 2px; white-space: nowrap; }
.news-item--highlight { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); border-radius: 10px; padding-left: 12px; margin-left: -12px; }
.news-link { font-size: .85rem; font-weight: 500; white-space: nowrap; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; padding: 1px 7px; border-radius: 5px; vertical-align: 1px;
  font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--primary-strong); background: var(--primary-soft);
}
.tag--highlight, .tag--award { color: var(--accent-ink); background: var(--accent-soft); }
.tag--preprint { color: var(--muted); background: var(--surface-2); }

/* ---------- Publications ---------- */
.pub-list { display: flex; flex-direction: column; }
.pub { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.pub:first-child { border-top: 0; }
.pub--thumb { grid-template-columns: 184px minmax(0, 1fr); }
.pub-thumb img, .pub-tile { width: 100%; aspect-ratio: 16 / 10; border-radius: 12px; object-fit: cover; display: block; border: 1px solid var(--line); }
.pub-tile {
  display: grid; place-items: center; padding: 12px; text-align: center; color: #fff;
  font: 800 1.05rem/1.2 var(--font-head); letter-spacing: -.01em;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .22) 0 2px, transparent 3px) 0 0 / 16px 16px,
    linear-gradient(135deg, #0f766e, #14958a 45%, #e4677e);
}
.pub--highlight .pub-tile { background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .22) 0 2px, transparent 3px) 0 0 / 16px 16px,
    linear-gradient(135deg, #b63a55, #e4677e 50%, #0f766e); }
.pub-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px;
  font-size: .72rem; font-weight: 600; color: var(--muted); background: var(--surface-2);
}
.badge--venue { color: var(--primary-strong); background: var(--primary-soft); }
.badge--highlight { color: var(--accent-ink); background: var(--accent-soft); }
.pub-title { font: 600 1.02rem/1.4 var(--font-body); letter-spacing: 0; margin: 0 0 4px; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--primary); }
.pub-authors { color: var(--muted); font-size: .9rem; margin: 0 0 2px; }
.pub-authors b { color: var(--text); font-weight: 600; }
.pub-venue { color: var(--faint); font-size: .88rem; font-style: italic; margin: 0 0 10px; }
.pub-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  font: 500 .78rem var(--font-body); color: var(--muted); background: var(--surface); cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; padding: 3px 10px;
}
.chip-btn:hover, .chip-btn[aria-expanded="true"] { color: var(--primary); border-color: var(--primary); text-decoration: none; }
.bibtex { position: relative; margin-top: 10px; }
.bibtex pre {
  margin: 0; padding: 14px 16px; overflow-x: auto; border-radius: 10px; background: var(--surface-2);
  font: .76rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text);
}
.bibtex-copy {
  position: absolute; top: 8px; right: 8px; font: 500 .72rem var(--font-body); cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px;
}

/* Publications page filters */
.filters { display: flex; flex-direction: column; gap: 10px; padding: 26px 0 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter {
  display: inline-flex; align-items: center; gap: 5px; font: 500 .85rem var(--font-body); cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px;
}
.filter:hover { color: var(--text); border-color: var(--faint); }
.filter.is-on { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
.filter--topic.is-on { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent); }
.search {
  flex: 1 1 220px; min-width: 0; font: .9rem var(--font-body); color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}
.search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.year-group { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 20px; padding-top: 22px; }
.year { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin: 14px 0 0; position: sticky; top: 76px; align-self: start; }
.filter-empty { padding: 30px 0; }

/* ---------- Research ---------- */
.areas { display: grid; gap: 20px; padding: 30px 0; }
.area-head { display: flex; align-items: baseline; gap: 12px; }
.area-index { font: 800 1rem var(--font-head); color: var(--accent); }
.area h2 { font-size: 1.3rem; margin: 0 0 10px; }
.ticks { list-style: none; padding: 0; margin: 0 0 6px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 18px; }
.ticks li { position: relative; padding-left: 20px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.area-pubs { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.area-pubs h3 { font-size: .78rem; font-family: var(--font-body); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.area-pubs ul { list-style: none; padding: 0; margin: 0 0 10px; }
.area-pubs li { padding: 5px 0; font-size: .93rem; line-height: 1.45; }
.area-pubs li a { color: var(--text); }
.area-pubs li a:hover { color: var(--primary); }
.area-pubs li .muted { display: block; font-size: .82rem; }

/* ---------- Experience ---------- */
.exp { padding-bottom: 20px; }
.exp-section { padding-top: 36px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 22px; }
.timeline li::before {
  content: ""; position: absolute; left: -29px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--primary);
}
.timeline li:first-child::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.when { font-size: .8rem; font-weight: 600; color: var(--accent-ink); letter-spacing: .02em; }
.timeline h3 { font-size: 1.08rem; margin: 2px 0 2px; }
.org { margin: 0 0 4px; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.service-grid h3 { font-size: 1.05rem; margin: 0 0 12px; }
.service-grid .label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 12px 0 6px; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 4px 0; line-height: 1.5; }

/* ---------- CV & contact ---------- */
.page-hero .lead .btn { margin: 6px 6px 0 0; }
.cv-frame { padding: 0; overflow: hidden; margin: 28px 0; }
.cv-frame iframe { display: block; width: 100%; height: 82vh; border: 0; background: #fff; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 30px 0; }
.contact-grid h2 { font-size: 1rem; margin: 0 0 8px; }
.contact-grid p { margin: 0; word-break: break-word; }

/* ---------- Footer ---------- */
.footer { margin-top: 56px; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 22px 20px 34px; font-size: .85rem; color: var(--muted); }
.footer-inner p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; gap: 8px; }
  .glance { position: static; }
}
@media (max-width: 640px) {
  .brand span { display: none; }
  .nav { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }
  .is-home .brand img { display: block; }
  .banner-inner { flex-direction: column; align-items: flex-start; gap: 14px; padding-top: 56px; }
  .avatar { width: 112px; height: 112px; }
  .pub--thumb { grid-template-columns: 1fr; gap: 10px; }
  .pub-thumb { max-width: 260px; }
  .news-item { grid-template-columns: 1fr; gap: 2px; }
  .year-group { grid-template-columns: 1fr; gap: 0; }
  .year { position: static; }
  .block-head { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
@media print {
  .topbar, .theme-toggle, .filters, .pub-actions, .banner::before, .page-hero::before { display: none !important; }
  body { background: #fff; color: #000; }
}
