/* =====================================================================
   CHANGELOG — release ledger
   ---------------------------------------------------------------------
   Constructivist: zero radii, thick ink rules, hard offset shadows, an
   oversized display numeral for each version. Every color comes from a
   token in style.css so dark mode is inherited rather than re-specified.
   ===================================================================== */

.cl-page {
  max-width: 1020px;
  margin: 0 auto;
  padding: var(--sp-10) var(--sp-4) var(--sp-16);
}

/* ---- Masthead ---------------------------------------------------- */

.cl-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--fs-75);
  font-weight: 700;
  color: var(--brand);
  margin: 0 0 var(--sp-2);
}

.cl-title {
  font-weight: var(--fw-display);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-size: var(--fs-400);
  line-height: 0.95;
  margin: 0 0 var(--sp-4);
  color: var(--text-strong);
}

.cl-intro {
  font-size: var(--fs-1125);
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 0 var(--sp-6);
}

/* Stat strip — three hard-edged cells sharing one ink rule. */
.cl-stats {
  display: flex;
  flex-wrap: wrap;
  border: var(--border-thick) solid var(--structure);
  box-shadow: var(--shadow-e2);
  margin-bottom: var(--sp-8);
  background: var(--surface);
}

.cl-stat {
  flex: 1 1 0;
  min-width: 140px;
  padding: var(--sp-4) var(--sp-5);
  border-right: var(--border-thick) solid var(--structure);
}

.cl-stat:last-child {
  border-right: 0;
}

.cl-stat-value {
  display: block;
  font-size: var(--fs-200);
  font-weight: var(--fw-display);
  line-height: 1;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.cl-stat-label {
  display: block;
  margin-top: var(--sp-1);
  font-size: var(--fs-75);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ---- Sticky control bar ------------------------------------------ */

.cl-controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border: var(--border-thick) solid var(--structure);
  box-shadow: var(--shadow-e2);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-8);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  align-items: center;
  justify-content: space-between;
}

.cl-filters,
.cl-years {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}

.cl-controls-label {
  font-size: var(--fs-75);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: var(--sp-1);
}

/* Filter buttons and year links share one hard-edged pill-less shape. */
.cl-filter,
.cl-year {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-875);
  font-weight: 700;
  line-height: 1;
  color: var(--text-strong);
  background: var(--surface);
  border: var(--border-thick) solid var(--structure);
  cursor: pointer;
  text-decoration: none;
  transition:
    box-shadow 0.16s ease,
    transform 0.16s ease,
    background-color 0.16s ease;
}

.cl-filter:hover,
.cl-year:hover,
.cl-filter:focus-visible,
.cl-year:focus-visible {
  box-shadow: var(--shadow-hard);
  transform: translate(-2px, -2px);
  color: var(--text-strong);
}

.cl-filter[aria-pressed="true"] {
  background: var(--structure);
  color: var(--surface);
}

/* The swatch is reinforcement only — the label carries the meaning, so
   the control never depends on color alone. */
.cl-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: var(--cl-accent, var(--structure));
  border: 1px solid var(--structure);
}

.cl-filter[aria-pressed="true"] .cl-swatch {
  border-color: var(--surface);
}

.cl-count {
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  opacity: 0.7;
}

/* ---- Timeline ---------------------------------------------------- */

.cl-timeline {
  position: relative;
  padding-left: var(--sp-8);
}

/* The spine: one continuous ink rule the release blocks hang off. */
.cl-timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: var(--border-thick);
  background: var(--structure-2);
}

/* Zero-height marker so a year link lands above the release rather than
   under the sticky control bar. Kept out of the <section> tag because the
   repo's HTML formatter rewrites Jinja placed inside an attribute list. */
.cl-year-anchor {
  display: block;
  height: 0;
  scroll-margin-top: 96px;
}

.cl-release {
  position: relative;
  margin-bottom: var(--sp-10);
  scroll-margin-top: 96px;
}

.cl-release::before {
  content: "";
  position: absolute;
  left: calc(var(--sp-8) * -1);
  top: 10px;
  width: 16px;
  height: 16px;
  background: var(--brand);
  border: var(--border-thick) solid var(--structure);
}

