/* Site-specific Walker layout tuning for algo.ac.cn. */
.content-wrapper {
  min-width: 0;
}

.post-item .content {
  max-width: 100%;
  min-width: 0;
}

.post-item .content > a {
  display: block;
  max-width: 100%;
}

.post-item .post-title {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 1024px) {
  .main {
    max-width: min(1120px, calc(100vw - 48px)) !important;
  }

  .content-wrapper {
    padding: 2.75rem 1.5rem 2rem 1.5rem !important;
  }

  .content-wrapper:not(.post-detail) > h2:first-child {
    margin-bottom: 1.5rem !important;
  }

  #sidebar .sidebar-content > .static {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }

  #sidebar .sidebar-content > .static .group.relative {
    margin-top: 3rem !important;
  }

  #sidebar .avatar {
    height: 5rem !important;
    width: 5rem !important;
  }

  #sidebar .sidebar-content > .static [class*="text-4xl"] {
    margin-top: 1.25rem !important;
    font-size: 1.875rem !important;
    line-height: 1.18 !important;
  }

  #sidebar p.my-4 {
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
    font-size: 0.95rem;
    line-height: 1.6;
  }

  #sidebar .social-container {
    gap: 0.85rem !important;
  }

  #sidebar .animated.fadeIn.mt-6.hidden {
    margin-top: 1.25rem !important;
  }

  #menu-container > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1rem !important;
  }

  #menu-container a {
    font-size: 0.95rem;
  }

  .post-item {
    align-items: flex-start;
    padding-bottom: 2.25rem !important;
  }

  .post-item + .post-item {
    border-top: 1px solid rgb(127 127 127 / 0.12);
    padding-top: 0.25rem;
  }

  .post-item .feature-image-wrapper {
    height: 8.75rem !important;
    margin-right: 1.35rem !important;
    width: 12.5rem !important;
  }

  .post-item .post-title {
    font-size: 1.12rem !important;
    line-height: 1.35 !important;
  }

  .post-item .post-title::after {
    bottom: -5px !important;
  }

  .post-item .post-abstract {
    margin-top: 0.6rem !important;
    margin-bottom: 0.75rem !important;
    font-size: 0.94rem;
    line-height: 1.58;
    -webkit-line-clamp: 2 !important;
  }

  .post-item .content > .flex {
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }

  .post-detail {
    padding-top: 3.5rem !important;
  }

  .post-detail h1 {
    font-size: 1.875rem !important;
    line-height: 1.25 !important;
  }

  .post-detail > .post-feature-image {
    max-height: 22rem;
    object-fit: cover;
  }
}

