/* Issue #432: article-scoped visual refinement for the published Plex forensic case study. */

.sp-article--the-database-had-been-wrong-for-twelve-years {
  --pf-dark: #11120f;
  --pf-dark-2: #1b1d19;
  --pf-cream: #f7efd9;
  --pf-gold: #e3bd73;
  --pf-soft-accent: color-mix(in srgb, var(--accent), transparent 92%);
  --pf-soft-trust: color-mix(in srgb, var(--trust), transparent 90%);
}

/* Featured operating architecture. */
.sp-article--the-database-had-been-wrong-for-twelve-years #the-application-never-needed-an-ai-feature > p:nth-of-type(4) {
  margin: 34px 0 38px;
  border: 1px solid color-mix(in srgb, var(--pf-gold), transparent 48%);
  border-radius: 18px;
  padding: clamp(24px, 4vw, 34px);
  background: linear-gradient(135deg, var(--pf-dark), var(--pf-dark-2));
  box-shadow: 0 18px 42px rgba(17, 18, 15, .16);
  color: var(--pf-cream);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1.15rem, 2.8vw, 1.7rem);
  font-weight: 820;
  line-height: 1.4;
  letter-spacing: -.025em;
  text-align: center;
  text-wrap: balance;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #the-application-never-needed-an-ai-feature > p:nth-of-type(4)::before {
  content: "OPERATING ARCHITECTURE";
  display: block;
  margin-bottom: 12px;
  color: var(--pf-gold);
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .16em;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #the-application-never-needed-an-ai-feature > p:nth-of-type(4) strong {
  color: inherit;
}

/* First-glance anomaly population. */
.sp-article--the-database-had-been-wrong-for-twelve-years #the-database-looked-much-worse-than-it-was > ul {
  counter-reset: pf-signal;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 32px 0 38px;
  padding: 0;
  border: 0;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #the-database-looked-much-worse-than-it-was > ul > li {
  counter-increment: pf-signal;
  position: relative;
  min-height: 104px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 21px 20px 21px 66px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-2), transparent 42%));
  box-shadow: 0 10px 28px rgba(17, 18, 15, .045);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(.98rem, 1.7vw, 1.08rem);
  font-weight: 760;
  line-height: 1.45;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #the-database-looked-much-worse-than-it-was > ul > li::before {
  content: "0" counter(pf-signal);
  position: absolute;
  top: 20px;
  left: 18px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pf-dark);
  color: var(--pf-gold);
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .06em;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #the-database-looked-much-worse-than-it-was > ul > li:last-child {
  grid-column: 1 / -1;
}

/* Historical snapshots as a real timeline. */
.sp-article--the-database-had-been-wrong-for-twelve-years #eventually-the-noise-started-collapsing > ol {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 30px 0 18px;
  padding: 0 0 0 36px;
  border: 0;
  list-style: none;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #eventually-the-noise-started-collapsing > ol::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 10px;
  width: 2px;
  background: color-mix(in srgb, var(--accent), var(--line) 35%);
}
.sp-article--the-database-had-been-wrong-for-twelve-years #eventually-the-noise-started-collapsing > ol > li {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 18px;
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .98rem;
  font-weight: 720;
  line-height: 1.45;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #eventually-the-noise-started-collapsing > ol > li::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -33px;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  border: 3px solid var(--page);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.sp-article--the-database-had-been-wrong-for-twelve-years #eventually-the-noise-started-collapsing > ol > li:nth-child(3) {
  border-color: color-mix(in srgb, var(--accent), var(--line) 40%);
  background: var(--pf-soft-accent);
}
.sp-article--the-database-had-been-wrong-for-twelve-years #eventually-the-noise-started-collapsing > ol + p {
  margin: 14px 0 36px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 15px 18px;
  background: var(--pf-soft-accent);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 840;
}

/* Duplicate-root and repair ledgers become proof surfaces. */
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-table-region,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-table-region {
  margin: 34px 0 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(17, 18, 15, .07);
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table {
  font-size: .88rem;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table thead,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table thead {
  background: var(--pf-dark);
  color: var(--pf-cream);
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table th,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table th {
  border-bottom-color: color-mix(in srgb, var(--pf-cream), transparent 76%);
  padding: 14px 16px;
  color: var(--pf-cream);
  font-size: .62rem;
  letter-spacing: .12em;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table td,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table td {
  padding: 16px;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table th:first-child,
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table td:first-child,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table th:first-child,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table td:first-child {
  padding-left: 16px;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table th:last-child,
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table td:last-child,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table th:last-child,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table td:last-child {
  padding-right: 16px;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table td:first-child,
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table td:first-child {
  font-weight: 820;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table td:last-child {
  color: var(--accent);
  font-size: 1.02rem;
  font-weight: 880;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table td:nth-child(3) {
  color: var(--trust);
  font-weight: 830;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-table-region + p {
  margin: 18px 0 34px;
  border: 1px solid color-mix(in srgb, var(--pf-gold), var(--line) 52%);
  border-radius: 14px;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--pf-gold), transparent 88%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 1.03rem;
  font-weight: 780;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-table-region + p {
  margin: 18px 0 32px;
  border: 1px solid color-mix(in srgb, var(--trust), var(--line) 48%);
  border-radius: 14px;
  padding: 17px 20px;
  background: var(--pf-soft-trust);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 840;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-table-region + p::before {
  content: "✓ ";
  color: var(--trust);
  font-weight: 950;
}

/* Fix the visible defect: remove the tiny duplicated SVG rail and make the six stages the primary visual. */
.sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-diagram {
  display: none;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures {
  counter-reset: pf-step;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 34px 0 32px;
  padding: 0;
  border: 0;
  background: transparent;
  list-style: none;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures li,
.sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures li:not(:nth-child(3n + 1)),
.sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures li:last-child {
  counter-increment: pf-step;
  grid-column: auto;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-content: start;
  min-height: 164px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 20px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-2), transparent 48%));
  box-shadow: 0 10px 28px rgba(17, 18, 15, .045);
}
.sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures li > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pf-dark);
  color: var(--pf-gold);
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .06em;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures strong {
  min-height: 0;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 790;
  line-height: 1.42;
}
.sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures p:empty {
  display: none;
}

@media (max-width: 820px) {
  .sp-article--the-database-had-been-wrong-for-twelve-years #the-database-looked-much-worse-than-it-was > ul,
  .sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures {
    grid-template-columns: 1fr;
  }
  .sp-article--the-database-had-been-wrong-for-twelve-years #the-database-looked-much-worse-than-it-was > ul > li:last-child {
    grid-column: auto;
  }
  .sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures li,
  .sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures li:not(:nth-child(3n + 1)),
  .sp-article--the-database-had-been-wrong-for-twelve-years #what-ai-actually-contributed .sp-process-failures li:last-child {
    min-height: 0;
    padding: 18px;
    border-left: 1px solid var(--line);
  }
  .sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-table-region,
  .sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-table-region {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
  .sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table tr,
  .sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 12px 14px;
    background: var(--surface);
  }
  .sp-article--the-database-had-been-wrong-for-twelve-years #we-finally-found-the-generator .sp-markdown-table td,
  .sp-article--the-database-had-been-wrong-for-twelve-years #so-we-repaired-the-cause-first .sp-markdown-table td {
    padding: 7px 0;
  }
}
