/*
 * pyrix.org · the changelog page (/changelog, server/views/changelog-page.js, /js/changelog.js). Linked after
 * site.css; every rule is scoped to the page. The sticky column holds the title, search, type keys and the version
 * index; on narrow or short windows the index becomes a sticky strip of version keys over the releases.
 */

.site .vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
html:has(.cl-page) { scroll-padding-top: calc(56px + 28px); }

/* ---------- the column ---------- */
.site .cl-spec { gap: 24px; }
.site .cl-head { display: grid; gap: 12px; }
.site .cl-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  color: var(--text-3);
  font-size: 0.8125rem;
}
.site .cl-facts .mono { color: var(--text-2); font-size: 0.75rem; }

/* search: one frame around the icon and the field, lit as a whole */
.site .cl-tools { display: grid; gap: 12px; }
.site .cl-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--edge-2);
  border-radius: var(--r);
  background: #000;
  color: var(--text-3);
  transition: border-color var(--t1);
}
.site .cl-field:hover { border-color: var(--edge-hi); }
.site .cl-field:focus-within { border-color: var(--blue); outline: 1.5px solid var(--blue-2); outline-offset: 2px; }
.site .cl-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  outline: none;
}
.site .cl-field input:focus-visible { outline: none; }
.site .cl-field input::placeholder { color: var(--text-3); opacity: 1; }
.site .cl-field input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.site .cl-kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-right: 3px;
  padding: 0 6px;
  border: 1px solid var(--edge-2);
  border-radius: 2px;
  background: #0c0c0f;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
}
.site .cl-field:focus-within .cl-kbd,
.site .cl-field:has(input:not(:placeholder-shown)) .cl-kbd { display: none; }
@media (pointer: coarse) {
  .site .cl-kbd { display: none; }
}

