/* Minimal academic style, modelled on the layout of rikiyat.github.io (academicpages). */

:root {
  --text: #2f3542;
  --muted: #6c7380;
  --faint: #9aa3b5;
  --accent: #3b6fd4;
  --accent-soft: rgba(89, 139, 231, 0.35);
  --bg: #ffffff;
  --card: #f8f9fc;
  --card-border: #e5e8f3;
  --rule: #e8ebf3;
  --code-bg: #f6f8fa;
  --radius: 12px;
  --max: 860px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Lucida Grande", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}
img, video, iframe { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 650; }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 16px; top: 8px; background: #fff; padding: 4px 8px; z-index: 10; }

.container { max-width: var(--max); margin: 0 auto; padding: 1.5rem 16px 3rem; }

/* ---------- Masthead ---------- */
.masthead { border-bottom: 1px solid var(--rule); background: #fff; position: sticky; top: 0; z-index: 5; }
.masthead__inner {
  max-width: var(--max); margin: 0 auto; padding: 0.8rem 16px;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.4rem 1.2rem;
}
.masthead__title { font-weight: 700; font-size: 1.08rem; color: var(--text); }
.masthead__title:hover { text-decoration: none; color: var(--accent); }
.masthead__links { list-style: none; display: flex; flex-wrap: wrap; gap: 0.2rem 1.15rem; margin: 0; padding: 0; }
.masthead__links a { color: var(--muted); font-size: 0.95rem; }
.masthead__links a:hover, .masthead__links a.active { color: var(--text); text-decoration: none; }
.masthead__links a.active { border-bottom: 2px solid var(--accent-soft); }

/* ---------- Hero ---------- */
.hero { display: flex; gap: 2rem; align-items: flex-start; margin: 1rem 0 0.5rem; }
.hero__photo { width: 200px; height: 250px; border-radius: 12px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--card-border); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08); }
.hero__name { font-size: 2rem; line-height: 1.2; margin: 0 0 0.25rem; letter-spacing: -0.01em; }
.hero__subtitle { color: var(--muted); font-weight: 600; font-size: 0.98rem; margin: 0 0 0.9rem; }
.hero__bio p { margin: 0 0 0.8rem; }
.hero__links { margin: 0.4rem 0 0; font-weight: 600; }
.quick-links .divider, .divider { color: var(--faint); margin: 0 0.45rem; font-weight: 400; }

/* ---------- Section headings (gradient rule, as in the reference) ---------- */
.section-heading {
  font-size: 1.32rem; font-weight: 700; letter-spacing: 0.01em;
  margin: 2.2rem 0 0.9rem; display: flex; align-items: center; gap: 0.6rem;
  scroll-margin-top: 4.5rem;
}
.section-heading::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--accent-soft), rgba(89, 139, 231, 0));
}
.subsection-heading { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 1.2rem 0 0.2rem; }
.section-more { text-align: right; font-size: 0.92rem; margin: 0.6rem 0 0; }

/* ---------- News ---------- */
.news-box { max-height: 260px; overflow-y: auto; border-left: 2px solid var(--rule); padding-left: 1rem; }
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.8rem; padding: 0.3rem 0; }
.news__date { color: var(--muted); font-size: 0.88rem; font-weight: 600; padding-top: 0.08rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.05); padding: 1rem 1.2rem;
}
.research-card p { margin: 0.4rem 0 0.6rem; }
.research-card__label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; }
.research-card__title { font-weight: 700; font-size: 1.08rem; margin: 0.15rem 0; }
.research-card__title a { color: var(--text); }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.project-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--card-border);
  border-radius: var(--radius); overflow: hidden; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.15s ease;
}
.project-card:hover { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.09); }
.project-card__media { display: block; aspect-ratio: 16 / 9; background: var(--card); overflow: hidden; }
.project-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-card__body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; flex: 1; }
.project-card__title { font-size: 1.05rem; margin: 0 0 0.15rem; line-height: 1.35; }
.project-card__title a { color: var(--text); }
.project-card__meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.45rem; }
.project-card__desc { font-size: 0.93rem; margin: 0 0 0.6rem; flex: 1; }
.project-card__links { font-size: 0.9rem; font-weight: 600; margin-top: 0.5rem; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; }
.tags li {
  font-size: 0.76rem; padding: 0.08rem 0.55rem; border-radius: 999px;
  background: #eef2fb; color: #3d4a66; border: 1px solid #dde4f4;
}

