/* ============================================
   RELIABILITY FACTORY — Resources section styles
   Shared by resources/index.html and all
   resource summary articles.
   ============================================ */

/* ===== Listing page ===== */

/* Shelf hero — text left, illustration right */
.shelf-hero { padding-bottom: 28px; }
.shelf-hero .container { position: relative; }
.shelf-hero .container::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: 40px;
  background: linear-gradient(90deg, transparent, var(--grey-border) 18%, var(--grey-border) 82%, transparent);
}
.shelf-hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 52px;
  align-items: center;
}
@media (max-width: 920px) {
  .shelf-hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .shelf-hero-media { order: -1; max-width: 420px; }
}
.shelf-hero-text h1 {
  font-size: clamp(32px, 4.4vw, 50px);
  line-height: 1.07;
  letter-spacing: -0.02em;
  margin: 16px 0 16px;
  max-width: 16ch;
}
.shelf-hero-text .article-lede {
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0;
  text-align: left;
}

.shelf-cta {
  margin-top: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.shelf-cta-copy {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 30ch;
}
.shelf-cta-btn {
  flex-shrink: 0;
  padding: 9px 16px;
  font-size: 13px;
}
.shelf-cta-btn svg { width: 15px; height: 15px; }

.shelf-hero-media { position: relative; }
.shelf-hero-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 600px;
  object-fit: cover;
  object-position: center top;
  border-radius: 16px;
  border: 1px solid var(--grey-border);
  box-shadow: var(--shadow-lg);
}

.res-intro {
  max-width: 760px;
}
.res-intro p {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.res-group { margin-top: 56px; }
.res-group:first-of-type { margin-top: 24px; }
.res-group:not(:first-of-type) { margin-top: 0; }
.res-group:not(:first-of-type)::before {
  content: "";
  display: block;
  height: 1px;
  margin: 60px 0;
  background: linear-gradient(90deg, transparent, var(--grey-border) 18%, var(--grey-border) 82%, transparent);
}
.res-group-head { margin-bottom: 22px; }
.res-group-head h2 {
  font-size: clamp(22px, 2.6vw, 30px);
  margin: 0 0 8px;
}
.res-group-head p {
  font-size: 14.5px;
  color: var(--text-muted);
  max-width: 64ch;
}

.res-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 1080px) { .res-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .res-grid { grid-template-columns: 1fr; } }

.res-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: white;
  border: 1px solid var(--grey-border);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  transition: all .25s;
}
.res-card.has-banner {
  padding: 0;
  background: #fff;
}
.res-card-banner {
  position: relative;
  line-height: 0;
  overflow: hidden;
  background: #eef3f8;
}
.res-card-banner img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.45s ease;
}
.res-card.has-banner:hover .res-card-banner img {
  transform: scale(1.04);
}
.res-card-banner::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 56px;
  background: linear-gradient(to bottom, transparent, #fff);
  pointer-events: none;
}
.res-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  z-index: 1;
  margin-top: -10px;
  padding: 0 22px 22px;
  background: #fff;
}
.res-card-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.res-card-headline .stars {
  flex-shrink: 0;
  margin-top: 2px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.18);
  font-size: 11px;
  letter-spacing: 1.5px;
}
.res-card.has-banner h3 {
  margin: 0 0 4px;
  font-size: 16.5px;
  line-height: 1.3;
}
.res-card.has-banner .res-author {
  margin: 0;
}
.res-card-body > p:not(.res-author) {
  flex: 1;
  margin-top: 10px;
}
.res-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(0,184,214,0.4);
}

.res-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.res-card .uc-icon { margin-bottom: 0; }

.stars {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--orange);
  white-space: nowrap;
}
.stars .off { color: var(--rr-steel); }

.res-card h3 { font-size: 17px; margin: 0 0 4px; }
.res-card .res-author {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.res-card > p:not(.res-author),
.res-card-body > p:not(.res-author) {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  flex: 1;
  margin: 0;
}

.res-card-foot {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.res-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--grey-border);
  color: var(--text-secondary);
  transition: all .2s;
}
.res-btn:hover { border-color: var(--rr-cyan-shade); color: var(--text-primary); }
.res-btn svg { width: 13px; height: 13px; }
.res-btn.primary {
  background: linear-gradient(135deg, var(--rr-cyan-shade), var(--rr-deep));
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(10, 18, 32, 0.14);
}
.res-btn.primary:hover { filter: brightness(1.08); color: white; }

.res-soon {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(138,148,166,0.14);
  color: var(--text-muted);
}

/* ===== Article pages ===== */

