/*
 * v3 storefront (TODO.md Phase 22 steps 4b and 5). Loaded AFTER
 * app_proxy_v2.css, only for shops on v3, whose forum sits inside the store
 * theme's layout. Structure follows the approved design
 * (https://claude.ai/artifact/585dpoDBDDMD1AbYCbi4r1); colours, fonts and
 * corners come from the store theme.
 *
 * Theme values (--sf-*) are set on the v3 root by app_proxy/v3/_theme_tokens
 * (it measures the theme's own button, heading and body). The defaults below
 * are the no-JS fallback: the body's text colour and the shop's Champ primary
 * colour. Everything else is mixed from those few values, so a dark theme
 * gives a dark forum without a second palette.
 *
 * Every selector is scoped to the v3 root, so nothing here can reach the
 * theme's header or footer.
 */

/* ── Theme values ──────────────────────────────────────────────────────── */

.champ-v3-root.champ-design-v2 {
  /* Every forum size is a multiple of this (see the Sizes block in
     app_proxy_v2.css). Fixed, not rem: many themes set the root to 62.5%
     (1rem = 10px), which made the whole forum 37.5% smaller. */
  --champ-rem: 16px;
  --champ-font: inherit;

  --sf-bg: Canvas;
  --sf-ink: currentColor;
  --sf-accent: var(--champ-primary);
  --sf-accent-ink: var(--champ-on-primary);
  --sf-btn-radius: 6px;

  --sf-radius: min(var(--sf-btn-radius), 14px);
  --sf-surface: var(--sf-bg);
  --sf-line: color-mix(in srgb, var(--sf-ink) 14%, var(--sf-bg));
  --sf-muted: color-mix(in srgb, var(--sf-ink) 64%, var(--sf-bg));
  --sf-soft: color-mix(in srgb, var(--sf-accent) 11%, var(--sf-bg));
  /* Readable accent for text; the theme probe darkens a light accent. */
  --sf-accent-text: var(--sf-accent);
  --sf-soft-ink: color-mix(in srgb, var(--sf-accent-text) 72%, var(--sf-ink));
  --sf-unread: var(--sf-accent);

  font-family: inherit;
  font-size: calc(1 * var(--champ-rem));
  line-height: 1.55;
  color: inherit;
  background: transparent;
  min-height: 0;
}

/* The v2 parts that v3 still reuses (posts, composer, forms, popovers) take
   the theme look through their own tokens. Set on the children, so the shop's
   --champ-primary can still be the --sf-accent fallback on the root. */
.champ-v3-root > * {
  --champ-bg: var(--sf-bg);
  --champ-canvas: transparent;
  --champ-surface: var(--sf-surface);
  --champ-surface-sunken: var(--sf-soft);
  --champ-text: var(--sf-ink);
  --champ-text-subtle: var(--sf-muted);
  --champ-link: var(--sf-ink);
  --champ-border: var(--sf-line);
  --champ-primary: var(--sf-accent);
  --champ-on-primary: var(--sf-accent-ink);
  --champ-radius: var(--sf-radius);
}

/* Theme element rules (Horizon: `img { width: 100% }`, large h1/h2) are
   unlayered, so they beat the layered v2 CSS that v3 reuses. Inside the v3
   root these properties go back to Champ's layers (step 5e, live 2026-11-09).
   Kept before every other v3 rule, so a later v3 rule of the same weight wins. */
.champ-v3-root :is(h1, h2, h3, h4, h5, h6) {
  font-size: revert-layer;
  line-height: revert-layer;
  margin: revert-layer;
  letter-spacing: revert-layer;
  text-transform: revert-layer;
}

.champ-v3-root img {
  width: revert-layer;
  height: revert-layer;
  max-width: revert-layer;
  aspect-ratio: revert-layer;
}

/* ── Page frame ────────────────────────────────────────────────────────── */

.champ-v3-root .champ-v3-main {
  max-width: 1120px;
  margin-inline: auto;
  padding: 32px max(16px, env(safe-area-inset-left, 0px)) 96px;
}

.champ-v3-root .champ-v3-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .champ-v3-root .champ-v3-grid { grid-template-columns: minmax(0, 1fr); }
}

.champ-v3-root .champ-v3-primary { min-width: 0; }

.champ-v3-root .champ-v3-panel {
  background: var(--sf-surface);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
}

