/* changelog — the standalone Changelog page (public/changelog.html).
 *
 * Mockup: .tmp/changelog-hig-mockup.html (approved 2026-10-09).
 * Audit:  docs/design/phase-d-hig-audit.md, sections 2 to 4.
 * Script: public/js/changelog.js.
 *
 * Uses ONLY var(--v2-*) tokens, all defined in /css/canopy-v2.css. No raw
 * colour. The page does not load style.css, so the base resets it needs are
 * here (REL-182 consumer-HTML rule).
 *
 * Two layers:
 *   Glass   — the round top-bar buttons, the tab bar, the scroll-edge fade (glass.css).
 *             The .glass surface, .glass-btn, .glass-topbar and .glass-tabbar are
 *             in glass.css, which this page also loads: opaque by default,
 *             translucent only where backdrop-filter is supported, opaque again
 *             for Reduce Transparency and Increase Contrast.
 *   Content — everything that scrolls: cards, rows, chips, fields. Opaque.
 */

/* ─── 1. Base resets and page ─── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.chg-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--v2-bg-primary);
  color: var(--v2-text-primary);
  font-family: var(--v2-font-body);
  font-size: var(--v2-font-size-subhead);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.chg-page a, .chg-page button { -webkit-tap-highlight-color: transparent; }
.chg-page button { font-family: inherit; margin: 0; cursor: pointer; }
.chg-page [hidden] { display: none !important; }

/* Increase Contrast: hairlines on this page step up to the strong border. */
@media (prefers-contrast: more) {
  body.chg-page { --v2-edge: var(--v2-border-strong); --v2-border-soft: var(--v2-border-strong); }
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--v2-safe-top) + var(--v2-topbar-height) + 12px) calc(var(--v2-space-md) + var(--v2-safe-right))
    calc(var(--v2-safe-bottom) + var(--v2-tabbar-height) + 40px) calc(var(--v2-space-md) + var(--v2-safe-left));
}
.page-heading {
  font-family: var(--v2-font-display);
  font-weight: 500;
  font-size: var(--v2-font-size-title1);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--v2-text-primary);
  margin: 0 0 6px;
}
.page-lede { font-size: var(--v2-font-size-subhead); line-height: 1.5; color: var(--v2-text-support); margin: 0 0 18px; }

/* ─── 2. Glass layer: top bar title (the scroll edge now lives in glass.css) ─── */

.topbar-title {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--v2-space-sm);
  margin: 0;
  font-family: var(--v2-font-display);
  font-weight: 500;
  font-size: var(--v2-font-size-body);
  letter-spacing: -0.01em;
  color: var(--v2-accent-text);
}
.topbar-title svg { width: 22px; height: 22px; flex: 0 0 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }


/* ─── 3. Content layer: opaque ─── */

/* Cross-page switch. Scrolls away with the page, so it stays opaque. */
.page-segment {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin: 0 0 20px;
  padding: 4px;
  gap: 4px;
  background: var(--v2-bg-secondary);
  border-radius: var(--v2-radius-md);
}
.page-segment-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: var(--v2-space-touch);
  border: 1px solid transparent;
  border-radius: var(--v2-radius-sm);
  color: var(--v2-text-support);
  font-size: var(--v2-font-size-subhead);
  font-weight: 500;
  text-decoration: none;
}
.page-segment-tab.is-active { background: var(--v2-bg-card); border-color: var(--v2-edge); color: var(--v2-accent-text); font-weight: 700; box-shadow: var(--v2-elev-1); }
.dark .page-segment-tab.is-active { background: var(--v2-bg-card-hover); }
/* Rows keep their pressed overlay; the segment tile fades between choices. */
.page-segment-tab { transition: color var(--v2-transition-fast) var(--v2-ease-out); }
.page-segment-tab:focus-visible { outline: 2px solid var(--v2-accent-text); outline-offset: 2px; }

.section-label { font-size: var(--v2-font-size-caption2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--v2-text-support); margin: 0; }

.secondary-cta {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border-radius: var(--v2-radius-sm);
  font-family: var(--v2-font-body);
  font-weight: 600;
  font-size: var(--v2-font-size-subhead);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--v2-bg-card);
  color: var(--v2-text-primary);
  border: 1px solid var(--v2-border-strong);
}
.dark .secondary-cta { background: transparent; }
.secondary-cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.secondary-cta:active { opacity: 0.8; }
.secondary-cta:focus-visible { outline: 2px solid var(--v2-accent-text); outline-offset: 2px; }

.text-btn {
  background: none;
  border: none;
  padding: 0 8px;
  min-width: var(--v2-space-touch);
  min-height: var(--v2-space-touch);
  font-size: var(--v2-font-size-footnote);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--v2-accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.shimmer-line { height: 14px; border-radius: 6px; background: var(--v2-bg-secondary); animation: chg-shimmer 1.4s ease-in-out infinite; }
.dark .shimmer-line { background: var(--v2-bg-card-hover); }
@keyframes chg-shimmer { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }

/* ─── 4. Release timeline (chg-*) ─── */
.chg-date-group { margin-top: 26px; }
.chg-date-group:first-of-type { margin-top: 4px; }
.chg-date-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 10px;
  font-family: var(--v2-font-display);
  font-weight: 500;
  font-size: var(--v2-font-size-callout);
  color: var(--v2-text-support);
}
.chg-date-label::after { content: ""; flex: 1; height: 1px; background: var(--v2-edge); }
.chg-date-count { order: 2; font-family: var(--v2-font-body); font-size: var(--v2-font-size-caption2); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--v2-text-support); }

