/*
 * Swizzel reader -- the swizzel page and learning-path focus mode's reading
 * area. Ported from the designer's prototype (styles.css, "Swizzel reader (full
 * detail page)", https://swizzel-profile-prototype.vercel.app/#/swizzel/...).
 *
 * Class names are kept byte-identical to the prototype's where a prototype piece
 * exists, as in home_hero.css (see the note at the top of that file for why this
 * is plain, unlayered CSS rather than Tailwind utilities). Rules here win over
 * utilities on the same element regardless of specificity -- so never set
 * `display` on an element JS shows and hides with Tailwind's `hidden` class (the
 * progress pill, the chat quote chip): use :not(.hidden), or the [hidden]
 * attribute for new toggles.
 *
 * Where this departs from the prototype, deliberately:
 *   - The reader is a STAGE with its own scroll container, and its rails and
 *     panel are positioned against the stage, not the viewport. The prototype
 *     scrolls the window with fixed rails, which cannot work in focus mode, where
 *     the reader sits between the path tree and the window edge.
 *   - Breakpoints are container queries on the stage's width, at 880px (panel
 *     becomes a bottom sheet) and 600px (rails become bottom bars) rather than the
 *     prototype's 960/720 of the viewport: geometry for a 640px article beside a
 *     360px panel, so focus mode keeps the side panel on a laptop.
 *   - The open panel rests at transform/filter: none. The prototype's
 *     translateX(0) + blur(0) + will-change would make the panel the containing
 *     block for the note editor's position:fixed overlay, which renders inside it.
 *   - The rail dots keep the app's reading-progress rings.
 */

/* ---------------------------------------------------------------- tokens ---
 * Scoped like home_hero.css's, on both the page root and the stage (focus mode
 * has only the stage). */
.swizzel-reader {
  --text-primary: #1c1917;
  --text-secondary: #57534d;
  --text-tertiary: #79716b;
  --text-quaternary: #a6a09b;
  --surface-subtle: #f3f3f2;
  --border: #f3f3f2;
  --border-secondary: #e7e5e4;
  --brand: #0093ff;
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);

  --panel-open-dur: 400ms;
  --panel-close-dur: 350ms;
  --panel-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --panel-blur: 2px;
  --page-fade-dur: 250ms;
  --page-slide-dur: 250ms;
  --page-slide-distance: 8px;
  --page-blur: 3px;
  --page-ease: cubic-bezier(0.22, 1, 0.36, 1);

  --reader-gutter: 60px;
  --reader-panel-width: 360px;
  --reader-sheet-height: min(52dvh, 440px);
  /* % here resolves against the stage, where it is used (bottom insets). */
  --reader-sheet-offset: min(var(--reader-sheet-height), calc(100% - 24px));

  color: var(--text-primary);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
}

/* ----------------------------------------------------------------- shell --- */
.swizzel-reader-page {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: clip;
  background: #fff;
}

/* Not sticky and no backdrop-filter, unlike the prototype's: the stage scrolls
 * beneath it rather than under it, and a backdrop-filter would trap the More
 * menu's fixed children. Positioned with a z-index so its tooltips and menu paint
 * over the stage's rails. */
.swizzel-reader-topbar {
  position: relative;
  z-index: 4;
  display: flex;
  flex: 0 0 60px;
  height: 60px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.swizzel-reader-topbar-spacer {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
}

.swizzel-reader-topbar-actions {
  display: flex;
  gap: 2px;
  align-items: center;
}

.swizzel-reader-back {
  width: 36px;
  height: 36px;
  padding: 8px;
}

.swizzel-reader-logo {
  display: inline-flex;
  height: 36px;
  gap: 8px;
  align-items: center;
  padding: 0 8px;
  color: var(--text-primary);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.15px;
  text-decoration: none;
}
.swizzel-reader-logo:hover { background: var(--surface-subtle); }
.swizzel-reader-logo:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }

/* Icon buttons inside the reader. Scoped: `.icon-button` is a generic name. */
.swizzel-reader .icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 10px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.swizzel-reader .icon-button:hover {
  color: var(--text-primary);
  background: var(--surface-subtle);
}
.swizzel-reader .icon-button:focus-visible {
  background: var(--surface-subtle);
  outline: 2px solid var(--brand);
  outline-offset: 0;
}
.swizzel-reader .icon-button svg {
  display: block;
  width: 20px;
  height: 20px;
}

/* Top-bar buttons: also used by focus mode's top bar (Save), which sits outside
 * .swizzel-reader -- hence the var() fallbacks. */
