/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V5
 * page: changelog · macrostructure: Index-First (design.md) · theme: Cobalt (design.md)
 * genre: modern-minimal · mode: light-default (dark toggle)
 * nav: shared (design.md) · footer: Ft2 inline (design.md)
 * contrast: pass (40-41) · honest: pass (46, real git log + skills-index.json recency only)
 * chrome: pass (47) · tokens: pass (48) · responsive: pass (34, 49, 50-57)
 * feature (phase 6): the same selection also drives "Copy as Markdown", "Copy
 * release body" (GitHub release shape) and a date-range picker, plus a link to
 * feed.xml — all real <button>s/<input>s with :focus-visible rings and >=44px
 * touch targets, all styled from tokens by name.
 * feature: entry selection + "copy selected as Discord text" toolbar — real
 * <input type="checkbox"> per row (native a11y, no custom role), sticky
 * toolbar under the nav, 8-state .btn-primary "Copy selected" reused from
 * base.css. Hit targets ≥44px verified at 320/375/414/768.
 * Requires tokens.css + base.css, linked before this file in changelog.html.
 * Reference tokens by name only — no inline OKLCH/hex/font-family below.
 */

.changelog-page {
  padding-block: var(--space-2xl) var(--space-3xl);
}

/* ---- Intro — modest h1 + one line, no display headline (Index-First stays list-shaped) ---- */
.changelog-head {
  max-width: 60ch;
  margin-block-end: var(--space-2xl);
}
.changelog-title {
  font-size: var(--text-2xl);
  margin-block-end: var(--space-sm);
}
.changelog-intro {
  font-size: var(--text-lg);
  color: var(--color-ink-2);
  overflow-wrap: anywhere;
}

.changelog-loading,
.changelog-empty {
  font-size: var(--text-sm);
  color: var(--color-ink-3);
  padding-block: var(--space-lg);
}

/* ---- Selection toolbar — sticky utility bar for "copy selected as Discord text" ---- */
.changelog-toolbar {
  position: sticky;
  top: 60px; /* nav height, base.css .nav-inner */
  z-index: var(--z-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-block-end: var(--space-xl);
  padding: var(--space-sm) var(--space-md);
  background: color-mix(in oklab, var(--color-paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-control);
}
.changelog-toolbar-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-2);
}
.changelog-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
/* Success feedback for the primary copy CTA — mirrors .btn-primary[data-state="success"]
   in base.css; HermesCommon.copyToClipboard only toggles the .is-success class, so this
   page supplies the matching visual for its own button. */
.changelog-copy-btn.is-success {
  background: var(--color-success);
  color: var(--color-accent-ink);
}

/* ---- Second toolbar row — date-range selection + the Atom feed link ----
   Created by changelog.js (changelog.html owns only the base bar), so the whole
   selection/export feature has one owner. flex-basis:100% drops it onto its own
   line inside the existing wrapping flex toolbar without disturbing row one. */
.changelog-toolbar-more {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-block-start: var(--space-sm);
  border-top: 1px solid var(--color-rule);
}

.changelog-range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}
.changelog-range-legend {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-3);
}
.changelog-range-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  cursor: pointer;
}
.changelog-range-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-3);
}
.changelog-range-input {
  height: 40px;
  padding-inline: var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink);
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-control);
  cursor: pointer;
}
.changelog-range-input:hover { border-color: var(--color-ink-3); }
.changelog-range-input:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Feed link — a real link (not a button) because it navigates; sized to the
   same 44px tap target as the buttons beside it on touch. */
.changelog-feed-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  min-height: 40px;
  padding-inline: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-3);
  text-decoration: none;
}
.changelog-feed-link:hover { color: var(--color-accent); }
.changelog-feed-link:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-control);
}

/* ---- Dated groups ---- */
.changelog-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

.changelog-group {
  min-width: 0;
}

.changelog-date {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-block-end: var(--space-sm);
  padding-block-end: var(--space-xs);
  border-bottom: 1px solid var(--color-rule-2);
}
.changelog-date-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink);
}
.changelog-date-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-3);
}

/* ---- Entry rows — hairline between entries, no boxed cards ---- */
.changelog-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-xs);
  padding-block: var(--space-md);
  border-bottom: 1px solid var(--color-rule);
}
.changelog-entry:last-child { border-bottom: none; }

/* Real checkbox per row — the wrapping <label> expands the click/tap target to
   44px without inflating the checkbox's visual size (interaction-and-states.md). */
.changelog-entry-select {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-block-start: calc(-1 * var(--space-xs));
  cursor: pointer;
}
.changelog-checkbox {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.changelog-entry-content {
  display: grid;
  grid-template-columns: minmax(0, 5.5rem) minmax(0, 1fr);
  gap: var(--space-md);
  min-width: 0;
}

.changelog-entry-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-3);
  padding-top: 0.15em;
  overflow-wrap: anywhere;
  min-width: 0;
}
.changelog-entry-tag.is-skills {
  color: var(--tier-core-ink);
}

.changelog-entry-body {
  min-width: 0;
}
.changelog-entry-text {
  max-width: 68ch;
  font-size: var(--text-sm);
  color: var(--color-ink-2);
  overflow-wrap: anywhere;
}

.changelog-entry.reveal { transition-delay: 0ms; }

/* ---- Mobile: stack tag above line, no horizontal scroll, no two-line link risk ---- */
@media (max-width: 40rem) {
  .changelog-entry-content {
    grid-template-columns: 1fr;
    gap: var(--space-2xs);
  }
  .changelog-entry-tag {
    padding-top: 0;
  }
  .changelog-date {
    flex-wrap: wrap;
  }
  .changelog-toolbar {
    justify-content: flex-start;
  }
  .changelog-toolbar-actions {
    width: 100%;
  }
  .changelog-toolbar-actions .btn {
    flex: 1 1 auto;
  }
  .changelog-toolbar-more {
    justify-content: flex-start;
  }
  .changelog-range {
    width: 100%;
  }
  /* Legend onto its own line so From/To sit on a shared baseline instead of
     being pushed ragged by the label width. */
  .changelog-range-legend {
    flex-basis: 100%;
  }
  .changelog-range-field,
  .changelog-range-input,
  .changelog-range-btn {
    flex: 1 1 auto;
  }
}

/* Touch targets: every control in the toolbar clears 44px on a small screen or
   any coarse pointer, including the date inputs and the feed link. */
@media (max-width: 40rem), (pointer: coarse) {
  .changelog-toolbar .btn,
  .changelog-range-input,
  .changelog-feed-link {
    min-height: 44px;
  }
  .changelog-entry-select {
    width: 2.75rem;
    height: 2.75rem;
  }
}
