/* ============================================================
   Copy-to-clipboard button
   ============================================================ */

.highlight {
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-family: "PT Sans", sans-serif;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  color: #aaa;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}

.highlight:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.copy-btn.copied {
  color: #4caf50;
  border-color: #4caf50;
}


/* ============================================================
   Article layout — content + sticky TOC sidebar
   ============================================================ */

.post-layout {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

.post-content {
  flex: 1;
  min-width: 0;
}

.toc-sidebar {
  display: none; /* shown by JS once .toc is moved inside */
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  font-size: 0.8rem;
  line-height: 1.5;
}

.toc-sidebar .toc {
  background: #f8f9fa;
  border-left: 3px solid #6a9fb5;
  border-radius: 0 4px 4px 0;
  padding: 0.8rem 1rem;
}

.toc-sidebar .toc ul {
  margin: 0;
  padding-left: 1rem;
  list-style: none;
}

.toc-sidebar .toc ul li {
  margin: 0.25rem 0;
}

.toc-sidebar .toc a {
  color: #555;
  text-decoration: none;
}

.toc-sidebar .toc a:hover {
  color: #6a9fb5;
}

/* hide the inline TOC once the sidebar is active */
.post-layout.has-toc .post-content .toc {
  display: none;
}

@media (max-width: 64em) {
  .toc-sidebar {
    display: none !important;
  }

  .post-layout.has-toc .post-content .toc {
    display: block;
  }
}


/* ============================================================
   Post meta (date + reading time)
   ============================================================ */

.post-meta {
  color: #9a9a9a;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.post-meta .reading-time::before {
  content: " · ";
}


/* ============================================================
   Series navigation
   ============================================================ */

.series-nav {
  background: #f0f4f8;
  border-left: 3px solid #6a9fb5;
  border-radius: 0 4px 4px 0;
  padding: 0.8rem 1.2rem;
  margin-bottom: 2rem;
  font-size: 0.88rem;
}

.series-nav .series-title {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.series-nav ol {
  margin: 0.4rem 0 0 1.2rem;
  padding: 0;
}

.series-nav ol li {
  margin: 0.2rem 0;
}

.series-nav ol li.current {
  font-weight: bold;
}

.series-nav ol li.current::marker {
  color: #6a9fb5;
}


/* ============================================================
   Neighbors — previous / next article
   ============================================================ */

.post-neighbors {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e8e8e8;
  font-size: 0.88rem;
}

.neighbor {
  max-width: 48%;
}

.neighbor a {
  display: block;
  color: #555;
  text-decoration: none;
  line-height: 1.4;
}

.neighbor a:hover {
  color: #6a9fb5;
}

.neighbor-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #aaa;
  margin-bottom: 0.2rem;
}

.neighbor-next {
  text-align: right;
  margin-left: auto;
}


/* ============================================================
   Giscus comments
   ============================================================ */

.giscus-container {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e8e8e8;
}


/* ============================================================
   Google site-search form (sidebar)
   ============================================================ */

.search-form {
  margin-bottom: 1rem;
}

.search-input-wrap {
  display: flex;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  overflow: hidden;
}

.search-input-wrap input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 0.82rem;
  outline: none;
}

.search-input-wrap input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.search-input-wrap input[type="text"]:focus {
  background: rgba(255, 255, 255, 0.18);
}

.search-input-wrap button {
  padding: 0 0.65rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.15s, color 0.15s;
}

.search-input-wrap button:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}
