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

:root {
  --font-body: "DM Sans", sans-serif;
  --font-display: "Cormorant Garamond", serif;
  --bg: #1e1e1e;
  --bg-soft: #252526;
  --bg-overlay: rgba(37, 37, 38, 0.95);
  --ink: #f2f6ff;
  --ink-mid: #e0e7f8;
  --ink-soft: #c1cbe2;
  --accent: #569cd6;
  --accent-violet: #c586c0;
  --line: rgba(212, 212, 212, 0.2);
  --scroll-track: rgba(212, 212, 212, 0.08);
  --scroll-thumb: rgba(86, 156, 214, 0.55);
  --scroll-thumb-hover: rgba(197, 134, 192, 0.68);
  --body-background:
    radial-gradient(circle at 10% 5%, rgba(86, 156, 214, 0.2), transparent 38%),
    radial-gradient(circle at 90% 12%, rgba(197, 134, 192, 0.18), transparent 30%),
    linear-gradient(135deg, #20233a 0%, #252526 42%, #2a2243 100%);
  --overlay-background: rgba(30, 30, 30, 0.45);
  --drawer-background:
    radial-gradient(circle at top, rgba(86, 156, 214, 0.2), transparent 30%),
    linear-gradient(180deg, #20233a 0%, #252526 45%, #2a2243 100%);
  --mobile-menu-background:
    radial-gradient(circle at top, rgba(86, 156, 214, 0.2), transparent 30%),
    linear-gradient(180deg, #20233a 0%, #252526 45%, #2a2243 100%);
  --modal-overlay-background: rgba(18, 18, 20, 0.72);
  --modal-panel-background:
    radial-gradient(circle at top, rgba(86, 156, 214, 0.12), transparent 34%),
    linear-gradient(180deg, #20233a 0%, #252526 52%, #2a2243 100%);
  --code-surface: rgba(0, 0, 0, 0.2);
  --ui-surface: rgba(255, 255, 255, 0.05);
  --ui-surface-hover: rgba(86, 156, 214, 0.18);
  --scroll-thumb-gradient: rgba(86, 156, 214, 0.35);
  --scroll-thumb-hover-gradient: rgba(197, 134, 192, 0.45);
  --nav-background: transparent;
  --theme-toggle-border: rgba(212, 212, 212, 0.3);
  --theme-toggle-bg: rgba(255, 255, 255, 0.05);
  --theme-toggle-bg-hover: rgba(255, 255, 255, 0.12);
}

html[data-theme="rustic"] {
  --font-body: "Sorts Mill Goudy", "IM Fell English", serif;
  --font-display: "IM Fell English SC", "IM Fell English", serif;
  --bg: #fff8dc;
  --bg-soft: #f6ecd4;
  --bg-overlay: rgba(244, 232, 204, 0.97);
  --ink: #2f2216;
  --ink-mid: #3e2d1d;
  --ink-soft: #4d3824;
  --accent: #5e3f20;
  --accent-violet: #412a15;
  --line: rgba(63, 47, 31, 0.22);
  --scroll-track: rgba(63, 47, 31, 0.12);
  --scroll-thumb: rgba(143, 90, 43, 0.6);
  --scroll-thumb-hover: rgba(109, 68, 32, 0.75);
  --body-background:
    radial-gradient(circle at 12% 7%, rgba(176, 130, 74, 0.15), transparent 33%),
    radial-gradient(circle at 88% 10%, rgba(133, 95, 58, 0.14), transparent 31%),
    linear-gradient(140deg, #fff8dc 0%, #f7edd1 48%, #efe2bf 100%);
  --overlay-background: rgba(80, 60, 35, 0.24);
  --drawer-background:
    radial-gradient(circle at top, rgba(176, 130, 74, 0.16), transparent 32%),
    linear-gradient(180deg, #fff8dc 0%, #f5ebd0 55%, #eadcb8 100%);
  --mobile-menu-background:
    radial-gradient(circle at top, rgba(176, 130, 74, 0.14), transparent 30%),
    linear-gradient(180deg, #fff8dc 0%, #f5ebd0 52%, #eadcb8 100%);
  --modal-overlay-background: rgba(78, 58, 32, 0.45);
  --modal-panel-background:
    radial-gradient(circle at top, rgba(176, 130, 74, 0.12), transparent 36%),
    linear-gradient(180deg, #fff8dc 0%, #f6ecd3 55%, #eddfbd 100%);
  --code-surface: rgba(255, 248, 220, 0.55);
  --ui-surface: rgba(63, 47, 31, 0.06);
  --ui-surface-hover: rgba(143, 90, 43, 0.16);
  --scroll-thumb-gradient: rgba(143, 90, 43, 0.35);
  --scroll-thumb-hover-gradient: rgba(109, 68, 32, 0.4);
  --nav-background: transparent;
  --theme-toggle-border: rgba(63, 47, 31, 0.28);
  --theme-toggle-bg: rgba(255, 248, 220, 0.46);
  --theme-toggle-bg-hover: rgba(255, 248, 220, 0.76);
}

html,
body {
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
}

body {
  background: var(--body-background);
}

/* Global scrollbar styling for modern, minimal dark theme consistency */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scroll-thumb), var(--scroll-thumb-gradient));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scroll-thumb-hover), var(--scroll-thumb-hover-gradient));
}

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1.3rem clamp(1.4rem, 3vw, 2.8rem);
  background: var(--nav-background);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--theme-toggle-border);
  background: var(--theme-toggle-bg);
  padding: 2px;
}

.theme-option {
  background: transparent;
  border: 1px solid var(--theme-toggle-border);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.35rem 0.55rem;
  min-width: 5.3rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.theme-option:hover {
  background: var(--theme-toggle-bg-hover);
}

.theme-option.active {
  background: var(--theme-toggle-bg-hover);
  border-color: var(--accent);
}

.hamburger {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0.4rem;
  background: transparent;
  border: none;
  transition: transform 0.2s ease;
}

.hamburger:hover {
  transform: translateY(-1px);
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-background);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100%;
  background: var(--drawer-background);
  z-index: 300;
  padding: 4.4rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  transition: right 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer.open {
  right: 0;
}

.drawer-close {
  position: absolute;
  top: 1.4rem;
  right: 1.6rem;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--ink-mid);
  background: none;
  border: none;
  line-height: 1;
}

.drawer a {
  display: block;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 2.6vw, 2.45rem);
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink);
  text-decoration: none;
  padding: 0.45rem 0;
  text-align: left;
}

