.post-layout {
  display: block;
}

.post-main {
  min-width: 0;
}

.post-main > main {
  min-width: 0;
}

.post-toc-mobile {
  margin: 0 0 1.1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fcfcfc;
}

.post-toc-mobile summary {
  cursor: pointer;
  font-weight: 700;
  user-select: none;
}

.post-toc-desktop {
  display: none;
}

.toc-title {
  font-weight: 700;
  margin-bottom: 0.55rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed #ddd;
}

.post-toc-desktop nav ul,
.post-toc-mobile nav ul {
  margin: 0.3rem 0;
  padding: 0;
  list-style: none;
}

.post-toc-desktop nav ul ul,
.post-toc-mobile nav ul ul {
  margin: 0.2rem 0 0.3rem 0.45rem;
  padding-left: 0.7rem;
  border-left: 1px dashed #d9d9d9;
}

.post-toc-desktop nav li,
.post-toc-mobile nav li {
  margin: 0.18rem 0;
}

.post-toc-desktop a,
.post-toc-mobile a {
  color: #1f4fbf;
  text-decoration: none;
  word-break: break-word;
}

.post-toc-desktop a:visited,
.post-toc-mobile a:visited {
  color: #1f4fbf;
}

.post-main main a {
  color: #1f4fbf;
}

.post-main main a:visited {
  color: #1f4fbf;
}

.post-toc-desktop a:hover,
.post-toc-mobile a:hover {
  text-decoration: underline;
}

@media (min-width: 980px) {
  .post-layout.has-toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 2rem;
    align-items: start;
    width: min(1100px, calc(100vw - 2.5rem));
    margin-left: 50%;
    transform: translateX(-50%);
  }

  .post-toc-mobile {
    display: none;
  }

  .post-toc-desktop {
    display: block;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 0.7rem 0.85rem 0.55rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fcfcfc;
    line-height: 1.4;
    font-size: 0.93em;
  }
}
