/* Magic Editor X page styles. site.css is the shared theme, byte-identical in
   every plugin docs site; this file holds the Magic Editor X accent (taken from
   the plugin icon) and the components that exist on this page alone. */

:root {
  --accent: #15803d;
  --accent-ink: #14713a;
  --on-accent: #ffffff;
  --accent-soft: #e3f4e8;
  --hero-accent: #86d99f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #6fd38f;
    --accent-ink: #84dda0;
    --on-accent: #0e1016;
    --accent-soft: #16301f;
  }
}

/* Install: three numbered cards side by side instead of a plain list. */
.section .steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  max-width: none;
  padding: 0;
  list-style: none;
}
.steps > li.card {
  margin: 0;
  padding: var(--space-5);
}
.steps .card h3 {
  margin-top: 0;
}

/* Phone screenshots stay phone-sized inside the two-column gallery. */
.shot.phone img {
  max-width: 300px;
  margin: 0 auto;
}

@media (max-width: 820px) {
  .section .steps {
    grid-template-columns: 1fr;
  }
}

/* The install command sits in its own box; the inline-code chip inside it is not needed. */
.hero-install code {
  padding: 0;
  background: none;
}

/* The long plugin name and four top links do not fit one row on small phones:
   npm and the changelog stay in the hero badges and the footer. */
.brand span {
  white-space: nowrap;
}
@media (max-width: 480px) {
  .top-links a[href$='CHANGELOG.md'],
  .top-links a[href^='https://www.npmjs.com'] {
    display: none;
  }
}

/* Config keys stay on one line on wide screens; the table scrolls in its wrapper. */
@media (min-width: 821px) {
  td code,
  th code {
    overflow-wrap: normal;
    white-space: nowrap;
  }
}

/* "Used by" strip under the hero, the same block in every plugin site.
   .github/scripts/showcase.mjs renders docs/site/showcase.json into #used-by when the Pages
   workflow builds the site: a slim call to action while the list is empty, a still logo row
   for up to four companies and a logo slider from five on. site.js starts the slider and adds
   its Pause button; until then (or without JavaScript) the logos are a still row that scrolls
   sideways. The hero is dark in both colour schemes, so logos sit on light neutral tiles,
   greyscale until hover or focus. */
.hero-grid > .hero-copy {
  min-width: 0;
}
.used-by {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: var(--space-5) 0 0;
  padding: var(--space-4) 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}
