/*
 * RiderMates article body (WordPress post content inside .rm-wp-content) and its comparison blocks.
 * Mobile first; one breakpoint at 768px. The article shell (title, byline, share bar) is written by
 * the exported app with inline styles; the few rules that must beat those are at the end.
 */

/* ---------------------------------------------------------------------------
   Body text
   --------------------------------------------------------------------------- */
.rm-wp-content {
  --rm-flow: 12px;
  font-size: 16px;
  line-height: 1.6;
}

.rm-wp-content > * {
  margin: 0;
}

.rm-wp-content > * + * {
  margin-top: var(--rm-flow);
}

.rm-wp-content > h2 {
  margin-top: 22px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.rm-wp-content > h3 {
  margin-top: 16px;
  line-height: 1.25;
}

.rm-wp-content > figure {
  margin-inline: 0;
}

.rm-wp-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--rm-radius-md);
}

.rm-wp-content a {
  color: var(--rm-color-link);
}

.rm-wp-content :is(ul, ol) {
  padding-left: var(--rm-space-5);
}

/* ---------------------------------------------------------------------------
   Tables: scroll sideways on phones with the first column pinned
   --------------------------------------------------------------------------- */
.rm-wp-content :is(.rm-cmp-table, figure.wp-block-table) {
  max-width: 100%;
  margin: 16px 0 24px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rm-color-line);
  border-radius: var(--rm-radius-lg);
}

.rm-wp-content table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.45;
}

.rm-wp-content table :is(th, td) {
  min-width: 150px;
  padding: var(--rm-space-3) 14px;
  vertical-align: top;
}

.rm-wp-content table th {
  background: var(--rm-color-tint);
  color: var(--rm-color-ink);
  font-weight: 700;
  text-align: left;
}

.rm-wp-content table td {
  border-top: 1px solid var(--rm-color-line);
}

.rm-wp-content table :is(th, td):first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 120px;
  background: var(--rm-color-bg);
  box-shadow: 1px 0 0 var(--rm-color-line);
}

.rm-wp-content table th:first-child {
  background: var(--rm-color-tint);
}

.rm-wp-content table td:first-child {
  font-weight: 600;
  color: var(--rm-color-ink);
}

/* ---------------------------------------------------------------------------
   Comparison blocks
   --------------------------------------------------------------------------- */
.rm-wp-content .rm-cmp-note,
.rm-wp-content .rm-cmp-small {
  font-size: 12px;
  line-height: 1.5;
}

.rm-wp-content .rm-cmp-note {
  color: var(--rm-color-muted);
}

.rm-wp-content .rm-cmp-small {
  color: var(--rm-color-link);
}

.rm-wp-content .rm-cmp-short {
  margin: 24px 0;
  padding: 18px var(--rm-space-5) 18px 20px;
  background: var(--rm-color-bg);
  border: 1px solid var(--rm-color-line);
  border-radius: var(--rm-radius-lg);
}

.rm-wp-content .rm-cmp-short h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.rm-wp-content .rm-cmp-short ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.rm-wp-content .rm-cmp-short li::marker {
  color: var(--rm-color-accent);
}

.rm-wp-content .rm-cmp-cta {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin: 28px 0;
  padding: 20px;
  background: var(--rm-color-tint);
  border: 1px solid var(--rm-color-line);
  border-radius: var(--rm-radius-lg);
}

.rm-wp-content .rm-cmp-cta h3 {
  margin: 0;
  font-size: 20px;
}

.rm-wp-content .rm-cmp-cta p {
  margin: 0 0 var(--rm-space-1);
  color: var(--rm-color-muted);
}

.rm-wp-content .rm-cmp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--rm-tap);
  padding: 0 22px;
  background: var(--rm-color-accent);
  color: var(--rm-color-on-accent);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--rm-radius-pill);
}

.rm-wp-content .rm-cmp-btn:hover {
  background: var(--rm-color-accent-hover);
}

.rm-wp-content .rm-cmp-link {
  color: var(--rm-color-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Tablet and up */
@media (min-width: 768px) {
  .rm-wp-content {
    --rm-flow: 20px;
    line-height: 1.7;
  }

  .rm-wp-content > h2,
  .rm-wp-content > h3 {
    margin-top: var(--rm-flow);
  }

  .rm-wp-content :is(.rm-cmp-table, figure.wp-block-table) {
    margin: 20px 0 28px;
  }

  .rm-wp-content table {
    font-size: 14px;
  }

  .rm-wp-content table :is(th, td) {
    min-width: 0;
  }

  .rm-wp-content table th {
    white-space: nowrap;
  }

  .rm-wp-content table :is(th, td):first-child {
    position: static;
    min-width: 0;
    box-shadow: none;
  }

  .rm-wp-content table td:first-child {
    white-space: nowrap;
  }

  .rm-wp-content table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--rm-color-ink) 2%, transparent);
  }

  .rm-wp-content .rm-cmp-note {
    font-size: 15px;
  }

  .rm-wp-content .rm-cmp-small {
    font-size: 14px;
  }

  .rm-wp-content .rm-cmp-btn {
    width: auto;
  }
}

/* ---------------------------------------------------------------------------
   App overrides: the article shell is written by the exported app with inline styles.
   --------------------------------------------------------------------------- */

/* Phones: tighter spacing around the title and byline */
@media (max-width: 767.98px) {
  article[data-screen-label="CMS article"] {
    padding-top: 12px !important;
    row-gap: 10px !important;
  }

  article[data-screen-label="CMS article"] h1 {
    margin: 0 0 8px !important;
    font-size: clamp(24px, 6.8vw, 30px) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.5px !important;
  }

  article[data-screen-label="CMS article"] h1 + * {
    margin-top: 0 !important;
  }

  article[data-screen-label="CMS article"] p {
    line-height: 1.55 !important;
  }

  article[data-screen-label="CMS article"] h1 ~ p:first-of-type {
    margin: 0 0 12px !important;
    font-size: 17px !important;
  }
}

/* Desktop: comfortable reading width */
@media (min-width: 1024px) {
  #dc-root .rm-main article[data-screen-label="CMS article"] {
    max-width: 800px !important;
    margin-inline: auto !important;
  }
}
