/* Public proof gallery composition styles.
 * Owner: design/compositions/public_proof_gallery.jinja and public proof detail.
 * This carrier owns proof-gallery-* and proof-detail-* only; do not add route shell or reader mechanics here.
 */

/* Margin shim for Eyebrow primitive in hero contexts.
 * The Eyebrow primitive itself carries no margin (it's atomic).
 * Compositions place spacing. */
.proof-gallery-hero [data-primitive="eyebrow"]       { margin-bottom: var(--space-5); }
.proof-gallery-promise [data-primitive="eyebrow"]    { margin-bottom: var(--space-6); }

/* ============================================================
 * /examples gallery — direct artifact tile grid + modal reader.
 * One card click opens the chrome-free artifact body in place. The
 * ReaderShell route remains the fallback href.
 * ============================================================ */

.proof-gallery-frame {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.proof-gallery-artifacts {
  margin: var(--space-7) 0 var(--space-8);
}

.proof-gallery-artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
  align-items: stretch;
}

.proof-gallery-artifact-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 20px 20px 56px;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radii-lg);
  cursor: pointer;
  font: inherit;
  color: inherit;
  /* Buttons inherit some upstream text-transform / letter-spacing
   * from the global button styling. The tile content is reader-grade
   * prose; reset on the container, then re-apply uppercase + tracking
   * only on the eyebrow + foot. */
  text-transform: none;
  letter-spacing: normal;
  transition: transform var(--motion-duration-fast) var(--motion-ease-standard),
              border-color var(--motion-duration-fast) var(--motion-ease-standard),
              box-shadow var(--motion-duration-fast) var(--motion-ease-standard);
  min-height: 232px;
  height: 100%;
}
.proof-gallery-artifact-grid [data-primitive="action_trigger"].proof-gallery-artifact-tile {
  background: var(--color-surface);
  border-color: var(--color-rule);
  color: inherit;
}
.proof-gallery-artifact-tile:hover {
  transform: translateY(-2px);
  border-color: var(--color-orange);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}
.proof-gallery-artifact-grid [data-primitive="action_trigger"][data-variant="ghost"].proof-gallery-artifact-tile:hover:not(:disabled) {
  background: var(--color-surface);
  border-color: var(--color-orange);
  color: inherit;
}
.proof-gallery-artifact-tile:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 2px;
}

.proof-gallery-artifact-icon {
  font-size: 30px;
  line-height: 1;
}
.proof-gallery-artifact-body { flex: 1; }
.proof-gallery-artifact-format {
  font-family: var(--type-eyebrow-family);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-orange);
  margin-bottom: 6px;
}
.proof-gallery-artifact-title {
  font-family: var(--type-title-family);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text);
  margin-bottom: 8px;
}
.proof-gallery-artifact-summary {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.proof-gallery-artifact-foot {
  position: absolute;
  left: 20px;
  bottom: 16px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--type-button-family);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.proof-gallery-artifact-tile:hover .proof-gallery-artifact-foot {
  color: var(--color-orange);
}
.proof-gallery-artifact-arrow {
  transition: transform var(--motion-duration-fast) var(--motion-ease-standard);
}
.proof-gallery-artifact-tile:hover .proof-gallery-artifact-arrow {
  transform: translateX(2px);
}
.proof-gallery-artifact-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 10px;
  background: var(--color-orange);
  color: var(--color-text-inverse);
  font-family: var(--type-eyebrow-family);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  border-radius: var(--radii-pill);
}

.proof-gallery-others {
  margin-top: var(--space-9);
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radii-lg);
}
.proof-gallery-others-head p {
  margin: 6px 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: 13px;
}
.proof-gallery-others-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.proof-gallery-other-link {
  display: block;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radii-md);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color var(--motion-duration-fast) var(--motion-ease-standard);
}
.proof-gallery-other-link:hover {
  border-color: var(--color-orange);
}
.proof-gallery-other-title {
  display: block;
  font-family: var(--type-title-family);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.proof-gallery-other-meta {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.proof-gallery-other-cta {
  display: block;
  font-family: var(--type-button-family);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-orange);
}

.proof-gallery-hero-meta {
  margin-top: var(--space-3);
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Three-line trust manifesto sitting between the hero lead and the
 * featured-example meta. Each line is its own list item with a small
 * orange dot — visual rhythm matches the constitutional discipline,
 * doesn't shout. */
.proof-gallery-hero-principles {
  list-style: none;
  margin: var(--space-5) 0 var(--space-3);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.proof-gallery-hero-principles li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--type-body-family);
  font-size: 13.5px;
  color: var(--color-text-muted);
}
.proof-gallery-hero-principle-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--color-orange);
  border-radius: 50%;
  transform: translateY(-2px);
  flex-shrink: 0;
}

