/* Shared buttons */

.home-button,
.pub-button {
  display: inline-block;
  width: fit-content;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--bs-primary);
  border-radius: var(--bs-border-radius);
  background-color: var(--bs-primary);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.5;
  text-decoration: none;
}

.home-button:hover,
.pub-button:hover {
  border-color: var(--bs-link-hover-color);
  background-color: var(--bs-link-hover-color);
  color: #fff;
  text-decoration: none;
}

.home-button-secondary {
  background-color: transparent;
  color: var(--bs-primary);
}

.home-button-secondary:hover {
  background-color: transparent;
  color: var(--bs-link-hover-color);
}


/* Home page headings */

.home-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.home-section-title h2 {
  margin: 0;
  padding: 0;
  border-bottom: none;
}

.home-section-title h2::before,
.home-section-title h2::after {
  display: none;
  content: none;
}

.home-section-more {
  color: var(--bs-primary);
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
}

.home-section-more::after {
  content: " →";
}

.home-section-more:hover {
  color: var(--bs-link-hover-color);
  text-decoration: underline;
}


/* Card grids */

.home-card-row {
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.home-card-row > .columns,
.pub-feature-grid {
  display: grid;
  gap: 1rem;
  align-items: stretch;
}

.home-card-row > .columns {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pub-feature-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
}

.home-card-row > .columns > .column {
  display: flex;
  width: auto !important;
  max-width: none !important;
  min-width: 0;
}


/* Cards */

.home-card,
.pub-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid var(--bs-border-color);
  border-top: 3px solid var(--bs-primary);
  border-radius: var(--bs-border-radius);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

.home-card {
  height: 100%;
  min-height: 260px;
  padding: 1rem;
}

.home-card-research {
  min-height: 340px;
}

.pub-card {
  min-height: 0;
  padding: 0.75rem 1rem;
}

.home-card-image {
  display: block;
  width: 95%;
  height: 145px;
  margin: 0 auto 1rem;
  object-fit: contain;
}

.home-card-title,
.pub-card-title {
  color: var(--bs-body-color);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.home-card-title {
  margin-bottom: 0.75rem;
}

.pub-card-title {
  margin-bottom: 0.25rem;
}

.home-card p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.pub-card p {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

.pub-card-meta {
  margin-bottom: 0.5rem;
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
  line-height: 1.3;
}

.home-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.pub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 0.5rem;
}

.pub-tags span {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  line-height: 1.25;
}

.pub-card .pub-button {
  padding: 0.25rem 0.625rem;
  font-size: 0.875rem;
  line-height: 1.35;
}


/* Publications page */

.publication-page {
  max-width: 1180px;
  margin: 0 auto;
}

.pub-list {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.pub-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}

.pub-title {
  margin: 0 0 0.125rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.pub-title p,
.pub-meta p {
  margin: 0;
}

.pub-title-link {
  color: var(--bs-body-color);
  text-decoration: none;
}

.pub-title-link::after {
  content: " ↗";
  color: var(--bs-primary);
  font-size: 0.875rem;
  font-weight: 400;
}

.pub-title-link:hover {
  color: var(--bs-primary);
  text-decoration: none;
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
  line-height: 1.25;
}

.pub-authors,
.pub-journal {
  display: inline-flex;
  min-width: 0;
}

.pub-authors::before,
.pub-journal::before {
  margin-right: 0.25rem;
  color: var(--bs-primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.pub-authors::before {
  content: "作者";
}

.pub-journal::before {
  content: "期刊";
}


/* Responsive layout */

@media (max-width: 1100px) {
  .home-card-row > .columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .pub-feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .home-card-row > .columns {
    grid-template-columns: 1fr;
  }

  .home-card,
  .home-card-research,
  .pub-card {
    min-height: auto;
  }

  .home-card-image {
    height: 120px;
  }

  .home-section-heading {
    align-items: flex-end;
  }

  .home-section-more {
    font-size: 0.875rem;
  }
}