/* type keys: filter chips; the pressed one is the blue selection box */
.site .cl-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.site .cl-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--edge);
  border-radius: var(--r);
  background: #000;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--t1), border-color var(--t1), background-color var(--t1);
}
.site .cl-key .mono { color: var(--text-3); font-size: 0.75rem; font-weight: 500; transition: color var(--t1); }
.site .cl-key:hover { color: #fff; border-color: var(--edge-hi); }
.site .cl-key:active { transform: translateY(1px); }
.site .cl-key[aria-pressed="true"] { color: #fff; border-color: var(--line-blue); background: var(--blue-wash); }
.site .cl-key[aria-pressed="true"] .mono { color: var(--blue-ink); }
@media (pointer: coarse) {
  .site .cl-key { height: 40px; padding: 0 13px; }
}
.site .cl-status { color: var(--text-2); font-size: 0.8125rem; }
.site .cl-status .link { margin-left: 6px; }

/* version index: version and date, the title under them, the number of changes at the end */
.site .cl-index { border-top: 1px solid var(--edge); padding-top: 10px; }
.site .cl-ix-list {
  display: grid;
  gap: 2px;
  max-height: max(176px, calc(100dvh - var(--bar-h) - 470px));
  overflow-y: auto;
  padding: 0 4px 0 0;
  overscroll-behavior: contain;
}
.site .cl-ix {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "v d n" "t t n";
  align-items: center;
  gap: 2px 12px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--text-2);
  transition: color var(--t1), border-color var(--t1), background-color var(--t1), opacity var(--t2);
}
.site .cl-ix:hover { border-color: var(--edge-2); color: #fff; }
.site .cl-ix-v { grid-area: v; color: var(--text); font-size: 0.8125rem; font-weight: 600; }
.site .cl-ix-d { grid-area: d; color: var(--text-3); font-size: 0.75rem; }
.site .cl-ix-t { grid-area: t; overflow: hidden; font-size: 0.8125rem; font-weight: 500; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.site .cl-ix-n {
  grid-area: n;
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--edge-2);
  border-radius: 2px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.site .cl-ix[aria-current="true"] { border-color: var(--line-blue); background: var(--blue-wash); color: #fff; }
.site .cl-ix[aria-current="true"] .cl-ix-v { color: var(--blue-2); }
.site .cl-ix[data-empty] { opacity: 0.42; }

/* the strip: the same versions as one row of keys, sticky under the top bar (narrow or short windows only) */
.site .cl-strip {
  display: none;
  position: sticky;
  top: var(--bar-h);
  z-index: 5;
  margin: 0 calc(-1 * var(--gutter)) 28px;
  padding: 0 var(--gutter);
  border-block: 1px solid var(--edge);
  background: #000;
}
.site .cl-strip ol {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.site .cl-strip ol::-webkit-scrollbar { display: none; }
.site .cl-strip[data-more~="r"] ol { mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.site .cl-strip[data-more~="l"] ol { mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
.site .cl-strip[data-more~="l"][data-more~="r"] ol { mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.site .cl-chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--edge-2);
  border-radius: var(--r);
  color: var(--text-2);
  white-space: nowrap;
  transition: color var(--t1), border-color var(--t1), background-color var(--t1), opacity var(--t2);
}
.site .cl-chip .cl-ix-v { color: inherit; font-size: 0.8125rem; }
.site .cl-chip:hover { color: #fff; border-color: var(--edge-hi); }
.site .cl-chip[aria-current="true"] { color: #fff; border-color: var(--line-blue); background: var(--blue-wash); }
.site .cl-chip[data-empty] { opacity: 0.42; }

/* ---------- releases ---------- */
.site .cl { min-width: 0; max-width: 780px; }
.site .cl-rel { scroll-margin-top: calc(var(--bar-h) + 28px); }
/* (every shown release after another shown one: a filtered-out first release leaves no rule on top) */
.site .cl-rel:not([hidden]) ~ .cl-rel:not([hidden]) { margin-top: 56px; padding-top: 48px; border-top: 1px solid var(--edge); }
.site .cl-rel-h { display: grid; gap: 10px; margin-bottom: 32px; }
.site .cl-rel-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 34px; }
.site .cl-rel-meta b { margin-left: -5px; padding: 1px 5px; border-radius: 2px; color: var(--blue-ink); font-size: 0.9375rem; font-weight: 600; }
.site .cl-rel-meta > span.mono { color: var(--text-3); font-size: 0.75rem; }
.site .cl-perma { margin-left: auto; opacity: 0; transition: opacity var(--t1), color var(--t1), border-color var(--t1); }
.site .cl-rel:hover .cl-perma,
.site .cl-perma:focus-visible,
.site .cl-perma[data-copied] { opacity: 1; }
.site .cl-perma[data-copied] { color: var(--green-ink); border-color: rgba(34, 197, 94, 0.4); }
@media (hover: none) {
  .site .cl-perma { opacity: 1; }
}
.site .cl-rel-t {
  font-size: clamp(1.3125rem, 1.1rem + 0.7vw, 1.75rem);
  font-weight: 680;
  line-height: 1.18;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.site .cl-sum { max-width: 66ch; color: var(--text-2); }
.site .cl-counts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; }
.site .cl-count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: color var(--t1);
}
.site .cl-count .mono { color: var(--text); font-size: 0.75rem; }
/* a release's totals would contradict a filtered view */
.site .cl-page[data-filtered] .cl-counts { display: none; }
.site .cl-count:hover { color: #fff; }
.site .cl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.site .cl-dot[data-k="new"] { background: var(--green); }
.site .cl-dot[data-k="removed"] { background: var(--red); }

/* a type group: its tag and count on a hairline, then the changes */
.site .cl-group { scroll-margin-top: calc(var(--bar-h) + 28px); }
.site .cl-group + .cl-group { margin-top: 36px; }
.site .cl-gh {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--edge);
}
.site .cl-gn { color: var(--text-3); font-size: 0.75rem; font-weight: 500; }
.site .cl-list { display: grid; gap: 20px; }
.site .cl-item { display: grid; gap: 3px; max-width: 70ch; }
.site .cl-item-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.site .cl-name { color: var(--text); font-size: 0.96875rem; font-weight: 650; letter-spacing: -0.006em; line-height: 1.4; }
.site .cl-area { color: var(--text-3); font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.site .cl-text { color: var(--text-2); }
.site .cl-item:not(.cl-item-plain) .cl-text::first-letter { text-transform: uppercase; }
.site .cl-item-plain .cl-text { color: var(--text); }
.site .cl mark { padding: 0 1px; border-radius: 2px; background: rgba(59, 130, 246, 0.3); color: #fff; }

/* a release or group the reader jumped to marks itself once */
@media (prefers-reduced-motion: no-preference) {
  .site .cl-rel:target .cl-rel-meta b,
  .site .cl-group:target .cl-gh .tag { animation: cl-mark 1.4s var(--ease); }
}
@keyframes cl-mark {
  0%, 30% { background-color: rgba(59, 130, 246, 0.32); }
  100% { background-color: transparent; }
}

.site .cl-empty { display: grid; gap: 10px; justify-items: start; padding: 48px 0; border-top: 1px solid var(--edge); }
.site .cl-empty-t { font-size: 1.125rem; font-weight: 650; }
.site .cl-empty .key { margin-top: 8px; }

/* ---------- narrow or short windows: the strip replaces the index ---------- */
@media (max-width: 960px), (max-height: 759px) {
  .site .cl-index { display: none; }
  .site .cl-strip { display: block; }
  html:has(.cl-page) { scroll-padding-top: calc(56px + 50px + 20px); }
  .site .cl-rel,
  .site .cl-group { scroll-margin-top: calc(var(--bar-h) + 50px + 20px); }
}
@media (max-width: 960px) {
  .site .cl-page { gap: 32px; }
  .site .cl { max-width: none; }
}
@media (max-width: 760px) {
  .site .cl-field input { font-size: 16px; }
  .site .cl-kbd { display: none; }
  .site .cl-rel:not([hidden]) ~ .cl-rel:not([hidden]) { margin-top: 44px; padding-top: 40px; }
  .site .cl-rel-h { margin-bottom: 26px; }
  .site .cl-list { gap: 18px; }
  .site .cl-group + .cl-group { margin-top: 30px; }
  .site .cl-name { font-size: 0.9375rem; }
}