.chg-card { background: var(--v2-bg-card); border: 1px solid var(--v2-border-soft); border-radius: var(--v2-radius-lg); box-shadow: var(--v2-elev-1); overflow: hidden; }
.chg-card + .chg-card { margin-top: 10px; }
.chg-card.is-open { box-shadow: var(--v2-elev-2); }
.chg-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 16px 12px 0 16px;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
}
.chg-card-title {
  flex: 1;
  min-width: 0;
  font-family: var(--v2-font-display);
  font-weight: 600;
  font-size: var(--v2-font-size-title3);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--v2-text-primary);
  overflow-wrap: anywhere;
}
.chg-chevron {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 5px;
  border-radius: 50%;
  background: var(--v2-bg-secondary);
  fill: none;
  stroke: var(--v2-text-primary);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--v2-transition-base) var(--v2-ease-out);
}
.dark .chg-chevron { background: var(--v2-bg-card-hover); }
.chg-card.is-open > .chg-card-head .chg-chevron { transform: rotate(180deg); }
.chg-card-head:focus-visible, .chg-idea-row:focus-visible { outline: 2px solid var(--v2-accent-text); outline-offset: -2px; }

/* Issue 757 (REQ-0014): grouped notes. Mockup: docs/design/mockups/changelog-grouped-notes-757.html */
/* "New" tag on a release this device had not seen. Slate = information. */
.chg-new-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--v2-radius-full);
  background: var(--v2-pop-slate-bg);
  color: var(--v2-pop-slate-text);
  font-family: var(--v2-font-body);
  font-size: var(--v2-font-size-caption2);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 3px;
}
.chg-counts { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; }
.chg-count { padding: 3px 9px; border-radius: var(--v2-radius-full); background: var(--v2-bg-secondary); font-size: var(--v2-font-size-caption); font-weight: 600; color: var(--v2-text-support); }
.chg-count b { color: var(--v2-text-primary); font-variant-numeric: tabular-nums; }
.dark .chg-count { background: var(--v2-bg-card-hover); }

.chg-preview { padding: 10px 16px 6px; }
.chg-notes { padding: 6px 0 0; }
.chg-note-list { list-style: none; margin: 0; padding: 0; }
.chg-note {
  position: relative;
  margin: 7px 0;
  padding: 0 0 0 16px;
  font-size: var(--v2-font-size-subhead);
  line-height: 1.45;
  color: var(--v2-text-primary);
  overflow-wrap: anywhere;
}
.chg-note::before { content: ""; position: absolute; left: 2px; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--v2-text-support); }
.chg-group-label { font-size: var(--v2-font-size-caption2); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--v2-text-support); }
.chg-group-label.is-first { margin: 0; }
.chg-group + .chg-group, .chg-footer { border-top: 1px solid var(--v2-border-soft); }
.chg-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--v2-space-touch);
  padding: 0 16px;
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
}
.chg-group-head .chg-chevron { margin-left: auto; width: 24px; height: 24px; flex-basis: 24px; padding: 4px; background: none; stroke: var(--v2-text-support); }
.chg-group-head[aria-expanded="true"] .chg-chevron { transform: rotate(180deg); }
.chg-group-head:focus-visible, .chg-more:focus-visible, .chg-broke:focus-visible { outline: 2px solid var(--v2-accent-text); outline-offset: -2px; }
.chg-group-count { font-size: var(--v2-font-size-footnote); font-variant-numeric: tabular-nums; color: var(--v2-text-support); }
.chg-group-panel { padding: 0 16px 6px; }
.chg-more {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--v2-space-touch);
  padding: 0;
  background: none;
  border: 0;
  font-size: var(--v2-font-size-footnote);
  font-weight: 700;
  color: var(--v2-accent-text);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.chg-footer { margin: 0; padding: 12px 16px 14px; font-size: var(--v2-font-size-footnote); color: var(--v2-text-support); }

