/* ==========================================================================
   MetalSharp changelog: one section per release, its changes grouped by
   kind, and a sticky version index. Loaded after styles.css.
   ========================================================================== */

.changelog-page {
  --k-added: #8fe3c0;
  --k-changed: var(--accent);
  --k-fixed: #f0c38e;
  --k-removed: #f2a6d6;
  --k-security: #ff9f9f;
  --k-documentation: #c9d2e3;
  --k-other: var(--muted);
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.cl-hero { padding-block: clamp(4rem, 9vw, 6.5rem) clamp(2.5rem, 5vw, 3.5rem); }
.cl-label {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.cl-label span { width: 28px; height: 1px; background: currentColor; opacity: 0.5; }
.cl-hero h1 {
  margin-top: 1.1rem;
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1;
}
.cl-hero h1 em { font: inherit; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cl-lede { max-width: 36rem; margin-top: 1.3rem; color: var(--muted); font-size: 1.08rem; line-height: 1.6; }
.cl-jump { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.8rem; }
.cl-jump a {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.cl-jump a:hover { color: var(--text); border-color: rgba(200, 212, 255, 0.4); }
.cl-jump a:first-child { color: #0a0d14; background: #eceff6; border-color: #eceff6; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.cl-layout {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  border-top: 1px solid var(--line);
}

.cl-nav {
  position: sticky;
  top: calc(var(--nav-h) + 1.5rem);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 3rem);
  padding-block: 2.6rem 2rem;
  overflow-y: auto;
  scrollbar-width: thin;
}
.cl-nav p { margin: 0 0 0.6rem; color: var(--dim); font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; }
.cl-nav ul { margin: 0 0 1.8rem; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.cl-nav a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-left: -1px;
  padding: 0.32rem 0 0.32rem 0.9rem;
  border-left: 1px solid transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.cl-nav a small { color: var(--dim); font-size: 0.66rem; white-space: nowrap; }
.cl-nav a:hover { color: var(--text); }
.cl-nav a[aria-current] { color: var(--text); border-left-color: var(--accent); }

/* ── A release ───────────────────────────────────────────────────────── */
.cl-release { padding-block: clamp(2.4rem, 5vw, 3.4rem); border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--nav-h) + 1rem); }
.cl-release:last-child { border-bottom: 0; }

.cl-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0.6rem 1.5rem; }
.cl-head h2 { display: flex; align-items: center; gap: 0.8rem; font-size: clamp(1.9rem, 3.6vw, 2.6rem); font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
.cl-head h2 a { color: var(--text); text-decoration: none; }
.cl-head h2 a:hover { color: #fff; }
.cl-latest {
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: #0a0d14;
  font: 600 0.62rem var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cl-meta { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.1rem; color: var(--muted); font-family: var(--font-mono); font-size: 0.74rem; }
.cl-count { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--dim); }
.cl-count::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--k); }
.cl-gh { grid-column: 2; grid-row: 1; padding: 0.35rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-family: var(--font-mono); font-size: 0.72rem; text-decoration: none; white-space: nowrap; }
.cl-gh:hover { color: var(--text); border-color: var(--line-strong); }

.cl-k-added { --k: var(--k-added); }
.cl-k-changed { --k: var(--k-changed); }
.cl-k-fixed { --k: var(--k-fixed); }
.cl-k-removed { --k: var(--k-removed); }
.cl-k-security { --k: var(--k-security); }
.cl-k-documentation { --k: var(--k-documentation); }
.cl-k-other { --k: var(--k-other); }

.cl-intro { max-width: 46rem; margin-top: 1.3rem; color: var(--text-soft); font-size: 1rem; line-height: 1.65; }
.cl-intro p + p, .cl-intro p + ul, .cl-intro ul + p { margin-top: 0.7rem; }
.cl-intro ul { margin: 0.6rem 0 0; padding-left: 1.1rem; }
.cl-intro li + li { margin-top: 0.35rem; }

/* a group: its kind in the margin, its changes beside it */
.cl-group { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0 1.5rem; margin-top: 1.8rem; }
.cl-group h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: fit-content;
  padding-top: 1.05rem;
  color: var(--k);
  font: 500 0.7rem var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.cl-group h3::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--k); }

.cl-items > ul { margin: 0; padding: 0; list-style: none; }
.cl-items > ul > li { padding: 1rem 0 1.05rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.94rem; line-height: 1.62; }
.cl-items > ul > li:last-child { border-bottom: 1px solid var(--line); }
.cl-items > ul > li > strong:first-child,
.cl-items > ul > li > p:first-child > strong:first-child { display: block; margin-bottom: 0.3rem; color: var(--text); font-size: 1rem; font-weight: 500; letter-spacing: -0.01em; }
.cl-items p { margin: 0; }
.cl-items p + p { margin-top: 0.5rem; }
.cl-items ul ul { margin: 0.5rem 0 0.3rem; padding-left: 1.1rem; }
.cl-items ul ul li { margin-top: 0.3rem; }
.cl-items ul ul li::marker { color: var(--dim); }
.cl-items strong { color: var(--text-soft); font-weight: 500; }
.cl-items > p { color: var(--muted); font-size: 0.94rem; padding-top: 1rem; }

.cl-release code {
  padding: 0.08rem 0.32rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 0.82em;
  overflow-wrap: anywhere;
}
.cl-release a { color: var(--text-soft); text-decoration-color: var(--line-strong); }
.cl-release a:hover { color: var(--text); text-decoration-color: currentColor; }
.cl-release a.cl-pr { color: var(--muted); font-family: var(--font-mono); font-size: 0.86em; text-decoration: none; }
.cl-release a.cl-pr:hover { color: var(--accent); }
.cl-release table { width: 100%; margin-top: 0.6rem; border-collapse: collapse; font-size: 0.86rem; }
.cl-release th, .cl-release td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }

/* releases before 1.0.0: folded */
.cl-release--old { padding-block: 1.6rem; }
.cl-release--old .cl-head h2 { font-size: clamp(1.4rem, 2.6vw, 1.7rem); }
.cl-more > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  cursor: pointer;
  list-style: none;
}
.cl-more > summary::-webkit-details-marker { display: none; }
.cl-more > summary::before { content: "+"; width: 1rem; color: var(--accent); }
.cl-more[open] > summary::before { content: "−"; }
.cl-more > summary:hover { color: var(--text); }

/* ── Small screens ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cl-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cl-nav { display: none; }
}
@media (max-width: 640px) {
  .cl-group { grid-template-columns: minmax(0, 1fr); }
  .cl-group h3 { padding: 0 0 0.6rem; }
  .cl-head { grid-template-columns: minmax(0, 1fr); }
  .cl-gh { grid-column: 1; grid-row: auto; justify-self: start; }
}
