/* Content views follow the typography and card hierarchy used by Lab. AAA. */
:root {
  --content-text: var(--text-color, #212529);
  --content-muted: #777;
  --content-faint: #999;
  --content-line: rgba(0, 0, 0, .125);
  --content-surface: var(--bg-color, #fff);
  --content-accent: #7668a8;
}

[data-theme="dark"] {
  --content-muted: #aaa;
  --content-faint: #969696;
  --content-line: rgba(255, 255, 255, .18);
}

#main-content.content-page {
  --content-page-max: 925px;
  width: min(calc(100vw - 60px), var(--content-page-max));
  max-width: none;
  margin-top: 48px;
  margin-right: 0;
  margin-left: calc((100vw - min(calc(100vw - 60px), var(--content-page-max))) / 2);
  padding: 0 15px 48px;
  box-sizing: border-box;
  color: var(--content-text);
  font-family: Poppins, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.content-page-heading h1 {
  margin: 48px 0 8px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.content-page-heading hr,
.markdown-body hr {
  height: 0;
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--border-color, #bbb);
}

.content-tools {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto minmax(150px, auto);
  align-items: center;
  gap: 10px;
  margin: 24px 0 16px;
}

.content-tools label {
  color: var(--content-muted);
  font-size: 12.8px;
}

.content-tools input,
.content-tools select {
  min-width: 0;
  box-sizing: border-box;
  padding: 8px 11px;
  border: 1px solid var(--content-line);
  border-radius: 8px;
  background: var(--content-surface);
  color: var(--content-text);
  font: inherit;
  font-size: 12.8px;
  line-height: 1.5;
}

.content-tools input:focus,
.content-tools select:focus {
  outline: 2px solid color-mix(in srgb, var(--content-accent), transparent 45%);
  outline-offset: 1px;
}

.content-year {
  margin: 24px 0 4px;
  color: var(--content-muted);
  font-size: 24px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.2;
}

#content-list { padding-inline: 1px; }

.content-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  min-height: 160px;
  margin: 8px 0;
  overflow: hidden;
  border: 1px solid var(--content-line);
  border-radius: 8px;
  background: var(--content-surface);
}

main[data-category="publications"] .content-row { height: 159.9px; min-height: 0; }
main[data-category="publications"] .content-row-image img,
main[data-category="publications"] .content-row-body { height: 160px; min-height: 0; }
main[data-category="publications"] .content-row-body { overflow: hidden; }

.content-row.no-image {
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.content-row-image {
  display: block;
  min-width: 0;
  box-sizing: border-box;
  padding-right: 15px;
}

.content-row-image img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: cover;
  border-radius: 8px 0 0 8px;
}

.content-row-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  box-sizing: border-box;
  padding: 16px 15px;
}

.content-row h3 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.content-row h3 a {
  color: var(--content-text);
  text-decoration: none;
}

.content-row h3 a:hover { text-decoration: underline; }

.content-row p {
  margin: 0;
  font-size: 12.8px;
  line-height: 1.2;
}

.content-subtitle { margin-bottom: 8px !important; }
.content-meta { color: var(--content-muted); }

.content-tags {
  display: flex;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 4px 10px;
  overflow: hidden;
  color: var(--content-faint);
  font-size: 10.5px;
  line-height: 1.35;
  white-space: nowrap;
}

.content-tags::before { content: "Tags:"; }

.content-tags span:not(:last-child)::after {
  content: " ·";
  margin-left: 10px;
}

.content-kind {
  flex: 0 0 auto;
  color: var(--content-text);
  line-height: 1.5 !important;
}

.content-row-footer {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 0;
}

.content-empty {
  padding: 32px 0;
  color: var(--content-muted);
  font-size: 12.8px;
}

/* Detail pages use the same 690/660 px tablet measure as the source site. */
#main-content.content-detail {
  --content-page-max: 860px;
  margin-top: 43px;
}

#content-detail { min-width: 0; }

.content-back {
  display: inline-block;
  margin: 0 0 16px;
  color: var(--content-muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-decoration: none;
}

#content-detail > h1 {
  margin: 32px 0 8px;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.detail-subtitle {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
}

.detail-meta {
  margin: -6px 0 16px;
  color: var(--content-faint);
  font-size: 13.3px;
  line-height: 1.5;
}

.detail-meta p { margin: 0; }

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  overflow: visible;
  white-space: normal;
}

