:root {
  --text: #494e52;
  --heading: #313638;
  --muted: #6c7380;
  --faint: #9aa3b5;
  --link: #598be7;
  --bg: #fff;
  --rule: #e8ebf3;
  --masthead-rule: #f2f3f3;
  --footer-bg: #f2f3f3;
  --footer-rule: #bdc1c4;
  --footer-text: #7a8288;
  --card-bg: linear-gradient(135deg, #fcfdff 0%, #f3f7ff 100%);
  --card-border: #dfe7f8;
  --card-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
  --pill-text: #8a4800;
  --pill-bg: #fff2cd;
  --pill-border: #ffd487;
  --heading-line: rgba(89, 139, 231, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #c9ced6;
    --heading: #eef0f3;
    --muted: #9aa1ad;
    --faint: #737b89;
    --link: #82a9f0;
    --bg: #15171a;
    --rule: #2a2e35;
    --masthead-rule: #24272c;
    --footer-bg: #1c1f23;
    --footer-rule: #2f333a;
    --footer-text: #8b929c;
    --card-bg: linear-gradient(135deg, #1c2029 0%, #1a1f2b 100%);
    --card-border: #2c3445;
    --card-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
    --pill-text: #ffcf86;
    --pill-bg: #3a2c12;
    --pill-border: #6b4f1d;
    --heading-line: rgba(130, 169, 240, 0.4);
  }
}

:root[data-theme="dark"] {
  --text: #c9ced6;
  --heading: #eef0f3;
  --muted: #9aa1ad;
  --faint: #737b89;
  --link: #82a9f0;
  --bg: #15171a;
  --rule: #2a2e35;
  --masthead-rule: #24272c;
  --footer-bg: #1c1f23;
  --footer-rule: #2f333a;
  --footer-text: #8b929c;
  --card-bg: linear-gradient(135deg, #1c2029 0%, #1a1f2b 100%);
  --card-border: #2c3445;
  --card-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  --pill-text: #ffcf86;
  --pill-bg: #3a2c12;
  --pill-border: #6b4f1d;
  --heading-line: rgba(130, 169, 240, 0.4);
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "San Francisco", Roboto, "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--masthead-rule);
}

.masthead__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1em;
}

.masthead__menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em 1.5em;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.masthead__menu a {
  color: var(--text);
}

.masthead__menu a:hover {
  color: var(--link);
  text-decoration: none;
}

.masthead__menu-item--lg {
  padding-right: 1em;
  font-weight: 700;
  font-size: 1.05rem;
}

/* ---------- Main column ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 2em auto 3em;
  padding: 0 16px;
  font-size: 0.95rem;
  line-height: 1.65;
}

h1,
h2,
h3 {
  color: var(--heading);
  line-height: 1.25;
}

.hero-title {
  margin: 0.2em 0 0.25em;
  font-size: 2rem;
}

.hero-subtitle {
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
}

.about-photo {
  float: right;
  width: clamp(200px, 30vw, 270px);
  height: auto;
  margin: 6px 0 12px 22px;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

@media (max-width: 700px) {
  .about-photo {
    float: none;
    display: block;
    margin: 8px auto 16px;
  }
}

.quick-links {
  clear: both;
  margin: 1.2em 0 1em;
  font-size: 0.92rem;
  text-align: center;
}

.quick-links .divider {
  color: var(--faint);
  margin: 0 0.4em;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.6em 0 0.6em;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.section-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--heading-line), transparent);
}

/* ---------- News ---------- */

.news-hint {
  text-align: right;
  font-size: 0.82rem;
  color: var(--faint);
  margin: -6px 0 6px;
}

.news-box {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 18px;
}

.news-box ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

/* ---------- Publications ---------- */

.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub-item {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.pub-item:last-child {
  border-bottom: none;
  margin-bottom: 0.2rem;
}

.pub-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
}

.pill {
  display: inline-block;
  margin: 0.18rem 0 0.2rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pill-text);
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
}

/* ---------- Entries (experience, education, talks) ---------- */

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  padding: 0.6rem 0;
}

.entry__meta {
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.entry__title {
  font-weight: 700;
  color: var(--heading);
}

.entry__details {
  margin-top: 0.15rem;
}

/* ---------- Cards (projects, achievements) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.9rem;
  margin: 0 0 1.3rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 0.95rem 1rem;
}

.card__meta {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.28rem;
}

.card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
}

.card p {
  margin: 0.32rem 0 0;
}

/* ---------- Project write-up pages ---------- */

.project h1 {
  font-size: 1.8rem;
  margin: 0.2em 0 0.3em;
}

.project .lede {
  color: var(--muted);
  font-size: 1.02rem;
  margin-bottom: 1.5em;
}

.back-link {
  font-size: 0.88rem;
}

/* ---------- Footer ---------- */

.page__footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-rule);
  color: var(--footer-text);
  font-size: 0.75rem;
}

.page__footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5em 1em;
}

.page__footer a {
  color: inherit;
}

.page__footer a:hover {
  color: var(--link);
}

.social-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 1.2em;
  margin: 0 0 0.6em;
  padding: 0;
  list-style: none;
}

a.card {
  display: block;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

a.card:hover,
a.card:focus {
  text-decoration: none;
  border-color: var(--link);
  transform: translateY(-1px);
}
