/* Shared article-content styles under staging evaluation.
 * Loaded by stage-index.php only; production index.php is intentionally untouched.
 */
.prose img,
.article-preview img {
  max-width: 100%;
  height: auto;
}

.prose ol,
.article-preview ol {
  margin: .5em 0 1em 1.5em;
  padding-left: .5em;
}

.prose code,
.article-preview code {
  padding: .12em .35em;
  border: 1px solid #e2e8f0;
  border-radius: .3rem;
  background: #f8fafc;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .9em;
}

.prose pre,
.article-preview pre {
  max-width: 100%;
  margin: 1.25em 0;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid #1e293b;
  border-radius: .65rem;
  background: #0f172a;
  color: #e2e8f0;
  text-align: left;
  line-height: 1.55;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

.prose pre code,
.article-preview pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.prose figure,
.article-preview figure {
  margin: 1.5em 0;
}

.prose figcaption,
.article-preview figcaption,
.prose caption,
.article-preview caption {
  padding: .55rem .25rem;
  color: #64748b;
  font-size: .82rem;
  line-height: 1.45;
  text-align: left;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6,
.article-preview h1,
.article-preview h2,
.article-preview h3,
.article-preview h4,
.article-preview h5,
.article-preview h6 {
  text-align: left;
}

/* Compact article index rail, enabled on staging only. */
.article-outline {
  position: fixed;
  z-index: 60;
  top: 50%;
  left: clamp(12px, calc((100vw - 1180px) / 2 - 48px), 64px);
  transform: translateY(-50%);
  font-family: Inter, system-ui, sans-serif;
}

.article-outline__toggle {
  display: flex;
  width: 34px;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(8, 38, 40, .13);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 5px 18px rgba(8, 38, 40, .09);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.article-outline__toggle:hover,
.article-outline__toggle[aria-expanded="true"] {
  border-color: rgba(11, 102, 107, .38);
  background: #fff;
  box-shadow: 0 8px 24px rgba(8, 38, 40, .15);
}

.article-outline__marks {
  display: flex;
  width: 13px;
  flex-direction: column;
  gap: 4px;
}

.article-outline__marks i {
  display: block;
  width: 13px;
  height: 2px;
  border-radius: 2px;
  background: #76908d;
  transition: width .18s ease, background .18s ease;
}

.article-outline__marks i:nth-child(2) { width: 8px; }
.article-outline__marks i:nth-child(3) { width: 11px; }
.article-outline__marks i:nth-child(4) { width: 6px; }
.article-outline__toggle:hover .article-outline__marks i,
.article-outline__toggle[aria-expanded="true"] .article-outline__marks i { background: #0b666b; }
.article-outline__toggle[aria-expanded="true"] .article-outline__marks i:nth-child(2),
.article-outline__toggle[aria-expanded="true"] .article-outline__marks i:nth-child(4) { width: 13px; }

.article-outline__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.article-outline__panel {
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  width: min(300px, calc(100vw - 90px));
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 16px 17px;
  border: 1px solid rgba(8, 38, 40, .12);
  border-radius: 14px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 16px 48px rgba(8, 38, 40, .17);
  color: #183638;
  transform: translateY(-50%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.article-outline__panel[hidden] { display: none; }
.article-outline__title { margin-bottom: 9px; color: #627775; font-size: .68rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.article-outline__panel ol { margin: 0; padding: 0; list-style: none; }
.article-outline__panel li + li { margin-top: 2px; }
.article-outline__panel a { display: block; padding: 6px 8px; border-radius: 7px; color: #294b4d; font-size: .82rem; line-height: 1.4; text-decoration: none; }
.article-outline__panel .article-outline__subsection a { padding-left: 19px; color: #627775; font-size: .76rem; }
.article-outline__panel a:hover,
.article-outline__panel a[aria-current="location"] { background: #e9f2ef; color: #07575b; }

[data-theme="dark"] .article-outline__toggle { border-color: rgba(208, 226, 222, .2); background: rgba(24, 42, 43, .88); }
[data-theme="dark"] .article-outline__toggle:hover,
[data-theme="dark"] .article-outline__toggle[aria-expanded="true"] { background: #1b3031; }
[data-theme="dark"] .article-outline__marks i { background: #a4bbb7; }
[data-theme="dark"] .article-outline__panel { border-color: #365153; background: rgba(24, 39, 40, .98); color: #e1ece9; }
[data-theme="dark"] .article-outline__title,
[data-theme="dark"] .article-outline__panel .article-outline__subsection a { color: #a8bfbb; }
[data-theme="dark"] .article-outline__panel a { color: #d5e4e0; }
[data-theme="dark"] .article-outline__panel a:hover,
[data-theme="dark"] .article-outline__panel a[aria-current="location"] { background: #294243; color: #c6e7df; }

@media (max-width: 1100px) {
  .article-outline { left: 4px; }
  .article-outline__toggle { width: 25px; min-height: 44px; }
  .article-outline__marks,
  .article-outline__marks i { width: 10px; }
  .article-outline__marks i:nth-child(2) { width: 6px; }
  .article-outline__marks i:nth-child(3) { width: 8px; }
  .article-outline__marks i:nth-child(4) { width: 5px; }
}

@media (max-width: 360px) {
  .article-outline__panel { width: calc(100vw - 58px); }
}

@media (prefers-reduced-motion: reduce) {
  .article-outline__toggle,
  .article-outline__marks i { transition: none; }
}

.prose table,
.article-preview table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.5em 0;
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  border-collapse: collapse;
  border-spacing: 0;
  background: #fff;
  text-align: left;
  font-size: .9rem;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

.prose thead,
.article-preview thead {
  background: #eff6ff;
  color: #1e3a8a;
}

.prose th,
.prose td,
.article-preview th,
.article-preview td {
  min-width: 9rem;
  padding: .7rem .8rem;
  border: 1px solid #cbd5e1;
  vertical-align: top;
}

.prose th,
.article-preview th {
  font-weight: 700;
}

.prose tbody tr:nth-child(even),
.article-preview tbody tr:nth-child(even) {
  background: #f8fafc;
}

:is([data-theme="dark"], html.dark) .prose code,
:is([data-theme="dark"], html.dark) .article-preview code {
  border-color: #475569;
  background: #1e293b;
  color: #e2e8f0;
}

:is([data-theme="dark"], html.dark) .prose table,
:is([data-theme="dark"], html.dark) .article-preview table {
  border-color: #475569;
  background: #18181b;
  color: #e5e7eb;
}

:is([data-theme="dark"], html.dark) .prose thead,
:is([data-theme="dark"], html.dark) .article-preview thead {
  background: #172554;
  color: #bfdbfe;
}

:is([data-theme="dark"], html.dark) .prose th,
:is([data-theme="dark"], html.dark) .prose td,
:is([data-theme="dark"], html.dark) .article-preview th,
:is([data-theme="dark"], html.dark) .article-preview td {
  border-color: #475569;
}

:is([data-theme="dark"], html.dark) .prose tbody tr:nth-child(even),
:is([data-theme="dark"], html.dark) .article-preview tbody tr:nth-child(even) {
  background: #27272a;
}

:is([data-theme="dark"], html.dark) .prose figcaption,
:is([data-theme="dark"], html.dark) .article-preview figcaption,
:is([data-theme="dark"], html.dark) .prose caption,
:is([data-theme="dark"], html.dark) .article-preview caption {
  color: #a1a1aa;
}

@media (max-width: 640px) {
  .prose table,
  .article-preview table {
    font-size: .82rem;
  }

  .prose th,
  .prose td,
  .article-preview th,
  .article-preview td {
    min-width: 8rem;
    padding: .6rem;
  }
}