.detail-tags span {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(108, 117, 125, .12);
  color: var(--content-muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.markdown-body {
  margin-top: 14px;
  min-width: 0;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  font-weight: 500;
  line-height: 1.2;
}

.markdown-body h2 { margin: 28px 0 8px; font-size: 32px; }
.markdown-body h3 { margin: 24px 0 8px; font-size: 28px; }
.markdown-body h4 { margin: 24px 0 8px; font-size: 24px; }
.markdown-body h5 { margin: 20px 0 8px; font-size: 20px; }
.markdown-body p { margin: 0 0 16px; }

.markdown-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 16px auto;
}

.markdown-body table,
.markdown-body pre {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.markdown-body video,
.markdown-body iframe { max-width: 100%; }
.markdown-body video { height: auto; }

.markdown-body .text-center { text-align: center; }
.markdown-body .mt-5 { margin-top: 48px; }
.markdown-body .w-100,
.markdown-body .img-fluid { width: 100%; height: auto; }

.markdown-body .carousel {
  position: relative;
  margin: 24px 0;
  overflow: hidden;
}

.markdown-body .carousel-item { display: none; }
.markdown-body .carousel-item.active { display: block; }
.markdown-body .carousel-item img {
  width: 100%;
  max-height: 560px;
  margin: 0;
  object-fit: contain;
}

.markdown-body .carousel-control-prev,
.markdown-body .carousel-control-next {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  width: 12%;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  text-decoration: none;
  text-shadow: 0 1px 3px #000;
}

.markdown-body .carousel-control-prev { left: 0; }
.markdown-body .carousel-control-next { right: 0; }
.markdown-body .carousel-control-prev-icon::before { content: "‹"; }
.markdown-body .carousel-control-next-icon::before { content: "›"; }

@media (max-width: 991.98px) {
  #main-content.content-page {
    --content-page-max: 690px;
    font-size: 14.4px;
    line-height: 1.5;
  }

  .content-page-heading h1,
  .content-year { font-size: 21.6px; }
  .content-row h3 { font-size: 18px; }
  .content-row-body { padding-block: 14.4px; }
  main[data-category="publications"] .content-row { height: 165.5px; }
  main[data-category="publications"] .content-row-image img,
  main[data-category="publications"] .content-row-body { height: 165.5px; }
  .content-row p { font-size: 11.52px; }
  .content-tools label,
  .content-tools input,
  .content-tools select { font-size: 11.52px; }

  #content-detail > h1 { font-size: 36px; }
  .detail-subtitle,
  .markdown-body h3 { font-size: 25.2px; }
  .markdown-body { font-size: 14.4px; }
  .detail-meta { font-size: 12px; }
  #content-list { margin-inline: -0.6px; padding-inline: 0; }
}

@media (max-width: 767.98px) {
  #main-content.content-page {
    margin-top: 38px;
    font-size: 12.8px;
  }

  .content-page-heading h1 {
    margin-top: 38px;
    font-size: 19.2px;
  }

  .content-page-heading hr { margin: 12.8px 0; }

  .content-tools {
    grid-template-columns: minmax(0, 1fr) minmax(105px, auto);
    gap: 8px;
    margin: 18px 0 12px;
  }

  .content-tools label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .content-tools input,
  .content-tools select {
    width: 100%;
    padding: 7px 9px;
    font-size: 10.24px;
  }

  .content-year {
    margin-top: 19.2px;
    font-size: 19.2px;
  }

  .content-row {
    display: block;
    min-height: 0;
    margin: 6.4px 0;
  }

  .content-row-image { display: none; }
  .content-row-body { min-height: 147px; padding: 12.8px 15px; }
  main[data-category="publications"] .content-row { height: 147.1px; }
  main[data-category="publications"] .content-row-body {
    width: calc(100% + 4.4px);
    height: 147.1px;
    margin-left: -2.2px;
  }
  .content-row h3 { margin-bottom: 9.6px; font-size: 16px; line-height: 1.2; }
  .content-row p { font-size: 10.24px; line-height: 1.2; }
  .content-tags { font-size: 9px; }

  #main-content.content-detail { margin-top: 34px; }
  #content-detail > h1 { font-size: 32px; }
  .detail-subtitle,
  .markdown-body h3 { font-size: 22.4px; }
  .markdown-body { font-size: 12.8px; line-height: 1.5; }
  .detail-meta { font-size: 10.67px; }
  .markdown-body h2 { font-size: 25.6px; }
  .markdown-body h4 { font-size: 19.2px; }
  .markdown-body h5 { font-size: 16px; }
  #content-list { margin-inline: -2.2px; }
}

@media (max-width: 340px) {
  .content-tools { grid-template-columns: minmax(0, 1fr); }
  .content-row-body { min-height: 0; }
}
.markdown-body .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Minimal carousel navigation */

.markdown-body .carousel-control-prev,
.markdown-body .carousel-control-next {
  color: #999 !important;
  text-shadow: none !important;
  text-decoration: none !important;
  outline: none;
  box-shadow: none;
  transition: color 0.2s ease;
}

.markdown-body .carousel-control-prev:hover,
.markdown-body .carousel-control-next:hover {
  color: #555 !important;
  text-shadow: none !important;
}

.markdown-body .carousel-control-prev:focus,
.markdown-body .carousel-control-next:focus {
  outline: none !important;
  box-shadow: none !important;
}

.markdown-body .carousel-control-prev:focus-visible,
.markdown-body .carousel-control-next:focus-visible {
  outline: 1px solid #999 !important;
  outline-offset: -4px;
}

/* Remove inherited text shadows from arrow characters */
.markdown-body .carousel-control-prev span,
.markdown-body .carousel-control-next span {
  text-shadow: none !important;
}

.markdown-body .carousel-control-prev span[aria-hidden="true"],
.markdown-body .carousel-control-next span[aria-hidden="true"] {
  color: inherit !important;
  font-family: Arial, sans-serif;
  font-size: 32px !important;
  font-weight: 300;
}

/* Unified card typography */

.content-row h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
}

.content-row .content-subtitle {
  margin: 0 0 8px !important;
  color: #888;
  font-size: 12.8px;
  line-height: 1.4;
  font-weight: 400;
}

.content-row .content-meta {
  margin: 0 0 2px !important;
  color: var(--content-muted);
  font-size: 12.8px;
  line-height: 1.5;
  font-weight: 400;
}

.content-row .content-kind {
  margin: 0 !important;
  font-size: 12.8px;
  font-weight: 400;
}

.content-row-footer {
  justify-content: flex-start;
  gap: 0;
}

/* Prevent long publication titles from being clipped */
main[data-category="publications"] .content-row {
  height: auto;
  min-height: 160px;
}

main[data-category="publications"] .content-row-body {
  height: auto;
  min-height: 160px;
  overflow: visible;
}
/* Prevent image selection and dragging */
.content-detail .markdown-body img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}