.champ-v3-root .champ-v3-eyebrow {
  margin: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sf-muted);
}

.champ-v3-root .champ-v3-num { font-variant-numeric: tabular-nums; }

.champ-v3-root :is(h1, h2, h3).champ-v3-title,
.champ-v3-root .champ-v3-hero h1 {
  font-family: var(--sf-font-head, inherit);
  font-weight: var(--sf-head-weight, 700);
  letter-spacing: var(--sf-head-track, normal);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.champ-v3-root .champ-v3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-btn-radius);
  background: var(--sf-surface);
  color: var(--sf-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.champ-v3-root .champ-v3-btn:hover { border-color: var(--sf-muted); }

.champ-v3-root .champ-v3-btn-primary {
  background: var(--sf-accent);
  border-color: var(--sf-accent);
  color: var(--sf-accent-ink);
}

.champ-v3-root .champ-v3-btn-primary:hover { filter: brightness(1.08); border-color: var(--sf-accent); }

.champ-v3-root .champ-v3-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Hero ──────────────────────────────────────────────────────────────── */

.champ-v3-root .champ-v3-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
  margin-bottom: 22px;
}

.champ-v3-root .champ-v3-hero-text { flex: 1 1 380px; min-width: 0; }

.champ-v3-root .champ-v3-hero h1 {
  margin: 0 0 4px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  text-wrap: balance;
}

.champ-v3-root .champ-v3-intro { margin: 0; color: var(--sf-muted); max-width: 60ch; }

.champ-v3-root .champ-v3-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* The v2 search form (the palette lives inside it), dressed as the design's
   ghost Search button with the shortcut hint. */
.champ-v3-root .champ-v3-hero .champ-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 220px;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  gap: 8px;
  background: var(--sf-surface);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-btn-radius);
  color: var(--sf-muted);
}

.champ-v3-root .champ-v3-hero .champ-search:hover { border-color: var(--sf-muted); }

.champ-v3-root .champ-v3-hero .champ-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--sf-ink);
  font: inherit;
  font-size: 15px;
  padding: 0;
  box-shadow: none;
  outline: none;
}

.champ-v3-root .champ-v3-hero .champ-search-icon { position: static; width: 17px; height: 17px; flex: none; color: var(--sf-muted); }

.champ-v3-root .champ-v3-hero .champ-search-shortcut {
  position: static;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid var(--sf-line);
  border-radius: 4px;
  color: var(--sf-muted);
  background: transparent;
}

/* ── Forum chips ───────────────────────────────────────────────────────── */

.champ-v3-root .champ-v3-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 20px;
  scrollbar-width: thin;
}

.champ-v3-root .champ-v3-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--sf-line);
  border-radius: 999px;
  background: var(--sf-surface);
  color: var(--sf-ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.champ-v3-root .champ-v3-chip:hover { border-color: var(--sf-muted); }

.champ-v3-root .champ-v3-chip[aria-current="page"] {
  background: var(--sf-ink);
  border-color: var(--sf-ink);
  color: var(--sf-bg);
}

.champ-v3-root .champ-v3-chip .champ-v3-num { opacity: 0.7; font-weight: 500; }

.champ-v3-root .champ-v3-sort {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: -8px 0 12px;
  font-size: 14px;
  color: var(--sf-muted);
}

/* ── Topic rows ────────────────────────────────────────────────────────── */

.champ-v3-root .champ-v3-tlist { list-style: none; margin: 0; padding: 0; }

.champ-v3-root .champ-v3-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px 18px;
  border-top: 1px solid var(--sf-line);
  align-items: start;
}

.champ-v3-root .champ-v3-row:first-child { border-top: 0; }

.champ-v3-root .champ-v3-row-dot {
  width: 8px;
  height: 8px;
  margin-top: 9px;
  border-radius: 50%;
  background: transparent;
}

.champ-v3-root .champ-v3-row:is(.champ-topic-is-new, .champ-topic-is-unread) .champ-v3-row-dot {
  background: var(--sf-unread);
}

.champ-v3-root .champ-v3-row-title {
  display: inline;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--sf-ink);
  text-decoration: none;
}

.champ-v3-root .champ-v3-row-title:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Once the reader's state is known, read rows step back (design). */
[data-unread-ready] .champ-v3-row:not(.champ-topic-is-new, .champ-topic-is-unread) .champ-v3-row-title {
  font-weight: 600;
  color: var(--sf-muted);
}