/* Placeholder for missing images/videos */
.media-placeholder {
  width: 100%; height: 100%; min-height: 100%; aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem;
  background:
    repeating-linear-gradient(135deg, rgba(89, 139, 231, 0.05) 0 12px, rgba(89, 139, 231, 0) 12px 24px),
    linear-gradient(135deg, #f3f6ff 0%, #e9eef9 100%);
  color: #7b88a3; font-size: 0.88rem; font-weight: 600; letter-spacing: 0.02em;
}

/* ---------- Entries (experience, education) ---------- */
.entry-list { list-style: none; margin: 0; padding: 0; }
.entry { padding: 0.55rem 0; }
.entry__meta { font-size: 0.88rem; color: var(--muted); margin-bottom: 0.1rem; }
.entry__title { font-weight: 700; }
.entry__details { margin: 0.15rem 0 0; font-size: 0.95rem; }
.entry__bullets { margin: 0.25rem 0 0; padding-left: 1.2rem; font-size: 0.95rem; }
.achievement-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; margin-top: 1rem; }
.achievement-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 0.8rem 1rem; }

/* ---------- Publications ---------- */
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-item { padding: 0 0 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.pub-item:last-child { border-bottom: none; }
.pub-title { font-weight: 700; font-size: 1.05rem; }
.pub-venue { color: var(--muted); font-style: italic; }

/* ---------- Blog lists ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item { padding: 0.6rem 0 0.8rem; border-bottom: 1px solid var(--rule); }
.post-item:last-child { border-bottom: none; }
.post-item__meta { font-size: 0.85rem; color: var(--muted); }
.post-item__title { font-weight: 700; font-size: 1.08rem; color: var(--text); }
.post-item__excerpt { margin: 0.2rem 0 0; font-size: 0.94rem; }

/* ---------- Pages, posts, project pages ---------- */
.breadcrumb { font-size: 0.9rem; margin: 0 0 0.4rem; }
.page-title { font-size: 1.9rem; line-height: 1.25; margin: 0.3rem 0 0.4rem; letter-spacing: -0.01em; }
.page-lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 1rem; }
.post-meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.4rem; }

.project-meta { display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; margin: 0.6rem 0 0.8rem; padding: 0.8rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.project-meta dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); font-weight: 700; }
.project-meta dd { margin: 0.1rem 0 0; font-size: 0.94rem; }
.project-links { font-weight: 600; margin: 0 0 1rem; }

.prose h2 { font-size: 1.3rem; margin: 2rem 0 0.6rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--rule); }
.prose h3 { font-size: 1.1rem; margin: 1.5rem 0 0.4rem; }
.prose .research-title { border: none; margin-bottom: 0.1rem; }
.prose li { margin: 0.2rem 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; margin: 1rem 0; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 0.45rem 0.7rem; text-align: left; white-space: nowrap; }
.prose th { background: var(--card); font-weight: 650; }
.prose blockquote { margin: 1rem 0; padding: 0.2rem 1rem; border-left: 3px solid var(--accent-soft); color: var(--muted); }
.prose img { height: auto; }

/* Figures */
.media { margin: 1.4rem 0; }
.media img, .media video { display: block; width: auto; max-width: 100%; max-height: min(65vh, 480px); height: auto; margin: 0 auto; border-radius: 10px; border: 1px solid var(--card-border); background: var(--card); }
.media--hero img, .media--hero video { max-height: min(70vh, 520px); }
/* Figures side by side, never cropped: each figure's width is proportional to its
   aspect ratio (--aspect, set by media.html), so all figures in the row share one height */
.media-row { display: flex; gap: 1rem; margin: 1.4rem 0; align-items: flex-start; }
.media-row .media { margin: 0; flex: var(--aspect, 1) 1 0; min-width: 0; }
.media-row .media img, .media-row .media video { width: 100%; height: auto; max-height: none; }
.media .media-placeholder { height: auto; min-height: 0; aspect-ratio: 4 / 1; border-radius: 10px; border: 1px solid var(--card-border); }
.media figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.5rem; text-align: center; }
.media__embed { position: relative; aspect-ratio: 16 / 9; }
.media__embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 10px; }

/* Code */
code { font-family: var(--mono); font-size: 0.88em; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre { font-family: var(--mono); font-size: 0.86rem; line-height: 1.5; background: var(--code-bg); border: 1px solid var(--rule); border-radius: 8px; padding: 0.9rem 1rem; overflow-x: auto; }
pre code { background: none; padding: 0; font-size: inherit; }
.highlighter-rouge .highlight { background: var(--code-bg); }

/* Maths */
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.88rem; }
.footer__inner { max-width: var(--max); margin: 0 auto; padding: 1.2rem 16px; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }

/* ---------- Mobile ---------- */
@media (max-width: 680px) {
  .hero { flex-direction: column; align-items: center; text-align: left; gap: 1rem; }
  .hero__text { width: 100%; }
  .hero__photo { width: 168px; height: 210px; }
  .hero__name { font-size: 1.7rem; text-align: center; }
  .hero__subtitle, .hero__links { text-align: center; }
  .project-grid, .achievement-list { grid-template-columns: 1fr; }
  .media-row { flex-direction: column; }
  .media-row .media { flex: none; width: 100%; }
  .news-list li { grid-template-columns: 1fr; gap: 0; }
  .page-title { font-size: 1.6rem; }
  .masthead { position: static; }
}
.entry__more { font-weight: 600; white-space: nowrap; }