/* Secondary example tasks keep a compact section below the primary grid. */
.proof-gallery-section { margin-top: var(--space-9); }
.proof-gallery-section-head {
  margin-bottom: var(--space-5);
  max-width: 760px;
}
.proof-gallery-section-tagline {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.proof-gallery-workdue {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
  margin-top: var(--space-5);
  padding: 12px 14px;
  border: 1px solid var(--color-rule);
  border-radius: var(--radii-md);
  background: rgba(255, 255, 255, 0.48);
  color: var(--color-text-muted);
  font-family: var(--type-body-family);
  font-size: 12.5px;
  line-height: 1.45;
}
.proof-gallery-workdue-label {
  font-family: var(--type-eyebrow-family);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-orange);
}
.proof-gallery-workdue-items {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.proof-gallery-workdue-item {
  color: var(--color-text);
}
.proof-gallery-workdue-item + .proof-gallery-workdue-item::before {
  content: "· ";
  color: var(--color-text-muted);
}

.proof-gallery-reader-modal .modal__head {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-rule);
}
.proof-gallery-reader-modal .modal__body {
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.proof-gallery-reader-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--color-surface);
}

/* Reduced-motion: respect user preference across gallery motion. */
@media (prefers-reduced-motion: reduce) {
  .proof-gallery-artifact-tile,
  .proof-gallery-artifact-arrow {
    animation: none !important;
    transition: none !important;
  }
  .proof-gallery-artifact-tile:hover {
    transform: none;
  }
}

/* Mobile: gallery to single column. */
@media (max-width: 720px) {
  .proof-gallery-frame {
    padding: 0 var(--space-4);
  }
  .proof-gallery-artifact-grid {
    grid-template-columns: 1fr;
  }
  .proof-gallery-artifact-tile {
    min-height: 212px;
  }
}

/* ============================================================
   Single-example overview
   ============================================================ */

.proof-detail-breadcrumb {
  max-width: 1180px; margin: 18px auto 0; padding: 0 24px;
  font-size: 12px;
}
.proof-detail-breadcrumb a,
.proof-detail-breadcrumb [data-primitive="action_trigger"] {
  color: var(--slate); text-decoration: none;
  font: 600 11px Calibri, sans-serif;
  letter-spacing: 1px;
  padding: 0;
  text-transform: uppercase;
}
.proof-detail-breadcrumb a:hover,
.proof-detail-breadcrumb [data-primitive="action_trigger"]:hover { color: var(--orange); }

.proof-detail-overview-hero {
  max-width: 1180px;
  margin: 22px auto 0;
  padding: 0 24px;
}
.proof-detail-overview-hero-inner {
  background: linear-gradient(135deg, var(--navy-deep), #1a3158 80%);
  color: white;
  padding: 40px 48px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.proof-detail-overview-hero-inner::before {
  content: '';
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 5px; background: var(--accent);
}
.proof-detail-overview-eyebrow {
  font: 600 10.5px Calibri, sans-serif;
  letter-spacing: 2.4px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.proof-detail-overview-title {
  font: 700 34px/1.15 Georgia, serif;
  color: white; margin: 0 0 8px;
  letter-spacing: -0.5px;
}
.proof-detail-overview-subtitle {
  font-size: 13.5px; color: #B5C2D2; margin-bottom: 20px;
}
.proof-detail-overview-blurb {
  font: 400 15.5px/1.6 Georgia, serif;
  color: #DCE3EE; margin: 0 0 28px; max-width: 680px;
}
.proof-detail-overview-stats {
  display: flex; gap: 32px; flex-wrap: wrap;
}
.proof-detail-overview-stat {
  border-left: 2px solid var(--accent);
  padding-left: 14px;
}
.proof-detail-overview-stat-num {
  font: 700 28px Georgia, serif;
  color: white; line-height: 1;
}
.proof-detail-overview-stat-label {
  font: 600 10px Calibri, sans-serif;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: #B5C2D2; margin-top: 6px;
}

.proof-detail-section-title {
  max-width: 1180px; margin: 48px auto 6px; padding: 0 24px;
  font: 600 11px Calibri, sans-serif;
  letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--orange);
}
.proof-detail-section-sub {
  max-width: 1180px; margin: 0 auto 22px; padding: 0 24px;
  font-size: 13.5px; line-height: 1.55; color: var(--slate);
  max-width: 740px;
}

.proof-detail-artifacts { padding-bottom: 32px; }
.proof-detail-source {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 64px;
}
.proof-detail-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 22px 28px;
}
.proof-detail-source-label {
  font: 600 9.5px Calibri, sans-serif;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--slate-light); margin-bottom: 4px;
}
.proof-detail-source-grid > div > div:not(.proof-detail-source-label) {
  font-size: 13.5px; color: var(--navy-deep);
}
.proof-detail-source-grid [class~="mono"] {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
}

