* {
  box-sizing: border-box;
}
body {
  font-family: "Inter", sans-serif;
  margin: 0;
  background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
  color: #eaeaea;
}
.wrap {
  max-width: 1100px;
  margin: 36px auto;
  padding: 20px;
}
.ch-header {
  text-align: left;
  margin-bottom: 18px;
}
.ch-header h1 {
  font-size: 2rem;
  margin: 0 0 6px 0;
  background: linear-gradient(90deg, #e4a2a4, #cb686b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  color: #cfcfcf;
  margin-bottom: 12px;
}
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.actions input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #0f0f10;
  color: #eee;
}
.actions .btn {
  display: inline-block;
  padding: 10px 14px;
  background: #cb686b;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

/* image preview button */
.img-btn {
  display: inline-block;
  margin-left: 10px;
  padding: 6px 8px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  color: #e6f7ff;
  border: 1px solid rgba(74, 163, 203, 0.18);
  border-radius: 6px;
  cursor: pointer;
}
.img-btn:hover {
  background: rgba(74, 163, 203, 0.08);
}

.img-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  z-index: 9999;
  padding: 20px;
}
.img-modal.open {
  display: flex;
}
.img-modal .box {
  max-width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.img-modal img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
}
.img-modal .caption {
  color: #ddd;
  font-size: 0.95rem;
}
.img-modal .close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
}

/* make overlay close button visually match the image modal close */
#video-player-overlay .close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
}

/* inline thumbnails for the imgs */
.thumbs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.thumb-figure {
  background: #101113;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #222;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 220px;
}
.thumb-figure img.thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    opacity 320ms ease;
}
.thumb-figure img.thumb:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.thumb-figure {
  transition:
    transform 300ms ease,
    opacity 300ms ease;
}
.thumbs.collapsed .thumb-figure {
  transform: translateY(-8px);
  opacity: 0;
}
.thumbs .thumb-figure {
  transform: translateY(0);
  opacity: 1;
}
.thumb-figure figcaption {
  color: #cfcfcf;
  font-size: 0.85rem;
  margin-top: 8px;
  text-align: center;
}

/* Disable thumbnail transitions until user interacts to avoid initial flicker */
.no-thumb-transitions .thumb-figure,
.no-thumb-transitions .thumbs {
  transition: none !important;
}
.no-thumb-transitions .thumbs {
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

@media (max-width: 640px) {
  .thumb-figure {
    width: 48%;
  }
  .ch-footer {
    flex-direction: column;
    gap: 16px;
  }
  .ch-footer div {
    flex-direction: column;
  }
}
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  margin-top: 20px;
}
.toc {
  background: #121214;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
  max-height: 60vh;
  overflow: auto;
}
.toc {
  position: sticky;
  top: 22px;
  will-change: max-height;
  /* animate height so it grows smoothly */
  transition:
    max-height 420ms cubic-bezier(0.2, 0.9, 0.2, 1),
    box-shadow 300ms ease;
}
.toc.slide-down {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.toc-link {
  display: block;
  padding: 8px 10px;
  color: #dcdcdc;
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 6px;
}
.toc-link:hover {
  background: rgba(203, 104, 107, 0.08);
  color: #fff;
}
.content {
  background: #0f0f10;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid #222;
}
.changelog-entry {
  margin-bottom: 22px;
}
.changelog-entry header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.changelog-entry h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #f3d5d6;
}
.meta {
  font-size: 0.85rem;
  color: #b0a4a4;
}
.changelog-entry ul {
  margin-top: 8px;
  padding-left: 18px;
  color: #ddd;
}
.changelog-entry li {
  margin-bottom: 6px;
  line-height: 1.45;
}
.ch-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  color: #9a9a9a;
}
.ch-footer div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.back {
  color: #cfcfcf;
  text-decoration: none;
  padding: 8px;
  border-radius: 6px;
}

.changelog-entry {
  opacity: 0;
  transform: translateY(8px);
  animation: entryIn 420ms ease-out forwards;
}

@keyframes entryIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toc-link {
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}
.toc-link:active {
  transform: translateY(1px);
}

@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .toc {
    max-height: 200px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }
  .toc-link {
    white-space: nowrap;
  }
}

/* collapsed/expanded thumbnails and toggles */
.thumbs {
  max-height: 2000px;
  transition:
    max-height 420ms cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 360ms ease,
    padding 360ms ease;
  overflow: hidden;
  opacity: 1;
}
.thumbs.collapsed {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.img-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e6f7ff;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-left: 8px;
}
.img-toggle:hover {
  background: rgba(74, 163, 203, 0.06);
}

.toc-link.expanded {
  color: #fff;
  font-weight: 700;
  transform: scale(1.03);
}

.changelog-entry.expanded {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 12px;
}
