/* Rak Stimot Flow – editorial layer for pages, single jobs/guides/posts, archives and 404.
   Loaded after the approved preview styles and before accessibility-v17.css. Everything is scoped
   to .rsf-* (plus a few WordPress/admin-bar hooks), so the approved homepage is untouched.
   Sizes are in rem so the accessibility text-size setting scales them; viewport-based parts of
   fluid sizes are multiplied by --a11y-scale. */

/* ---------- WordPress hooks ---------- */
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Logged-in toolbar: the sticky header sits right below it. --rsf-adminbar and the matching
   scroll-padding are printed inline by functions.php only while the toolbar shows. */
body.admin-bar .site-header { top: 32px; }
@media screen and (max-width: 782px) {
  body.admin-bar .site-header { top: 46px; }
}
@media screen and (max-width: 600px) {
  body.admin-bar .site-header { top: 0; }
}
@media (max-height: 560px) {
  html[data-a11y-text] body.admin-bar .site-header { top: auto; }
}
@media (max-width: 899px) {
  html.js body.admin-bar .nav {
    max-height: calc(100vh - var(--a11y-header-box, var(--hh)) - var(--rsf-adminbar, 0px) - 12px);
    max-height: calc(100dvh - var(--a11y-header-box, var(--hh)) - var(--rsf-adminbar, 0px) - 12px);
  }
}
html.js[data-a11y-text] body.admin-bar .nav {
  max-height: calc(100vh - var(--a11y-header-box, var(--hh)) - var(--rsf-adminbar, 0px) - 12px);
  max-height: calc(100dvh - var(--a11y-header-box, var(--hh)) - var(--rsf-adminbar, 0px) - 12px);
}

/* ---------- Reviews shortcodes ---------- */
/* Cached review text keeps its own line breaks. */
.reviews-v14 .gr-text { white-space: pre-line; }
.reviews-v14 .gr-rating-only {
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.5;
}

/* ---------- Layout ---------- */
.rsf-main {
  --rsf-gutter: 1.25rem;
  --rsf-measure: 46rem;
  --rsf-wide: 72rem;
  display: block;
  padding-top: 2.5rem;
  overflow-x: clip;
}
.rsf-404 { padding-bottom: 4rem; }
.rsf-container {
  width: min(100% - 2 * var(--rsf-gutter), var(--rsf-wide));
  margin-inline: auto;
}
.rsf-container--measure { width: min(100% - 2 * var(--rsf-gutter), var(--rsf-measure)); }
.rsf-main > .home-contact { margin-top: 4rem; }

