/* Minimal academic home page. Palette: #542177 purple, #8E1EA2 violet, #D552A3 pink, #98E8DE aqua. */
:root {
  --bg: #ffffff;
  --text: #241a2e;
  --muted: #5f5370;
  --navy: #542177;
  --violet: #8e1ea2;
  --sky: #d552a3;
  --mint: #98e8de;
  --rule: #ece4f1;
  --mint-soft: #ebfaf8;
}
/* Dark: follows the system unless the visitor picked a mode with the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a0d24; --text: #f1eaf5; --muted: #c4b6cd; --navy: #98e8de;
    --violet: #e58cc6; --sky: #d552a3; --mint: #98e8de; --rule: #3a2449; --mint-soft: #16302d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #1a0d24; --text: #f1eaf5; --muted: #c4b6cd; --navy: #98e8de;
    --violet: #e58cc6; --sky: #d552a3; --mint: #98e8de; --rule: #3a2449; --mint-soft: #16302d;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.7 var(--font); }
/* Text in Ubuntu (as on the project guides); badges and code keep the monospace stack. */
:root { --font: Ubuntu, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: Consolas, Inconsolata, "Cascadia Mono", "Liberation Mono", Menlo, monospace; }
code, pre, kbd, samp, .badge { font-family: var(--mono); }
a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--violet); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--violet); }
h1, h2, h3 { color: var(--navy); font-weight: 600; line-height: 1.3; }

/* Masthead */
.masthead { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--rule); }
.masthead .inner { max-width: 1120px; margin: 0 auto; padding: 0 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 26px; min-height: 60px; }
.site-title { font-weight: 700; color: var(--navy); text-decoration: none; font-size: 1.05rem; display: inline-flex; align-items: center; gap: .5rem; }
.site-logo { width: 28px; height: 28px; flex-shrink: 0; display: block; }
.masthead nav { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-left: auto; }
.masthead nav a { text-decoration: none; color: var(--muted); font-size: .95rem; padding: 4px 0; border-bottom: 2px solid transparent; }
.masthead nav a:hover, .masthead nav a.active { color: var(--navy); border-bottom-color: var(--violet); }
.mode { border: 1px solid var(--rule); background: transparent; color: var(--muted); border-radius: 999px;
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; font-size: 1.15rem; }
.mode:hover { color: var(--navy); border-color: var(--violet); }
.mode:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.menu-toggle { display: none; place-items: center; border: 1px solid var(--rule); background: transparent; color: var(--navy);
  border-radius: 10px; cursor: pointer; font-size: 1.35rem; }
.menu-toggle:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: inline; }
.mode .icon-light { display: none; }
:root[data-theme="dark"] .mode .icon-light { display: inline; }
:root[data-theme="dark"] .mode .icon-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mode .icon-light { display: inline; }
  :root:not([data-theme="light"]) .mode .icon-dark { display: none; }
}

/* Page: author sidebar + content */
.page { max-width: 1120px; margin: 0 auto; padding: 40px 24px 64px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; }
.page[hidden], .intro[hidden], main section[hidden] { display: none; }
main h2:focus { outline: none; }
.author-name { font-size: 1.35rem; margin: 0 0 4px; }
.author { position: sticky; top: 92px; align-self: start; font-size: .92rem; }
.avatar { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; background: var(--mint-soft);
  border: 2px solid var(--mint); color: var(--navy); font-size: 2.6rem; font-weight: 600; margin-bottom: 16px; }