.chg-ideas { border-top: 1px solid var(--v2-border-soft); }
.chg-ideas-list { padding-bottom: 4px; }
.chg-idea-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 9px 14px 9px 16px;
  text-align: left;
  background: none;
  border: none;
  border-top: 1px solid var(--v2-border-soft);
  color: inherit;
}
.chg-idea-row:active { background: var(--v2-press-overlay); }
.chg-idea-num { flex: 0 0 40px; font-family: var(--v2-font-display); font-size: var(--v2-font-size-footnote); font-variant-numeric: tabular-nums; color: var(--v2-text-support); }
.chg-idea-title {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--v2-font-size-subhead);
  font-weight: 500;
  line-height: 1.35;
  color: var(--v2-text-primary);
  overflow-wrap: anywhere;
}
.chg-idea-skeleton { display: grid; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--v2-border-soft); }
.chg-idea-skeleton .shimmer-line:last-child { width: 45%; height: 12px; }
.chg-ideas-msg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 8px 10px 16px;
  font-size: var(--v2-font-size-subhead);
  line-height: 1.4;
  color: var(--v2-text-support);
}
.chg-ideas-msg.is-error { color: var(--v2-pop-coral-text); font-weight: 500; }
.chg-ideas-msg .text-btn { flex-shrink: 0; color: var(--v2-text-primary); }
.chg-card-foot { display: flex; justify-content: center; padding: 4px 8px 8px; border-top: 1px solid var(--v2-border-soft); }
/* "Something broke after this release": a rare action, so a quiet text button. */
.chg-broke {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--v2-space-touch);
  padding: 0 12px;
  background: none;
  border: 0;
  font-size: var(--v2-font-size-subhead);
  font-weight: 600;
  color: var(--v2-text-support);
}
.chg-broke svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.dark .chg-card, .dark .chg-ideas, .dark .chg-idea-row, .dark .chg-idea-skeleton, .dark .chg-card-foot,
.dark .chg-group + .chg-group, .dark .chg-footer { border-color: var(--v2-edge); }

/* Page loading: card-shaped placeholders */
.chg-skeleton-date { width: 140px; height: 18px; margin: 4px 2px 12px; }
.chg-skeleton-card { display: grid; gap: 10px; padding: 16px; background: var(--v2-bg-card); border: 1px solid var(--v2-border-soft); border-radius: var(--v2-radius-lg); }
.chg-skeleton-card + .chg-skeleton-date { margin-top: 26px; }
.chg-skeleton-card .shimmer-line:first-child { width: 80%; height: 18px; }
.chg-skeleton-card .shimmer-line:last-child { width: 45%; }
.dark .chg-skeleton-card { border-color: var(--v2-edge); }

.chg-empty { padding: 40px 24px; text-align: center; }
.chg-empty svg { width: 36px; height: 36px; fill: none; stroke: var(--v2-text-support); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chg-empty h3 { margin: 12px 0 4px; font-family: var(--v2-font-display); font-weight: 500; font-size: var(--v2-font-size-title3); color: var(--v2-text-primary); }
.chg-empty p { margin: 0; font-size: var(--v2-font-size-subhead); color: var(--v2-text-support); }

/* ─── 5. Something broke (problem-*, inside a sheet) ─── */
.problem-form { display: grid; gap: 16px; margin: 0; padding-bottom: 8px; }
.problem-after { margin: 0; font-size: var(--v2-font-size-subhead); line-height: 1.4; color: var(--v2-text-primary); font-weight: 500; overflow-wrap: anywhere; }
.problem-lede { margin: 4px 0 0; font-size: var(--v2-font-size-subhead); line-height: 1.45; color: var(--v2-text-support); }
.problem-note {
  display: block;
  width: 100%;
  min-height: 120px;
  resize: none;
  padding: 12px 14px;
  border: 1px solid var(--v2-border-strong);
  border-radius: var(--v2-radius-md);
  background: var(--v2-bg-card);
  color: var(--v2-text-primary);
  font-family: var(--v2-font-body);
  font-size: var(--v2-font-size-body);
  line-height: 1.45;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dark .problem-note, .dark .screenshot-pick-btn { background: var(--v2-bg-secondary); }
.problem-note::placeholder { color: var(--v2-text-support); opacity: 1; }
.problem-note:focus-visible { border-color: var(--v2-accent-text); box-shadow: 0 0 0 3px var(--v2-focus-ring); }
.problem-note.is-invalid { border-color: var(--v2-pop-coral); }
.screenshot-pick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 4px 4px 4px 16px;
  border: 1.5px dashed var(--v2-border-strong);
  border-radius: var(--v2-radius-md);
  background: var(--v2-bg-card);
  color: var(--v2-text-primary);
  font-size: var(--v2-font-size-callout);
  font-weight: 500;
  cursor: pointer;
}
.screenshot-pick-btn svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.screenshot-pick-btn.has-file { border-style: solid; cursor: default; }
.screenshot-pick-btn.has-file > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screenshot-pick-btn:focus-visible, .screenshot-clear-btn:focus-visible { outline: 2px solid var(--v2-accent-text); outline-offset: 2px; }
.screenshot-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.screenshot-clear-btn {
  width: var(--v2-space-touch);
  height: var(--v2-space-touch);
  flex: 0 0 var(--v2-space-touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: var(--v2-radius-full);
  background: var(--v2-glass-control-fill);
  color: var(--v2-text-primary);
}
.screenshot-clear-btn svg { width: 16px; height: 16px; stroke-width: 2; }

/* Reduce Motion: no pulsing, no travel. State changes are instant. */
@media (prefers-reduced-motion: reduce) {
  .shimmer-line { animation: none; }
  .chg-chevron { transition: none; }
  .page-segment-tab { transition: none; }
}