.drawer a.coming-soon {
  color: var(--ink-soft);
  pointer-events: none;
}

.cs-tag {
  display: block;
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.72;
  margin-top: -0.2rem;
  margin-left: 0;
}

.mobile-menu {
  display: flex;
  position: fixed;
  inset: 0;
  background: var(--mobile-menu-background);
  z-index: 300;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    visibility 0.28s ease;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.mobile-close {
  position: absolute;
  top: 1.4rem;
  right: 1.6rem;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--ink-mid);
  background: none;
  border: none;
}

.mobile-menu a {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  padding: 0.55rem 2rem;
  text-align: center;
}

.mobile-menu a.coming-soon {
  color: var(--ink-soft);
  pointer-events: none;
}

.mobile-cs {
  display: block;
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.72;
  margin-top: -0.25rem;
}

.hero {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
  padding: 6.15rem clamp(1.2rem, 3vw, 2.6rem) 0;
  position: relative;
}

.hero-left,
.hero-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - 8.6rem);
}

.hero-left {
  align-items: center;
  padding: 4rem clamp(1.8rem, 4vw, 5rem);
}

.identity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.1rem, 2.1vw, 1.8rem);
  width: min(100%, 36rem);
  opacity: 0;
  animation: fadeUp 0.85s 0.1s forwards;
}

.logo-wrap {
  flex-shrink: 0;
  width: clamp(64px, 7vw, 96px);
}

.logo-wrap img {
  width: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.3rem, 4vw, 4rem);
  letter-spacing: -0.02em;
  line-height: 0.96;
  white-space: nowrap;
  color: var(--ink);
}

.hero-right {
  align-items: center;
  padding: 4rem clamp(1.8rem, 4vw, 5rem);
  gap: 1.2rem;
}

.discipline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.45rem, 2.6vw, 2.35rem);
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  color: var(--ink);
  opacity: 0;
  animation: fadeUp 0.85s 0.3s forwards;
}

.position-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.42rem;
  opacity: 0;
  animation: fadeUp 0.85s 0.45s forwards;
}

.position {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(0.76rem, 1.02vw, 0.92rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mid);
  text-align: center;
}

.at-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.at-sym {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.institution {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(0.88rem, 1.32vw, 1.04rem);
  color: var(--ink);
  letter-spacing: 0.02em;
  text-align: center;
}

footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 0.9rem 2rem 0.8rem;
}

