/* Palette
   Lavender     #ede5ff
   Vintage Grape #6b4e71
   Charcoal Blue #3a4454
   Blue Slate   #53687e
   Soft Blush   #f5dddd
*/

:root,
[data-theme="light"] {
  --bg: #ffffff;
  --surface: #faf6ff;
  --surface-2: #f5dddd;
  --text: #3a4454;
  --text-muted: #53687e;
  --accent: #6b4e71;
  --accent-contrast: #ffffff;
  --accent-soft: #ede5ff;
  --border: rgba(58, 68, 84, 0.12);
  --dot-faint: rgba(58, 68, 84, 0.12);
  --dot-strong: rgba(107, 78, 113, 0.55);
  --shadow: 0 1px 2px rgba(58, 68, 84, 0.06);

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --max-width: 760px;
  --pad-x: clamp(1.25rem, 4vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2a313f;
    --surface: #353d4d;
    --surface-2: #3a4454;
    --text: #ede5ff;
    --text-muted: #cdc5dd;
    --accent: #f5dddd;
    --accent-contrast: #2a313f;
    --accent-soft: #6b4e71;
    --border: rgba(237, 229, 255, 0.12);
    --dot-faint: rgba(237, 229, 255, 0.10);
    --dot-strong: rgba(245, 221, 221, 0.55);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  }
}

[data-theme="dark"] {
  --bg: #2a313f;
  --surface: #353d4d;
  --surface-2: #3a4454;
  --text: #ede5ff;
  --text-muted: #cdc5dd;
  --accent: #f5dddd;
  --accent-contrast: #2a313f;
  --accent-soft: #6b4e71;
  --border: rgba(237, 229, 255, 0.12);
  --dot-faint: rgba(237, 229, 255, 0.10);
  --dot-strong: rgba(245, 221, 221, 0.55);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Cursor-led background: dot grid that reveals itself around the cursor.
   The faint layer is always visible; the strong layer is masked to a soft
   circle that follows the pointer. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, var(--dot-faint) 1px, transparent 1.5px);
  background-size: 22px 22px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, var(--dot-strong) 1px, transparent 1.5px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(280px circle at var(--mx, 50%) var(--my, 30%), rgba(0,0,0,1) 0%, rgba(0,0,0,0) 65%);
          mask-image: radial-gradient(280px circle at var(--mx, 50%) var(--my, 30%), rgba(0,0,0,1) 0%, rgba(0,0,0,0) 65%);
}

main, header, footer { position: relative; z-index: 1; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
a:hover { border-bottom-color: var(--accent); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.6rem); margin-top: 2.5rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; }

p { margin: 0 0 1.1em; }

/* Header / Nav */
header {
  padding: 1.5rem var(--pad-x) 0;
  max-width: var(--max-width);
  margin: 0 auto;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--text);
  border-bottom: none;
  letter-spacing: 0.01em;
}
.logo:hover { color: var(--accent); border-bottom: none; }

.nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
}

.nav-links li { flex-shrink: 0; }
.nav-links li.truncate { flex-shrink: 1; min-width: 0; }
.nav-links li.truncate a {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.92rem;
  border-bottom: none;
  padding: 0.25rem 0;
  position: relative;
}
.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.nav-links a:hover { color: var(--text); border-bottom: none; }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { transform: scaleX(1); }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 3px; /* nudge so its center aligns with the social-icon column */
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Default (light): show moon (switch to dark) */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Main content */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem var(--pad-x) 4rem;
}

