.research-projects,
.research-project-detail {
  --research-muted: color-mix(in srgb, var(--global-text-color, #111827) 68%, var(--global-bg-color, #fff));
  --research-border: var(--global-divider-color, #dfe4ec);
  --research-accent: var(--global-theme-color, #2563eb);
  --research-tint: color-mix(in srgb, var(--research-accent) 6%, var(--global-bg-color, #fff));
}

.research-projects__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  margin-bottom: 1rem;
  color: var(--research-muted);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}

.research-projects__back:hover {
  color: var(--research-accent);
  text-decoration: none;
}

.research-projects__heading {
  margin-bottom: 1.35rem;
}

.research-projects__kicker {
  margin: 0 0 0.55rem;
  color: var(--research-accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.6;
  text-transform: uppercase;
}

.research-projects__heading h2 {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  color: var(--global-text-color, #111827);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.research-projects__heading h2 span {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--research-border);
  border-radius: 6px;
  color: var(--research-muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0;
}

.research-projects__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 1.6rem;
  margin-bottom: 2rem;
}

.research-project-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--research-border);
  border-radius: 14px;
  background: var(--global-card-bg-color, #fff);
  box-shadow: 0 5px 22px rgb(15 23 42 / 4%);
  scroll-margin-top: 6rem;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.research-project-card:hover,
.research-project-card:focus-within {
  border-color: color-mix(in srgb, var(--research-accent) 50%, var(--research-border));
  box-shadow: 0 8px 28px rgb(15 23 42 / 9%);
}

.research-project-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111820;
}

.research-project-card__media video,
.research-project-detail__demo video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #111820;
  object-fit: contain;
}

.research-project-card__playback {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 7px;
  background: rgb(10 18 30 / 88%);
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.research-project-card__playback[hidden] {
  display: none;
}

.research-project-card__playback:hover {
  background: #0a121e;
}

.research-project-card__playback span,
.research-project-card__action span {
  color: inherit;
}

.research-project-card__playback:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.research-project-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.45rem;
}

.research-project-card__publication {
  margin: 0 0 0.7rem;
  color: var(--research-muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.6;
}

.research-project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  padding: 0;
  margin: 0 0 1rem;
  list-style: none;
}

.research-project-tags li {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--research-tint);
  color: var(--research-accent);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.5;
}

.research-project-card h3 {
  margin: 0 0 0.5rem;
  color: var(--global-text-color, #111827);
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.research-project-card__subtitle {
  margin: 0 0 0.65rem;
  color: var(--global-text-color, #111827);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
}

.research-project-card__description {
  flex: 1;
  margin: 0 0 1.2rem;
  color: var(--research-muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.research-project-card__action {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.75rem;
  padding: 0.35rem 0;
  color: var(--research-accent);
  font-size: 0.83rem;
  font-weight: 700;
  text-decoration: none;
}

.research-project-card__action:hover {
  color: var(--research-accent);
  text-decoration: underline;
  text-underline-offset: 0.25rem;
}

.research-projects a:focus-visible,
.research-project-detail a:focus-visible {
  outline: 2px solid var(--research-accent);
  outline-offset: 4px;
  border-radius: 3px;
}

.research-project-detail__intro {
  max-width: 800px;
  margin-bottom: 1.8rem;
  color: var(--research-muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.research-project-detail__demo {
  margin: 0 0 2.5rem;
}

.research-project-detail__demo video {
  overflow: hidden;
  border: 1px solid var(--research-border);
  border-radius: 12px;
}

.research-project-detail__demo figcaption {
  margin-top: 0.75rem;
  color: var(--research-muted);
  font-size: 0.8rem;
  text-align: center;
}

.research-project-detail h2 {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.research-project-detail__footer {
  display: inline-block;
  padding: 1rem 0;
  margin-bottom: 1rem;
  color: var(--research-accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.research-content {
  color: var(--research-muted);
  font-size: 0.95rem;
  line-height: 1.85;
}

.research-content > section {
  padding-top: 2rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--research-border);
}

.research-content h2,
.research-content h3 {
  color: var(--global-text-color, #111827);
}

.research-content h3 {
  margin: 2rem 0 0.85rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.research-content li + li {
  margin-top: 0.65rem;
}

.research-content figure {
  min-width: 0;
  margin: 1.6rem 0;
}

.research-content figure img {
  display: block;
  width: 100%;
  height: auto;
  padding: 0.6rem;
  border: 1px solid var(--research-border);
  border-radius: 10px;
  background: #fff;
}

.research-content figure video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--research-border);
  border-radius: 10px;
  background: #111820;
}

.research-content figcaption {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  line-height: 1.65;
  text-align: center;
}

.research-content__figures,
.research-content__videos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1.3rem;
}

.research-content__table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--research-border);
  border-radius: 8px;
}

.research-content table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.6;
}

.research-content th,
.research-content td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--research-border);
  text-align: left;
}

.research-content th {
  color: var(--global-text-color, #111827);
  font-weight: 600;
}

.research-content thead {
  background: var(--research-tint);
}

.research-content caption {
  padding: 0.75rem 1rem;
  color: var(--research-muted);
  font-size: 0.8rem;
}

.research-citations {
  padding-top: 2rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--research-border);
}

.research-citation {
  padding: 1.4rem;
  margin: 1rem 0;
  border: 1px solid var(--research-border);
  border-radius: 10px;
}

.research-citation h3 {
  margin: 0 0 0.8rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.6;
}

.research-citation > p {
  margin: 0 0 0.5rem;
  color: var(--research-muted);
  font-size: 0.85rem;
  line-height: 1.65;
}

.research-citation > .research-citation__version {
  margin-bottom: 0.6rem;
  color: var(--research-accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.research-citation__links {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1rem;
}

.research-citation__links > a,
.research-citation__bib > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--research-accent);
  border-radius: 6px;
  color: var(--research-accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.research-citation__bib {
  min-width: 0;
}

.research-citation__bib[open] {
  flex-basis: 100%;
}

.research-citation__bib pre {
  padding: 1rem;
  margin: 0.75rem 0 0;
  border: 1px solid var(--research-border);
  border-radius: 6px;
  background: var(--research-tint);
  color: var(--global-text-color, #111827);
  font-size: 0.75rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.research-content__source {
  margin: 2rem 0 0.5rem;
  color: var(--research-muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

@media (max-width: 700px) {
  .research-projects__grid,
  .research-content__figures,
  .research-content__videos {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .navbar .navbar-brand {
    max-width: calc(100% - 3rem);
    font-size: 1rem;
    line-height: 1.3;
    white-space: normal;
  }

  .post-header .post-title {
    font-size: 2rem;
    overflow-wrap: anywhere;
  }

  .research-project-card__body {
    padding: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .research-project-card {
    transition: none;
  }
}