.copyright {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  opacity: 0;
  animation: fadeUp 0.85s 0.6s forwards;
}

.page-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding-top: 6.15rem;
}

.research-main {
  width: min(1240px, 100% - 3rem);
  margin: 0 auto;
  padding: 2rem 0 2.25rem;
}

.research-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.research-subtitle {
  color: var(--ink-mid);
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  margin-bottom: 2rem;
}

.page-title-rule {
  height: 1px;
  background: var(--line);
  margin: 0.25rem 0 1.45rem;
}

.research-section + .research-section {
  margin-top: 2rem;
}

.research-heading {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.8vw, 2rem);
  font-weight: 400;
  margin-bottom: 0.65rem;
}

.research-list {
  margin-left: 1.5rem;
}

.research-list li + li {
  margin-top: 0.8rem;
}

.research-item-title {
  font-weight: 500;
  color: var(--ink);
}

.research-item-meta {
  color: var(--ink-mid);
  font-size: 0.95rem;
}

.research-link {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

.research-link:hover {
  color: var(--accent-violet);
}

.research-placeholder {
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.research-publications {
  margin-left: 1.9rem;
}

.research-publications li + li {
  margin-top: 1.05rem;
}

.thesis-list li + li {
  margin-top: 1.05rem;
}

.publication-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 0.85rem;
}

.publication-name {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.03rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  min-width: 0;
}

.publication-name:hover {
  color: var(--ink-mid);
}

/* Math inside titles: keep site font unchanged while giving LaTeX glyphs
   an elegant math-capable serif stack close to the surrounding typography. */
.inline-math {
  display: inline-block;
  vertical-align: -0.08em;
  margin-inline: 0.04em;
}

.inline-math math {
  font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", "Times New Roman", serif;
  font-size: 1.02em;
  color: currentColor;
}

.cite-button {
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 0.34rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0;
  white-space: nowrap;
}

.cite-button:hover {
  color: var(--accent-violet);
}

.cite-button::after {
  content: "";
  width: 0.62rem;
  height: 0.62rem;
  border: 1px solid currentColor;
  box-shadow: -2px 2px 0 -1px currentColor;
  transform: translateY(0.02rem);
}

.publication-meta {
  margin-top: 0.18rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.42rem;
  font-size: 0.95rem;
}

.thesis-meta {
  margin-top: 0.3rem;
}

.publication-identifier,
.publication-link {
  color: var(--ink-mid);
  text-underline-offset: 0.16em;
}

.publication-identifier:hover,
.publication-link:hover {
  color: var(--accent);
}

.publication-sep {
  color: var(--ink-soft);
}

.cite-modal {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--modal-overlay-background);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cite-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cite-modal-panel {
  width: min(760px, calc(100% - 2rem));
  background: var(--modal-panel-background);
  border: 1px solid var(--line);
  padding: 0.9rem 1rem 1rem;
}

.cite-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cite-modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.02em;
}

.cite-modal-close {
  background: none;
  border: none;
  color: var(--ink-mid);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.cite-modal-body {
  margin-top: 0.6rem;
}

.cite-modal-bibtex {
  margin: 0;
  max-height: 50dvh;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid rgba(212, 212, 212, 0.14);
  padding: 0.85rem;
  background: var(--code-surface);
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre;
  word-break: normal;
}

.cite-modal-actions {
  margin-top: 0.72rem;
  display: flex;
  justify-content: flex-end;
}

.copy-bibtex-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--ui-surface);
  padding: 0.34rem 0.7rem;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.copy-bibtex-btn:hover {
  background: var(--ui-surface-hover);
}

.gallery-main {
  width: min(1240px, 100% - 3rem);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.gallery-card {
  border: 1px solid var(--line);
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--bg-soft);
  position: relative;
}

.gallery-card-multi {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 0.95rem;
  height: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.9);
  opacity: 0.95;
  z-index: 2;
}

.gallery-card-multi::before {
  content: "";
  position: absolute;
  left: -0.28rem;
  top: 0.2rem;
  width: 0.95rem;
  height: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.24s ease;
}

.gallery-card:hover img {
  transform: scale(1.02);
}

.gallery-view-page {
  height: 100dvh;
  background: #000;
  color: #f5f7ff;
  --gallery-topbar-h: 3.35rem;
  display: grid;
  grid-template-rows: var(--gallery-topbar-h) minmax(0, 1fr);
  overflow: hidden;
}

html[data-theme="rustic"] .gallery-view-page {
  background: #fff;
  color: #1f1610;
}