/* Theme rules such as Atelier's `img { display: block }` beat the browser's
   own [hidden] rule; Champ markup relies on hidden, so it wins here (step 5e). */
.champ-v3-root [hidden]:not([hidden="until-found"]) { display: none !important; }

.champ-v3-root .champ-v3-row-badge:not([hidden]) {
  display: inline-flex;
  margin-left: 6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  vertical-align: 2px;
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
  font-size: 12px;
  font-weight: 700;
}

.champ-v3-root .champ-v3-row-badge:empty { display: none; }

.champ-v3-root .champ-v3-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--sf-muted);
}

.champ-v3-root .champ-v3-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

.champ-v3-root .champ-v3-pill svg { width: 12px; height: 12px; }
.champ-v3-root .champ-v3-pill-quiet { background: transparent; border: 1px solid var(--sf-line); color: var(--sf-muted); }
.champ-v3-root .champ-v3-pill-store { background: var(--sf-accent); color: var(--sf-accent-ink); }

.champ-v3-root .champ-v3-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-size: 13px;
  color: var(--sf-muted);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .champ-v3-root .champ-v3-row { grid-template-columns: 10px minmax(0, 1fr); }
  .champ-v3-root .champ-v3-row-side { grid-column: 2; flex-direction: row; align-items: center; }
}

.champ-v3-root .champ-v3-empty { margin: 0; padding: 24px 18px; color: var(--sf-muted); }

/* ── Avatars ───────────────────────────────────────────────────────────── */

.champ-v3-root .champ-v3-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
  font-weight: 700;
  font-size: 14px;
  object-fit: cover;
}

.champ-v3-root .champ-v3-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.champ-v3-root .champ-v3-avatar-sm { width: 26px; height: 26px; font-size: 11px; }

/* ── Aside ─────────────────────────────────────────────────────────────── */

.champ-v3-root .champ-v3-aside { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.champ-v3-root .champ-v3-aside > .champ-v3-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
}

.champ-v3-root .champ-v3-me-who { display: flex; align-items: center; gap: 12px; }
.champ-v3-root .champ-v3-me-who b { display: block; }
.champ-v3-root .champ-v3-me-label { display: block; font-size: 13px; color: var(--sf-muted); }
.champ-v3-root .champ-v3-me-bell { margin-left: auto; }

.champ-v3-root .champ-v3-me-links,
.champ-v3-root .champ-v3-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.champ-v3-root .champ-v3-me-links a,
.champ-v3-root .champ-v3-links a { color: var(--sf-ink); text-underline-offset: 3px; }

.champ-v3-root .champ-v3-me-guest p { margin: 0; font-size: 14px; color: var(--sf-muted); }

.champ-v3-root .champ-v3-iconbtn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sf-ink);
  cursor: pointer;
}

.champ-v3-root .champ-v3-iconbtn:hover { background: var(--sf-soft); }

.champ-v3-root .champ-v3-flist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.champ-v3-root .champ-v3-flist a {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--sf-ink);
  text-decoration: none;
}

.champ-v3-root .champ-v3-flist a:hover b,
.champ-v3-root .champ-v3-flist a[aria-current="page"] b { text-decoration: underline; text-underline-offset: 3px; }
.champ-v3-root .champ-v3-flist b { display: block; font-size: 15px; }
.champ-v3-root .champ-v3-flist small { display: block; color: var(--sf-muted); font-size: 13px; line-height: 1.4; }

.champ-v3-root .champ-v3-ficon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--sf-radius) / 2 + 2px);
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
  font-weight: 700;
  font-size: 14px;
}

.champ-v3-root .champ-v3-forums .champ-v3-eyebrow + .champ-v3-flist { margin-top: -2px; }
.champ-v3-root .champ-v3-online .champ-users-online-list { margin: 0; font-size: 14px; color: var(--sf-muted); }
.champ-v3-root .champ-v3-online { --champ-here-ring: var(--sf-surface); }

/* ── Topic page (step 5b) ──────────────────────────────────────────────────
   The v2 topic markup is reused (it carries the moderator links, permission
   guards, the honeypot and the post editor) and dressed as the design's topic
   page: no card around the topic, posts divided by lines, actions as pills,
   the composer as a panel. These rules are outside any CSS layer on purpose:
   the v2 rules sit in layers, and the theme's unlayered element rules (button,
   h2, ul, a) would otherwise win against them. */