/* Shell — sticky side TOC */
.article-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding: 0 0 80px;
}
@media (max-width: 1080px) {
  .article-shell { grid-template-columns: 1fr; gap: 0; }
}

.article-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
}
@media (max-width: 1080px) {
  .article-toc {
    position: sticky;
    top: 72px;
    z-index: 25;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 -20px 28px;
    padding: 10px 20px;
    background: rgba(245,248,251,0.92);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--grey-border);
    -webkit-overflow-scrolling: touch;
  }
}

.article-toc-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
}
@media (max-width: 1080px) { .article-toc-label { display: none; } }

.article-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--grey-border);
}
@media (max-width: 1080px) {
  .article-toc-list {
    display: flex;
    gap: 8px;
    border-left: none;
    padding-bottom: 2px;
  }
}
.article-toc-list li { margin: 0; }
.article-toc-list a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -2px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.35;
  transition: color 0.15s ease, border-color 0.15s ease;
}
@media (max-width: 1080px) {
  .article-toc-list a {
    flex: 0 0 auto;
    padding: 7px 14px;
    margin-left: 0;
    border-left: none;
    border: 1px solid var(--grey-border);
    border-radius: 999px;
    background: var(--white);
    font-size: 12.5px;
    white-space: nowrap;
  }
}
.article-toc-list a:hover { color: var(--accent-a); }
.article-toc-list a.is-active {
  color: var(--accent-a);
  font-weight: 600;
  border-left-color: var(--accent-a);
}
@media (max-width: 1080px) {
  .article-toc-list a.is-active {
    border-color: var(--accent-a);
    background: rgba(0,184,214,0.08);
  }
}

.article-body { min-width: 0; }
.article-body .section { padding-top: 48px; padding-bottom: 48px; }
.article-body .section:first-child { padding-top: 12px; }
.article-section { scroll-margin-top: 100px; }
.article-body .section-head { max-width: none; margin-bottom: 24px; }
.article-body .section-head h2 { margin: 0 0 12px; color: var(--text-primary); }
.article-body .section-head p {
  margin-top: 0;
  font-size: 16px;
  line-height: 1.6;
  max-width: 62ch;
  text-align: justify;
  hyphens: auto;
}

/* Article header */
.article-head { padding: 30px 0 14px; }
.article-head .eyebrow { margin-bottom: 18px; }
.article-head h1 {
  font-size: clamp(32px, 4.6vw, 52px);
  line-height: 1.07;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  max-width: 20ch;
}
.article-lede {
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 56ch;
  margin: 0;
  text-align: justify;
  hyphens: auto;
}
.article-date {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--grey-border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Prose */
.prose { max-width: 720px; }
.prose.wide { max-width: none; }
.prose p {
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0 0 18px;
  text-align: justify;
  hyphens: auto;
}
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text-primary); }
.prose ul, .prose ol {
  margin: 0 0 18px;
  padding-left: 24px;
  color: var(--text-secondary);
  font-size: 15.5px;
  line-height: 1.65;
}
.prose li { margin-bottom: 6px; }
.prose li strong { color: var(--text-primary); }
.prose h3 { font-size: clamp(18px, 1.9vw, 22px); margin: 28px 0 12px; letter-spacing: -0.01em; }
.prose a.link {
  color: var(--accent-a);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(0,184,214,0.35);
  overflow-wrap: anywhere;
}
.prose a.link:hover { border-bottom-color: var(--accent-a); }
.prose h2 { font-size: clamp(24px, 2.6vw, 30px); margin: 0 0 14px; letter-spacing: -0.01em; }
.lede-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-a);
  margin: 0 0 10px;
}

.title-hand-line {
  display: inline-block;
  position: relative;
  padding-bottom: 10px;
}
.title-hand-line::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 280 7' preserveAspectRatio='none'%3E%3Cpath d='M1 4.8 C 38 6.2, 72 2.4, 108 4.6 S 188 6.4, 224 3.8 S 262 5.6, 279 4.2' fill='none' stroke='%2300B8D6' stroke-width='1.4' stroke-linecap='round' opacity='0.42'/%3E%3C/svg%3E") no-repeat left bottom / 100% 100%;
  pointer-events: none;
}

/* Source citation block */
.res-cite {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin: 26px 0 0;
  padding: 20px 22px;
  background: var(--white);
  border: 1px solid var(--grey-border);
  border-left: 3px solid var(--rr-cyan-shade);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.res-cite-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0,184,214,0.08);
  border: 1px solid rgba(0,184,214,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rr-cyan-shade);
}
.res-cite-icon svg { width: 20px; height: 20px; }
.res-cite-body { min-width: 0; }
.res-cite-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 6px;
}
.res-cite-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
  line-height: 1.35;
}
.res-cite-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.res-cite-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .res-cite { flex-direction: column; }
}