@media (max-width: 1023.98px) {
  .content-wrapper {
    padding-top: 5.75rem !important;
  }

  .content-wrapper.post-detail {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .content-wrapper:not(.post-detail) > h2:first-child {
    margin-bottom: 1.5rem !important;
  }

  .post-item {
    padding-bottom: 2rem !important;
  }

  .post-item + .post-item {
    border-top: 1px solid rgb(127 127 127 / 0.1);
    padding-top: 0.25rem;
  }

  .post-item .feature-image-wrapper {
    height: 12rem !important;
    margin-bottom: 0.9rem;
    margin-right: 0 !important;
  }

  .post-item .post-title {
    margin-top: 0.75rem !important;
    font-size: 1.08rem !important;
    line-height: 1.4 !important;
  }

  .post-item .post-title::after {
    bottom: -5px !important;
  }

  .post-item .post-abstract {
    margin-top: 0.55rem !important;
    margin-bottom: 0.75rem !important;
    font-size: 0.95rem;
    line-height: 1.6;
    -webkit-line-clamp: 2 !important;
  }

  .post-item .content > .flex {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }

  .post-detail > .post-feature-image {
    max-height: 14rem;
    object-fit: cover;
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .post-item .feature-image-wrapper {
    height: 8.75rem !important;
    margin-bottom: 0;
    margin-right: 1.25rem !important;
    width: 12.5rem !important;
  }

  .post-item .post-title {
    margin-top: 0 !important;
  }
}

.series-native-lead {
  color: rgb(90 90 90);
  font-size: 0.98rem;
  line-height: 1.75;
  margin: -0.25rem 0 1.5rem;
  max-width: 45rem;
}

.tag-native-desc {
  color: rgb(90 90 90);
  font-size: 0.95rem;
  line-height: 1.75;
  margin: -1.25rem 0 1.5rem;
  max-width: 45rem;
}

.series-entry-chip {
  align-items: center;
  background: rgb(243 232 255);
  border-radius: 9999px;
  color: rgb(126 34 206) !important;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 500;
  gap: 0.35rem;
  line-height: 1rem;
  padding: 0.25rem 0.55rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.series-entry-chip:hover {
  box-shadow: 0 0 0 2px rgb(233 213 255);
  opacity: 1;
  transform: translateY(-1px);
}

.series-native-sections {
  display: flex;
  flex-direction: column;
}

.series-native-section {
  border-top: 1px solid rgb(127 127 127 / 0.12);
  margin-top: 2rem;
  padding-top: 1.5rem;
}

.series-native-header {
  align-items: start;
  display: grid;
  gap: 0.75rem 2rem;
  grid-template-areas:
    "title action"
    "description description";
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 2.25rem;
}

.series-native-title {
  grid-area: title;
  margin: 0;
  min-width: 0;
}

.series-more-link {
  border-bottom: 2px solid rgb(127 127 127 / 0.35);
  grid-area: action;
  justify-self: end;
  margin-top: 0.1rem;
  padding-bottom: 0.08rem;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.series-more-link:hover {
  border-bottom-color: currentColor;
  opacity: 1;
}

.series-native-desc {
  color: rgb(112 112 112);
  font-size: 0.92rem;
  grid-area: description;
  line-height: 1.75;
  margin: 0;
  max-width: 46rem;
}

@media (max-width: 640px) {
  .series-native-header {
    gap: 0.75rem;
    grid-template-areas:
      "title"
      "description"
      "action";
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 1.75rem;
  }

  .series-more-link {
    justify-self: start;
    margin-top: 0.1rem;
  }
}

.series-order-1 {
  margin-top: 0;
  order: 1;
}

.series-order-2 {
  order: 2;
}

.series-order-3 {
  order: 3;
}

.series-order-4 {
  order: 4;
}

.series-order-5 {
  order: 5;
}

.series-order-9 {
  order: 9;
}

.dark .series-native-lead,
.dark .series-native-desc,
.dark .tag-native-desc {
  color: rgb(190 190 190);
}

.dark .series-entry-chip {
  background: rgb(88 28 135 / 0.45);
  color: rgb(233 213 255) !important;
}

.dark .series-entry-chip:hover {
  box-shadow: 0 0 0 2px rgb(168 85 247 / 0.35);
}

.dark .series-more-link {
  border-bottom-color: rgb(255 255 255 / 0.36);
}

.algo-series-shell.post-detail {
  max-width: none;
}

.algo-series-shell .algo-page-content {
  padding-bottom: 0 !important;
  padding-top: 0 !important;
  word-break: normal !important;
}

.algo-series-page {
  color: inherit;
  margin-top: 0;
}

.algo-series-page a {
  color: inherit !important;
  text-decoration: none;
}

.algo-series-page a:hover {
  opacity: 0.78;
}

.series-lead {
  color: rgb(90 90 90);
  font-size: 0.98rem;
  line-height: 1.75;
  margin: 0 0 1.35rem;
  max-width: 45rem;
}

.series-toc {
  align-items: center;
  border-top: 1px solid rgb(127 127 127 / 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.65rem;
  margin: 0 0 0.2rem;
  padding-top: 1rem;
}

.series-toc a {
  align-items: center;
  background: rgb(127 127 127 / 0.055);
  border: 1px solid rgb(127 127 127 / 0.16);
  border-radius: 9999px;
  color: rgb(54 54 54) !important;
  display: inline-flex;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.18rem 0.58rem;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.series-toc a:hover {
  background: rgb(127 127 127 / 0.12);
  border-color: rgb(127 127 127 / 0.32);
  color: rgb(22 22 22) !important;
  opacity: 1;
}

.series-toc span {
  color: rgb(128 128 128);
  font-size: 0.78rem;
  margin-left: 0.18rem;
}

.series-block {
  border-top: 1px solid rgb(127 127 127 / 0.14);
  display: grid;
  gap: 0.6rem 2rem;
  grid-template-columns: minmax(8.5rem, 12rem) minmax(0, 1fr);
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
}

.series-block-title {
  min-width: 0;
}

.series-block h2 {
  color: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  margin: 0;
}

.series-tag-link {
  background: rgb(127 127 127 / 0.055);
  border: 1px solid rgb(127 127 127 / 0.16);
  border-radius: 9999px;
  color: rgb(70 70 70) !important;
  display: inline-flex;
  font-weight: 400;
  font-size: 0.82rem;
  line-height: 1.45;
  margin-top: 0.45rem;
  padding: 0.12rem 0.5rem;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.series-tag-link:hover {
  background: rgb(127 127 127 / 0.12);
  border-color: rgb(127 127 127 / 0.32);
  color: rgb(22 22 22) !important;
  opacity: 1;
}

.series-block-body {
  min-width: 0;
}

.series-summary {
  color: rgb(92 92 92);
  font-size: 0.94rem;
  line-height: 1.65;
  margin: 0 0 0.75rem;
}

.series-guide {
  display: grid;
  gap: 0.42rem;
  margin: 0 0 0.95rem;
}

.series-guide-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 5.2rem minmax(0, 1fr);
}

.series-guide dt {
  color: rgb(120 120 120);
  font-size: 0.84rem;
  line-height: 1.65;
  margin: 0;
  white-space: nowrap;
}

.series-guide dd {
  color: rgb(73 73 73);
  font-size: 0.9rem;
  line-height: 1.65;
  margin: 0;
}

.series-post-list {
  box-sizing: border-box;
  display: grid;
  gap: 0.34rem 1.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  line-height: 1.55;
  margin: 0.65rem 0 0;
  max-width: 100%;
  padding-left: 1.2rem;
}

.series-post-list li {
  color: inherit;
  max-width: 100%;
  min-width: 0;
  padding-left: 0.08rem;
}

.series-post-list a {
  border-bottom: 1px solid rgb(127 127 127 / 0.45);
  color: rgb(36 36 36) !important;
  overflow-wrap: anywhere;
  padding-bottom: 0.06rem;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
  word-break: break-word;
}

.series-post-list a:hover {
  border-bottom-color: currentColor;
  color: rgb(0 0 0) !important;
  opacity: 1;
}

.dark .series-lead,
.dark .series-summary {
  color: rgb(190 190 190);
}

.dark .series-toc a,
.dark .series-tag-link,
.dark .series-guide dd,
.dark .series-post-list li,
.dark .series-post-list a {
  color: rgb(230 230 230) !important;
}

.dark .series-toc a,
.dark .series-tag-link {
  background: rgb(255 255 255 / 0.07);
  border-color: rgb(255 255 255 / 0.18);
}

.dark .series-toc a:hover,
.dark .series-tag-link:hover {
  background: rgb(255 255 255 / 0.12);
  border-color: rgb(255 255 255 / 0.34);
  color: rgb(255 255 255) !important;
}

.dark .series-post-list a {
  border-bottom-color: rgb(255 255 255 / 0.42);
}

.dark .series-post-list a:hover {
  color: rgb(255 255 255) !important;
}

.dark .series-toc span,
.dark .series-guide dt {
  color: rgb(170 170 170) !important;
}

.algo-post-series-nav {
  border-bottom: 1px solid rgb(127 127 127 / 0.14);
  border-top: 1px solid rgb(127 127 127 / 0.14);
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 0;
}

.algo-post-series-kicker {
  color: rgb(120 120 120);
  font-size: 0.78rem;
  letter-spacing: 0;
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.algo-post-series-nav h2 {
  font-size: 1.08rem;
  line-height: 1.4;
  margin: 0;
}

.algo-post-series-nav p {
  color: rgb(92 92 92);
  font-size: 0.92rem;
  line-height: 1.65;
  margin: 0.4rem 0 0;
}

.algo-post-series-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin-top: 0.7rem;
}

.algo-post-series-actions a {
  border-bottom: 1px solid currentColor;
  color: inherit !important;
  font-size: 0.9rem;
  line-height: 1.5;
  text-decoration: none;
}

.algo-post-series-actions a:hover {
  opacity: 0.78;
}

.dark .algo-post-series-kicker,
.dark .algo-post-series-nav p {
  color: rgb(190 190 190);
}

@media (max-width: 640px) {
  .algo-series-shell,
  .algo-series-shell .algo-page-content,
  .algo-series-page,
  .series-block,
  .series-block-body,
  .series-lead,
  .series-summary,
  .series-guide,
  .series-guide dd,
  .series-post-list,
  .series-post-list li {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .algo-series-shell .algo-page-content {
    overflow-x: hidden;
  }

  .series-toc {
    gap: 0.45rem 0.9rem;
  }

  .series-block {
    display: block;
  }

  .series-block-title {
    margin-bottom: 0.65rem;
  }

  .series-guide-row {
    display: block;
  }

  .series-guide dt {
    margin-bottom: 0.05rem;
  }

  .series-post-list {
    display: block;
    padding-left: 1.15rem;
  }

  .series-post-list li {
    margin: 0.42rem 0;
  }

  .series-post-list a {
    word-break: break-all;
  }
}