.topbar-action {
  display: inline-flex;
  min-width: 36px;
  height: 36px;
  gap: 2px;
  align-items: center;
  justify-content: center;
  padding: 8px;
  color: var(--text-secondary, #57534d);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: -0.14px;
  text-decoration: none;
  transition:
    color 320ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.topbar-action:hover {
  color: var(--text-primary, #1c1917);
  background: var(--surface-subtle, #f3f3f2);
}
.topbar-action:focus-visible {
  background: var(--surface-subtle, #f3f3f2);
  outline: 2px solid var(--brand, #0093ff);
  outline-offset: 0;
}
.topbar-action-icon {
  width: 36px;
  padding: 8px;
}
.topbar-action svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

/* Save for later: the bookmark fills when saved. */
.t-like[data-liked="true"] {
  color: var(--text-primary, #1c1917);
}
.t-like svg path {
  fill: transparent;
  transition: fill 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.t-like[data-liked="true"] svg path {
  fill: currentColor;
}
.swizzel-reader-pin-form {
  display: inline-flex;
  margin: 0;
}

/* -------------------------------------------------------------- tooltips ---
 * The prototype's .t-tt, always in its dark "inverse" style here. Shown on hover,
 * and on keyboard focus -- :has(:focus-visible), not :focus-within, which would
 * pop the tooltip after every click. Off on touch screens. */
.t-tt-wrap {
  position: relative;
  display: inline-block;
  overflow: visible;
}

.t-tt {
  --tt-shift: 4px;
  --tt-scale: 0.98;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 20;
  padding: 4px 8px;
  color: #fff;
  background: #1c1917;
  border-radius: 8px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: -0.14px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, var(--tt-shift)) scale(var(--tt-scale));
  transform-origin: 50% 100%;
  transition: opacity 50ms ease-out, transform 50ms ease-out;
}

.t-tt-below {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translate(-50%, calc(var(--tt-shift) * -1)) scale(var(--tt-scale));
  transform-origin: 50% 0;
}

.t-tt-below.t-tt-align-end {
  right: 0;
  left: auto;
  transform: translate(0, calc(var(--tt-shift) * -1)) scale(var(--tt-scale));
  transform-origin: 100% 0;
}

.t-tt-end {
  top: 50%;
  bottom: auto;
  left: calc(100% + 8px);
  transform: translate(calc(var(--tt-shift) * -1), -50%) scale(var(--tt-scale));
  transform-origin: 0 50%;
}

.t-tt-start {
  top: 50%;
  right: calc(100% + 8px);
  bottom: auto;
  left: auto;
  transform: translate(var(--tt-shift), -50%) scale(var(--tt-scale));
  transform-origin: 100% 50%;
}

.t-tt-wrap:hover > .t-tt,
.t-tt-wrap:has(:focus-visible) > .t-tt {
  --tt-shift: 0px;
  --tt-scale: 1;
  opacity: 1;
  transition: opacity 150ms ease-out 500ms, transform 150ms ease-out 500ms;
}

@media (hover: none), (pointer: coarse) {
  .t-tt { display: none; }
}

/* ----------------------------------------------------------------- stage --- */
.swizzel-reader-stage {
  position: relative;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: clip;
  background: #fff;
  container: swizzel-reader / inline-size;
}

.swizzel-reader-layout {
  position: absolute;
  inset: 0;
}

/* Wrappers that must not box their children: the rail positions against the
 * layout, the action rail and panel against the stage. */
turbo-frame#swizzel_circles,
.swizzel-reader-side {
  display: contents;
}

turbo-frame#reader_header,
turbo-frame#content_display {
  display: block;
}

/* The reader's only scroller. Shrinks beside an open side panel (instead of the
 * prototype's padding-right) so its scrollbar stays visible and the centred
 * article re-centres in the space that is left. */
.swizzel-reader-scroll-area {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scroll-padding-bottom: 72px;
  transition:
    right var(--panel-close-dur) var(--panel-ease),
    bottom var(--panel-close-dur) var(--panel-ease);
}
.swizzel-reader-scroll-area:focus { outline: none; }

.swizzel-reader-stage[data-panel-open="true"] .swizzel-reader-scroll-area {
  right: var(--reader-panel-width);
  transition-duration: var(--panel-open-dur);
}

.swizzel-reader-columns {
  display: flex;
  justify-content: center;
  min-height: 100%;
  padding: 0 var(--reader-gutter);
}

.swizzel-reader-article {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  min-width: 0;
  padding: 48px 0 160px;
}

/* ----------------------------------------------------- article: headers --- */
.swizzel-reader-intro,
.swizzel-reader-perspective {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
}

.swizzel-reader-title {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.swizzel-reader-title-text {
  display: -webkit-box;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 40px;
  font-weight: 600;
  line-height: 48px;
  letter-spacing: -0.4px;
  overflow-wrap: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.swizzel-reader-title.is-expanded .swizzel-reader-title-text {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

.swizzel-reader-title-toggle {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin-top: 8px;
  place-items: center;
  color: var(--text-tertiary);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.swizzel-reader-title-toggle:hover { color: var(--text-primary); background: var(--surface-subtle); }
.swizzel-reader-title-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
.swizzel-reader-title-toggle svg { transition: transform 200ms ease; }
.swizzel-reader-title.is-expanded .swizzel-reader-title-toggle svg { transform: rotate(180deg); }

.swizzel-reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.14px;
}

.swizzel-detail-author-link {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  color: inherit;
  border-radius: 8px;
  text-decoration: none;
}
a.swizzel-detail-author-link:hover .swizzel-detail-author {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.swizzel-detail-author-link:focus-visible {
  outline: 2px solid rgb(0 147 255 / 45%);
  outline-offset: 2px;
}

.swizzel-reader .search-avatar--32 { width: 32px; height: 32px; }
.swizzel-reader .search-avatar--32.search-avatar--initial { font-size: 14px; line-height: 32px; }

.swizzel-detail-author {
  max-width: 240px;
  overflow: hidden;
  color: var(--text-primary);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swizzel-detail-separator {
  flex: 0 0 3px;
  width: 3px;
  height: 3px;
  background: #e7e5e4;
  border-radius: 50%;
}

.swizzel-detail-date,
.swizzel-reader-read-time,
.swizzel-reader-read-progress {
  flex: 0 0 auto;
}

.swizzel-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swizzel-detail-chip {
  display: inline-flex;
  height: 32px;
  gap: 2px;
  align-items: center;
  padding: 6px;
  color: var(--text-primary);
  background: var(--chip-background, #fafaf9);
  border: 0;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: -0.14px;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 150ms ease-out,
    box-shadow 150ms ease-out,
    scale 150ms ease-out;
}
a.swizzel-detail-chip:hover {
  background: color-mix(in srgb, var(--chip-background, #fafaf9) 72%, #e7e5e4);
  box-shadow: 0 1px 2px rgb(0 0 0 / 8%);
}
a.swizzel-detail-chip:active { scale: 0.96; }
.swizzel-detail-chip:focus-visible {
  outline: 2px solid rgb(0 147 255 / 45%);
  outline-offset: 2px;
}
.swizzel-detail-chip-label { padding: 0 4px; }

.swizzel-reader-cover {
  margin: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #f5f5f4;
  border-radius: 12px;
}
.swizzel-reader-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.swizzel-reader-cover.is-empty {
  display: grid;
  place-items: center;
}

.swizzel-reader-perspective-identity {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.swizzel-reader-perspective-name {
  min-width: 0;
  margin: 0;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.24px;
  overflow-wrap: anywhere;
}

.swizzel-reader-perspective-tag {
  flex: 0 0 auto;
  padding: 2px 8px;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
}

.swizzel-reader-subtabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.swizzel-reader-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.swizzel-reader-subtab {
  display: inline-flex;
  height: 40px;
  gap: 6px;
  align-items: center;
  padding: 8px 12px;
  color: var(--text-tertiary);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: -0.16px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
a.swizzel-reader-subtab:hover { color: var(--text-primary); }
.swizzel-reader-subtab.is-active {
  color: var(--text-primary);
  background: #f4f4f1;
  cursor: default;
}
.swizzel-reader-subtab:focus-visible {
  outline: 2px solid rgb(0 147 255 / 45%);
  outline-offset: 2px;
}

.swizzel-reader-subtab-action {
  color: var(--text-secondary);
  box-shadow: inset 0 0 0 1px var(--border-secondary);
}
.swizzel-reader-subtab-action:hover { background: var(--surface-subtle); }
.swizzel-reader-subtab-action svg { width: 16px; height: 16px; }

.swizzel-reader-subtab-spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid #e7e5e4;
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: swizzel-reader-spin 0.7s linear infinite;
}

.swizzel-reader-perspective-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: -16px;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.14px;
}

.swizzel-reader-mini-chip {
  display: inline-flex;
  height: 28px;
  gap: 6px;
  align-items: center;
  padding: 4px 10px 4px 4px;
  color: var(--text-primary);
  background: #fafaf9;
  border-radius: 9999px;
  font-weight: 500;
}

.swizzel-reader-document-link {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--text-quaternary);
  text-underline-offset: 2px;
}

/* A mind or expression whose markdown opens with its own "# Title" uses that as
 * the panel's title (the prototype's `doc.title || card.title`); the swizzel's
 * prompt is only the fallback. */
.swizzel-reader-article:has(.swizzel-reader-body-content.is-perspective > .swizzel-reader-markdown > h1:first-child) .swizzel-reader-fallback-title {
  display: none;
}

/* -------------------------------------------------------- article: body --- */
.swizzel-reader-body {
  margin-top: 64px;
}
.swizzel-reader-article:has(.swizzel-reader-body-content.is-perspective > .swizzel-reader-markdown > h1:first-child) .swizzel-reader-body {
  margin-top: 32px;
}

.swizzel-reader-body-content {
  color: var(--text-primary);
  font-size: 18px;
  line-height: 28px;
  letter-spacing: -0.18px;
  overflow-wrap: anywhere;
}

.swizzel-reader-body-content.is-perspective > .swizzel-reader-markdown > h1:first-child {
  margin: 0 0 48px;
  font-size: 40px;
  line-height: 48px;
  letter-spacing: -0.4px;
  text-wrap: balance;
}

/* Selectors carry .swizzel-reader-body-content .swizzel-reader-markdown so they
 * beat application.css's .markdown-* rules on specificity, not file order. */
.swizzel-reader-body-content .swizzel-reader-markdown > * { margin: 0; }
.swizzel-reader-body-content .swizzel-reader-markdown > * + * { margin-top: 16px; }
.swizzel-reader-body-content .swizzel-reader-markdown > * + :is(h1, h2) { margin-top: 48px; }
.swizzel-reader-body-content .swizzel-reader-markdown > * + :is(h3, h4, h5, h6) { margin-top: 32px; }

.swizzel-reader-body-content .swizzel-reader-markdown :is(h1, h2, h3, h4, h5, h6) {
  padding: 0;
  color: var(--text-primary);
  font-weight: 600;
  text-wrap: balance;
}
.swizzel-reader-body-content .swizzel-reader-markdown h1 { font-size: 28px; line-height: 36px; letter-spacing: -0.28px; }
.swizzel-reader-body-content .swizzel-reader-markdown h2 { font-size: 24px; line-height: 32px; letter-spacing: -0.24px; }
.swizzel-reader-body-content .swizzel-reader-markdown h3 { font-size: 18px; line-height: 28px; letter-spacing: -0.18px; }
.swizzel-reader-body-content .swizzel-reader-markdown :is(h4, h5, h6) { font-size: 16px; line-height: 24px; letter-spacing: -0.16px; }

/* No `margin` on these: the flow rule above spaces every block, and a margin
 * here would outrank it (an element selector adds specificity). */
.swizzel-reader-body-content .swizzel-reader-markdown p {
  padding: 0;
  line-height: inherit;
}

.swizzel-reader-body-content .swizzel-reader-markdown :is(ul, ol) {
  padding: 0 0 0 27px;
}
.swizzel-reader-body-content .swizzel-reader-markdown ul { list-style: disc; }
.swizzel-reader-body-content .swizzel-reader-markdown ol { list-style: decimal; }
.swizzel-reader-body-content .swizzel-reader-markdown li {
  margin: 0;
  padding: 0;
}
.swizzel-reader-body-content .swizzel-reader-markdown li + li { margin-top: 8px; }
.swizzel-reader-body-content .swizzel-reader-markdown li > :is(ul, ol) { margin-top: 8px; }

.swizzel-reader-body-content .swizzel-reader-markdown blockquote {
  padding-left: 16px;
  color: var(--text-secondary);
  border-left: 3px solid var(--border-secondary);
}

.swizzel-reader-body-content .swizzel-reader-markdown a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--text-quaternary);
  text-underline-offset: 2px;
}

.swizzel-reader-body-content .swizzel-reader-markdown strong { font-weight: 600; }

.swizzel-reader-body-content .swizzel-reader-markdown :not(pre) > code {
  padding: 1px 5px;
  background: #f5f5f4;
  border-radius: 6px;
  font-size: 0.875em;
}

.swizzel-reader-body-content .swizzel-reader-markdown pre {
  max-width: 100%;
  overflow-x: auto;
}

.swizzel-reader-body-content .swizzel-reader-markdown hr {
  height: 0;
  border: 0;
  border-top: 1px solid var(--border-secondary);
}

.swizzel-reader-body-content .swizzel-reader-markdown img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.swizzel-reader-body-content .swizzel-reader-markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 24px;
}
.swizzel-reader-body-content .swizzel-reader-markdown :is(th, td) {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-secondary);
}
.swizzel-reader-body-content .swizzel-reader-markdown th { font-weight: 600; }

/* AudioPlayerComponent's own -20px offset assumed the old padded column. */
.swizzel-reader-body-content audio { margin-left: 0; }

.swizzel-reader-audio-slot { margin-bottom: 24px; }

.swizzel-reader-generating {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 24px 0;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 24px;
  text-align: center;
}
.swizzel-reader-generating img {
  width: min(420px, 100%);
  height: auto;
}
.swizzel-reader-generating p { margin: 0; max-width: 440px; }
.swizzel-reader-generating .swizzel-reader-generating-title {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
}

.swizzel-reader-unavailable {
  margin: 0;
  color: var(--text-tertiary);
  font-style: italic;
}

/* A swizzel whose generation failed with nothing to read: the generating
   message's place, with Try again for its owner (reader/_generation_state). */
.swizzel-reader-generating.is-failed { padding-top: 56px; }
.swizzel-reader-failed-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  color: #d97706;
  background: #fffbeb;
  border-radius: 9999px;
}
.swizzel-reader-try-again { display: inline-flex; margin: 8px 0 0; }

/* Above every panel of an incomplete swizzel: which parts didn't finish, with
   Try again, or that they are being generated again (reader/_generation_notice). */
.swizzel-reader-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 32px;
  padding: 12px 12px 12px 16px;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border-radius: 16px;
  font-size: 14px;
  line-height: 20px;
}
.swizzel-reader-notice p { flex: 1 1 220px; margin: 0; }
.swizzel-reader-notice-icon { display: inline-flex; flex: 0 0 auto; color: #d97706; }
.swizzel-reader-notice .swizzel-reader-try-again { margin: 0; }

/* Buttons that sit in the content: Generate cover image, Generate audio. */
.swizzel-reader-pill-button {
  display: inline-flex;
  height: 36px;
  gap: 6px;
  align-items: center;
  padding: 8px 14px;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border-secondary);
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: -0.14px;
  text-decoration: none;
  transition: background-color 150ms ease-out;
}
.swizzel-reader-pill-button:hover { background: var(--surface-subtle); }
.swizzel-reader-pill-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.swizzel-reader-pill-button svg { flex: 0 0 auto; }

.swizzel-reader-pill-button.is-busy .swizzel-reader-stop-icon { display: none; }
.swizzel-reader-pill-button.is-busy:is(:hover, :focus-visible) .swizzel-reader-spinner { display: none; }
.swizzel-reader-pill-button.is-busy:is(:hover, :focus-visible) .swizzel-reader-stop-icon { display: block; }

.swizzel-reader-pill-status {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 20px;
}

turbo-frame#generate-summary-image-button-frame form,
turbo-frame#generate-audio-button-frame form {
  display: inline-flex;
  margin: 0;
}

.swizzel-reader-spinner {
  display: inline-block;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border: 1.5px solid #e7e5e4;
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: swizzel-reader-spin 0.7s linear infinite;
}

@keyframes swizzel-reader-spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------ article: footer --- */
.swizzel-reader-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 48px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.swizzel-reader-footer-actions {
  display: flex;
  gap: 2px;
  align-items: center;
  margin-left: -10px;
}
.swizzel-reader-footer-actions:empty { display: none; }

.swizzel-reader-disclaimer {
  margin: 0;
  color: var(--text-quaternary);
  font-size: 13px;
  line-height: 18px;
}

/* ----------------------------------------------------- progress pill ------
 * Sticks to the bottom of the scroll area. reading-progress toggles `hidden`. */
.swizzel-reader-progress {
  position: sticky;
  bottom: 16px;
  z-index: 1;
  justify-content: center;
  pointer-events: none;
}
.swizzel-reader-progress:not(.hidden) { display: flex; }

.swizzel-reader-progress-pill {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 14px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 96%);
  border: 1px solid rgb(0 0 0 / 8%);
  border-radius: 9999px;
  box-shadow: 0 0 4px rgb(0 0 0 / 4%), 0 8px 16px rgb(0 0 0 / 6%);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  pointer-events: auto;
}

.swizzel-reader-progress-done {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--text-primary);
}

.swizzel-reader-progress-percent { font-variant-numeric: tabular-nums; font-weight: 600; }

.swizzel-reader-progress-sep {
  width: 3px;
  height: 3px;
  background: #d6d3d1;
  border-radius: 50%;
}

.swizzel-reader-progress-button {
  padding: 0;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.swizzel-reader-progress-button:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------ minds rail ---
 * A transparent column over the scroll area's left gutter, centred while it
 * fits and scrollable when a swizzel has 20+ dots. Wide enough for the dots'
 * tooltips; only the dots take the pointer. */
.swizzel-reader-minds {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(280px, 45%);
  padding: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  pointer-events: none;
  transition: bottom var(--panel-close-dur) var(--panel-ease);
}
.swizzel-reader-minds::-webkit-scrollbar { display: none; }

.swizzel-reader-minds-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-block: auto;
}

.swizzel-reader-minds-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.swizzel-reader-minds-group + .swizzel-reader-minds-group { margin-top: 20px; }

.swizzel-reader-dot {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: var(--text-tertiary);
  background: transparent;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
  pointer-events: auto;
  text-decoration: none;
}

.swizzel-reader-dot > * { grid-area: 1 / 1; }

.swizzel-reader-dot .chip-mesh-orb {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  opacity: 0.2;
  transition: opacity 250ms var(--ease-out-quint);
}
.swizzel-reader-dot:hover:not(.is-active) .chip-mesh-orb { opacity: 0.35; }
.swizzel-reader-dot.is-active .chip-mesh-orb { opacity: 1; }
.swizzel-reader-dot:focus-visible {
  outline: 2px solid rgb(0 147 255 / 45%);
  outline-offset: -2px;
}

/* The app's reading-progress ring, just outside the orb. */
.swizzel-reader-dot-ring {
  z-index: 1;
  width: 40px;
  height: 40px;
  pointer-events: none;
}
.swizzel-reader-dot-ring circle { opacity: 0.6; }
.swizzel-reader-dot.is-active .swizzel-reader-dot-ring circle { opacity: 1; }

.swizzel-reader-dot.is-expanding { cursor: not-allowed; }
.swizzel-reader-dot.is-expanding .chip-mesh-orb { opacity: 0.35; }
.swizzel-reader-dot-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgb(87 83 77 / 25%);
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: swizzel-reader-spin 0.8s linear infinite;
}

.swizzel-reader-dot-add svg { width: 18px; height: 18px; }
.swizzel-reader-dot-add::before {
  content: "";
  grid-area: 1 / 1;
  width: 32px;
  height: 32px;
  border: 1px dashed #d6d3d1;
  border-radius: 50%;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.swizzel-reader-dot-add:hover { color: var(--text-primary); }
.swizzel-reader-dot-add:hover::before {
  background: var(--surface-subtle);
  border-style: solid;
  border-color: var(--border-secondary);
}

/* Six conic-gradients and a blur repainted every frame, on 20+ dots and chips:
 * only the orb the reader is looking at spins. */
.swizzel-reader .chip-mesh-orb::before { animation-play-state: paused; }
.swizzel-reader .swizzel-reader-dot.is-active .chip-mesh-orb::before,
.swizzel-reader .swizzel-reader-perspective-orb::before,
.swizzel-reader :is(.swizzel-reader-dot, .swizzel-detail-chip):is(:hover, :focus-visible) .chip-mesh-orb::before {
  animation-play-state: running;
}

/* ---------------------------------------------------------- action rail --- */
.swizzel-reader-actions {
  position: absolute;
  top: 50%;
  right: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform: translateY(-50%);
  transition: right var(--panel-close-dur) var(--panel-ease);
}

.swizzel-reader-stage[data-panel-open="true"] .swizzel-reader-actions {
  right: calc(var(--reader-panel-width) + 12px);
  transition-duration: var(--panel-open-dur);
}

/* The prototype gives the open pane's button no state; this does. */
.swizzel-reader-actions .icon-button[aria-expanded="true"] {
  color: var(--text-primary);
  background: var(--surface-subtle);
}

/* ---------------------------------------------------------------- panel --- */
.swizzel-reader-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: var(--reader-panel-width);
  max-width: 100%;
  overflow: clip;
  background: #fff;
  box-shadow: inset 1px 0 0 var(--border-secondary);
  opacity: 0;
  visibility: hidden;
  filter: blur(var(--panel-blur));
  transform: translateX(100%);
  transition:
    transform var(--panel-close-dur) var(--panel-ease),
    opacity var(--panel-close-dur) var(--panel-ease),
    filter var(--panel-close-dur) var(--panel-ease),
    visibility 0s linear var(--panel-close-dur);
}

/* At rest the open panel has NO transform or filter: either would make it the
 * containing block for the note editor's fixed overlay rendered inside it. */
.swizzel-reader-panel[data-open="true"] {
  opacity: 1;
  visibility: visible;
  filter: none;
  transform: none;
  transition:
    transform var(--panel-open-dur) var(--panel-ease),
    opacity var(--panel-open-dur) var(--panel-ease),
    filter var(--panel-open-dur) var(--panel-ease),
    visibility 0s linear 0s;
}

.swizzel-reader-panel-header {
  display: flex;
  flex: 0 0 auto;
  gap: 20px;
  align-items: center;
  padding: 12px;
}

.swizzel-reader-panel-header h2 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 8px 12px;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: -0.14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swizzel-reader .swizzel-reader-panel-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 8px;
}

.swizzel-reader-panel-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: clip;
}

.swizzel-reader-panel-pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: clip;
  opacity: 0;
  visibility: hidden;
  filter: blur(var(--page-blur));
  transform: translateX(var(--page-slide-distance));
  transition:
    opacity var(--page-fade-dur) var(--page-ease),
    transform var(--page-slide-dur) var(--page-ease),
    filter var(--page-slide-dur) var(--page-ease),
    visibility 0s linear var(--page-fade-dur);
}

