:root{
  /* Thrylos dark theme (restored) */
  --bg:#0b0f19;
  --card:#111827;
  --text:#e5e7eb;
  --muted:#a7b0c0;
  --line:rgba(255,255,255,.10);
  --accent:#7dd3fc;
  --accent2:#a78bfa;
  --shadow: 0 12px 28px rgba(0,0,0,.35);
  --radius: 16px;
  --max: 980px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:
    radial-gradient(1000px 600px at 20% 0%, rgba(125,211,252,.14), transparent 60%),
    radial-gradient(900px 600px at 80% 10%, rgba(167,139,250,.12), transparent 55%),
    var(--bg);
  line-height:1.6;
}

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

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

/* Top navigation bar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 1000;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(17,24,39,.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.topbar nav{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:center;
}

/* Prevent nav flash before JS sets active link */
html.js .topbar nav { visibility: hidden; }
html.js .topbar nav.is-ready { visibility: visible; }

/* Nav pills (topbar) */
nav a{
  border:1px solid var(--line);
  padding:8px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.03);
  font-size:13px;
  color:var(--text);
}
nav a:hover{
  text-decoration:none;
  background:rgba(125,211,252,.12);
  border-color:rgba(125,211,252,.35);
  color:var(--accent);
}
nav a.active{
  border-color: rgba(125,211,252,.40);
  background: rgba(125,211,252,.14);
  color: var(--text);
}

/* Header card */
header{
  display:flex;
  gap:22px;
  align-items:center;
  justify-content:space-between;
  padding:22px;
  border:1px solid var(--line);
  background:rgba(17,24,39,.65);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  backdrop-filter: blur(8px);
}

.id{
  display:flex;
  gap:18px;
  align-items:center;
  min-width:0;
}

.photo{
  width:128px;
  height:128px;
  border-radius:22px;
  object-fit:cover;
  border:1px solid var(--line);
  box-shadow:0 10px 20px rgba(0,0,0,.35);
  background:#0f172a;
  flex:0 0 auto;
}

h1{font-size:28px; margin:0}
.subtitle{margin:6px 0 0; color:var(--muted); font-size:14.5px}

main{margin-top:18px}
main.single{ margin-top:18px; }

/* Main grid (if used) */
.grid{
  display:grid;
  grid-template-columns: 1.15fr .85fr;
  gap:16px;
}

/* Sections */
section{
  border:1px solid var(--line);
  background:rgba(17,24,39,.55);
  border-radius:var(--radius);
  padding:18px 18px 14px;
  box-shadow:0 10px 22px rgba(0,0,0,.25);
}
section h2{
  margin:0 0 10px;
  font-size:16px;
  letter-spacing:.2px;
  text-transform:uppercase;
  color:#cbd5e1;
}

.item{padding:12px 0; border-top:1px dashed rgba(255,255,255,.12)}
.item:first-of-type{border-top:none; padding-top:0}

/* Item title + tag */
.item-title{
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  justify-content:flex-start;
  gap:8px;
  margin:0;
}
.item-title strong{font-size:15px}
.tag{color:var(--muted); font-size:13px}

/* Publications: paper title + tag layout */
.item-title .paper-title{
  flex: 1 1 420px;
  min-width: 0;
}
.item-title .tag{
  flex: 1 1 auto;
  white-space: normal;
  max-width: 100%;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: anywhere;
}

ul{margin:10px 0 0 18px; padding:0}

.kvs{display:grid; grid-template-columns: 120px 1fr; gap:10px 14px; margin-top:10px}
.kvs div{color:var(--muted); font-size:13px}
.kvs a, .kvs span{color:var(--text); font-size:13px}

footer{
  margin-top:18px;
  color:var(--muted);
  font-size:12.5px;
  text-align:center;
}
footer .last-updated{
  display: block;
  margin-top: 6px;
}

.small{font-size:13.5px; color:var(--muted)}
.note{color:var(--muted); font-size:13px}

/* Pills in header (research + contact links) */
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  padding:8px 10px;
  border-radius:999px;
  font-size:13px;
  margin:8px 8px 0 0;
}
.pill b{color:var(--text)}

/* Header highlights layout */
.highlights{ margin-top:10px; }
.pill-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  min-width:0;
}
.pill-row .pill{
  margin:0;
  max-width:100%;
  white-space:normal;
}
.highlights .pill-row + .pill-row{ margin-top: 8px; }

.pill-link{
  text-decoration:none;
  color:var(--text);
  cursor:pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.pill-link:hover{
  background:rgba(125,211,252,.12);
  border-color:rgba(125,211,252,.35);
  color:var(--accent);
}
.pill-link:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Ensure long Keywords pill wraps nicely */
.highlights .pill-row:first-child { min-width: 0; }
.highlights .pill-row:first-child .pill{
  flex: 0 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pill-row span.pill{
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pill-row span.pill b{ white-space: nowrap; }

/* Icon pills */
.icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
}
.icon-pill svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

/* Fallback for iOS Safari versions that don't support flexbox gap */
@supports not (gap: 1rem) {
  .id > * + * { margin-left: 18px; }
  .topbar nav a { margin: 0 10px 10px 0; }
  .pill-row > * { margin: 0 10px 10px 0; }
}

/* Responsive (mobile) */
@media (max-width: 860px){
  header{
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 16px;
    gap: 16px;
  }

  .photo{
    width: 96px;
    height: 96px;
    border-radius: 18px;
  }

  .grid{ grid-template-columns: 1fr; }

  /* 2-column grid: photo | text */
  .id{
    display: grid;
    grid-template-columns: 96px 1fr;
    column-gap: 16px;
    align-items: start;
  }

  /* lift the right wrapper so children can be placed in the grid */
  .id > div{ display: contents; }
  .highlights{ display: contents; }

  h1{ grid-column: 2; }

  /* subtitle starts under the photo (full width) */
  .subtitle{ grid-column: 1 / -1; }

  /* both pill rows span full width */
  .highlights .pill-row{ grid-column: 1 / -1; }

  /* Contact/link pills: one line + swipe */
  .highlights .pill-row:nth-child(2){
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .highlights .pill-row:nth-child(2) .pill{ flex: 0 0 auto; }
  .highlights .pill-row:nth-child(2)::-webkit-scrollbar{ display:none; }

  /* Make each experience/publication/degree header stack nicely */
  .item-title{ display:block; }
  .item-title .tag{
    display:block;
    margin-top:6px;
    font-size: clamp(12px, 3.4vw, 13px);
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .paper-title{ display:block; }
}