.hero .used-by h2 {
  margin: 0;
  color: var(--hero-ink-2);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero .hero-grid .used-by p {
  max-width: none;
  margin: 0;
  color: var(--hero-ink-2);
  font-size: var(--text-s);
  line-height: 1.5;
}
.hero .used-by .showcase-add {
  color: var(--hero-ink);
  font-weight: 650;
  text-decoration-color: var(--hero-accent);
  text-underline-offset: 0.2em;
}
.hero .used-by .showcase-add:hover {
  text-decoration-thickness: 2px;
}
.hero .hero-grid .used-by .showcase-empty {
  flex: 1 1 16rem;
}
.hero .hero-grid .used-by .showcase-more {
  margin-left: auto;
}
.showcase-row,
.showcase-marquee {
  flex: 1 0 100%;
  min-width: 0;
}
.showcase-row,
.showcase-list {
  display: flex;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.showcase-row {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.showcase-row > li,
.showcase-list > li {
  flex: none;
  margin: 0;
}
.showcase-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 7rem;
  height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: #eef0f4;
}
.showcase-tile img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.85;
  transition:
    filter 0.2s ease,
    opacity 0.2s ease;
}
.showcase-tile:hover img,
.showcase-tile:focus-visible img {
  filter: none;
  opacity: 1;
}
.hero .showcase-tile:focus-visible {
  outline-offset: 2px;
}

/* Slider: one list plus an aria-hidden copy; moving the track by half its width loops it
   seamlessly. The trailing padding keeps the gap between the two copies equal. */
.showcase-marquee {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.showcase-track {
  display: flex;
  width: max-content;
}
.showcase-list {
  flex: none;
  padding-right: var(--space-3);
}
.showcase-list[aria-hidden='true'] {
  display: none;
}
.showcase-marquee.is-animated {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 var(--space-6),
    #000 calc(100% - var(--space-6)),
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 var(--space-6),
    #000 calc(100% - var(--space-6)),
    transparent
  );
}
.showcase-marquee.is-animated .showcase-list[aria-hidden='true'] {
  display: flex;
}
.showcase-marquee.is-animated .showcase-track {
  animation: showcase-slide var(--showcase-duration, 40s) linear infinite;
}
.showcase-marquee.is-animated:hover .showcase-track,
.showcase-marquee.is-animated:focus-within .showcase-track,
.showcase-marquee.is-paused .showcase-track {
  animation-play-state: paused;
}
/* Keyboard focus: stop at the start and let the strip scroll, so a focused logo is never
   carried out of view. Mouse clicks do not match :focus-visible, so a click never jumps. */
.showcase-marquee.is-animated:has(:focus-visible) {
  overflow-x: auto;
  -webkit-mask-image: none;
  mask-image: none;
}
.showcase-marquee.is-animated:has(:focus-visible) .showcase-track {
  animation: none;
}
.showcase-marquee.is-animated:has(:focus-visible) .showcase-list[aria-hidden='true'] {
  display: none;
}
@keyframes showcase-slide {
  to {
    transform: translateX(-50%);
  }
}

/* Pause / Play button, added by site.js. */
.showcase-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 1.75rem;
  padding: 0 var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: transparent;
  color: var(--hero-ink);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 650;
  cursor: pointer;
}
.showcase-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}
.showcase-toggle[hidden] {
  display: none;
}
.showcase-toggle::before {
  width: 0.625rem;
  height: 0.75rem;
  box-sizing: border-box;
  border-right: 3px solid currentColor;
  border-left: 3px solid currentColor;
  content: '';
}
.showcase-toggle[data-state='paused']::before {
  border: 0;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.hero .hero-grid .used-by .showcase-more + .showcase-toggle {
  margin-left: calc(-1 * var(--space-2));
}

/* Phones: a slightly tighter hero, so the strip stays above the fold at 390 x 844. */
@media (max-width: 560px) {
  .hero {
    padding-top: var(--space-4);
  }
  .hero .crumbs ol {
    margin-bottom: var(--space-3);
  }
  .hero .hero-grid h1 {
    margin-bottom: var(--space-3);
  }
  .hero .hero-grid p {
    margin-bottom: var(--space-3);
  }
  .hero .hero-actions {
    margin-top: var(--space-4);
  }
  .hero .hero-install {
    margin-top: var(--space-3);
  }
  .used-by {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
  }
  .showcase-tile {
    width: 6.25rem;
    height: 2.25rem;
    padding: var(--space-1) var(--space-2);
  }
}
@media (prefers-reduced-motion: reduce) {
  .showcase-marquee.is-animated {
    overflow-x: auto;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .showcase-marquee .showcase-track {
    animation: none !important;
  }
  .showcase-marquee .showcase-list[aria-hidden='true'],
  .showcase-toggle {
    display: none !important;
  }
}

/* Comparison page (compare.html): a shorter hero without the screenshot column. */
.hero-compact h1 {
  max-width: 24ch;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.125rem);
}
.hero-compact p {
  max-width: 46rem;
}

/* Status labels in the feature matrix: a word, a symbol and a colour, never colour alone. */
.st {
  display: block;
  margin: 0 0 0.15em;
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}
.st::before {
  margin-right: 0.3em;
}
.st-has {
  color: var(--good);
}
.st-has::before {
  content: '\2713';
}
.st-partial,
.st-paid {
  color: var(--open);
}
.st-partial::before {
  content: '\25D0';
}
.st-paid::before {
  content: '$';
}
.st-missing {
  color: var(--bad);
}
.st-missing::before {
  content: '\2715';
}
.st-none {
  color: var(--ink-2);
}
.st-none::before {
  content: '\2013';
}
.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0 0 var(--space-4);
  font-size: var(--text-s);
}
.status-legend div {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
}
.status-legend dt,
.status-legend dd {
  margin: 0;
}
.status-legend dd {
  color: var(--ink-2);
}

/* The matrix has eight columns: it scrolls inside its frame and keeps the feature column visible. */
.matrix {
  min-width: 68rem;
}
.matrix th[scope='col'] {
  min-width: 9rem;
}
.matrix th[scope='row'] {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 9rem;
  max-width: 11rem;
  background: var(--surface-2);
}
.matrix td {
  min-width: 9rem;
}
.table-wrap:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.table-note {
  color: var(--ink-2);
  font-size: var(--text-s);
}

/* Star call to action: one quiet box, no counter, no pop-up. */
.star-cta {
  max-width: var(--measure);
  margin: var(--space-5) 0 0;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.star-cta h3 {
  margin: 0 0 var(--space-2);
}
.star-cta p {
  margin: 0 0 var(--space-3);
  color: var(--ink-2);
}
.star-link {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-2);
  font-weight: 650;
  text-decoration: none;
}
.star-link:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}
.star-link svg {
  flex: none;
}

/* Demo video: the same frame as the screenshots, never wider than the column. */
.demo-video {
  margin: 0;
}
.demo-video video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  aspect-ratio: 16 / 10;
}
.demo-video figcaption {
  margin-top: var(--space-2);
  color: var(--ink-2);
  font-size: var(--text-s);
}

/* Star link in the hero: an ordinary secondary button with a star icon. */
.button-star {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
}
.button-star svg {
  flex: none;
}