.gallery-topbar {
  height: var(--gallery-topbar-h);
  background: #000;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding-right: 1rem;
}

html[data-theme="rustic"] .gallery-topbar {
  background: #fff;
}

.gallery-overlay-back {
  position: relative;
  width: auto;
  height: auto;
  z-index: 11;
  border: none;
  background: transparent;
  color: inherit;
  font-family: var(--font-body);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  padding: 0.25rem 1.15rem;
  cursor: pointer;
  opacity: 1;
  text-align: left;
}

.gallery-overlay-back:hover {
  opacity: 1;
}

.gallery-post-counter {
  min-width: 5.9rem;
  text-align: right;
  font-family: var(--font-body);
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  opacity: 0.92;
  pointer-events: none;
}

.gallery-feed {
  width: 100%;
  margin: 0 auto;
  padding: 0.7rem 0.7rem 1.2rem;
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.gallery-feed-post {
  width: min(1120px, 100%);
  margin-inline: auto;
  border: none;
  background: transparent;
  padding: 0.5rem;
  height: calc(100dvh - 4.4rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "media caption"
    "dots caption";
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.gallery-feed-media-wrap {
  grid-area: media;
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) 2.2rem;
  grid-template-rows: 2.2rem minmax(0, 1fr) 2.2rem;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
  height: 100%;
  position: relative;
  touch-action: none;
}

.gallery-item-dots {
  grid-area: dots;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.38rem;
  min-height: 0.9rem;
}

.gallery-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 38%, transparent);
}

.gallery-dot.active {
  background: var(--accent);
}

.gallery-dot.mini {
  width: 0.3rem;
  height: 0.3rem;
  opacity: 0.85;
}

.gallery-item-counter {
  position: absolute;
  right: 0.7rem;
  top: 0.55rem;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  z-index: 4;
}

html[data-theme="rustic"] .gallery-item-counter {
  background: rgba(255, 255, 255, 0.62);
  color: #1f1610;
}