.champ-v3-root .champ-topic {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.champ-v3-root .champ-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--sf-muted);
}

.champ-v3-root .champ-breadcrumb a { color: var(--sf-muted); text-underline-offset: 3px; }
/* Every item after the first, link or plain text (Move/Merge pages end in plain text). */
.champ-v3-root .champ-breadcrumb > * + *::before { content: "›"; margin-right: 6px; text-decoration: none; display: inline-block; }

/* The vote sits in a small box left of the title (v2's column, in the store's
   colours). Without these rules the arrow took its full default size and sat
   alone above the title (seen on the demo store, 2026-11-10). A guest on a
   topic with no votes gets an empty box, so it is hidden. */
.champ-v3-root .champ-topic-header { display: flex; align-items: flex-start; gap: 14px; margin: 0 0 8px; padding: 0; border: 0; }
.champ-v3-root .champ-topic-header .champ-topic-heading { flex: 1; min-width: 0; }
.champ-v3-root .champ-topic-vote { flex: none; margin-top: 2px; }
.champ-v3-root .champ-topic-vote:not(:has(.champ-upvote-button, .champ-upvote-count)) { display: none; }
.champ-v3-root .champ-topic-upvote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  padding: 6px 4px;
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  background: var(--sf-surface);
}
.champ-v3-root .champ-upvote-button {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--sf-btn-radius);
  color: var(--sf-muted);
  text-decoration: none;
}
.champ-v3-root .champ-upvote-button svg { width: 18px; height: 18px; }
.champ-v3-root .champ-upvote-button:hover,
.champ-v3-root .champ-upvote-button-on { color: var(--sf-accent); }
.champ-v3-root .champ-upvote-count { font-size: 14px; font-weight: 700; line-height: 1; color: var(--sf-ink); font-variant-numeric: tabular-nums; }

.champ-v3-root .champ-topic-header .champ-page-title {
  margin: 0 0 10px;
  font-family: var(--sf-font-head, inherit);
  font-weight: var(--sf-head-weight, 700);
  letter-spacing: var(--sf-head-track, normal);
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.2;
  text-wrap: balance;
  color: var(--sf-ink);
}

.champ-v3-root .champ-topic-header .champ-topic-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 14px;
  color: var(--sf-muted);
}

.champ-v3-root .champ-topic-meta .champ-topic-forum {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.champ-v3-root .champ-topic-meta .champ-forum-dot { display: none; }

.champ-v3-root .champ-topic-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.champ-v3-root .champ-topic-tools .champ-icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-btn-radius);
  background: var(--sf-surface);
  color: var(--sf-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.champ-v3-root .champ-topic-tools .champ-icon-button[hidden] { display: none; }
.champ-v3-root .champ-topic-tools .champ-icon-button:hover { border-color: var(--sf-muted); }
.champ-v3-root .champ-topic-tools .champ-icon-button svg { width: 16px; height: 16px; }

.champ-v3-root .champ-subscribe-button[aria-pressed="true"] {
  background: var(--sf-soft);
  border-color: var(--sf-accent);
  color: var(--sf-soft-ink);
}

/* The thread */

.champ-v3-root .champ-thread {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  background: transparent;
}

.champ-v3-root .champ-thread > .champ-post {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-top: 1px solid var(--sf-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.champ-v3-root .champ-post .champ-post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
}

.champ-v3-root .champ-post-main { min-width: 0; }

.champ-v3-root .champ-post-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  font-size: 14px;
}

.champ-v3-root .champ-post-author,
.champ-v3-root .champ-post-author a {
  font-size: 15px;
  font-weight: 700;
  color: var(--sf-ink);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.champ-v3-root .champ-post-author a:hover { text-decoration-color: currentColor; }

.champ-v3-root .champ-post-head .champ-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
}

.champ-v3-root .champ-post-head .champ-badge-staff { background: var(--sf-accent); color: var(--sf-accent-ink); }
.champ-v3-root .champ-post-head .champ-badge[hidden] { display: none; }
.champ-v3-root .champ-post-time { margin-left: 0; color: var(--sf-muted); font-size: 14px; }

.champ-v3-root .champ-post-content {
  margin-top: 6px;
  max-width: 68ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--sf-ink);
}

