.posts-page {
  background: radial-gradient(circle at top right, #e2eef5, #f5efe6 52%, #f7efe3 100%);
}

.posts-layout {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 28px;
  padding: 40px 7vw 80px;
}

.posts-sidebar {
  position: sticky;
  top: 120px;
  align-self: start;
  background: white;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--stroke);
  box-shadow: 0 18px 40px rgba(26, 27, 31, 0.08);
}

.posts-sidebar h2 {
  font-size: 1rem;
  margin: 0 0 12px;
}

.posts-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.rss-link {
  display: inline-flex;
  margin-top: 16px;
  color: var(--accent-dark);
  font-weight: 600;
}

.posts-nav a {
  display: block;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(26, 27, 31, 0.04);
}

.posts-nav a.active {
  background: rgba(28, 107, 90, 0.14);
  color: var(--accent-dark);
  font-weight: 600;
}

.posts-content {
  background: white;
  border-radius: 28px;
  padding: 32px;
  border: 1px solid var(--stroke);
  box-shadow: 0 24px 60px rgba(26, 27, 31, 0.08);
}

.posts-status {
  color: var(--muted);
  margin-bottom: 18px;
}

.post h1 {
  font-family: "Newsreader", "Times New Roman", serif;
  font-size: clamp(2rem, 2.4vw + 1rem, 3rem);
  margin: 0 0 8px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 18px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-tags a {
  background: rgba(28, 107, 90, 0.12);
  color: var(--accent-dark);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.post-hero {
  margin: 20px 0 28px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--stroke);
}

.post-hero img {
  width: 100%;
  display: block;
  height: auto;
  cursor: zoom-in;
}

.post-section {
  margin-bottom: 24px;
}

.post-section p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.post-text p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 1.05rem;
}

.post-text h2,
.post-text h3 {
  font-family: "Newsreader", "Times New Roman", serif;
  margin: 18px 0 10px;
}

.post-text ul {
  margin: 0 0 12px 20px;
}

.post-figure {
  margin: 0;
  position: relative;
  width: 100%;
}


.post-figure img {
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  display: block;
  cursor: zoom-in;
}

.image-carousel {
  position: relative;
  width: 100%;
}

.carousel-item {
  margin: 0;
  display: none;
  max-width: 100%;
  width: 100%;
}

.carousel-item.is-active {
  display: block;
}


.carousel-item figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
  width: 100%;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: center;
}

.image-carousel:not(.is-multi) .carousel-item figcaption {
  display: none;
}

.carousel-controls {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  padding: 0 10px;
  z-index: 2;
}

.carousel-btn {
  pointer-events: auto;
  border: none;
  background: rgba(15, 27, 42, 0.6);
  color: white;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
}

.post-figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
}

.post-code {
  background: #0f1b2a;
  color: #f1f5f9;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
}

.post-embed iframe {
  width: 100%;
  max-width: 720px;
  min-height: 320px;
  border: 0;
  border-radius: 16px;
  background: #0b1220;
}

.post-embed a {
  color: var(--accent-dark);
  text-decoration: underline;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 2000;
  padding: 24px;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-image {
  max-width: min(90vw, 1100px);
  max-height: 85vh;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: white;
  font-size: 1.8rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
}

.layout-left .post-figure,
.layout-right .post-figure {
  max-width: 45%;
  margin: 0 0 16px;
}

.layout-above .post-figure,
.layout-below .post-figure {
  max-width: 100%;
  float: none;
}

.layout-left .post-figure {
  float: none;
  margin-right: 0;
}

.layout-left {
  display: block;
}

.left-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.left-row .post-figure {
  flex: 0 0 45%;
}

.left-body {
  flex: 1 1 auto;
}

.post-heading {
  width: 100%;
  clear: both;
}

.layout-right .post-figure {
  float: right;
  margin-left: 18px;
}

.layout-left .post-figure img,
.layout-right .post-figure img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.layout-right .post-figure img {
  border: none;
}

.layout-above .post-figure {
  order: -1;
}

.layout-below .post-figure {
  order: 2;
}

.layout-above,
.layout-below {
  clear: both;
}

.post-section::after {
  content: "";
  display: block;
  clear: both;
}

.post-listing {
  display: grid;
  gap: 16px;
}

.post-listing a {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  display: block;
  background: rgba(26, 27, 31, 0.03);
}

.post-listing span {
  color: var(--muted);
  font-size: 0.9rem;
}

.posts-load {
  margin-top: 20px;
}

.posts-load .btn {
  box-shadow: none;
}

@media (max-width: 960px) {
  .posts-layout {
    grid-template-columns: 1fr;
  }

  .posts-sidebar {
    position: relative;
    top: 0;
  }

  .layout-left,
  .layout-right {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .posts-layout {
    padding: 24px 6vw 60px;
  }

  .posts-content {
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .layout-left,
  .layout-right {
    display: block;
  }

  .layout-left .post-figure,
  .layout-right .post-figure {
    float: none;
    max-width: 100%;
    margin: 0 0 16px;
  }

  .layout-right .post-figure {
    float: right;
    max-width: 55%;
    margin: 0 0 16px 16px;
  }
}