.swizzel-reader-panel-pane.is-active {
  opacity: 1;
  visibility: visible;
  filter: none;
  transform: none;
  transition-delay: 0s;
}

/* reader-panel's instant protocol: state applied with no transitions at all. */
.swizzel-reader-stage.is-instant :is(.swizzel-reader-panel, .swizzel-reader-panel-pane, .swizzel-reader-scroll-area, .swizzel-reader-actions, .swizzel-reader-minds),
.swizzel-reader-panel-body.is-instant .swizzel-reader-panel-pane {
  transition: none !important;
}

/* Safety net: while a note's editor or viewer is open, nothing in the panel may
 * still be mid-slide -- see the note on the open panel above. */
.swizzel-reader-stage:has(:is([data-note-editor-target="modal"], [data-notes-target="viewerModal"]):not(.hidden)) :is(.swizzel-reader-panel, .swizzel-reader-panel-pane) {
  transition: none !important;
}

/* Notes and Highlights reuse their components, which bring their own scroller. */
.swizzel-reader-panel-pane > [data-controller] {
  flex: 1 1 auto;
  min-height: 0;
}

.swizzel-reader-chat-pane {
  gap: 12px;
  padding: 0 12px 12px;
}

.swizzel-reader-scroll {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.swizzel-reader-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 4px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.swizzel-reader-panel-empty {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 0 16px;
  color: var(--text-quaternary);
  text-align: center;
}
.swizzel-reader-panel-empty p {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.14px;
}

.swizzel-reader-panel-loading {
  margin: 0;
  padding: 16px;
  color: var(--text-tertiary);
  font-size: 14px;
  text-align: center;
}

/* Thought Partner thread. */
.swizzel-reader-chat-message,
.swizzel-reader-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.14px;
}

