/* Custom CSS for Archer Theme - Enhanced Styling */

/* ===== Beautiful Table Styling ===== */
.article-entry table {
  width: auto;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  margin: 1.5em 0;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.article-entry table thead {
  background-color: rgba(100, 100, 255, 0.1);
}

.article-entry table th {
  font-weight: 600;
  padding: 12px 15px;
  text-align: left;
  border-bottom: 2px solid rgba(100, 100, 255, 0.2);
  color: #555;
  font-size: 0.9rem;
}

.article-entry table td {
  padding: 12px 15px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 0.9rem;
}

.article-entry table tr:last-child td {
  border-bottom: none;
}

.article-entry table tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.article-entry table tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.01);
}

/* ===== macOS-style Code Blocks ===== */
.article-entry figure.highlight {
  position: relative;
  margin: 1.5em 0;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  background-color: #282c34;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.article-entry figure.highlight table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0;
}
.article-entry figure.highlight td {
  padding: 0;
  vertical-align: top;
}

/* Top bar of code block */
.article-entry figure.highlight:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  background-color: #21252b;
  z-index: 1;
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid #181a1f;
}

/* macOS window buttons */
.article-entry figure.highlight:after {
  content: "";
  position: absolute;
  top: 10px; /* Adjusted to match new title bar height */
  left: 15px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #ff5f56;
  box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
  z-index: 2;
}

.article-entry pre {
  position: relative;
  background-color: #282c34;
  margin: 0;
  padding: 0; 
  overflow: hidden;
  font-size: 14px;
  color: #abb2bf;
}

/* ===== Centered Image Captions ===== */
.article-entry figure:not(.highlight) {
  text-align: center;
  margin: 1.5rem auto;
}

.article-entry figure figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: #888;
  margin-top: 0.5rem;
}

/* Target manual captions in brackets [...] immediately following an image */
.article-entry p:has(img) + p,
.article-entry p:has(.fancy-link) + p {
  text-align: center;
  font-size: 0.9rem;
  color: #888;
  margin-top: -0.8rem;
}

/* ===== Rounded Images with Soft Shadows ===== */
.article-entry img {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  transition: transform 0.3s ease;
}

.article-entry img:hover {
  transform: scale(1.01);
}

/* Line numbers container */
.article-entry figure.highlight pre {
  margin: 0;
  padding-left: 0;
  border: none;
}

/* Line numbers styling */
.article-entry figure.highlight .gutter {
  width: 36px; /* Fixed width for gutter */
  background-color: #282c34;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  user-select: none;
}

.article-entry figure.highlight .gutter pre {
  color: #636d83;
  text-align: right;
  padding-right: 10px;
  padding-left: 0;
  padding-top: 26px;
  line-height: 1.6;
}

.article-entry figure.highlight .code {
  padding-top: 26px;
  width: 100%;
}

.article-entry figure.highlight .code pre {
  padding-left: 8px;
  padding-top: 0;
  line-height: 1.6;
}

/* Scrollbar styling */
.article-entry figure.highlight::-webkit-scrollbar {
  height: 8px;
  background-color: #21252b;
}

.article-entry figure.highlight::-webkit-scrollbar-thumb {
  background-color: #4b5363;
  border-radius: 4px;
}

/* ===== Code Block Beautification (Copy & Language & Shrink) ===== */
.code_copy {
    position: absolute;
    top: 4px;
    right: 10px;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    z-index: 10;
    transition: all 0.2s ease;
}

.code_copy:hover {
    color: #fff;
    transform: scale(1.1);
}

.code_lang {
    position: absolute;
    top: 4px;
    right: 35px;
    color: #888;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    line-height: 1.2;
    padding-right: 10px;
    border-right: 1px solid #444;
    text-transform: uppercase;
    pointer-events: none;
}

/* Mermaid: transparent background and centering */
.article-entry .mermaid {
  background: transparent !important;
  display: flex;
  justify-content: center;
  margin: 1.5em 0;
}

/* Compact illustrations in migrated WeChat posts */
.article-entry img.article-image-compact {
  width: 60%;
  height: auto;
  max-width: 100%;
}

/* SemiDone legacy GIFs: compact multi-column gallery on wide screens. */
.article-entry .semidone-legacy-gifs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  margin: 1.5rem 0;
}

.article-entry .semidone-legacy-gifs figure {
  flex: 1 1 calc((100% - 2rem) / 3);
  width: calc((100% - 2rem) / 3);
  max-width: 35%;
  min-width: 0;
  margin: 0;
}

.article-entry .semidone-legacy-gifs img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.article-entry .semidone-legacy-gifs figcaption {
  margin-top: 0.45rem;
}

.article-entry .semidone-chicken-leg {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
}

.article-entry .semidone-chicken-leg-button {
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  font: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-entry .semidone-chicken-leg-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.article-entry .semidone-chicken-leg-count {
  color: #777;
  font-size: 0.9rem;
}

@media (max-width: 700px) {
  .article-entry .semidone-legacy-gifs figure {
    flex-basis: calc((100% - 1rem) / 2);
    width: calc((100% - 1rem) / 2);
    max-width: 48%;
  }
}

@media (max-width: 480px) {
  .article-entry .semidone-legacy-gifs figure {
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
  }
}


