/* E2-P6: self-contained preview styling. No Hugo theme or external CDN. */
:root {
  color-scheme: light dark;
  --page: #f6f8fa;
  --surface: #fff;
  --text: #172334;
  --muted: #4c5c6e;
  --border: #d8e0e8;
  --accent: #075a8e;
  --focus: #bc5800;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #101923;
    --surface: #192635;
    --text: #eaf0f6;
    --muted: #b6c5d5;
    --border: #3b4e61;
    --accent: #86c6f3;
    --focus: #ffcd83;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--text); }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .14em; }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.container { width: min(100% - 2rem, 70rem); margin-inline: auto; }
.skip-link { position: absolute; top: -5rem; left: 1rem; padding: .5rem 1rem;
  background: var(--surface); z-index: 101; }
.skip-link:focus { top: 1rem; }
.site-header { position: sticky; top: 0; z-index: 100;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.header-content { display: flex; align-items: center;
  justify-content: space-between; gap: .75rem 1.5rem; padding-block: .9rem; }
.site-brand { font-size: 1.15rem; font-weight: 750; text-decoration: none; }
.site-navigation { display: flex; align-items: center; gap: 1.25rem; margin-left: auto; }
.site-nav, .language-nav { display: flex; gap: 1.1rem; }
.site-nav a, .language-nav a { text-decoration: none; font-weight: 600; }
.language-nav { font-size: .86rem; border-left: 1px solid var(--border); padding-left: 1rem; }
.site-menu-checkbox, .site-menu-toggle { display: none; }
#main-content { scroll-margin-top: 5rem; }
.main-content { padding-block: clamp(1.5rem, 4vw, 3.5rem) 4rem; }
.page-heading { margin-bottom: 1.8rem; }
h1, h2, h3 { line-height: 1.25; overflow-wrap: break-word; }
h1 { font-size: clamp(2rem, 4vw, 2.9rem); margin: .3rem 0 1rem; }
h2 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
.eyebrow { margin: 0; font-size: .85rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); font-weight: 750; }
.publication-detail { width: min(100%, 52rem); }
.publication-detail .authors { font-size: 1.1rem; margin-bottom: .4rem; }
.publication-meta, .card-meta { color: var(--muted); }
.publication-meta { margin-bottom: 2rem; }
.publication-detail section { padding-top: 1.2rem; border-top: 1px solid var(--border); margin-top: 1.5rem; }
.publication-detail section p { white-space: pre-line; }
.publication-list { list-style: none; margin: 1.7rem 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.publication-card { min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: .6rem; padding: 1.3rem 1.5rem; }
.publication-card h2 { margin: .3rem 0 .7rem; }
.publication-card .card-authors { margin: 0; }
.card-meta { font-size: .93rem; margin-bottom: 0; }
.card-label { color: var(--accent); font-size: .8rem; font-weight: 750; margin: 0; }
.resource-links { padding-left: 1.2rem; overflow-wrap: anywhere; }
.resource-links li { margin: .45rem 0; }
.site-footer { padding: 1rem 0 2rem; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .9rem; }
@media (max-width: 60rem) {
  .header-content { display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem 1rem; }
  .site-menu-checkbox { display: block; position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%);
    white-space: nowrap; }
  .site-menu-toggle { display: inline-flex; align-items: center; gap: .45rem;
    cursor: pointer; border: 1px solid var(--border); border-radius: .4rem;
    padding: .35rem .75rem; font-weight: 650; }
  .site-menu-icon { font-size: 1.3rem; line-height: 1; }
  .site-menu-checkbox:focus-visible + .site-menu-toggle {
    outline: 3px solid var(--focus); outline-offset: 3px; }
  .site-navigation { display: none; grid-column: 1 / -1; margin-left: 0;
    flex-direction: column; align-items: stretch; gap: .75rem;
    max-height: calc(100dvh - 5rem); overflow-y: auto; padding: .5rem 0; }
  .site-menu-checkbox:checked ~ .site-navigation { display: flex; }
  .site-nav { flex-direction: column; gap: 0; }
  .site-nav a { display: block; padding: .45rem .2rem;
    border-bottom: 1px solid var(--border); }
  .language-nav { border-left: 0; padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* E2-P7: projects, using the same tokens and responsive container. */
.project-list { list-style: none; padding: 0; margin: 1.7rem 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1.25rem; }
.project-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: .85rem; overflow: hidden; }
.project-card img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.project-card-content { padding: 1.1rem; }
.project-card h2 { margin: 0 0 .5rem; font-size: 1.2rem; }
.project-card p { overflow-wrap: anywhere; }
.project-detail { width: min(100%, 54rem); }
.project-summary { font-size: 1.1rem; }
.project-meta { color: var(--muted); margin-block: 1rem 1.5rem; }
.project-hero { display: block; max-width: 100%; height: auto; border-radius: .85rem;
  margin-block: 1.5rem; }
.project-body { line-height: 1.75; overflow-wrap: anywhere; }
.project-body h2, .project-body h3 { margin-top: 1.7rem; }
.project-body pre { max-width: 100%; overflow-x: auto; }
.project-body img { max-width: 100%; height: auto; }

/* E2-P8: course plans share academic components but retain their own layout. */
.syllabus-list { list-style: none; padding: 0; margin: 1.7rem 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1.2rem; }
.syllabus-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: .85rem; overflow: hidden; }
.syllabus-card img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.syllabus-card-content { padding: 1.2rem; }
.syllabus-card h2 { margin: 0 0 .4rem; font-size: 1.2rem; }
.syllabus-detail { width: min(100%, 56rem); }
.syllabus-summary { font-size: 1.12rem; }
.syllabus-subtitle { color: var(--muted); font-size: 1.1rem; }
.syllabus-facts { display: grid; grid-template-columns: minmax(8rem, 25%) 1fr;
  gap: .4rem 1rem; border: 1px solid var(--border); border-radius: .6rem;
  padding: 1.2rem; background: var(--surface); margin-block: 1.5rem 2rem; }
.syllabus-facts dt { font-weight: 700; }
.syllabus-facts dd { margin: 0; overflow-wrap: anywhere; }
.syllabus-content { line-height: 1.75; overflow-wrap: anywhere; }
.syllabus-content h2 { margin-top: 2rem; }
.syllabus-content pre { max-width: 100%; overflow-x: auto; }
.syllabus-content img { max-width: 100%; height: auto; }
.syllabus-content blockquote { margin-inline: 0; padding: .7rem 1rem;
  border-left: 4px solid var(--accent); background: var(--surface); }
@media (max-width: 35rem) {
  .syllabus-facts { grid-template-columns: 1fr; }
  .syllabus-facts dd { margin-bottom: .6rem; }
}

/* E2-P9: talks; same semantic layouts and tokens as the other previews. */
.talk-detail { width: min(100%, 54rem); }
.talk-summary { font-size: 1.12rem; }
.talk-facts { display: grid; grid-template-columns: minmax(6rem, 23%) 1fr;
  gap: .4rem 1rem; border: 1px solid var(--border); border-radius: .7rem;
  background: var(--surface); padding: 1.15rem; margin-block: 1.5rem; }
.talk-facts dt { font-weight: 700; }
.talk-facts dd { margin: 0; }
.talk-hero { display: block; max-width: 100%; height: auto; border-radius: .75rem; }
.talk-tags { color: var(--muted); }
.talk-body { line-height: 1.75; }
.talk-list { list-style: none; padding: 0; margin-block: 1.5rem;
  display: grid; gap: 1rem; }
.talk-card { border: 1px solid var(--border); background: var(--surface);
  border-radius: .75rem; padding: 1.15rem 1.4rem; }
.talk-card h2 { margin-top: 0; }
.empty-state, .language-notice { color: var(--muted); }
@media (max-width: 35rem) { .talk-facts { grid-template-columns: 1fr; } }

/* Home pages: reproduce the Hugo Academic Legacy layout, without its theme.
   The 4/8 split, round portrait, section rhythm and vertical streams come from
   the preserved Hugo HTML. Non-home detail pages retain their existing CSS. */
/* Keep full-viewport section backgrounds from creating horizontal scrollbars. */
body:has(.academic-home) { overflow-x: clip; background: var(--surface); }
.home-main-content { padding-block: 0; }
.academic-home { display: block; }
.academic-home .home-section {
  position: relative; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: clamp(2rem, 4vw, 4rem); min-width: 0;
  isolation: isolate;
  padding-block: clamp(2.75rem, 5vw, 5.5rem);
  scroll-margin-top: 5rem;
}
.academic-home .home-section::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: 50%; width: 100vw; transform: translateX(-50%);
  background: var(--surface); z-index: -1;
}
.academic-home .home-section:nth-child(even)::before {
  background: var(--page);
}
.academic-home .home-section > h2,
.academic-home .home-section-content > h2 {
  margin: 0 0 1.5rem; font-size: clamp(1.65rem, 2.5vw, 2rem);
  font-weight: 600; line-height: 1.2;
}
.academic-home .home-section-content { min-width: 0; }
.academic-home .home-section > h2 { padding-top: .2rem; }
.home-about .profile-sidebar { text-align: center; min-width: 0; }
.home-about .profile-avatar {
  display: block; width: min(100%, 12.5rem); height: auto;
  aspect-ratio: 1; object-fit: cover; border-radius: 50%;
  margin: 0 auto 1.25rem;
}
.home-about .profile-sidebar h1 {
  font-size: clamp(1.45rem, 2.4vw, 1.8rem);
  font-weight: 400; line-height: 1.2; margin: .5rem 0 .7rem;
}
.home-about .profile-role,
.home-about .profile-organization { margin: .35rem 0; color: var(--muted); }
.home-about .profile-social-links,
.academic-home .contact-list {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap;
  gap: .4rem; list-style: none; padding: 0; margin: 1.4rem 0 0;
}
.academic-home .contact-list { justify-content: flex-start; margin: 0; }
.social-link {
  display: inline-flex; justify-content: center; align-items: center;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  color: var(--accent); text-decoration: none;
}
a.social-link:hover { background: var(--border); }
a.social-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.social-link-pending { opacity: .45; cursor: help; }
.social-icon {
  display: inline-block; flex: 0 0 auto; width: 1.45rem; height: 1.45rem;
  background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.social-icon-envelope { --icon: url("/icons/envelope.svg"); }
.social-icon-mastodon { --icon: url("/icons/mastodon.svg"); }
.social-icon-linkedin { --icon: url("/icons/linkedin.svg"); }
.social-icon-orcid { --icon: url("/icons/orcid.svg"); }
.social-icon-lattes { --icon: url("/icons/lattes.svg"); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.home-about .profile-body { max-width: 100%; overflow-wrap: anywhere; }
.home-about .profile-body > :first-child { margin-top: 0; }
.home-about .profile-details {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.5rem; margin-top: 1.4rem;
}
.home-about .profile-details h3 { font-size: 1.2rem; font-weight: 600; margin: 0 0 .6rem; }
.home-about .profile-interests ul { margin: 0; padding-left: 1.2rem; }
.home-about .profile-education ul { list-style: none; margin: 0; padding: 0; }
.home-about .profile-education li { margin-bottom: .85rem; }
.home-about .profile-education li strong,
.home-about .profile-education li span { display: block; font-size: .95rem; }
.home-about .profile-education li strong { font-weight: 600; }
.home-about .education-year { color: var(--muted); font-size: .85rem; }
.academic-home .project-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem; margin-top: 0;
}
.academic-home .project-card { border-radius: .25rem; }
.academic-home .project-card img { aspect-ratio: 16 / 10; }
.academic-home .project-card-content { padding: 1rem; }
.academic-home .project-card h2 { font-size: 1.05rem; }
/* Home: compact publication cards; archive: larger single-column cards. */
.academic-home .publication-list { display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 0; }
.academic-home .publication-card { padding: 1rem 1.2rem; }
.academic-home .publication-card h2 { font-size: 1.08rem; margin: 0 0 .45rem; }
.academic-home .publication-card .card-authors,
.academic-home .publication-card .card-meta { font-size: .88rem; }
.publication-index .publication-list { grid-template-columns: 1fr; gap: 1rem; }
.publication-index .publication-card { padding: 1.35rem 1.6rem; }
.publication-index .publication-card h2 { font-size: 1.3rem; }
.academic-home .syllabus-list,
.academic-home .talk-list { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
.academic-home .syllabus-card,
.academic-home .talk-card {
  border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; background: transparent;
  padding: 1.2rem 0;
}
.academic-home .syllabus-card:first-child,
.academic-home .talk-card:first-child { padding-top: 0; }
.academic-home .syllabus-card h2,
.academic-home .talk-card h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 .4rem; }
.academic-home .syllabus-card .card-meta,
.academic-home .talk-card .card-meta { font-size: .87rem; }
.academic-home .syllabus-card article {
  display: flex; align-items: flex-start; gap: 1.1rem;
}
.academic-home .syllabus-card article > a { order: 2; flex: 0 0 7rem; }
.academic-home .syllabus-card img { aspect-ratio: 4 / 3; border-radius: .2rem; }
.academic-home .syllabus-card-content { order: 1; flex: 1; min-width: 0; padding: 0; }
.academic-home .syllabus-card-content p { margin: .45rem 0; }
.academic-home .section-more { margin: 1.5rem 0 0; font-weight: 600; }
@media (max-width: 48rem) {
  .academic-home .home-section { grid-template-columns: 1fr; gap: 1.5rem; }
  .academic-home .home-section > h2 { margin-bottom: 0; }
  .home-about .profile-sidebar { max-width: 30rem; margin-inline: auto; }
}
@media (max-width: 38rem) {
  .academic-home .publication-list { grid-template-columns: 1fr; }
}
@media (max-width: 35rem) {
  .home-about .profile-details { grid-template-columns: 1fr; }
  .academic-home .project-list { grid-template-columns: 1fr; }
  .academic-home .syllabus-card article > a { flex-basis: 5rem; }
}