.intro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
}
.intro-main { min-width: 0; }
.intro h1 { margin-bottom: 0.25rem; }
.intro .role {
  font-family: var(--serif);
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

/* Core positioning: two compact columns under a small label */
.positioning {
  margin: 1.6rem 0 0;
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) 1fr 1fr;
  gap: 1.2rem 1.6rem;
  align-items: baseline;
  border-top: 1px solid var(--border);
  padding: 1rem 0 0.2rem;
}
.positioning-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-family: var(--sans);
}
.positioning-item {
  display: block;
}
.positioning-item .pname {
  display: block;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.15rem;
}
.positioning-item .pdesc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Social column: sits to the right of the intro block, centered vertically */
.socials-side {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-self: center;
}
.socials-side a {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  border-bottom: none;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.socials-side a:hover {
  background: var(--accent);
  color: var(--accent-contrast);
  border-bottom: none;
  transform: translateY(-2px);
}
.socials-side svg { width: 18px; height: 18px; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* Research tracks */
.track {
  margin: 2rem 0;
  padding-left: 2.2rem;
  position: relative;
}
.track .num {
  position: absolute;
  left: 0;
  top: 0.1em;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  width: 1.8rem;
}
.track h3 { margin-top: 0; }
.track .aside {
  margin-top: 0.5rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--surface-2);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.note {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.9rem 1rem;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  margin-top: 2.5rem;
}

/* Background story bullets */
.track-mappings {
  margin: 1.2rem 0 1.4rem;
  padding: 0;
  list-style: none;
}
.track-mappings li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.7rem;
}
.track-mappings li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.track-mappings strong {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--text);
}

/* Footer */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem var(--pad-x) 3rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Resume page */
.resume-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 2rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  border-bottom: 1px solid var(--border);
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}
.btn.primary:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.btn svg { width: 15px; height: 15px; }

.pdf-frame {
  width: 100%;
  height: 80vh;
  min-height: 500px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.pdf-fallback {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

/* Background story */
.story { margin-top: 2rem; }
.story p:first-of-type::first-letter {
  font-family: var(--serif);
  font-size: 2.6rem;
  float: left;
  line-height: 0.9;
  padding: 0.25rem 0.5rem 0 0;
  color: var(--accent);
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.2rem;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Papers page */
.paper {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1.6rem;
  margin: 2.4rem 0;
  padding: 1.4rem 0;
  border-top: 1px solid var(--border);
}
.paper:first-of-type { border-top: none; padding-top: 0.6rem; }

.paper-preview {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.414;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-bottom: 1px solid var(--border);
}
.paper-preview:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(58, 68, 84, 0.12);
  border-bottom: 1px solid var(--border);
}
.paper-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.paper-content h2 {
  margin-top: 0;
  font-size: 1.25rem;
}
.paper-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}
.paper-summary {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 1rem;
}
.paper-link {
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.paper-link svg { width: 13px; height: 13px; }

/* Affiliations page */
.affiliation {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 1.4rem;
  align-items: center;
  padding: 1.3rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  margin: 1.4rem 0;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.affiliation:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(58, 68, 84, 0.10);
}
.affiliation-logo {
  width: 100%;
  aspect-ratio: 1;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.affiliation-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.affiliation-body { min-width: 0; }
.affiliation-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.affiliation-body h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}
.affiliation-tag {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-contrast);
  background: var(--accent);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}
.affiliation-org {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 0.3rem;
}
.affiliation-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
  letter-spacing: 0.02em;
}
.affiliation-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
}

/* Mobile */
@media (max-width: 640px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .socials-side {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.5rem;
    align-self: stretch;
  }
  .positioning {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }
  .paper {
    grid-template-columns: 130px 1fr;
    gap: 1.1rem;
  }
  .affiliation {
    grid-template-columns: 76px 1fr;
    gap: 1.1rem;
    padding: 1.1rem;
  }
}

@media (max-width: 480px) {
  .nav-links { gap: 0.9rem; }
  .nav-links a { font-size: 0.88rem; }
  header { padding-top: 1.1rem; }
  main { padding-top: 2rem; }
  .track { padding-left: 1.8rem; }
  footer { flex-direction: column; align-items: center; gap: 0.5rem; }
  .pdf-frame { height: 70vh; min-height: 400px; }
  .paper {
    grid-template-columns: 1fr;
  }
  .paper-preview {
    max-width: 200px;
  }
}

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

/* Touch devices: hide the cursor spotlight (no useful cursor position) */
@media (hover: none) {
  body::after { display: none; }
}