/* Public proof gallery and example detail surfaces: relocated from app.css as measured CSS debt reduction. */
.proof-gallery-hero-inner { max-width: 880px; margin: 0; }
/* .proof-gallery-hero-eyebrow — REMOVED 2026-05-20. Migrated to canonical
 * Eyebrow primitive (design/primitives/eyebrow.jinja). */
.proof-gallery-hero-title {
  font: 700 44px/1.1 Georgia, "Times New Roman", serif;
  margin: 0 0 18px; letter-spacing: -0.8px;
}
.proof-gallery-hero-lead {
  font: 400 16px/1.65 Georgia, serif;
  color: var(--color-text-muted); max-width: 720px; margin: 0;
}

.proof-gallery-grid {
  max-width: 1180px;
  margin: 48px auto 32px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 24px;
}
.proof-gallery-promise {
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding: 48px 24px 64px;
  margin-top: 32px;
}
.proof-gallery-promise-inner { max-width: 1180px; margin: 0 auto; }
/* .proof-gallery-promise-eyebrow — REMOVED 2026-05-20. Migrated to canonical
 * Eyebrow primitive. The margin-bottom is supplied by the parent layout. */
.proof-gallery-promise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
}
.proof-gallery-promise-cell {
  background: white;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 18px 20px;
}
.proof-gallery-promise-cell-title {
  font: 600 14px Georgia, serif;
  color: var(--navy-deep); margin-bottom: 8px;
}
.proof-gallery-promise-cell p {
  font-size: 13px; line-height: 1.55;
  color: var(--slate); margin: 0;
}
.proof-gallery-promise-cell kbd {
  display: inline-block;
  font: 600 10px "SF Mono", Menlo, monospace;
  background: var(--paper); border: 1px solid var(--rule);
  padding: 1px 5px; border-radius: 3px; color: var(--navy-deep);
}

/* Restored ArtifactManifest reader popover. */
.reader-popover .modal__head {
  flex-shrink: 0;
  padding: 14px 22px;
}

.reader-popover .modal__body {
  /* The reader's body is a vertical stack (meta row → iframe stage →
   * keyboard-hint footer), not prose. Override the primitive's
   * default scrolling body so each child can size deliberately. */
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

/* The peek panel needs to be a flex column so head + body stack
 * properly. The primitive sets the dimensions, this completes the
 * layout contract. */
.reader-popover .modal__panel {
  display: flex;
  flex-direction: column;
}

/* The canonical Modal primitive owns the title + close. Below the
 * modal__head we lay a meta row that gives the artifact a sense of
 * place: format eyebrow · issuer · form · counter / per-kind actions.
 * This is the popover's identity strip — the thing that says "you are
 * reading Apple's 10-K, the Partner Brief artifact, 3 of 8." */
.reader-popover-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 12px 22px;
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-paper);
  flex-shrink: 0;
}
.reader-popover-identity {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}
.reader-popover-eyebrow {
  font-family: var(--type-eyebrow-family);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-orange);
  white-space: nowrap;
}
.reader-popover-sep {
  color: var(--color-rule);
  font-size: 11px;
  line-height: 1;
  position: relative;
  top: -1px;
}
.reader-popover-breadcrumb {
  font-family: var(--type-body-family);
  font-size: 12.5px;
  color: var(--color-text);
  font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.reader-popover-crumb-sep {
  color: var(--color-text-muted);
  margin: 0 6px;
  font-weight: 400;
}
.reader-popover-meta-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* Step-29 P0b: state-driven display.  The previous rule set
 * `display: inline-flex` unconditionally, which beat the
 * user-agent's `[hidden] { display: none }` for any action JS set
 * `hidden=true` on (Present hidden for non-decks, Export hidden
 * for public examples).  Buttons remained visible/focusable while
 * the model said they were absent.  Fix: default display is none
 * and we only paint the action when it is NOT hidden.  Hidden
 * means absent at all costs (no bounding box, no focus). */
.reader-popover-action {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-family: var(--type-button-family);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-rule);
  border-radius: var(--radii-md);
  text-decoration: none;
  transition: color var(--motion-duration-fast) var(--motion-ease-standard),
              border-color var(--motion-duration-fast) var(--motion-ease-standard),
              background var(--motion-duration-fast) var(--motion-ease-standard);
}
.reader-popover-action:not([hidden]) {
  display: inline-flex;
}
.reader-popover-action:hover {
  color: var(--color-orange);
  border-color: var(--color-orange);
}
.reader-popover-action-present {
  color: var(--color-text-inverse);
  background: var(--color-orange);
  border-color: var(--color-orange);
}
.reader-popover-action-present:hover {
  background: #B53F00;
  border-color: #B53F00;
  color: var(--color-text-inverse);
}
.reader-popover-stage {
  flex: 1;
  overflow: hidden;
  background: var(--color-paper);
  position: relative;
}
.reader-popover-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--color-surface);
  transition: opacity 220ms cubic-bezier(0.2, 0.65, 0.25, 1);
}

