/* ==========================================================================
   Personal site stylesheet
   - No frameworks, no web fonts, no JavaScript: system fonts only.
   - Light/dark follow the visitor's system setting.
   - Brand colour is the original navy (#0b2f5c).
   ========================================================================== */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --surface: #f5f7fa;
  --text: #1b2430;
  --muted: #566274;
  --border: #e1e7ef;
  --brand: #0b2f5c;
  --on-brand: #ffffff;
  --link: #0b5cad;
  --link-hover: #0b2f5c;
  --shadow: 0 1px 2px rgba(11, 47, 92, 0.08), 0 10px 28px rgba(11, 47, 92, 0.08);

  /* publication type colours */
  --t-c: #0b5cad;
  --t-j: #7a3db8;
  --t-b: #b45309;
  --t-w: #2b7a4b;

  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", "Noto Sans Devanagari", "Noto Sans Oriya", "Nirmala UI",
    Calibri, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1520;
    --surface: #142031;
    --text: #e6edf5;
    --muted: #9aa9bc;
    --border: #243349;
    --brand: #9cc4ff;
    --on-brand: #0d1520;
    --link: #7db4ff;
    --link-hover: #bcd8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.35);

    --t-c: #7db4ff;
    --t-j: #c9a8ff;
    --t-b: #f0b46a;
    --t-w: #6fd19a;
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: min(100% - 2.5rem, 56rem); margin-inline: auto; }

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--link-hover); text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 4px;
}

img { max-width: 100%; }
b, strong { font-weight: 650; }

/* Links inside content get a soft underline so they don't rely on colour alone */
main a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
}
main a:hover { text-decoration-color: currentColor; }

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 30;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
}
.skip:focus { top: 0.75rem; }

/* ---------- Header / navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
@supports (backdrop-filter: blur(8px)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
  }
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  padding-block: 0.55rem;
}

.nav { display: flex; flex-wrap: wrap; gap: 0.1rem; }
.nav a {
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface); color: var(--brand); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--brand); color: var(--on-brand); }

.find {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}
.social { display: flex; gap: 0.15rem; margin: 0; padding: 0; list-style: none; }
.social a {
  display: grid;
  place-items: center;
  width: 2.05rem;
  height: 2.05rem;
  border-radius: 0.65rem;
  transition: background-color 0.15s, transform 0.15s;
}
.social a:hover { background: var(--surface); transform: translateY(-1px); }
.social img { display: block; width: 1.5rem; height: 1.5rem; object-fit: contain; }

@media (prefers-color-scheme: dark) {
  /* icons are single-colour black artwork; flip them for the dark theme */
  .social img { filter: invert(1); }
}

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

main { padding-block: 1rem 5rem; }

h2, h3 { line-height: 1.3; font-weight: 700; }

h2 {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 2.6rem 0 1.1rem;
  font-size: 1.55rem;
  color: var(--brand);
  letter-spacing: -0.005em;
}
h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
main > section:first-child > h2:first-child,
main > h2:first-child { margin-top: 1.6rem; }

h3 { margin: 1.9rem 0 0.7rem; font-size: 1.15rem; }

p { margin: 0 0 1rem; }
.prose p { max-width: 72ch; }

/* ---------- Home: hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2rem 3rem;
  padding-block: clamp(1.75rem, 5vw, 3.25rem) 0.5rem;
}

.name { margin: 0; font-size: 1rem; line-height: 1.25; }
.name span { display: block; }
.name-en {
  font-size: clamp(1.75rem, 4.4vw, 2.4rem);
  font-weight: 750;
  letter-spacing: -0.012em;
  color: var(--brand);
}
.name-alt {
  margin-top: 0.2rem;
  font-size: clamp(1.15rem, 2.7vw, 1.4rem);
  font-weight: 650;
}

.role { margin: 1.1rem 0 0.8rem; font-size: 1.12rem; }

.facts { margin: 0; padding: 0; list-style: none; }
.facts li { padding: 0.12rem 0; }
.facts i { color: var(--muted); font-style: normal; font-weight: 600; }

.hero-photo {
  display: block;
  width: clamp(10rem, 27vw, 16.9rem);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--surface), var(--shadow);
}

/* ---------- Home: news ---------- */

.news { margin: 0; padding: 0; list-style: none; }
.news li {
  margin: 0 0 0.75rem;
  padding: 0.8rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.news b { color: var(--brand); }

/* ---------- Cards (education, experience, awards) ---------- */

.entry {
  margin: 0 0 0.85rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.entry p { margin: 0; }
.entry p + p { margin-top: 0.15rem; }
.entry-head { font-weight: 650; }
.when { color: var(--muted); font-weight: 500; white-space: nowrap; }

.plain { margin: 0; padding: 0; list-style: none; }
.plain li { padding: 0.45rem 0; border-top: 1px solid var(--border); }
.plain li:first-child { border-top: 0; }

/* ---------- Research ---------- */

.legend {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
}

.pub {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 0 1rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--border);
}
.pub:first-child { border-top: 0; }

.pub-id {
  --tc: var(--t-c);
  align-self: start;
  justify-self: start;
  margin-top: 0.15rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.5rem;
  font: 600 0.8rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--tc);
  background: color-mix(in srgb, var(--tc) 12%, var(--bg));
}
.pub-id[data-type="J"] { --tc: var(--t-j); }
.pub-id[data-type="B"] { --tc: var(--t-b); }
.pub-id[data-type="W"] { --tc: var(--t-w); }

.pub-title { margin: 0; font-size: 1.06rem; font-weight: 650; line-height: 1.4; }
.pub-title a { color: var(--text); text-decoration: none; }
.pub-title a:hover { color: var(--link); text-decoration: underline; }

.pub-authors { margin: 0.3rem 0 0; color: var(--muted); }
.pub-authors i { font-style: normal; }
.pub-authors b { color: var(--text); }
.pub-venue { margin: 0.2rem 0 0; }
.pub-links { margin: 0.4rem 0 0; font-size: 0.95rem; color: var(--muted); }

/* ---------- Talks ---------- */

.timeline {
  margin: 0;
  padding: 0.2rem 0 0 1.3rem;
  list-style: none;
  border-left: 2px solid var(--border);
}
.timeline li { position: relative; padding: 0 0 1.2rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1.3rem - 5px);
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline li > a:first-child { font-weight: 650; white-space: nowrap; }

/* ---------- Back to top ---------- */

.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 20;
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s, filter 0.15s;
}
.to-top:hover { color: var(--on-brand); text-decoration: none; transform: translateY(-2px); filter: brightness(1.1); }

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
  .site-header { position: static; }
  .bar { justify-content: center; }
  .nav { justify-content: center; }
  .find { width: 100%; justify-content: center; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  h2 { font-size: 1.4rem; }

  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .hero-photo { order: -1; width: 10.5rem; }

  .pub { grid-template-columns: 1fr; gap: 0.5rem 0; }
  .to-top { right: 0.75rem; bottom: 0.75rem; padding: 0.35rem 0.8rem; font-size: 0.8rem; opacity: 0.9; }
}

/* ---------- Preferences & print ---------- */

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

@media print {
  .site-header, .to-top, .skip { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .entry, .news li { background: none; border-color: #ccc; }
  a { color: #000; text-decoration: none; }
  h2 { color: #000; }
}