/* Figures (SVG diagrams) */
.res-figure {
  margin: 32px 0;
  background: var(--white);
  border: 1px solid var(--grey-border);
  border-radius: 14px;
  padding: 24px 24px 18px;
  box-shadow: var(--shadow-md);
}
.res-figure svg { width: 100%; height: auto; }
.res-figure figcaption {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--grey-border);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
@media (max-width: 560px) { .res-figure { padding: 14px 14px 12px; } }

/* Data tables */
.res-table-wrap { margin: 28px 0; overflow-x: auto; }
.res-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--grey-border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 13.5px;
}
.res-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-main);
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-border);
}
.res-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-border);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.5;
}
.res-table tr:last-child td { border-bottom: none; }
.res-table td strong { color: var(--text-primary); }
.res-table .mono { font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }

/* Key takeaway callout */
.res-callout {
  margin: 32px 0;
  padding: 22px 26px;
  background: var(--white);
  border: 1px solid var(--grey-border);
  border-left: 3px solid var(--rr-cyan-shade);
  border-radius: 12px;
}
.res-callout .res-callout-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-a);
  margin: 0 0 8px;
}
.res-callout p {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  text-align: justify;
  hyphens: auto;
}
.res-callout p strong { color: var(--text-primary); }

/* Numbered concept list (e.g. the 7 RCM questions) */
.num-list {
  list-style: none;
  margin: 28px 0;
  padding: 0;
  display: grid;
  gap: 10px;
  counter-reset: numlist;
}
.num-list li {
  counter-increment: numlist;
  position: relative;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--white);
  border: 1px solid var(--grey-border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.num-list li::before {
  content: counter(numlist);
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-a);
  background: rgba(0,184,214,0.1);
  border: 1px solid rgba(0,184,214,0.18);
  border-radius: 8px;
}
.num-list li strong { color: var(--text-primary); }

/* References list */
.ref-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.ref-list li {
  background: var(--white);
  border: 1px solid var(--grey-border);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.ref-list li strong { color: var(--text-primary); }
.ref-list li a {
  color: var(--accent-a);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.ref-list li a:hover { text-decoration: underline; }

/* Legal / attribution disclaimer (discreet) */
.res-disclaimer {
  margin: 28px 0 0;
  padding: 14px 18px;
  background: transparent;
  border-top: 1px solid var(--grey-border);
}
.res-disclaimer p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
  text-align: justify;
}
.res-disclaimer a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* Closing CTA strip back to resources */
.res-back {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Static figures: visible at first paint, including without JavaScript.
   SVG transform attributes are deliberately preserved on child elements. */
.rf-resources-page .res-figure.reveal,
.rf-resources-page .article-head.reveal,
.rf-resources-page .article-body .reveal {
  opacity: 1;
  transform: none;
  transition: none;
  animation: none;
}

/* ASM reading guide: static, responsive diagrams using the shared palette. */
.asm-phase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.asm-phase-grid > div { padding: 18px; background: #eef8fb; border-top: 3px solid #00b8d6; }
.asm-phase-grid span { font-family: var(--font-mono); color: #006a80; font-size: 12px; }
.asm-phase-grid h3 { margin: 10px 0; font-size: 22px; color: #0a2236; }
.asm-phase-grid p { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: #18324a; }
.asm-phase-grid small { display: block; font-size: 13px; line-height: 1.6; color: #526d88; }
.asm-feedback { margin: 16px 0 0; padding: 14px 18px; border-left: 3px solid #006a80; background: #f3f6fa; font-size: 14px; line-height: 1.6; color: #18324a; }
.asm-change-flow { margin: 0; padding: 0; list-style: none; counter-reset: asm-step; }
.asm-change-flow li { position: relative; counter-increment: asm-step; padding: 14px 0 14px 46px; border-bottom: 1px solid #dce5ed; }
.asm-change-flow li:last-child { border: 0; }
.asm-change-flow li::before { content: counter(asm-step, decimal-leading-zero); position: absolute; left: 0; top: 16px; color: #006a80; font: 13px var(--font-mono); }
.asm-change-flow strong { display: block; font-size: 16px; color: #0a2236; margin-bottom: 5px; }
.asm-change-flow span { font-size: 14px; line-height: 1.6; color: #526d88; }
@media (max-width: 600px) { .asm-phase-grid { grid-template-columns: 1fr; gap: 12px; } }