/* Artifact reader chrome — mutable surface state that sits ABOVE
 * the immutable article body.
 *
 * Genus split (per the projection-boundary correction):
 *   - .artifact-reader-meta-chrome  → mutable chrome (version
 *                                     history, share/present/export,
 *                                     checklist state). RE-renders
 *                                     each request; never cacheable
 *                                     long-term.
 *   - <article class="manifest-reader"> → immutable artifact body,
 *                                          rendered via the shared
 *                                          _manifest_article.html
 *                                          partial. Same shape as
 *                                          the inline modal preview.
 *
 * The wrapper is a calm container — no background, no border, just
 * vertical rhythm. The chrome inside owns its own styling (action
 * buttons, version-history details, etc).
 */
.artifact-reader-meta-chrome {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.artifact-reader-meta-chrome > details + details,
.artifact-reader-meta-chrome > details + .manifest-reader-actions,
.artifact-reader-meta-chrome > .manifest-reader-actions + details {
  margin-top: 0;
}

/* Inline preview content slot — replaces the iframe.
 *
 * Same document as the gallery, no nested browsing context. The
 * fragment fetched from /preview/ is innerHTMLed in here. The slot
 * scrolls (overflow-y: auto) so the popover's scroll-progress bar
 * tracks THIS region's scroll, not an iframe's contentWindow.
 *
 * Padding mirrors what preview_base.html's <main> used to add
 * around the article body inside the iframe, so the inline
 * experience preserves the reading column it had before. */
.reader-popover-content {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--color-surface);
  color: var(--color-text);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px clamp(20px, 6vw, 64px) 32px;
  /* Match the iframe's crossfade so cycling between artifacts still
     feels like a swap. */
  transition: opacity 220ms cubic-bezier(0.2, 0.65, 0.25, 1);
}

/* Presentation mode — same content slot, different projection.
 * When the modal's "Present" button is clicked, the content slot
 * fetches the slide fragment, sets data-reader-mode="presentation",
 * and the modal panel goes fullscreen via requestFullscreen(). The
 * rules below kick in for that one element / state combination:
 *   - dark canvas (slide stage)
 *   - paginated slides (only .is-active is visible)
 *   - no padding (slides own their own padding)
 *   - hide non-slide chrome (popover meta + hints) in fullscreen
 *
 * The slide rendering markup (`.pres-slide`, `.pres-slide-inner`,
 * etc.) is shared with the legacy /present/ full-page route via the
 * `_manifest_slides.html` partial — one slide shape, two surfaces. */
.reader-popover-content[data-reader-mode="presentation"] {
  background: var(--lp-cta);              /* dark navy slide canvas */
  color: var(--lp-cta-fg);
  padding: 0;
  overflow: hidden;
}
.reader-popover-content[data-reader-mode="presentation"] .presentation-slide,
.reader-popover-content[data-reader-mode="presentation"] .pres-slide {
  display: none;
}
.reader-popover-content[data-reader-mode="presentation"] .presentation-slide.is-active,
.reader-popover-content[data-reader-mode="presentation"] .pres-slide.is-active {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: clamp(24px, 4vw, 64px);
}
/* Fullscreen state on the modal panel — hide the popover's regular
 * meta row + keyboard-hints footer so only the slide stage is
 * visible during presentation. */
[data-primitive="modal"]:fullscreen .reader-popover-meta,
[data-primitive="modal"]:fullscreen .reader-popover-hints {
  display: none;
}
[data-primitive="modal"]:fullscreen .modal__panel,
[data-primitive="modal"]:-webkit-full-screen .modal__panel {
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}
[data-primitive="modal"]:fullscreen .reader-popover-stage {
  height: 100%;
}
.reader-popover-content:focus { outline: none; }

