@import url("./home.css");

/* --------------------------------------------------
   Reveal-анимация на странице поста отключена: контент
   должен быть виден сразу, без появления по скроллу.
   (Всё тело статьи — один [data-slide-in], из-за чего
   IntersectionObserver в blog.js показывал его только
   после заметного скролла.)
-------------------------------------------------- */
[data-slide-in],
[data-slide-in][data-slide-direction="up"],
[data-slide-in][data-slide-direction="left"],
[data-slide-in][data-slide-direction="right"],
[data-slide-in].is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------
   Post content typography
   Tailwind preflight resets headings/lists/etc., so the
   HTML produced by the_content() needs its own type scale.
   Scoped to .post-content to avoid touching page chrome.
-------------------------------------------------- */
.post-content {
  color: #374151; /* gray-700 */
  font-size: 1.0625rem;
  line-height: 1.75;
}

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

.post-content p {
  margin: 0 0 1.5rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  color: #111827; /* gray-900 */
  font-weight: 600;
  line-height: 1.3;
  scroll-margin-top: 6rem; /* clears the fixed header on anchor jumps */
}

.post-content h2 {
  font-size: 1.75rem;
  margin: 3rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #E5E7EB; /* gray-200 */
}

.post-content h3 {
  font-size: 1.375rem;
  margin: 2.25rem 0 0.75rem;
}

.post-content h4 {
  font-size: 1.125rem;
  margin: 2rem 0 0.5rem;
}

.post-content a {
  color: #0357EE;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.post-content a:hover {
  color: #023288;
}

.post-content strong,
.post-content b {
  color: #111827;
  font-weight: 600;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.5rem;
  padding-left: 1.5rem;
}

.post-content ul {
  list-style: disc;
}

.post-content ol {
  list-style: decimal;
}

.post-content li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

.post-content li::marker {
  color: #0357EE;
}

.post-content blockquote {
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #0357EE;
  background: #EFF6FF; /* blue-50 */
  border-radius: 0 0.75rem 0.75rem 0;
  color: #1F2937; /* gray-800 */
  font-style: italic;
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

.post-content img,
.post-content figure {
  margin: 2rem 0;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

.post-content figure img {
  margin: 0;
}

.post-content figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6B7280; /* gray-500 */
  text-align: center;
}

.post-content hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid #E5E7EB;
}

.post-content code {
  background: #F3F4F6; /* gray-100 */
  color: #023288;
  padding: 0.15em 0.4em;
  border-radius: 0.375rem;
  font-size: 0.9em;
}

.post-content pre {
  margin: 2rem 0;
  padding: 1.25rem;
  background: #111827;
  color: #F9FAFB;
  border-radius: 0.75rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

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

.post-content table {
  width: 100%;
  margin: 2rem 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.post-content th,
.post-content td {
  border: 1px solid #E5E7EB;
  padding: 0.75rem 1rem;
  text-align: left;
}

.post-content th {
  background: #F9FAFB;
  color: #111827;
  font-weight: 600;
}

/* --------------------------------------------------
   Table of contents (sticky sidebar + scroll-spy)
   Mirrors the legal-pages TOC. Scroll-spy lives in blog.js.
-------------------------------------------------- */

/* header.php wraps everything in .w-full.bg-white.overflow-hidden. An ancestor
   with overflow:hidden becomes a scroll container and breaks position:sticky,
   so the TOC would scroll away. overflow-x:clip still hides horizontal overflow
   without creating a scroll container. Scoped: single.css loads only on posts. */
.w-full.bg-white.overflow-hidden {
  overflow: visible;
  overflow-x: clip;
}

/* Two-column reading layout: sticky TOC + article body. The body column is
   capped at 48rem to preserve the original max-w-3xl reading measure; the pair
   is centred so it sits like the old single column with a TOC to its left. */
.post-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 48rem);
  gap: 3rem;
  justify-content: center;
}
.post-layout--full {
  grid-template-columns: minmax(0, 48rem);
}
.post-main {
  min-width: 0;
}

.post-toc {
  align-self: start;
  position: sticky;
  top: 88px;
  padding: 1.5rem;
  border: 1px solid #E5E7EB;
  border-radius: 0.75rem;
  background: #fff;
}
.post-toc__summary {
  list-style: none;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}
.post-toc__summary::-webkit-details-marker {
  display: none;
}
.post-toc__list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.post-toc__item {
  margin: 0;
}
.post-toc__link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid transparent;
  border-radius: 0 0.375rem 0.375rem 0;
  color: #374151;
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}
.post-toc__link:hover {
  color: #0357EE;
}
.post-toc__link.is-active {
  background: #F3F4F6;
  border-left-color: #0357EE;
  color: #111827;
  font-weight: 600;
}

/* Desktop: TOC is a static card. The heading is not a toggle; the list scrolls
   internally when there are more items than fit the viewport. */
@media (min-width: 1024px) {
  .post-toc__summary {
    pointer-events: none;
    cursor: default;
  }
  .post-toc > nav {
    max-height: calc(100vh - 88px - 7rem);
    overflow-y: auto;
  }
}

/* Mobile: single column, TOC collapsible and not sticky, above the article. */
@media (max-width: 1023px) {
  .post-layout {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 48rem;
    margin-inline: auto;
  }
  .post-toc {
    position: static;
    margin-bottom: 2rem;
  }
}