.author h1, .author .author-name { font-size: 1.35rem; margin: 0 0 4px; }
.author .role { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.author .keywords { margin: -6px 0 14px; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.author .position { margin: 0 0 14px; padding-left: 10px; border-left: 3px solid var(--mint); font-size: .88rem; line-height: 1.45; }
.author ul { list-style: none; margin: 0; padding: 0; }
.author li { margin: 6px 0; }
.author li a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.author li a:hover { color: var(--violet); }
.author li i { width: 18px; text-align: center; color: var(--violet); }

/* Content */
main section { margin-bottom: 44px; }
main h2 { font-size: 1.5rem; margin: 0 0 14px; padding-bottom: 6px; border-bottom: 2px solid var(--sky); }
main h3 { font-size: 1.12rem; margin: 26px 0 6px; }
main p { margin: 8px 0; }
.interests { margin-top: 10px; color: var(--muted); }
.interests mark { background: var(--mint-soft); color: var(--navy); padding: 1px 8px; border-radius: 4px; margin: 2px 2px 2px 0; display: inline-block; }

.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li { margin: 0 0 18px; }
.pubs .title { font-weight: 600; color: var(--navy); }
.pubs .status { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pubs .links { font-size: .92rem; }
.pubs .links a + a::before { content: "·"; color: var(--muted); margin: 0 8px; display: inline-block; text-decoration: none; }

main h3.group { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 10px;
  display: inline-block; padding-bottom: 4px; border-bottom: 3px solid var(--mint); }
main h3.group + ul { margin-top: 0; }
/* Publications | Conferences tabs: same size and pink rule as a section heading; selected tab filled, the other transparent. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.subtabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding-bottom: 6px; border-bottom: 2px solid var(--sky); }
.subtabs button { font: inherit; font-size: 1.5rem; font-weight: 600; line-height: 1.3; padding: 2px 14px; border-radius: 6px;
  background: transparent; border: 2px solid var(--navy); color: var(--navy); cursor: pointer; transition: background .15s, color .15s; }
.subtabs button:hover { background: var(--mint-soft); }
.subtabs button[aria-selected="true"] { background: var(--navy); color: var(--bg); }
.subtabs button:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
@media (max-width: 820px) { .subtabs button { font-size: 1.3rem; } }
.projects { padding-left: 20px; }
.projects li { margin: 6px 0; }

footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: .85rem; text-align: center; padding: 20px 24px 30px; }

/* Tablet and phone */
@media (max-width: 820px) {
  html { scroll-padding-top: 72px; }
  body { font-size: 15px; }
  main a, .author a { overflow-wrap: anywhere; }

  /* Masthead: one row (name, mode, menu button); sections open as a dropdown */
  .masthead .inner { position: relative; flex-wrap: nowrap; gap: 8px; padding: 0 12px 0 16px; min-height: 56px; }
  .site-title { margin-right: auto; min-width: 0; }
  .mode, .menu-toggle { width: 40px; height: 40px; flex: none; }
  .menu-toggle { display: grid; }
  .masthead nav { display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule); box-shadow: 0 12px 24px rgba(84, 33, 119, .14); padding: 6px 16px 12px; }
  .masthead nav.open { display: flex; }
  .masthead nav a { padding: 12px 4px; border-bottom: 1px solid var(--rule); font-size: 1rem; color: var(--text); }
  .masthead nav a:last-child { border-bottom: 0; }
  .masthead nav a.active { color: var(--navy); border-bottom-color: var(--rule); box-shadow: inset 3px 0 0 var(--violet); padding-left: 12px; }

  /* Single column; author card above the content */
  .page { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px 48px; }
  .author { position: static; display: grid; grid-template-columns: 88px 1fr; gap: 0 16px; align-items: center;
    padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
  .avatar { width: 88px; height: 88px; font-size: 1.6rem; margin: 0; grid-row: span 2; }
  .author h1, .author .author-name { font-size: 1.25rem; }
  .author .role { margin: 0; }
  .author .keywords { grid-column: 1 / -1; margin: 12px 0 0; }
  .author .position { grid-column: 1 / -1; margin: 14px 0 0; }
  /* Profile links collapse to a row of round icons; the link text stays for screen readers */
  .author ul { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
  .author li { margin: 0; }
  .author li a { width: 42px; height: 42px; padding: 0; gap: 0; justify-content: center; border: 1px solid var(--rule); border-radius: 50%;
    font-size: 0; background: var(--bg); }
  .author li a:hover { border-color: var(--violet); }
  .author li a:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
  .author li i, .author li ion-icon { font-size: 1.1rem; width: auto; }

  main section { margin-bottom: 36px; }
  main h2 { font-size: 1.3rem; }
  main h3 { font-size: 1.05rem; }
  .pubs .links a { display: inline-block; padding: 4px 0; }
}

/* Small phones */
@media (max-width: 400px) {
  .author { grid-template-columns: 72px 1fr; gap: 0 14px; }
  .avatar { width: 72px; height: 72px; font-size: 1.35rem; }
}

/* Profile photo clipped to an angled surface tile */
img.avatar { object-fit: cover; display: block; }
.avatar-link { display: block; width: fit-content; margin-bottom: 16px; }
.avatar-link img { border: 0; border-radius: 0; margin: 0; }
.avatar-link:hover img { opacity: .85; }
.avatar-link:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
@media (max-width: 820px) {
  .avatar-link { grid-row: span 2; margin: 0; }
}

.portrait-surface { position: relative; display: block;
  clip-path: polygon(12% 17%, 24% 12%, 39% 13%, 56% 7%, 71% 8%, 88% 3%, 95% 19%, 92% 38%,
    98% 55%, 96% 72%, 100% 84%, 81% 90%, 65% 88%, 48% 95%, 32% 93%, 12% 100%, 3% 84%,
    7% 68%, 1% 52%, 7% 36%);
  animation: portrait-sway 16s ease-in-out infinite; }
@keyframes portrait-sway {
  50% { transform: translateY(-2px) rotate(2deg); }
}

/* Entry screen (centred introduction) */
.intro { min-height: calc(100svh - 61px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px 72px; position: relative;
  background: radial-gradient(ellipse at 50% 30%, var(--mint-soft), transparent 70%); }
.intro h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0 0 6px; }
.intro .role { color: var(--text); font-size: 1.1rem; margin: 0 0 6px; }
.intro .keywords { color: var(--muted); font-size: .95rem; margin: 0 0 16px; }
.intro .position { color: var(--muted); font-size: .9rem; line-height: 1.5; margin: 0 0 22px; padding: 8px 16px; border-left: 0;
  border-top: 2px solid var(--sky); }
.social { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.social a { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
  border: 1px solid var(--rule); color: var(--navy); font-size: 1.15rem; background: var(--bg); }
.social a:hover { border-color: var(--violet); color: var(--violet); }
.social a:focus-visible, .scroll-cue:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.scroll-cue { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: var(--muted); text-decoration: none;
  font-size: 1.2rem; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) { .scroll-cue, .portrait-surface { animation: none; } }
@media (max-width: 820px) {
  .intro { min-height: calc(100svh - 57px); padding: 32px 16px 64px; }
  .intro .role { font-size: 1rem; }
  .intro .keywords { font-size: .85rem; max-width: 320px; }
}

.more { color: var(--muted); font-size: .95rem; }
.more i { color: var(--violet); margin-right: 4px; }

/* Ionicons inside link lists and icon buttons */
.author li ion-icon { width: 18px; color: var(--violet); flex: none; }
.social a ion-icon { font-size: 1.25rem; }

/* Entry screen with a landscape background (as on trchudley.github.io) */
.intro { color: #fff;
  background: linear-gradient(rgba(84, 33, 119, .45), rgba(84, 33, 119, .62)), url("../images/header.jpg") center 60% / cover no-repeat; }
.intro h1 { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
.intro .role { color: #fff; }
.intro .keywords, .intro .position { color: rgba(255, 255, 255, .9); }
.intro .position { border-top-color: var(--mint); }
.intro .social a { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .55); color: #fff; backdrop-filter: blur(2px); }
.intro .social a:hover { background: #fff; color: var(--navy); border-color: #fff; }
.intro .scroll-cue { color: #fff; }

/* UI controls inherit the page font */
button { font-family: inherit; }

/* Publication entries: title / Year / Venue / Type / DOI */
.pubs .authors { font-size: .92rem; margin-top: 2px; }
.pubs .authors strong { font-weight: 700; }
.pubs .meta { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.pubs .doi { font-size: .92rem; }
.pubs .desc { font-size: .92rem; line-height: 1.55; margin: 4px 0; }

/* Resources: contents box, badges and item layout (pattern from trchudley.github.io/resources) */
.resource { margin: 0 0 28px; scroll-margin-top: 84px; }
.resource h4 { font-size: 1.15rem; margin: 0 0 8px; color: var(--navy); }
.resource p { margin: 0 0 10px; line-height: 1.6; }
.resource::after { content: ""; display: table; clear: both; }
.resource .thumb { float: right; width: min(45%, 320px); margin: 0 0 10px 20px; border-radius: 6px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; font-size: .78rem; line-height: 1; border: 1px solid var(--navy); border-radius: 4px; overflow: hidden; text-decoration: none; transition: border-color .15s; }
.badge span { padding: 5px 9px; }
.badge span:first-child { background: var(--navy); color: var(--bg); font-weight: 600; }
.badge span:last-child { background: var(--mint-soft); color: var(--navy); }
.badge.alt span:last-child { background: var(--rule); color: var(--violet); }
.badge:hover { border-color: var(--violet); }
.badge:hover span:first-child { background: var(--violet); }
.badge:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
@media (max-width: 820px) { .resource .thumb { float: none; width: 100%; margin: 0 0 10px; } }

/* Resources: contents box in a right-hand column (like trchudley.github.io/resources) */
#resources:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) 220px; column-gap: 32px; align-items: start; }
#resources > * { grid-column: 1; }
#resources > .toc { grid-column: 2; grid-row: 1 / span 30; position: sticky; top: 92px; }
.toc { border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; font-size: .9rem; background: var(--bg); }
.toc p { margin: 0; }
.toc .toc-title { padding: 10px 14px; font-weight: 700; color: var(--bg); background: var(--navy); }
.toc a.toc-head { padding: 8px 14px; font-weight: 700; color: var(--navy); }
#resources h3.group { scroll-margin-top: 84px; }
.toc a { display: block; padding: 7px 14px 7px 26px; border-top: 1px solid var(--rule); text-decoration: none; color: var(--text); line-height: 1.4; }
.toc a:hover { background: var(--mint-soft); color: var(--violet); }
.toc a.current { background: var(--rule); color: var(--violet); box-shadow: inset 3px 0 0 var(--violet); }
@media (max-width: 1060px) {
  #resources:not([hidden]) { display: block; }
  #resources > .toc { position: static; margin: 16px 0 20px; }
  .toc a { padding-top: 10px; padding-bottom: 10px; }
}
.pubs .cites { margin-top: 6px; }
.pubs .cites:has(.badge[hidden]) { display: none; }
.badge[hidden] { display: none; }

/* Year first: date in a left column, entry details beside it. */
:is(#publications, #collaborations) .pubs li { display: grid; grid-template-columns: 6.5rem 1fr; column-gap: 16px; }
:is(#publications, #collaborations) .pubs li > * { grid-column: 2; }
:is(#publications, #collaborations) .pubs li > .year { grid-column: 1; grid-row: 1 / span 10; font-weight: 700; color: var(--violet); font-variant-numeric: tabular-nums; }
@media (max-width: 820px) {
  :is(#publications, #collaborations) .pubs li { display: block; }
  :is(#publications, #collaborations) .pubs li > .year { font-size: .92rem; }
}

/* Numbered entries: [1] is the oldest. Set data-n on each entry's .title; entries without it (the PhD thesis) stay unnumbered. */
#publications .pubs .title[data-n] { position: relative; }
#publications .pubs .title[data-n]::before { content: "[" attr(data-n) "]"; position: absolute; right: 100%; margin-right: 6px; top: .2em;
  font-size: .75rem; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 820px) {
  #publications .pubs .title[data-n]::before { position: static; margin-right: 6px; }
}