.champ-v3-root .champ-post-content > :first-child { margin-top: 0; }
.champ-v3-root .champ-post-content p { margin: 0 0 10px; }
.champ-v3-root .champ-post-content p:last-child { margin-bottom: 0; }
.champ-v3-root .champ-post-content a { color: var(--sf-ink); text-decoration: underline; text-underline-offset: 3px; }

.champ-v3-root .champ-post-edited,
.champ-v3-root .champ-post-signature { color: var(--sf-muted); font-size: 13px; }

/* Actions as the design's pills */

.champ-v3-root .champ-post-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.champ-v3-root .champ-post-actions :is(.champ-icon-button, .champ-post-upvotes) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--sf-line);
  border-radius: 999px;
  background: var(--sf-surface);
  color: var(--sf-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.champ-v3-root .champ-post-actions .champ-post-upvotes { cursor: default; color: var(--sf-muted); }
.champ-v3-root .champ-post-actions .champ-post-upvotes[hidden] { display: none; }
.champ-v3-root .champ-post-actions :is(.champ-icon-button, .champ-post-upvotes) svg { width: 15px; height: 15px; }
.champ-v3-root .champ-post-actions .champ-icon-button:hover { border-color: var(--sf-muted); }

.champ-v3-root .champ-post-actions .champ-reaction[aria-pressed="true"] {
  border-color: var(--sf-accent);
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
}

/* "New since your last visit" (design), inserted by application.js */

.champ-v3-root .champ-v3-newline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  color: var(--sf-accent-text);
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.champ-v3-root .champ-v3-newline::before,
.champ-v3-root .champ-v3-newline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.champ-v3-root .champ-v3-newline + .champ-post { border-top: 0; }

/* Notices, moderator tools, the composer */

.champ-v3-root .champ-thread-notice {
  padding: 12px 16px;
  margin: 0 0 8px;
  border-radius: var(--sf-radius);
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
  font-size: 15px;
  list-style: none;
}

.champ-v3-root .champ-moderator-controls,
.champ-v3-root .champ-moderator-actions { font-size: 13px; color: var(--sf-muted); }

.champ-v3-root .champ-composer {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  background: var(--sf-surface);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  box-shadow: none;
  list-style: none;
}

.champ-v3-root .champ-composer .champ-composer-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.champ-v3-root .champ-composer-heading {
  margin: 0 0 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: normal;
  color: var(--sf-ink);
}

.champ-v3-root :is(.champ-textarea, .champ-input, .champ-select) {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--sf-line);
  border-radius: calc(var(--sf-radius) / 2 + 2px);
  background: var(--sf-bg);
  color: var(--sf-ink);
  font: inherit;
  font-size: 16px;
  resize: vertical;
  box-shadow: none;
}

.champ-v3-root :is(.champ-textarea, .champ-input, .champ-select):focus-visible {
  outline: 2px solid var(--sf-accent);
  outline-offset: 1px;
}

.champ-v3-root .champ-composer-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.champ-v3-root .champ-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--sf-accent);
  border-radius: var(--sf-btn-radius);
  background: var(--sf-accent);
  color: var(--sf-accent-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.champ-v3-root .champ-composer-prompt { margin-top: 18px; font-size: 15px; }
.champ-v3-root .champ-composer-prompt a { color: var(--sf-ink); font-weight: 700; }

/* ── Every other page (step 5c) ────────────────────────────────────────────
   New topic, search, tags, unread, points, profile and preferences keep their
   v2 templates; the token mapping above gives them the theme look. These
   unlayered rules make the shared parts safe against theme element rules. */

.champ-v3-root .champ-page-title {
  font-family: var(--sf-font-head, inherit);
  font-weight: var(--sf-head-weight, 700);
  letter-spacing: var(--sf-head-track, normal);
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.2;
  color: var(--sf-ink);
  text-wrap: balance;
}

.champ-v3-root .champ-textarea { min-height: 96px; }
.champ-v3-root :is(.champ-input, .champ-select) { min-height: 44px; padding-block: 0; }
/* One chevron for every storefront select (Simon, 2026-11-11: the native
   arrow sat against the right edge). Drawn in the text colour with two
   gradients, so it follows light and dark themes; 40px of room on the right. */
.champ-v3-root .champ-select {
  width: auto;
  -webkit-appearance: none;
  appearance: none;
  padding-left: 14px;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent calc(50% - 0.8px), currentColor calc(50% - 0.8px), currentColor calc(50% + 0.8px), transparent calc(50% + 0.8px)),
    linear-gradient(-45deg, transparent calc(50% - 0.8px), currentColor calc(50% - 0.8px), currentColor calc(50% + 0.8px), transparent calc(50% + 0.8px));
  background-position: calc(100% - 21px) calc(50% + 1px), calc(100% - 15px) calc(50% + 1px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.champ-v3-root .champ-v3-sort .champ-select { min-height: 36px; font-size: 14px; }

.champ-v3-root .champ-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--sf-ink);
}

