.document-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 860px) 330px;
  justify-content: center;
  gap: 1.5rem;
  align-items: start;
}

.document-detail-sidebar {
  position: sticky;
  top: 6.75rem;
  align-self: start;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.15rem;
}

.document-detail-article,
.document-sidebar-card {
  padding: 1.45rem;
}

.document-detail-sidebar-stack {
  display: grid;
  gap: 1rem;
}

.document-detail-header {
  max-width: 760px;
  margin-inline: auto;
  padding-bottom: 1.35rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--th-public-border);
}

.document-detail-title {
  margin: 1rem 0 0;
  color: var(--th-public-heading);
  font-size: 2.4rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
  text-wrap: balance;
}

.document-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  color: var(--th-public-muted);
  font-size: 0.92rem;
}

.document-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.document-detail-tag,
.document-sidebar-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--th-public-accent-rgb), 0.18);
  background: rgba(var(--th-public-accent-rgb), 0.12);
  color: var(--th-public-accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.document-detail-description {
  margin: 1rem 0 0;
  color: var(--th-public-muted);
  font-size: 1rem;
  line-height: 1.85;
}

.document-detail-empty,
.document-sidebar-empty {
  margin: 0;
  color: var(--th-public-muted);
  line-height: 1.7;
}

.document-sidebar-eyebrow {
  margin-bottom: 0.85rem;
  color: var(--th-public-accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.document-sidebar-meta-list {
  display: grid;
  gap: 0.95rem;
}

.document-sidebar-meta-item {
  display: grid;
  gap: 0.35rem;
}

.document-sidebar-meta-label {
  color: var(--th-public-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.document-sidebar-meta-value {
  color: var(--th-public-heading);
  font-size: 0.95rem;
  font-weight: 700;
}

.document-sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.document-related-list {
  display: grid;
  gap: 0.9rem;
}

.document-related-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 0.85rem;
  padding: 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid var(--th-public-border);
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    background-color 0.22s ease;
}

.document-related-item:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--th-public-accent-rgb), 0.24);
  background: rgba(var(--th-public-accent-rgb), 0.08);
}

.document-related-thumb {
  overflow: hidden;
  border-radius: 0.9rem;
  border: 1px solid var(--th-public-border);
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(
      145deg,
      rgba(var(--th-public-accent-rgb), 0.12),
      rgba(255, 255, 255, 0)
    ),
    rgba(255, 255, 255, 0.14);
}

.document-related-thumb img,
.document-related-thumb-placeholder {
  width: 100%;
  height: 100%;
}

.document-related-thumb img {
  display: block;
  object-fit: cover;
}

.document-related-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--th-public-accent);
  font-size: 1.3rem;
}

.document-related-title {
  color: var(--th-public-heading);
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 700;
}

.document-related-date {
  margin-top: 0.35rem;
  color: var(--th-public-muted);
  font-size: 0.82rem;
}

.post-content {
  max-width: 760px;
  margin-inline: auto;
  color: var(--th-public-text);
  font-size: 1rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.post-content-body > *:first-child {
  margin-top: 0;
}

.post-content-body > *:last-child {
  margin-bottom: 0;
}

.post-content-body p {
  margin-bottom: 1.3rem;
}

.post-content-body h1,
.post-content-body h2,
.post-content-body h3,
.post-content-body h4,
.post-content-body h5,
.post-content-body h6 {
  margin-top: 2.25rem;
  margin-bottom: 0.9rem;
  color: var(--th-public-heading);
  line-height: 1.28;
  font-weight: 800;
}

.post-content-body h1 {
  font-size: 1.85rem;
}

.post-content-body h2 {
  font-size: 1.58rem;
}

.post-content-body h3 {
  font-size: 1.32rem;
}

.post-content-body ul,
.post-content-body ol {
  margin-bottom: 1.45rem;
  padding-left: 1.55rem;
}

.post-content-body li + li {
  margin-top: 0.42rem;
}

.post-content-body a {
  color: var(--th-public-accent);
  text-underline-offset: 0.2em;
  word-break: break-word;
}

.post-content-body strong,
.post-content-body b {
  color: var(--th-public-heading);
  font-weight: 700;
}

.post-content-body blockquote {
  margin: 1.8rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--th-public-accent);
  border-radius: 0 1rem 1rem 0;
  background: rgba(var(--th-public-accent-rgb), 0.08);
  color: var(--th-public-muted);
  font-style: italic;
}

.post-content-body pre {
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
  border-radius: 0.5rem;
  border: 1px solid var(--th-public-border);
  background: rgba(0, 0, 0, 0.06);
  color: var(--th-public-heading);
  overflow-x: auto;
}

html[data-theme="dark"] .post-content-body pre {
  background: rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .post-content-body pre {
    background: rgba(255, 255, 255, 0.05);
  }
}

.post-content-body code {
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  background: rgba(var(--th-public-accent-rgb), 0.12);
  color: var(--th-public-accent);
  font-size: 0.95em;
}

.post-content-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.post-content img {
  display: block;
  max-width: 100% !important;
  height: auto !important;
  max-height: 70vh;
  margin: 1.5rem auto;
  object-fit: contain;
  border-radius: 0.5rem;
}

.post-content figure,
.post-content table,
.post-content iframe,
.post-content video {
  max-width: 100%;
}

.post-content figure {
  margin: 1.75rem auto;
}

.post-content figcaption {
  margin-top: 0.7rem;
  text-align: center;
  font-size: 0.93rem;
  color: var(--th-public-muted);
}

.post-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.75rem 0;
}

.post-content th,
.post-content td {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--th-public-border);
  vertical-align: top;
}

.post-content th {
  background: rgba(var(--th-public-accent-rgb), 0.08);
  color: var(--th-public-heading);
  font-weight: 700;
}

.post-content hr {
  margin: 2rem 0;
  border-color: var(--th-public-border);
}

.post-content iframe,
.post-content video {
  width: 100%;
  border-radius: 0.5rem;
}

@media (max-width: 991.98px) {
  .document-detail-layout {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .document-detail-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 767.98px) {
  .document-detail-article,
  .document-sidebar-card {
    padding: 1.15rem;
  }

  .document-detail-title {
    font-size: 1.75rem;
  }

  .post-content {
    font-size: 0.97rem;
  }

  .post-content-body h1 {
    font-size: 1.55rem;
  }

  .post-content-body h2 {
    font-size: 1.34rem;
  }

  .post-content-body h3 {
    font-size: 1.18rem;
  }
}
