/**
 * Plugin tokens — a fallback layer.
 *
 * The design uses variables (--c-*, fonts, radii, shadows) that on the site
 * of origin came from the child theme. Installed over ANY other theme
 * (sloth, Hello Elementor, a client's own) those variables do not exist and
 * the CSS fails silently: the gradients are cancelled and text with
 * `-webkit-text-fill-color: transparent` becomes INVISIBLE.
 *
 * That is why the plugin ships its own values here, with the SAME names and
 * the SAME values as the original child theme, so it renders identically on
 * both sites. They sit on the plugin's containers (not on :root) so as not to
 * contaminate the rest of the client's website.
 *
 * A theme wanting to reskin can override them with more specificity.
 */
.sr-wiki,
.sr-doc {
  --c-ink-deep: #0E1D41;
  --c-ink: #244378;
  --c-accent: #f97316;
  --c-accent-hov: #ea580c;
  --c-accent-soft: #fff5ec;
  /* The accent as small text: #f97316 on --c-accent-soft reads at 2.6:1, and
     small text needs 4.5:1. This one gives 4.8:1. */
  --c-accent-ink: #c2410c;
  --c-glow: #22d3ee;
  --c-glow-soft: #ecfeff;
  --c-text: #33405a;
  --c-text-soft: #68738a;
  --c-border: #e5eaf1;
  --c-line: #eef1f6;
  --c-yes-text: #0f7a55;
  /*
   * The ScaleReady site loads ONE font only: Barlow, in weights 400 to 800
   * (sloth theme, functions.php). The body pointed at Mulish, which the theme
   * does NOT load: on stage it fell back to Helvetica and the catalogue text
   * looked different from the rest of the site. Both variables now point at
   * Barlow, and the weights this CSS uses (500, 600, 700, 800) are all among
   * the ones the theme downloads, so no extra font has to be requested.
   */
  /*
   * The TYPEFACE is the THEME's call, not ours.
   *
   * It was pinned to Barlow, which is the stage site's. Installed over another
   * theme —production uses Roboto— the catalogue came out in a font different
   * from the rest of the site, which is exactly what we do not want: this is a
   * section of the site, not an island. With `inherit` it adopts the theme's
   * wherever it is installed, and if it ever has to be forced, the variable is
   * redefined from the theme without touching the plugin.
   *
   * On ScaleReady that is exactly what happens, from the plugin itself: when
   * ScaleReady Components is installed, Typography.php declares its Barlow and
   * Mulish and points these two variables at them, so ScaleWiki reads like the
   * application pages. Without Components they stay `inherit`.
   */
  --font-display: inherit;
  --font-body: inherit;
  --r-sm: 6px;
  --r-md: 12px;
  --r-btn: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;
  --sh-soft: 0 4px 15px rgba(20,29,55,.05);
  --sh-card: 0 10px 30px rgba(20,29,55,.06);
  --sh-card-hov: 0 18px 44px rgba(20,29,55,.12);
  --sp-sm: .67rem;
  --sp-md: 1rem;
  --sp-lg: 1.5rem;
  --sp-xl: 2.25rem;
  --sp-2xl: 3.38rem;
  --sp-3xl: 5.06rem;
  --ease-expo: cubic-bezier(.16,1,.3,1);
  --ease-out: cubic-bezier(.2,.7,.2,1);
  --t-reveal: .7s;
  --t-micro: .22s;
}

/* ── Fitting the host theme ───────────────────────────────────────────────
 *
 * The plugin ships its own 1200px container, which is the width of the site
 * it was born on. Over the ScaleReady theme (sloth) the nav runs at 91.5rem
 * with 3.0625rem of side padding, so the catalogue came out ~230px narrower
 * than the menu and read as misaligned.
 *
 * It applies ONLY when that header exists: on any other theme the plugin
 * keeps its own width and there is nothing to adjust.
 */
body:has(header.site-header) .sr-wiki .wrap,
body:has(header.site-header) .sr-doc .wrap {
  max-width: 91.5rem;
  padding-inline: 1.25rem;
}
@media (min-width: 87.5em) {
  body:has(header.site-header) .sr-wiki .wrap,
  body:has(header.site-header) .sr-doc .wrap { padding-inline: 3.0625rem; }
}

/* The hero and the sticky filters are calculated for a 96px header
 * (the site of origin's). ScaleReady's is 221px because of the logo's
 * decorative circle, so the eyebrow was covered and the filters hid
 * themselves on scroll. They are recalculated with the real height.
 *
 * That header also SHRINKS once the page scrolls, so a fixed 221px left the
 * stuck filters floating well below the small header. wiki.js measures the
 * header's real bottom edge and keeps it in --srw-header-h; 221px is only the
 * value without JavaScript. */
body:has(header.site-header) .sr-wiki .wiki-hero {
  padding-top: calc(221px + 60px);
}
body:has(header.site-header) .sr-wiki .wiki-filters {
  top: calc(var(--srw-header-h, 221px) + 32px);
  max-height: calc(100vh - var(--srw-header-h, 221px) - 32px);
  transition: top .2s ease, max-height .2s ease;
}

/* Below 67.5613em the theme switches to its small header: 133px instead of
 * 221px, with the logo's circle reaching 148px. The 221px kept for desktop
 * (SR_MS_HEADER_OFFSET on the resource page, 221px + 60px on the catalogue)
 * left 90 to 150px of empty space on phones and tablets. The breakpoint is the
 * theme's own, so the two always switch together. */
@media (max-width: 67.5613em) {
  body:has(header.site-header) .sr-doc { padding-top: 133px; }
  body:has(header.site-header) .sr-wiki .wiki-hero { padding-top: calc(133px + 40px); }
}

/* ── The ® mark, as ScaleReady Components sets it ────────────────────────
 *
 * The model names carry the ® character (G-Rex®10M) and the templates wrap it
 * in <sup class="sr-reg">, the same markup Components prints. Components only
 * styles it on pages with its widgets, so the rule is repeated here, scoped to
 * the plugin: a small superscript in body text, smaller and higher in titles.
 * The tags and chips are small bold labels, where the body size still read as
 * a full-size mark, so they take the title size too. */
.sr-wiki sup.sr-reg,
.sr-doc sup.sr-reg {
  font-family: var(--font-display, "Barlow", sans-serif);
  font-weight: inherit;
  font-size: .90em;
  line-height: 0;
  vertical-align: baseline;
  position: relative;
  top: -.04em;
}
.sr-wiki :is(h1, h2, h3, h4, h5, h6, .tag, .chip, .chip-group-label) sup.sr-reg,
.sr-doc :is(h1, h2, h3, h4, h5, h6, .ms-chip, .rc-kind, .related-title, .ms-detail) sup.sr-reg {
  font-size: .70em;
  top: -.26em;
}
/* The tags and chips are inline-flex with a gap, and the ® is one of their flex items: the gap opened on both sides of
 * the mark («G-Rex ® 10»). The mark takes it back. The gap is in the label's em; the mark is .70 of it. */
.sr-wiki .pub-tags .tag > sup.sr-reg { margin-inline: calc(-.35em / .7); }
.sr-doc .ms-chip > sup.sr-reg { margin-inline: calc(-.4em / .7); }