.swizzel-reader-chat-message.is-user { align-items: flex-end; }

.swizzel-reader-chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  color: var(--text-primary);
  background: var(--surface-subtle);
  border-radius: 12px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.swizzel-reader-chat-thread .swizzel-reader-chat-bubble { align-self: flex-end; }

.swizzel-reader-chat-quoted {
  display: -webkit-box;
  max-width: 88%;
  margin: 0;
  padding-left: 8px;
  overflow: hidden;
  color: var(--text-tertiary);
  border-left: 2px solid var(--border-secondary);
  font-size: 13px;
  line-height: 18px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.swizzel-reader-chat-meta,
.swizzel-reader-chat-status {
  margin: 0 0 4px;
  color: var(--text-quaternary);
  font-size: 12px;
  line-height: 16px;
}

.swizzel-reader-chat-reply {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 22px;
  overflow-wrap: anywhere;
}
.swizzel-reader-chat-reply > * { margin: 0; }
.swizzel-reader-chat-reply > * + * { margin-top: 8px; }
.swizzel-reader-chat-reply :is(ul, ol) { padding-left: 20px; }
.swizzel-reader-chat-reply ul { list-style: disc; }
.swizzel-reader-chat-reply ol { list-style: decimal; }
.swizzel-reader-chat-reply :is(h1, h2, h3, h4) { font-size: 15px; font-weight: 600; line-height: 22px; padding: 0; }

.swizzel-reader-chat-thinking {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  color: var(--text-tertiary);
}
.swizzel-reader-chat-thinking svg { color: var(--brand); }
.swizzel-reader-chat-dots { display: inline-flex; gap: 3px; }
.swizzel-reader-chat-dots i {
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  animation: swizzel-reader-dot-bounce 1.2s ease-in-out infinite;
}
.swizzel-reader-chat-dots i:nth-child(2) { animation-delay: 0.15s; }
.swizzel-reader-chat-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes swizzel-reader-dot-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* Composer. */
.swizzel-reader-chat-composer-wrap { flex: 0 0 auto; }

.swizzel-reader-chat-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 16px;
  transition: border-color 150ms ease-out;
}
.swizzel-reader-chat-composer:hover,
.swizzel-reader-chat-composer:focus-within { border-color: #d6d3d1; }

.swizzel-reader-chat-composer textarea {
  width: 100%;
  min-height: 40px;
  max-height: 160px;
  padding: 8px 10px;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  resize: none;
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.16px;
}
.swizzel-reader-chat-composer textarea::placeholder { color: #a6a09b; }
.swizzel-reader-chat-composer textarea:focus { outline: none; box-shadow: none; }

.swizzel-reader-chat-composer-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.swizzel-reader-chat-composer-hint {
  padding-left: 10px;
  color: var(--text-quaternary);
  font-size: 12px;
  line-height: 16px;
}
@media (hover: none), (pointer: coarse) {
  .swizzel-reader-chat-composer-hint { visibility: hidden; }
}

.swizzel-reader-chat-send {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 6px;
  color: #d6d3d1;
  background: var(--surface-subtle);
  border: 0;
  border-radius: 8px;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.swizzel-reader-chat-send.is-ready {
  color: #fff;
  background: var(--brand);
  cursor: pointer;
}
.swizzel-reader-chat-send.is-ready:hover { background: #007fdc; }
.swizzel-reader-chat-send svg { width: 20px; height: 20px; }

.swizzel-reader-chat-quote:not(.hidden) {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: #fafaf9;
  border: 1px solid var(--border-secondary);
  border-radius: 10px;
}
.swizzel-reader-chat-quote svg { flex: 0 0 auto; }
.swizzel-reader-chat-quote-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.swizzel-reader-chat-quote-clear {
  color: var(--text-quaternary);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.swizzel-reader-chat-locked {
  margin: 0;
  padding: 16px 12px;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

/* ------------------------------------------------------------- More menu ---
 * Right-aligned under its trigger, with Add to collection's submenu flying out
 * to the left. The base .menu-field-popover (home_hero.css) clips its content,
 * which a nested submenu cannot live with. */
.swizzel-more-menu-wrap { position: relative; }

.swizzel-more-menu.menu-field-popover {
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  z-index: 40;
  min-width: 224px;
  max-height: none;
  overflow: visible;
}

.swizzel-more-menu-item { position: relative; }

.swizzel-collection-menu.menu-field-popover {
  top: -5px;
  right: calc(100% + 8px);
  left: auto;
  z-index: 41;
  width: 248px;
  min-width: 0;
  max-height: min(356px, calc(100dvh - 120px));
}

.swizzel-collection-menu .menu-field-list { max-height: 260px; }

.menu-field-option .menu-field-option-chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-left: auto;
  color: var(--text-quaternary);
}

.swizzel-collection-icon {
  display: grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  place-items: center;
}
.swizzel-collection-icon svg { width: 18px; height: 18px; }

.swizzel-collection-option .swizzel-collection-check {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--text-primary);
  opacity: 0;
}
.swizzel-collection-option[aria-checked="true"] .swizzel-collection-check { opacity: 1; }
.swizzel-collection-option[aria-disabled="true"] { opacity: 0.6; cursor: progress; }

@media (max-width: 560px) {
  /* No room to fly out on a phone: stack the collections under the item. */
  .swizzel-collection-menu.menu-field-popover {
    top: calc(100% + 4px);
    right: 0;
  }
}

/* Toasts and flash messages clear the reader's top bar instead of covering
 * Share, Save and More. */
body:is(.is-swizzel-reader, .is-focus-layout) .app-toast { top: 72px; }
body:is(.is-swizzel-reader, .is-focus-layout) #flash { top: 60px; }

/* ---------------------------------------------------- container queries ---
 * On the stage's width, not the viewport's: in focus mode the stage is what
 * the path tree leaves. */
@container swizzel-reader (max-width: 880px) {
  .swizzel-reader-columns { padding: 0 56px; }
  .swizzel-reader-article { padding: 32px 0 120px; }

  .swizzel-reader-title-text,
  .swizzel-reader-body-content.is-perspective > .swizzel-reader-markdown > h1:first-child {
    font-size: 32px;
    line-height: 40px;
  }

  .swizzel-reader-minds { left: 4px; }
  .swizzel-reader-actions { right: 8px; }

  /* The side panel becomes a bottom sheet over the article. */
  .swizzel-reader-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    width: auto;
    max-width: none;
    height: var(--reader-sheet-height);
    max-height: calc(100% - 24px);
    border-radius: 16px 16px 0 0;
    box-shadow: inset 0 1px 0 var(--border-secondary), 0 -8px 24px rgb(0 0 0 / 6%);
    transform: translateY(110px);
  }
  .swizzel-reader-panel[data-open="true"] { transform: none; }

  .swizzel-reader-stage[data-panel-open="true"] .swizzel-reader-scroll-area {
    right: 0;
    bottom: var(--reader-sheet-offset);
  }

  .swizzel-reader-stage[data-panel-open="true"] .swizzel-reader-minds {
    bottom: calc(var(--reader-sheet-offset) + 12px);
  }

  .swizzel-reader-stage[data-panel-open="true"] .swizzel-reader-actions {
    top: auto;
    right: 8px;
    bottom: calc(var(--reader-sheet-offset) + 12px);
    transform: none;
  }

  /* With the sheet up there is no room for the pill above the rails. */
  .swizzel-reader-stage[data-panel-open="true"] .swizzel-reader-progress { display: none; }
}

@container swizzel-reader (max-width: 600px) {
  .swizzel-reader-columns { padding: 0 16px; }
  .swizzel-reader-article { padding-bottom: 148px; }
  .swizzel-reader-scroll-area { scroll-padding-bottom: 140px; }

  .swizzel-reader-body-content,
  .swizzel-reader-body-content .swizzel-reader-markdown p { font-size: 16px; line-height: 24px; }

  /* Both rails become floating bars along the bottom. */
  .swizzel-reader-minds {
    top: auto;
    right: auto;
    bottom: 16px;
    left: 12px;
    flex-direction: row;
    width: auto;
    max-width: calc(100% - 156px);
    padding: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgb(255 255 255 / 96%);
    border: 1px solid #e7e5e4;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgb(0 0 0 / 8%);
    pointer-events: auto;
  }

  /* Read aloud adds a fourth button to the actions bar. Only a stage that has it
     (it carries data-audio-open) gives up the room: with it off the bar is as it was. */
  .swizzel-reader-stage[data-audio-open] .swizzel-reader-minds { max-width: calc(100% - 204px); }

  .swizzel-reader-minds-list,
  .swizzel-reader-minds-group {
    flex-direction: row;
    align-items: center;
    margin-block: 0;
  }

  .swizzel-reader-minds-group + .swizzel-reader-minds-group {
    margin-top: 0;
    margin-left: 12px;
  }

  .swizzel-reader-actions {
    top: auto;
    right: 12px;
    bottom: 16px;
    flex-direction: row;
    padding: 2px;
    background: rgb(255 255 255 / 96%);
    border: 1px solid #e7e5e4;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgb(0 0 0 / 8%);
    transform: none;
  }

  .swizzel-reader-stage[data-panel-open="true"] :is(.swizzel-reader-minds, .swizzel-reader-actions) {
    right: auto;
    bottom: calc(var(--reader-sheet-offset) + 12px);
  }
  .swizzel-reader-stage[data-panel-open="true"] .swizzel-reader-actions { right: 12px; }

  .swizzel-reader-minds .t-tt,
  .swizzel-reader-actions .t-tt { display: none; }

  .swizzel-reader-progress { bottom: 76px; }
}

/* -------------------------------------------------------- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .swizzel-reader :is(.swizzel-reader-panel, .swizzel-reader-panel-pane, .swizzel-reader-scroll-area, .swizzel-reader-actions, .swizzel-reader-minds, .menu-field-popover, .swizzel-reader-dot .chip-mesh-orb, .reading-progress-ring),
  .t-tt {
    transition: none !important;
  }
  .swizzel-reader .chip-mesh-orb::before,
  .swizzel-reader .reading-progress-bar-enter {
    animation: none !important;
  }
}

/* ----------------------------------------------------------------- print --- */
@media print {
  .swizzel-reader-topbar,
  .swizzel-reader-minds,
  .swizzel-reader-actions,
  .swizzel-reader-panel,
  .swizzel-reader-progress,
  .swizzel-reader-footer-actions {
    display: none !important;
  }

  .swizzel-reader-page,
  .swizzel-reader-stage {
    overflow: visible;
    container-type: normal;
  }

  .swizzel-reader-layout,
  .swizzel-reader-scroll-area {
    position: static;
    overflow: visible;
  }
}