/* Release header: version slab + label block. */
.cl-release-head {
  display: flex;
  align-items: stretch;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.cl-version {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand);
  border: var(--border-thick) solid var(--structure);
  box-shadow: var(--shadow-e2);
  min-width: 116px;
}

.cl-version-num {
  font-size: var(--fs-200);
  font-weight: var(--fw-display);
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.cl-version-tag {
  font-size: var(--fs-75);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rose);
  margin-top: 2px;
}

.cl-release-meta {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cl-release-title {
  font-size: var(--fs-125);
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
}

.cl-release-date {
  font-size: var(--fs-875);
  color: var(--text-muted);
  margin: 2px 0 0;
}

.cl-headline {
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-100);
  color: var(--text-strong);
  border-left: var(--border-bold) solid var(--brand);
  padding-left: var(--sp-3);
}

/* ---- Release body ------------------------------------------------ */

.cl-body {
  border: var(--border-thick) solid var(--structure);
  background: var(--surface);
  box-shadow: var(--shadow-e2);
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
}

.cl-group-label {
  font-size: var(--fs-75);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-3);
  border-bottom: var(--border-thin) solid var(--surface-border);
}

.cl-group + .cl-group {
  margin-top: var(--sp-5);
}

.cl-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cl-item {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: var(--sp-4);
  align-items: start;
  padding: var(--sp-3) 0;
  border-bottom: var(--border-thin) solid var(--surface-border);
}

.cl-item:last-child {
  border-bottom: 0;
}

/* Category tag: ink frame with a colored inset bar. Text stays
   --text-strong so contrast holds in both themes. */
.cl-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 3px var(--sp-2);
  font-size: var(--fs-75);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-strong);
  background: var(--surface-2);
  border: var(--border-thin) solid var(--structure);
  border-left: var(--border-bold) solid var(--cl-accent, var(--structure));
  white-space: nowrap;
}

.cl-text {
  color: var(--text-strong);
  line-height: var(--line-base);
}

.cl-text code {
  background: var(--surface-2);
  border: var(--border-thin) solid var(--surface-border);
  padding: 0 4px;
  font-size: 0.9em;
  color: var(--text-strong);
}

.cl-notes {
  list-style: none;
  margin: var(--sp-2) 0 0;
  padding: 0 0 0 var(--sp-4);
  border-left: var(--border-thick) solid var(--surface-border);
}

.cl-notes li {
  position: relative;
  color: var(--text-muted);
  font-size: var(--fs-875);
  padding: 2px 0;
}

/* ---- Category accents -------------------------------------------- */

.cl-cat-added {
  --cl-accent: var(--status-ac);
}

.cl-cat-improved {
  --cl-accent: var(--rank-sapphire);
}

.cl-cat-fixed {
  --cl-accent: var(--status-re);
}

.cl-cat-changed {
  --cl-accent: var(--brand);
}

/* ---- Filter state ------------------------------------------------ */

.cl-item[hidden],
.cl-group[hidden],
.cl-release[hidden] {
  display: none;
}

.cl-empty {
  border: var(--border-thick) dashed var(--surface-border);
  padding: var(--sp-8);
  text-align: center;
  color: var(--text-muted);
}

/* ---- Responsive --------------------------------------------------- */

@media (max-width: 720px) {
  .cl-page {
    padding: var(--sp-6) var(--sp-3) var(--sp-12);
  }

  .cl-timeline {
    padding-left: var(--sp-5);
  }

  .cl-release::before {
    left: calc(var(--sp-5) * -1);
  }

  .cl-item {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }

  .cl-tag {
    justify-self: start;
  }

  .cl-controls {
    position: static;
  }

  .cl-stat {
    border-right: 0;
    border-bottom: var(--border-thick) solid var(--structure);
  }

  .cl-stat:last-child {
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cl-filter,
  .cl-year {
    transition: none;
  }

  .cl-filter:hover,
  .cl-year:hover,
  .cl-filter:focus-visible,
  .cl-year:focus-visible {
    transform: none;
  }
}