.gallery-nav {
  border: none;
  background: transparent;
  color: inherit;
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-nav:hover {
  opacity: 0.85;
}

.gallery-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gallery-nav.hidden {
  visibility: hidden;
  pointer-events: none;
}

.gallery-prev {
  grid-column: 1;
  grid-row: 2;
}

.gallery-stage {
  grid-column: 2;
  grid-row: 2;
  width: min(100%, calc(100dvh - 7rem));
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 0;
  display: block;
  background: #000;
  border: none;
  overflow: hidden;
  touch-action: none;
  position: relative;
  justify-self: center;
  align-self: center;
}

.gallery-next {
  grid-column: 3;
  grid-row: 2;
}

.gallery-media {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

.gallery-picture {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-video-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.gallery-media-video {
  max-width: 100%;
  max-height: 100%;
}

.gallery-video-play,
.gallery-video-mute {
  position: absolute;
  border: none;
  color: #fff;
  background: rgba(0, 0, 0, 0.36);
  cursor: pointer;
}

.gallery-video-play {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  font-size: 1.18rem;
}

.gallery-video-play.hidden {
  opacity: 0;
  pointer-events: none;
}

.gallery-video-mute {
  right: 0.55rem;
  bottom: 0.55rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

.gallery-media-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(0);
  transition: transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}


.gallery-media-frame.enter-from-right {
  transform: translateX(100%);
}

.gallery-media-frame.enter-from-left {
  transform: translateX(-100%);
}

.gallery-media-frame.exit-to-left {
  transform: translateX(-100%);
}

.gallery-media-frame.exit-to-right {
  transform: translateX(100%);
}

video.gallery-media {
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.gallery-caption {
  color: inherit;
  font-size: 0.98rem;
  line-height: 1.45;
  white-space: pre-line;
  text-align: justify;
  text-justify: inter-word;
}

.gallery-caption-panel {
  grid-area: caption;
  border: none;
  background: transparent;
  padding: 0.2rem 0.2rem 0.2rem 0.55rem;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 0.45rem;
  min-height: 0;
  align-self: stretch;
  align-content: start;
  overflow: hidden;
}

.gallery-caption-panel .gallery-caption {
  overflow-y: auto;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  padding-right: 0.55rem;
  box-sizing: border-box;
}

@media (min-width: 681px) {
  .gallery-caption-panel {
    height: var(--gallery-caption-pane-height, 70%);
    max-height: var(--gallery-caption-pane-height, 70%);
    min-height: 0;
    align-self: center;
  }
}

.gallery-meta {
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

.gallery-date {
  color: color-mix(in srgb, currentColor 70%, transparent);
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.gallery-caption-more {
  display: none;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  padding: 0;
  width: fit-content;
  cursor: pointer;
}

.gallery-caption-more:hover {
  text-decoration: underline;
}

.gallery-caption-more[hidden] {
  display: none !important;
}

.cv-main {
  width: min(1240px, 100% - 3rem);
}

.cv-content {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
}

.cv-content h2,
.cv-content h3 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 1.1rem 0 0.45rem;
}

.cv-content p + p,
.cv-content ul + p,
.cv-content ol + p {
  margin-top: 0.6rem;
}

.cv-content ul,
.cv-content ol {
  margin-left: 1.5rem;
}

.cv-content li + li {
  margin-top: 0.34rem;
}

.cv-content a {
  color: var(--accent);
  text-underline-offset: 0.16em;
}

.cv-content a:hover {
  color: var(--accent-violet);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    min-height: 100dvh;
    padding-top: 5.2rem;
  }

  .hero-left,
  .hero-right {
    min-height: auto;
    padding: 2.5rem 1.6rem;
  }

  footer {
    grid-column: 1;
    padding-bottom: 0.9rem;
  }

  .page-shell {
    padding-top: 5.2rem;
  }

  .research-main {
    width: min(1240px, 100% - 2rem);
    padding-top: 1.4rem;
  }

  .gallery-main {
    width: min(1240px, 100% - 2rem);
  }
}

@media (max-width: 680px) {
  nav {
    padding: 1.1rem 1.4rem;
  }

  .theme-option {
    font-size: 0.68rem;
    padding: 0.32rem 0.45rem;
    letter-spacing: 0.08em;
    min-width: 4.6rem;
  }

  .drawer,
  .drawer-overlay {
    display: none !important;
  }

  .hero-left {
    padding: 2.3rem 1.4rem 1.5rem;
  }

  .identity {
    flex-direction: column;
    align-items: center;
    gap: 1.05rem;
    text-align: center;
  }

  .logo-wrap {
    width: clamp(68px, 20vw, 98px);
  }

  .name {
    font-size: clamp(2.2rem, 11vw, 3rem);
    white-space: normal;
    text-align: center;
  }

  .hero-right {
    padding: 1.5rem 1.4rem 2.25rem;
    text-align: center;
  }

  .discipline {
    font-size: clamp(1.2rem, 4.5vw, 1.7rem);
    white-space: normal;
  }

  .research-publications {
    margin-left: 1.4rem;
  }

  .cite-modal-panel {
    width: calc(100% - 1.25rem);
    padding: 0.8rem 0.82rem 0.9rem;
  }

  .position-block {
    width: min(100%, 22rem);
  }

  .position,
  .institution {
    white-space: normal;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem;
  }

  .gallery-feed {
    width: 100%;
    padding: 0.5rem 0.35rem 0.65rem;
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
    height: auto;
    touch-action: none;
    overscroll-behavior: none;
  }

  .gallery-feed-post {
    padding: 0.35rem;
    height: auto;
    max-height: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "media"
      "dots"
      "caption";
    gap: 0.45rem;
    align-items: start;
    align-content: start;
  }

  .gallery-caption-panel {
    padding: 0.15rem 0.25rem;
    grid-template-rows: auto auto auto;
    gap: 0.35rem;
    max-height: min(11rem, 30dvh);
    overflow: hidden;
  }

  .gallery-caption-panel .gallery-caption {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .gallery-caption.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .gallery-caption-more {
    display: inline-block;
  }

  .gallery-stage {
    grid-column: 1;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    min-height: 0;
  }

  .gallery-feed-media-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    height: auto;
    min-height: 0;
    align-items: stretch;
    gap: 0;
  }

  .gallery-nav {
    display: none;
  }

  .gallery-item-counter {
    right: 0.6rem;
    top: 0.55rem;
  }

  .gallery-item-dots {
    min-height: 0.8rem;
  }

  .gallery-post-counter {
    min-width: 5.25rem;
    font-size: 0.8rem;
    padding-right: 0.05rem;
  }

  .gallery-media {
    max-height: 100%;
    max-width: 100%;
  }

  .gallery-stage {
    grid-row: 1;
  }

  .gallery-video-shell {
    width: 100%;
    height: 100%;
  }

  .gallery-nav {
    width: 1.85rem;
    height: 1.85rem;
    font-size: 1.3rem;
  }
}
