:root{
  --bg: #ffffff;
  --card: #ffffff;
  --text: #0b1220;
  --muted: #4b5563;

  --accent: #1d4ed8;
  --accent2: #2563eb;

  --border: rgba(15, 23, 42, 0.12);
  --divider: rgba(15, 23, 42, 0.10);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);

  /* Background highlights */
  --bgGlow1: rgba(37, 99, 235, 0.10);
  --bgGlow2: rgba(29, 78, 216, 0.08);

  /* Radii */
  --r-card: 16px;
  --r-inner: 14px;

  /* Default pill styling */
  --pillBg: rgba(29, 78, 216, 0.06);
  --pillBorder: rgba(29, 78, 216, 0.22);

  /* Pill palettes by category (Type) */
  --pill-type-programme-bg: rgba(29, 78, 216, 0.08);
  --pill-type-programme-br: rgba(29, 78, 216, 0.30);

  --pill-type-project-bg: rgba(15, 118, 110, 0.08);
  --pill-type-project-br: rgba(15, 118, 110, 0.30);

  --pill-type-tool-bg: rgba(109, 40, 217, 0.08);
  --pill-type-tool-br: rgba(109, 40, 217, 0.28);

  --pill-type-case_study-bg: rgba(217, 119, 6, 0.10);
  --pill-type-case_study-br: rgba(217, 119, 6, 0.32);

  /* Pill palettes by category (Status) */
  --pill-status-active-bg: rgba(22, 163, 74, 0.08);
  --pill-status-active-br: rgba(22, 163, 74, 0.30);

  --pill-status-completed-bg: rgba(100, 116, 139, 0.10);
  --pill-status-completed-br: rgba(100, 116, 139, 0.28);

  --pill-status-maintenance-bg: rgba(79, 70, 229, 0.08);
  --pill-status-maintenance-br: rgba(79, 70, 229, 0.28);

  --pill-status-archived-bg: rgba(220, 38, 38, 0.08);
  --pill-status-archived-br: rgba(220, 38, 38, 0.28);

  /* Pill palettes by category (Context) */
  --pill-context-research-bg: rgba(15, 23, 42, 0.06);
  --pill-context-research-br: rgba(15, 23, 42, 0.18);

  --pill-context-teaching-bg: rgba(8, 145, 178, 0.08);
  --pill-context-teaching-br: rgba(8, 145, 178, 0.28);

  --pill-context-applied-bg: rgba(75, 85, 99, 0.08);
  --pill-context-applied-br: rgba(75, 85, 99, 0.22);

  --pill-context-hobby-bg: rgba(217, 119, 6, 0.08);
  --pill-context-hobby-br: rgba(217, 119, 6, 0.26);
}

/* Base */
*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  line-height: 1.6;
  background:
    radial-gradient(1200px 700px at 10% 0%, var(--bgGlow1), transparent 55%),
    radial-gradient(900px 600px at 85% 10%, var(--bgGlow2), transparent 55%),
    var(--bg);
}

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

/* Layout */
.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 0 18px;
}
.content{
  padding: 22px 0 18px 0;
}

/* Navigation */
.nav{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
}
.nav-inner{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 56px;
  padding: 8px 0;
}
.brand{
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.navlinks{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 4px;
  font-size: 14px;
}
.navlinks a{
  color: var(--muted);
  padding: 8px 9px;
  border-radius: 8px;
  line-height: 1;
  white-space: nowrap;
}
.navlinks a:hover{
  color: var(--text);
  background: rgba(15, 23, 42, 0.05);
  text-decoration: none;
}

/* Cards and sections */
.card{
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.section{ margin-top: 18px; }

/* Hero */
.hero{
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
}
.avatar{
  width: 120px;
  height: 120px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.10), rgba(255, 255, 255, 0.0));
}
.avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Typography */
h1{
  margin: 0 0 6px 0;
  font-size: 34px;
  line-height: 1.1;
}
h2{
  margin: 0 0 10px 0;
  font-size: 20px;
}
.muted{ color: var(--muted); }
.small{ font-size: 14px; }
.accent-strong{
  font-weight: 700;
  color: var(--accent);
}

/* Pills layout */
.pills{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Pills styling (global, works everywhere) */
.pill{
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--pillBorder);
  background: var(--pillBg);
  font-size: 13px;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.pill:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10);
  text-decoration: none;
}