.champ-v3-root .champ-button-quiet {
  background: var(--sf-surface);
  border-color: var(--sf-line);
  color: var(--sf-ink);
}

.champ-v3-root .champ-button-small { min-height: 34px; padding: 0 12px; font-size: 13px; }

.champ-v3-root .champ-button-danger {
  background: var(--sf-surface);
  border-color: color-mix(in srgb, #c62828 60%, var(--sf-line));
  color: #c62828;
}

/* Lists of conversations or results outside the Community page: one panel,
   rows divided by lines, as in the design. */
.champ-v3-root .champ-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--sf-surface);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
}

.champ-v3-root .champ-result {
  display: block;
  padding: 16px 0;
  border-top: 1px solid var(--sf-line);
  color: var(--sf-ink);
  text-decoration: none;
}

.champ-v3-root .champ-result:first-of-type { border-top: 0; }
.champ-v3-root .champ-result-title { margin: 0; font-size: 17px; font-weight: 700; font-family: inherit; color: var(--sf-ink); }
.champ-v3-root .champ-result:hover .champ-result-title { text-decoration: underline; text-underline-offset: 3px; }
.champ-v3-root .champ-result-time { margin: 2px 0 6px; font-size: 13px; color: var(--sf-muted); }
.champ-v3-root .champ-result mark { background: var(--sf-soft); color: var(--sf-soft-ink); padding: 0 2px; border-radius: 3px; }

/* A held post (approval forum or a held newcomer): the notice after posting,
   and the note under the composer. Full width inside the composer grid. */
.champ-v3-root .champ-composer > .champ-post-held-notice { grid-column: 1 / -1; }
.champ-v3-root .champ-post-held-notice {
  margin: 0 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  background: var(--sf-soft);
  color: var(--sf-soft-ink);
  font-size: 14px;
  font-weight: 700;
}
.champ-v3-root .champ-composer-note { margin: 8px 0 0; font-size: 13px; color: var(--sf-muted); }

/* The chat launcher and the Community drawer launcher both sat at the bottom
   corner, and the chat was hidden under the drawer button (demo store QA,
   2026-11-10). Where both are on the same side, the chat moves up. */
body:has(.champ-v3-root):has(.champ-drawer__launcher--bottom-right) .champ-chat:not([data-champ-chat-position="left"]),
body:has(.champ-v3-root):has(.champ-drawer__launcher--bottom-left) .champ-chat[data-champ-chat-position="left"] {
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

/* The chat launcher showed its bubble AND its × at once (demo store QA,
   2026-11-10): the v2 rules that swap them live in @layer champ.components,
   and the theme's unlayered `svg { display: block }` (Horizon base.css) beats
   any layered rule. Unlayered here, so they win again. */
.champ-v3-root .champ-chat-launcher .champ-chat-launcher-close { display: none; }
.champ-v3-root .champ-chat[data-champ-chat-open] .champ-chat-launcher .champ-chat-launcher-open { display: none; }
.champ-v3-root .champ-chat[data-champ-chat-open] .champ-chat-launcher .champ-chat-launcher-close { display: block; }

/* One product's questions (forums#show ?product=). */
.champ-v3-root .champ-v3-filter-note { margin: 0 0 10px; font-size: 14px; color: var(--sf-muted); }
.champ-v3-root .champ-v3-filter-note a { color: var(--sf-ink); text-underline-offset: 3px; }

/* The chat used Champ's own colour (the v2 `primary_color` setting, set inline
   by chat_launcher_style) while everything else on the new Champ takes the
   theme's colours (demo store QA, 2026-11-10). !important on the custom
   properties beats the inline values; the rest of the chat CSS reads them. */
.champ-v3-root .champ-chat {
  --champ-chat-accent: var(--sf-accent) !important;
  --champ-chat-on-accent: var(--sf-accent-ink, #ffffff) !important;
}