/* --- Scroll progress bar (above the iframe) ----------------------------- *
 * A 2-pixel orange line that fills as the iframe document scrolls. Lives
 * above the iframe stage so it doesn't compete with content. Width is
 * driven by the JS scroll handler reading frame.contentWindow.scrollY. */
.reader-popover-progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(10, 31, 61, 0.06);
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}
.reader-popover-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-orange);
  transition: width 80ms linear;
  will-change: width;
}

/* --- Edge fades (top + bottom of stage) --------------------------------- *
 * Gradient overlays that signal "more content scrolls beyond this edge".
 * Default state is invisible; the .reader-popover-fade-visible class is
 * toggled by the scroll handler when the iframe document is scrollable
 * past the visible region. */
.reader-popover-fade {
  position: absolute;
  left: 0; right: 0;
  height: 32px;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 180ms ease;
}
.reader-popover-fade-top {
  top: 2px;  /* sit below the progress bar */
  background: linear-gradient(180deg,
              rgba(255, 255, 255, 0.94) 0%,
              rgba(255, 255, 255, 0) 100%);
}
.reader-popover-fade-bottom {
  bottom: 0;
  background: linear-gradient(0deg,
              rgba(255, 255, 255, 0.94) 0%,
              rgba(255, 255, 255, 0) 100%);
}
.reader-popover-fade-visible { opacity: 1; }

/* Loading skeleton — visible while the iframe fetches; fades on the
 * load event via the .reader-popover-loading-done state class. The
 * top progress bar runs while the bars beneath shimmer; together
 * they replace the blank-frame flash that made cycling feel slow. */
.reader-popover-loading {
  position: absolute;
  inset: 0;
  background: var(--color-surface);
  z-index: 2;
  pointer-events: none;
  opacity: 1;
  transition: opacity 240ms ease;
}
.reader-popover-loading[hidden] { display: none; }
.reader-popover-loading-done { opacity: 0; }
.reader-popover-loading-bar {
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 40%;
  background: var(--color-orange);
  border-radius: 0 2px 2px 0;
  animation: rp-loading-bar 1.6s ease-in-out infinite;
}
.reader-popover-loading-skel {
  padding: 64px max(48px, 8%) 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 760px;
  margin: 0 auto;
}
.reader-popover-loading-line {
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.10) 50%,
    rgba(0, 0, 0, 0.04) 100%);
  background-size: 200% 100%;
  animation: rp-shimmer 1.4s linear infinite;
}
.reader-popover-loading-line-h {
  height: 28px;
  width: 60%;
  margin-bottom: 12px;
}
.reader-popover-loading-line-t { height: 12px; }
.reader-popover-loading-line-t-short { width: 70%; }

@keyframes rp-loading-bar {
  0%   { transform: translateX(-100%); width: 30%; }
  50%  { transform: translateX(150%); width: 50%; }
  100% { transform: translateX(300%); width: 30%; }
}
@keyframes rp-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Keyboard hint footer — Linear-style discoverability strip. */
.reader-popover-hints {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 8px 20px;
  border-top: 1px solid var(--color-rule);
  background: var(--color-surface);
  font-family: var(--type-body-family);
  font-size: 11.5px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.reader-popover-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.reader-popover-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-family: var(--type-mono-family);
  font-size: 10.5px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-bottom-width: 2px;
  border-radius: 3px;
}
/* Reduced-motion: respect user preference across the gallery + popover. */
@media (prefers-reduced-motion: reduce) {
  .reader-popover-loading,
  .reader-popover-loading-bar,
  .reader-popover-loading-line,
  .examples-artifact-tile,
  .examples-artifact-arrow {
    animation: none !important;
    transition: none !important;
  }
  .examples-artifact-tile:hover {
    transform: none;
  }
}

/* Mobile: gallery to single column; popover meta row stacks. The
 * popover panel itself is already sized down to a sheet at ≤720px by
 * the Modal primitive's peek variant, so no panel rules live here. */
@media (max-width: 720px) {
  .examples-artifact-grid {
    grid-template-columns: 1fr;
  }
  .reader-popover-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 14px 14px;
  }
  .reader-popover-meta-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

/* Mobile responsiveness for the stack: head stacks vertically, actions
 * wrap below the title, iframe takes less vertical room (still
 * scrollable internally). */
@media (max-width: 720px) {
  .artifact-stack-head {
    grid-template-columns: 36px 1fr;