/* Category pills (Type) */
.pill.pill-type-programme{ background: var(--pill-type-programme-bg); border-color: var(--pill-type-programme-br); }
.pill.pill-type-project{ background: var(--pill-type-project-bg); border-color: var(--pill-type-project-br); }
.pill.pill-type-tool{ background: var(--pill-type-tool-bg); border-color: var(--pill-type-tool-br); }
.pill.pill-type-case_study{ background: var(--pill-type-case_study-bg); border-color: var(--pill-type-case_study-br); }

/* Category pills (Status) */
.pill.pill-status-active{ background: var(--pill-status-active-bg); border-color: var(--pill-status-active-br); }
.pill.pill-status-completed{ background: var(--pill-status-completed-bg); border-color: var(--pill-status-completed-br); }
.pill.pill-status-maintenance{ background: var(--pill-status-maintenance-bg); border-color: var(--pill-status-maintenance-br); }
.pill.pill-status-archived{ background: var(--pill-status-archived-bg); border-color: var(--pill-status-archived-br); }

/* Category pills (Context) */
.pill.pill-context-research{ background: var(--pill-context-research-bg); border-color: var(--pill-context-research-br); }
.pill.pill-context-teaching{ background: var(--pill-context-teaching-bg); border-color: var(--pill-context-teaching-br); }
.pill.pill-context-applied{ background: var(--pill-context-applied-bg); border-color: var(--pill-context-applied-br); }
.pill.pill-context-hobby{ background: var(--pill-context-hobby-bg); border-color: var(--pill-context-hobby-br); }

/* List items */
.item{
  padding: 12px 0;
  border-top: 1px solid var(--divider);
}
.item:first-child{ border-top: none; }
.item-title{ font-weight: 650; }
.item-meta{ margin-top: 2px; }

/* Project cards */
.project-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.project-card{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--card);
}
.project-card .item-title{ margin: 0 0 6px 0; }
.project-meta{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Publications: split layout */
.pub-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.pub-col h3{ margin: 0 0 10px 0; }

/* Publications: table layout */
.pub-table{
  display: grid;
  gap: 0;
}
.pub-head{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 2px;
}
.pub-hcell h3{ margin: 0; }

.pub-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
  border-top: 1px solid var(--divider);
  padding: 12px 0;
}
.pub-row:first-of-type{
  border-top: none;
  padding-top: 12px;
}
/* Publications table: prevent double dividers */
.pub-table .item{
  border-top: none;
  padding: 0;
}

/* Role pills */
.role-pill{
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  margin-left: 8px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.role-pill::before{
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  margin-right: 6px;
  background: currentColor;
  opacity: 0.9;
}
.role-lead{
  color: var(--accent);
  background: rgba(29, 78, 216, 0.08);
  border-color: rgba(29, 78, 216, 0.25);
}
.role-colead{
  color: #334155;
  background: rgba(51, 65, 85, 0.08);
  border-color: rgba(51, 65, 85, 0.18);
}
.role-contributor{
  color: #166534;
  background: rgba(22, 101, 52, 0.08);
  border-color: rgba(22, 101, 52, 0.18);
}

/* Publications: mobile labels */
.pub-label{
  display: none;
  font-weight: 650;
  margin: 0 0 6px 0;
}

/* Publications: title colour consistent with project links */
#publications .item-title{
  color: var(--accent);
}

/* Responsive */
@media (max-width: 860px){
  .project-grid{ grid-template-columns: 1fr; }
  .pub-grid{ grid-template-columns: 1fr; }

  .pub-label{ display: block; }
  .pub-head{ display: none; }

  .pub-row{
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Publications: avoid double line between header and first row */
  .pub-head + .pub-row{ border-top: none; }

  .pub-cell{
    border-top: 1px solid var(--divider);
    padding-top: 12px;
  }

  .pub-cell:first-child{
    border-top: none;
    padding-top: 0;
  }
}

.kpi-sep{
  display: inline-block;
  margin: 0 10px;
  color: var(--muted);
  opacity: 0.7;
}

@media (max-width: 700px){
  .hero{ grid-template-columns: 1fr; }
  .avatar{ width: 104px; height: 104px; }
  h1{ font-size: 30px; }

  .nav-inner{
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 0 8px 0;
  }

  .brand{
    padding: 0 2px;
  }

  .navlinks{
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    padding: 2px 0 4px 0;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .navlinks a{
    padding: 9px 10px;
    background: rgba(15, 23, 42, 0.04);
  }
}

.card p{
  text-align: justify;
  text-justify: inter-word;
}

.content{
  text-align: justify;
  text-justify: inter-word;
}