/* ---------- Page head ---------- */
.rsf-head { margin-bottom: 2rem; }
.rsf-title {
  color: var(--navy);
  font-size: clamp(1.75rem, calc(1.25rem + 2.2vw * var(--a11y-scale, 1)), 3rem);
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.rsf-lead {
  max-width: var(--rsf-measure);
  margin-top: .75rem;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.6;
}
.rsf-lead > * + * { margin-top: .75em; }
.rsf-meta {
  margin-top: .75rem;
  color: var(--muted);
  font-size: .9375rem;
}

/* Breadcrumbs */
.rsf-crumbs { margin-bottom: 1rem; }
.rsf-crumbs ol {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0 .5rem;
  margin: 0; padding: 0; list-style: none;
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.5;
}
.rsf-crumbs li { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.rsf-crumbs a {
  display: inline-flex; align-items: center; min-height: 2.75rem;
  color: var(--purple); font-weight: 700;
  text-decoration: underline; text-underline-offset: .2em;
}
.rsf-crumbs [aria-current] { color: var(--ink); overflow-wrap: anywhere; }
.rsf-crumbs-sep { display: inline-flex; flex: none; }
.rsf-crumbs-sep svg { width: 1rem; height: 1rem; }

/* ---------- Entry content (block editor output) ---------- */
.rsf-entry {
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.75;
  overflow-wrap: break-word;
}
.rsf-entry > * {
  width: min(100% - 2 * var(--rsf-gutter), var(--rsf-measure));
  margin-inline: auto;
}
.rsf-entry > .alignwide { width: min(100% - 2 * var(--rsf-gutter), var(--rsf-wide)); }
/* Full-width blocks and approved sections (e.g. [rsf_reviews]) bring their own .wrap. */
.rsf-entry > .alignfull,
.rsf-entry > section,
.rsf-entry > .home-sec { width: 100%; max-width: none; }
.rsf-entry > * + * { margin-top: 1.25em; }
.rsf-entry > :where(h2, h3, h4) { margin-top: 2em; }
.rsf-entry > :first-child { margin-top: 0; }

.rsf-entry h2 {
  color: var(--navy);
  font-size: clamp(1.375rem, calc(1.15rem + 1vw * var(--a11y-scale, 1)), 1.875rem);
  font-weight: 800;
  line-height: 1.3;
}
.rsf-entry h3 { color: var(--navy); font-size: 1.25rem; font-weight: 800; line-height: 1.35; }
.rsf-entry h4 { color: var(--navy); font-size: 1.0625rem; font-weight: 800; line-height: 1.4; }
.rsf-entry :where(h2, h3, h4) { overflow-wrap: anywhere; }

.rsf-entry :where(p, li, dd, td, figcaption) a:not(.btn):not(.wp-block-button__link) {
  color: var(--purple);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: max(1px, .06em);
  text-underline-offset: .2em;
}
.rsf-entry :where(ul, ol):not(.gr-list) { padding-inline-start: 1.5em; }
.rsf-entry :where(ul, ol):not(.gr-list) > li + li { margin-top: .4em; }
.rsf-entry > blockquote,
.rsf-entry .wp-block-quote {
  padding: .25rem 1.25rem;
  border-inline-start: 4px solid var(--pink);
  font-size: 1.125rem;
}
.rsf-entry :where(img, video, iframe, embed, object) { max-width: 100%; }
.rsf-entry :where(img, video) { height: auto; }
.rsf-entry .wp-block-image img,
.rsf-entry .wp-block-gallery img { border-radius: 1rem; }
.rsf-entry figcaption,
.rsf-entry .wp-element-caption {
  margin-top: .5rem;
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.5;
}
.rsf-entry .aligncenter { margin-inline: auto; text-align: center; }
@media (min-width: 40em) {
  .rsf-entry .alignleft { float: left; max-width: 50%; margin: .25em 0 1em 1.5em; }
  .rsf-entry .alignright { float: right; max-width: 50%; margin: .25em 1.5em 1em 0; }
}
.rsf-entry::after { content: ""; display: table; clear: both; }
.rsf-entry hr { height: 0; border: 0; border-top: 1px solid var(--line); }
.rsf-entry table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.rsf-entry :where(th, td) { padding: .5rem .75rem; border: 1px solid var(--line); text-align: start; vertical-align: top; }
.rsf-entry :where(pre, code) { direction: ltr; unicode-bidi: isolate; }
.rsf-entry pre { overflow-x: auto; padding: 1rem; border-radius: .75rem; background: var(--cyan-l); }

.rsf-page-links { display: flex; flex-wrap: wrap; gap: .5rem; }

.rsf-featured { margin: 0 auto 2rem; }
.rsf-featured img { display: block; width: 100%; height: auto; border-radius: 1.25rem; }

/* ---------- Pills (topics, empty state, 404) ---------- */
.rsf-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: .25rem 1rem;
  border: 2px solid var(--purple); border-radius: 999px;
  background: #fff; color: var(--purple);
  font-weight: 700; line-height: 1.3; text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.rsf-pill:hover { background: var(--purple-l); }
.rsf-pill:focus-visible { border-radius: 999px; }

.rsf-terms {
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.rsf-terms-title { color: var(--navy); font-size: 1rem; font-weight: 800; line-height: 1.4; }
.rsf-terms ul,
.rsf-links {
  display: flex; flex-wrap: wrap; gap: .5rem .75rem;
  margin: .75rem 0 0; padding: 0; list-style: none;
}
.rsf-links { margin-top: 1.5rem; }

/* ---------- Listing cards ---------- */
.rsf-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1.5rem;
  margin: 0; padding: 0; list-style: none;
}
.rsf-cards > li { display: flex; min-width: 0; }
.rsf-card {
  position: relative;
  display: flex; flex-direction: column;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: #fff;
  box-shadow: 0 18px 30px -24px rgba(35, 67, 88, .45);
}
.rsf-card-media img {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.rsf-card-body { display: grid; align-content: start; gap: .5rem; padding: 1.25rem; }
.rsf-card-label { color: var(--purple); font-size: .875rem; font-weight: 700; line-height: 1.4; }
.rsf-card-title {
  color: var(--navy);
  font-size: 1.25rem; font-weight: 800; line-height: 1.35;
  overflow-wrap: anywhere;
}
.rsf-card-title a { color: inherit; text-decoration: none; }
/* Whole card is the title link's hit area; the link text itself stays the accessible name. */
.rsf-card-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.rsf-card:hover .rsf-card-title a { text-decoration: underline; text-underline-offset: .2em; }
.rsf-card:has(.rsf-card-title a:focus-visible) { outline: 3px solid var(--navy); outline-offset: 3px; }
.rsf-card-title a:focus-visible { outline: none; }
.rsf-card-excerpt { color: var(--muted); line-height: 1.6; }
.rsf-card-meta { color: var(--muted); font-size: .875rem; }

/* Pagination */
.rsf-pagination { margin-top: 2.5rem; }
.rsf-pagination .nav-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem;
}
.rsf-pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 .875rem;
  border: 2px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--purple);
  font-weight: 700; text-decoration: none;
}
.rsf-pagination a.page-numbers:hover { border-color: var(--purple); background: var(--purple-l); }
.rsf-pagination .page-numbers.current { border-color: var(--purple); background: var(--purple); color: #fff; }
.rsf-pagination .page-numbers.dots { border-color: transparent; background: transparent; color: var(--muted); }

/* Empty state */
.rsf-empty {
  display: grid; justify-items: center; gap: .75rem;
  padding: 2rem 1.25rem;
  border: 2px dashed var(--line);
  border-radius: 1.25rem;
  color: var(--ink);
  font-size: 1.0625rem;
  text-align: center;
}

/* ---------- High contrast / forced colours ---------- */
html[data-a11y-contrast="high"] .rsf-card { border: 2px solid var(--ink); box-shadow: none; }
html[data-a11y-contrast="high"] .rsf-empty { border-color: var(--ink); }
html[data-a11y-contrast="high"] .rsf-pagination .page-numbers:not(.dots) { border-color: var(--ink); }
html[data-a11y-contrast="high"] .rsf-pill { border-color: #000; }
html[data-a11y-contrast="high"] .rsf-terms,
html[data-a11y-contrast="high"] .rsf-entry hr { border-color: var(--ink); }

@media (forced-colors: active) {
  .rsf-card, .rsf-pill, .rsf-pagination .page-numbers { border-color: CanvasText; }
  .rsf-pagination .page-numbers.current { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}

@media print {
  .rsf-main > .home-contact { display: none; }
  .rsf-card { box-shadow: none; }
}

/* Dynamic homepage jobs use the same cards as the archive. */
.rsf-more-jobs .home-h2 { margin-bottom: 1.5rem; }
.rsf-page .rsf-article { padding-bottom: 3rem; }

/* Keep before/after labels legible inside the article typography. */
.rsf-entry .toilet-label { color: var(--navy); margin-top: 0; }
