/* Article section (/articles) -- CONTENT styles only.
   The header, footer, fonts and palette come from /ayuslab-styles.css so these
   pages are visually part of the marketing site. Everything here is prefixed
   .rs- and inherits the site's :root variables. */

.rs-page{
  --rs-ink:var(--ink, #0B1224);
  --rs-ink2:var(--muted, #4B5563);
  --rs-muted:#6B7280;
  --rs-line:var(--line, #E2E5EA);
  --rs-line2:#EFF1F4;
  --rs-accent:var(--orange, #E97724);
  --rs-accent-deep:var(--orange-deep, #C45D14);
  --rs-accent-soft:var(--orange-soft, #FFF1E5);
  --rs-navy:var(--navy, #0F1A33);
  --rs-soft:var(--paper-2, #F6F7F9);
  color:var(--rs-ink);
}

/* Match the site's container width and gutters exactly */
.rs-wrap{max-width:1320px;margin:0 auto;padding:0 48px}
/* Base link colour. Wrapped in :where() so it contributes ZERO specificity to
   the .rs-page part -- otherwise `.rs-page a` (0,1,1) silently outranks every
   single-class component like .rs-btn or .rs-tag (0,1,0) and repaints their
   text. That is how the CTA button ended up with orange text on an orange
   background. Component classes must always win over this default. */
:where(.rs-page) a{color:var(--rs-accent)}
.rs-page img{max-width:100%;height:auto}

/* ---------- breadcrumb ----------
   The site stylesheet targets the bare `nav` element for the sticky site
   header (display:flex, justify-content:space-between, position:sticky,
   padding:18px 48px). A semantic <nav> breadcrumb inherits all of it, so each
   property is reset explicitly rather than by dropping the element. */
.rs-page nav.rs-crumb{
  position:static;top:auto;z-index:auto;
  background:none;backdrop-filter:none;-webkit-backdrop-filter:none;
  border-bottom:none;
  display:block;
  padding:28px 0 0;
  font-size:13px;color:var(--rs-muted);
}
.rs-crumb a{color:var(--rs-muted);text-decoration:none}
.rs-crumb a:hover{color:var(--rs-accent);text-decoration:underline}
.rs-crumb span{color:var(--rs-ink2)}

/* ---------- hero ---------- */
.rs-hero{padding:26px 0 34px;border-bottom:1px solid var(--rs-line2);margin-bottom:38px}
.rs-hero h1{font-size:44px;line-height:1.1;letter-spacing:-.025em;color:var(--rs-navy);margin:0 0 14px;font-weight:700}
.rs-hero p{font-size:18px;color:var(--rs-ink2);margin:0;max-width:640px;line-height:1.55}

/* ---------- layout ---------- */
.rs-layout{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:60px;align-items:start;padding-bottom:80px}
/* The article fills its grid column, same as a card listing. Kept as a hook for
   capping the article width later if long lines become a problem. */
.rs-main{min-width:0}
.rs-article{max-width:none}
/* Title, summary and image span the full content width, across both the text
   column and the sidebar column below; the "On this page" box starts level
   with the article text, under the image. */

/* ---------- listing cards ---------- */
/* ---------- topic pills ---------- */
.rs-topics{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin:0 0 36px}
.rs-topic{
  display:inline-block;padding:9px 20px;border:1px solid var(--rs-line);border-radius:999px;
  background:#fff;color:var(--rs-ink2);font-size:15px;font-weight:500;line-height:1.2;
  text-decoration:none;transition:border-color .15s, color .15s, background .15s;
}
.rs-topic:hover{border-color:var(--rs-accent);color:var(--rs-accent-deep)}
.rs-topic.is-active{background:var(--rs-accent);border-color:var(--rs-accent);color:#fff}

/* ---------- article card grid ---------- */
.rs-listing{padding-bottom:80px}
.rs-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:28px}
.rs-tile{
  display:flex;flex-direction:column;
  background:#fff;border:1px solid var(--rs-line);border-radius:16px;overflow:hidden;
  text-decoration:none;color:inherit;
  transition:box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.rs-tile:hover{
  box-shadow:0 4px 12px rgba(15,23,42,.06), 0 12px 28px rgba(15,23,42,.08);
  border-color:#d3dae4;transform:translateY(-2px);
}
/* One tab stop per article, with a clear focus ring for keyboard users. */
.rs-tile:focus-visible{outline:3px solid var(--rs-accent);outline-offset:3px}

/* A fixed 16:9 slot, inset in the card. The whole image is shown (contain,
   not cover): a 16:9 upload fills it exactly, and any other shape sits on a
   white band that blends into the white card instead of being cropped. The
   image is absolutely positioned so an upload can never change the card's
   size. */
.rs-tile-media{
  position:relative;aspect-ratio:16/9;margin:16px 16px 0;
  border-radius:10px;overflow:hidden;background:#fff;
}
.rs-tile-media img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block}
.rs-tile-fallback{
  position:absolute;inset:0;display:flex;align-items:flex-end;padding:20px;
}
.rs-tile-fallback:after{
  content:"";position:absolute;top:-30%;left:-15%;width:150%;height:60%;
  background:rgba(255,255,255,.10);transform:rotate(-24deg);
}
.rs-tile-fallback-txt{
  position:relative;color:#fff;font-family:Georgia,"Times New Roman",serif;
  font-size:20px;line-height:1.25;opacity:.94;
}

/* The body stretches so the footer sits on the same line in every card of a
   row, whatever the title and summary lengths. */
.rs-tile-body{display:flex;flex-direction:column;flex:1;padding:18px 20px 20px}
.rs-tile-meta{
  margin:0 0 10px;font-size:14px;color:var(--rs-muted);
  display:flex;justify-content:space-between;gap:10px;
}
.rs-tile-cat{color:var(--rs-accent-deep);font-weight:600}
/* Title and summary are clamped so cards in a row keep the same rhythm. */
.rs-tile-title{
  margin:0 0 10px;font-size:19px;line-height:1.35;color:var(--rs-navy);font-weight:650;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.rs-tile:hover .rs-tile-title{color:var(--rs-accent-deep)}
.rs-tile-excerpt{
  margin:0 0 18px;color:var(--rs-ink2);font-size:15px;line-height:1.6;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
}
.rs-tile-foot{
  margin:auto 0 0;display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  font-size:14px;color:var(--rs-muted);
}
.rs-tile-avatar{
  width:32px;height:32px;border-radius:50%;object-fit:cover;flex:none;
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--rs-accent-soft);color:var(--rs-accent-deep);font-size:12px;font-weight:700;
}
.rs-tile-author{color:var(--rs-ink);font-weight:600}
.rs-tile-foot .rs-dot{color:var(--rs-line)}

/* ---------- back links ---------- */
.rs-back-foot{margin:44px 0 0;padding-bottom:80px;font-size:15px;text-align:center}
.rs-back-foot a{color:var(--rs-accent-deep);font-weight:600;text-decoration:none}
.rs-back-foot a:hover{text-decoration:underline}

/* ---------- article header ---------- */
.rs-head{margin:22px 0 18px}
.rs-head h1{
  margin:0 0 14px;color:var(--rs-navy);font-family:Georgia,"Times New Roman",serif;
  font-size:42px;line-height:1.16;letter-spacing:-.01em;font-weight:700;
}
.rs-head-meta{
  margin:0;color:var(--rs-muted);font-size:14.5px;
  display:flex;flex-wrap:wrap;gap:8px;align-items:center;
}
.rs-head-meta strong{color:var(--rs-ink);font-weight:600}
.rs-head-meta .rs-dot{color:var(--rs-line)}

/* ---------- article image ---------- */
.rs-figure{margin:0 0 34px}
/* Capped at 1200px, the width of the `large` rendition, so the image is never
   upscaled (and softened) on wide screens. Centred in the content width. */
.rs-figure img{display:block;width:100%;max-width:1200px;height:auto;margin:0 auto;border-radius:14px}
.rs-figure figcaption{margin:10px 0 0;font-size:13.5px;color:var(--rs-muted);text-align:center}

@media (max-width:768px){
  .rs-head h1{font-size:29px}
  .rs-figure{margin-bottom:26px}
}

/* ---------- article ---------- */
.rs-lede{font-size:20px;line-height:1.58;color:var(--rs-ink2);margin:0 0 30px}

.rs-body{font-size:17.5px;line-height:1.78;color:var(--rs-ink)}
.rs-body > *:first-child{margin-top:0}
.rs-body h2{font-size:28px;line-height:1.28;margin:46px 0 14px;color:var(--rs-navy);font-weight:650;letter-spacing:-.02em;scroll-margin-top:96px}
.rs-body h3{font-size:21px;line-height:1.35;margin:34px 0 10px;color:var(--rs-navy);font-weight:650;scroll-margin-top:96px}
.rs-body p{margin:0 0 22px}
.rs-body ul,.rs-body ol{margin:0 0 22px;padding-left:26px}
.rs-body li{margin-bottom:9px}
.rs-body a{color:var(--rs-accent);text-decoration:underline;text-underline-offset:2px}
.rs-body table{border-collapse:collapse;width:100%;margin:26px 0;font-size:15.5px;display:block;overflow-x:auto}
.rs-body th,.rs-body td{border:1px solid var(--rs-line);padding:11px 14px;text-align:left}
.rs-body th{background:var(--rs-soft);font-weight:600;color:var(--rs-navy)}
.rs-body blockquote{border-left:3px solid var(--rs-accent);margin:26px 0;padding:4px 0 4px 22px;color:var(--rs-ink2)}
.rs-body blockquote p:last-child{margin-bottom:0}
.rs-body pre{background:var(--rs-soft);border:1px solid var(--rs-line2);padding:18px;border-radius:10px;overflow-x:auto;font-size:14px;font-family:var(--mono,monospace)}
.rs-body code{background:var(--rs-soft);padding:2px 6px;border-radius:4px;font-size:15px;font-family:var(--mono,monospace)}
.rs-body pre code{background:none;padding:0}
.rs-body img{border-radius:10px;margin:8px 0}
.rs-body hr{border:none;border-top:1px solid var(--rs-line);margin:40px 0}

/* ---------- opt out of the site's scroll-reveal ----------
   ayuslab-script.js adds .reveal (opacity:0) to EVERY <section> and only
   un-hides it when an IntersectionObserver fires. On an article page the only
   two <section> elements are the CTA and the related-articles block -- the
   conversion path and internal linking. Those are content, not decoration, and
   must not disappear if the observer never fires (JS error earlier on the page,
   an older browser, a bot that runs scripts but does not scroll).
   Specificity (0,2,0) beats .reveal without needing !important. */
.rs-page .reveal,
.rs-page .reveal-left,
.rs-page .reveal-right,
.rs-page .reveal-scale{opacity:1;transform:none}

/* ---------- CTA ---------- */
.rs-cta{background:var(--rs-accent-soft);border:1px solid #F6D9BC;border-radius:16px;padding:30px 32px;margin:16px 0 0}
.rs-cta h3{margin:0 0 8px;color:var(--rs-navy);font-size:21px;font-weight:700;letter-spacing:-.015em}
.rs-cta p{margin:0;color:var(--rs-ink2);font-size:16px;max-width:540px}
/* Uses --orange-deep rather than --orange: white on #E97724 is only 2.95:1,
   which is hard to read at 15.5px. The deeper tone is already in the site
   palette and lifts it to ~4.3:1. */
.rs-btn{
  display:inline-block;background:var(--rs-accent-deep);color:#fff;padding:12px 24px;border-radius:8px;
  text-decoration:none;margin-top:18px;font-weight:600;font-size:15.5px;
}
.rs-btn:hover{background:#a94e11;color:#fff}

/* ---------- related ---------- */
/* Next article: one soft panel under the article, the whole panel a link.
   Left-aligned with the text column above it. */
.rs-article .rs-layout{padding-bottom:0}
.rs-next{
  display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:18px;
  margin:48px 0 0;padding:22px 26px;
  background:var(--rs-soft);border:1px solid var(--rs-line);border-radius:14px;
  text-decoration:none;color:inherit;
  transition:border-color .15s, background .15s, box-shadow .15s;
}
.rs-next:hover{
  background:var(--rs-accent-soft);border-color:#F3D3B2;
  box-shadow:0 6px 20px rgba(15,26,51,.06);
}
.rs-next-body{min-width:0}
.rs-next-label{
  display:block;margin-bottom:6px;font-size:12px;font-weight:600;letter-spacing:.06em;
  text-transform:uppercase;color:var(--rs-muted);
}
.rs-next-title{
  display:block;font-size:21px;line-height:1.35;font-weight:650;color:var(--rs-navy);
}
.rs-next:hover .rs-next-title{color:var(--rs-accent-deep)}
/* Two lines at most, so the panel keeps its height whatever the summary. */
.rs-next-summary{
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  margin-top:6px;font-size:15px;line-height:1.55;color:var(--rs-ink2);
}
.rs-next-arrow{
  display:inline-flex;align-items:center;justify-content:center;flex:none;
  width:40px;height:40px;border-radius:50%;background:#fff;
  border:1px solid var(--rs-line);color:var(--rs-accent-deep);font-size:18px;
  transition:transform .15s, border-color .15s;
}
.rs-next:hover .rs-next-arrow{transform:translateX(3px);border-color:var(--rs-accent)}

@media (max-width:640px){
  .rs-next{padding:18px 20px;gap:14px}
  .rs-next-title{font-size:18px}
  .rs-next-arrow{width:34px;height:34px;font-size:16px}
}

/* ---------- sidebar ---------- */
.rs-side{position:sticky;top:100px}
/* "On this page" as a card: heading over a divider, then the section links. */
.rs-toc{
  background:#fff;border:1px solid var(--rs-line);border-radius:14px;overflow:hidden;
  box-shadow:0 4px 18px rgba(15,23,42,.05);
}
.rs-toc h4{
  margin:0;padding:18px 20px;border-bottom:1px solid var(--rs-line2);
  font-size:16px;font-weight:650;color:var(--rs-navy);
}
.rs-side ul{list-style:none;padding:10px 12px 12px;margin:0;max-height:calc(100vh - 220px);overflow-y:auto}
.rs-side li{margin-bottom:2px}
.rs-side a{
  color:var(--rs-ink2);text-decoration:none;font-size:14px;display:block;padding:7px 0 7px 13px;
  border-left:2px solid #F3D9C0;line-height:1.45;
  transition:border-color .18s ease, color .18s ease, background .18s ease;
}
.rs-side a:hover{color:var(--rs-navy);border-left-color:var(--rs-accent);background:var(--rs-soft)}
/* Scroll-spy: the section currently in view gets a solid orange marker.
   Purely decorative -- with JavaScript off the list still reads and links
   still work (acceptance criterion #5). */
.rs-side a.is-active{
  color:var(--rs-navy);font-weight:600;
  border-left-color:var(--rs-accent-deep);border-left-width:3px;
  padding-left:12px;background:var(--rs-accent-soft);
}
.rs-side .lvl3{padding-left:26px;font-size:13.5px}

/* ---------- pagination ----------
   Markup comes from articles/_pager.html.erb, not from will_paginate: the
   app-wide helper is pinned to the admin's Bootstrap renderer.
   Named .rs-pg, not .rs-page: the layout's <main> already carries .rs-page. */
.rs-pager{
  display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:8px;
  margin:56px 0 0;
}
.rs-pg{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  min-width:42px;height:42px;padding:0 14px;box-sizing:border-box;
  border:1px solid var(--rs-line);border-radius:10px;background:#fff;
  color:var(--rs-ink2);font-size:15px;font-weight:500;line-height:1;text-decoration:none;
  transition:border-color .15s, color .15s, background .15s;
}
.rs-pg:hover{border-color:var(--rs-accent);color:var(--rs-accent-deep)}
.rs-pg.is-current{
  background:var(--rs-accent);border-color:var(--rs-accent);color:#fff;font-weight:600;
}
/* Previous/Next at the ends of the range stay in place, greyed out, so the
   row does not shift as you page through. */
.rs-pg.is-disabled{color:#BFC6D1;border-color:var(--rs-line2);background:transparent}
.rs-pg-gap{
  min-width:24px;text-align:center;color:var(--rs-muted);font-size:15px;
}

@media (max-width:640px){
  .rs-pager{gap:6px;margin-top:32px}
  .rs-pg{min-width:38px;height:38px;padding:0 10px;font-size:14px}
  /* Arrows only, so the row still fits on one line on a phone. */
  .rs-pg-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
}

/* ---------- states ---------- */
.rs-empty{padding:80px 0;text-align:center;color:var(--rs-muted)}
.rs-empty h1{font-size:29px;color:var(--rs-navy);margin:0 0 12px;font-weight:700}
.rs-preview-bar{background:#FFF8E6;border-bottom:1px solid #ECD9A4;padding:12px 0;font-size:14px;color:#6B5106}

@media (max-width:1024px){
  .rs-layout{grid-template-columns:1fr;gap:0}
  /* Single column: the contents box goes between the image and the article
     text. The column's children are hoisted into the grid (display:contents)
     so the box can be ordered between them -- ordering .rs-side alone would
     put it above the title, since it is a sibling of the whole column. */
  .rs-main{display:contents}
  .rs-article-top{order:-2}
  .rs-side{position:static;order:-1;margin:0 0 30px}
  .rs-side ul{max-height:none}
  .rs-main{max-width:none}
}
@media (max-width:1024px){
  .rs-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}
}
@media (max-width:640px){
  .rs-grid{grid-template-columns:1fr}
  .rs-topics{justify-content:flex-start;gap:8px;margin-bottom:26px}
  .rs-topic{padding:8px 16px;font-size:14px}
}
@media (max-width:768px){
  .rs-wrap{padding:0 20px}
    .rs-hero h1{font-size:31px}
  .rs-body{font-size:16.5px}
}

/* ---------- author bios ---------- */
/* Padding set on all four sides: the site stylesheet pads every bare
   `section` (up to 160px 56px), and setting only padding-top left the rest
   of that in place -- a large gap below the bios and an indent on the left. */
.rs-authors{margin:32px 0 0;padding:22px 0 0;border-top:1px solid var(--rs-line2)}
.rs-authors h3{
  font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:var(--rs-muted);
  margin:0 0 18px;font-weight:600;
}
.rs-author{display:flex;gap:16px;padding:12px 0;border-bottom:1px solid var(--rs-line2)}
.rs-author:last-child{border-bottom:none}
.rs-author-avatar{
  flex:none;width:52px;height:52px;border-radius:50%;background:var(--rs-navy);color:#fff;
  display:flex;align-items:center;justify-content:center;font-weight:600;font-size:17px;letter-spacing:.02em;
}
.rs-author-body{min-width:0}
.rs-author-name{margin:0 0 3px;font-size:16.5px;font-weight:650;color:var(--rs-navy)}
.rs-author-cred{font-weight:400;color:var(--rs-ink2)}
.rs-author-title{margin:0 0 6px;font-size:14px;color:var(--rs-muted)}
.rs-author-bio{margin:0;font-size:15px;line-height:1.6;color:var(--rs-ink2)}
.rs-author-link{display:inline-block;margin-top:7px;font-size:14px;font-weight:600;color:var(--rs-accent-deep)}
