/* ===========================================================
   Night lab articles (2026-11-07): single posts only (functions.php loads it with is_singular('post')).
   Contents list (left), text, rail (right), source chips, reading styles, "Keep exploring".
   Markup: single.php. Data: inc/article.php. Behaviour (progress bar, current section): theme.js.
   =========================================================== */

.art-page {
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #64748B;
  --line: #E2E8F0;
  --tint: #F1F5FE;
  --link: #2F5FC4;
}

/* Reading progress, at the very top of the window. */
.art-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1100; pointer-events: none; }
.art-progress span { display: block; height: 3px; width: 100%; background: #8FB4FF; transform-origin: 0 50%; transform: scaleX(0); }

/* --- Title block extras --- */
.art-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.art-chips .sgl-cat-badge { margin-bottom: 0; }
.art-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: #A7C4FF;
  border: 1px solid rgba(167, 196, 255, 0.35); border-radius: 999px; padding: 5px 11px;
}
.art-chip--sources { color: #8EE3C1; border-color: rgba(84, 199, 155, 0.45); }

/* --- Grid --- */
.art-page .sgl-body { padding: 48px 0 72px; }
.art-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 56px; align-items: start; }
.art-has-toc .art-grid { grid-template-columns: 220px minmax(0, 1fr) 280px; gap: 44px; }
.art-page .sgl-article { max-width: 720px; min-width: 0; }
.art-page .sgl-sidebar { width: auto; }

/* --- In this article (computer) --- */
.art-toc { position: sticky; top: 100px; max-height: calc(100vh - 130px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #E2E8F0 transparent; }
.art-toc-title { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.art-toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.art-toc-list a {
  display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; border-radius: 10px;
  font-size: 14px; line-height: 1.4; color: var(--ink-2); text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}
.art-toc-list a:hover { background: #F8FAFC; color: var(--ink); }
.art-toc-num { font-size: 11.5px; font-weight: 600; color: #94A3B8; font-variant-numeric: tabular-nums; flex: none; }
.art-toc-list a.is-active { background: var(--tint); color: var(--ink); font-weight: 600; }
.art-toc-list a.is-active .art-toc-num { color: var(--link); }

/* --- In this article (phone, tablet) --- */
.art-toc-mobile { display: none; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 16px; background: #F8FAFC; }
.art-toc-mobile summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; font-size: 15px; font-weight: 600; color: var(--ink); min-height: 44px; box-sizing: border-box;
}
.art-toc-mobile summary::-webkit-details-marker { display: none; }
.art-toc-mobile summary span { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.art-toc-mobile summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin: -4px 4px 0 10px; transition: transform 200ms ease; }
.art-toc-mobile[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.art-toc-mobile .art-toc-list { padding: 0 8px 10px; }

/* --- Text --- */
.art-page .sgl-featured { margin-bottom: 32px; }
.art-page .sgl-featured img { height: 380px; border-radius: 20px; }
.art-page .sgl-prose { font-size: 18px; line-height: 1.75; color: #1E293B; }
.art-page .sgl-prose p { color: #1E293B; line-height: 1.75; margin: 0 0 22px; }
.art-page .sgl-prose h2,
.art-page .sgl-prose h3,
.art-page .sgl-prose h4 { color: var(--ink); scroll-margin-top: 100px; letter-spacing: -0.015em; }
.art-page .sgl-prose h2 { font-size: 30px; line-height: 1.2; margin: 52px 0 16px; letter-spacing: -0.02em; }
.art-page .sgl-prose h3 { font-size: 22px; line-height: 1.3; margin: 36px 0 12px; }
.art-page .sgl-prose h4 { font-size: 20px; line-height: 1.35; font-weight: 700; margin: 32px 0 10px; }
.art-page .sgl-prose > :first-child { margin-top: 0; }
.art-page .sgl-prose a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.art-page .sgl-prose a:hover { color: #1E3A8A; }
.art-page .sgl-prose ul, .art-page .sgl-prose ol { padding-left: 22px; margin: 0 0 22px; }
.art-page .sgl-prose li { margin-bottom: 8px; line-height: 1.7; }
.art-page .sgl-prose li::marker { color: #558CEE; font-weight: 600; }
.art-page .sgl-prose strong { color: var(--ink); }
.art-page .sgl-prose img { border-radius: 18px; }
.art-page .sgl-prose blockquote {
  border: 0; border-radius: 18px; background: var(--tint); padding: 22px 26px; margin: 28px 0;
  font-style: normal; font-size: 19px; line-height: 1.6; color: var(--ink);
}
.art-page .sgl-prose blockquote p:last-child { margin-bottom: 0; }
.art-page .sgl-prose table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 0 0 26px; font-size: 15.5px; line-height: 1.5; }
.art-page .sgl-prose th { background: var(--tint); color: var(--ink); font-weight: 600; text-align: left; }
.art-page .sgl-prose th, .art-page .sgl-prose td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.art-page .sgl-prose tr:last-child td { border-bottom: 0; }

/* Source chips (inc/article.php): a citation in the text. A linked one opens the paper. */
.art-page .sgl-prose .cite-chip {
  display: inline; font-size: 0.74em; font-weight: 500; line-height: 1.5; color: var(--link);
  background: #EEF3FD; border-radius: 7px; padding: 2px 7px; text-decoration: none; white-space: normal;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.art-page .sgl-prose .cite-chip em { font-style: italic; }
.art-page .sgl-prose a.cite-chip::after { content: " ↗"; font-size: 0.9em; }
.art-page .sgl-prose a.cite-chip:hover { background: #DCE7FC; color: #1E3A8A; }

/* --- Rail --- */
.art-rail { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 14px; }
.art-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: #A7C4FF; }
.art-eyebrow--dark { color: var(--ink-3); }
.art-test-card h3 { margin: 0; }
.art-test-card p { margin: 0; }
.art-app-card { border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.art-app-card p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.art-app-card a { font-size: 14.5px; font-weight: 600; color: var(--link); }

/* --- Keep exploring --- */
.art-more { background: #F6F8FC; padding: 64px 0 80px; border-top: 1px solid var(--line); }
.art-more-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 22px; }
.art-more-head h2 { font-size: 30px; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
.art-more-head a { font-size: 15px; font-weight: 600; color: var(--link); }
.art-more-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.art-card {
  display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 20px;
  overflow: hidden; color: var(--ink); text-decoration: none; padding-bottom: 18px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.art-card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -18px rgba(15, 23, 42, 0.3); }
.art-card-img { aspect-ratio: 16 / 10; background: #E8EEF9; overflow: hidden; margin-bottom: 6px; }
.art-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-card-cat { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--ink-3); padding: 0 18px; }
.art-card-title { font-size: 17px; font-weight: 600; line-height: 1.35; padding: 0 18px; letter-spacing: -0.01em; }
.art-card--test {
  justify-content: flex-start; padding: 22px; gap: 10px; border: 0;
  background:
    radial-gradient(320px 220px at 90% 0%, rgba(85, 140, 238, 0.4), transparent 70%),
    #0A1630;
  color: #fff;
}
.art-card--test .art-card-title { padding: 0; font-size: 21px; color: #fff; }
.art-card-sub { font-size: 14.5px; line-height: 1.5; color: #CBD5E1; }
.art-card-go { margin-top: auto; font-size: 14.5px; font-weight: 600; color: #fff; }

/* --- Smaller screens --- */
@media (max-width: 1180px) {
  .art-has-toc .art-grid { grid-template-columns: minmax(0, 1fr) 270px; }
  .art-toc { display: none; }
  .art-toc-mobile { display: block; }
}
@media (max-width: 900px) {
  .art-grid, .art-has-toc .art-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .art-rail { display: none; }
  .art-page .sgl-body { padding: 24px 0 48px; }
  .art-page .sgl-article { max-width: none; }
  .art-more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .art-page .sgl-featured img { height: 220px; border-radius: 16px; }
  .art-page .sgl-prose { font-size: 17px; }
  .art-page .sgl-prose h2 { font-size: 25px; margin-top: 40px; }
  .art-page .sgl-prose h3 { font-size: 20px; }
  .art-page .sgl-prose h4 { font-size: 18.5px; }
  .art-page .sgl-prose table { display: block; overflow-x: auto; }
  .art-more { padding: 44px 0 56px; }
  .art-more-head h2 { font-size: 24px; }
  .art-more-grid { grid-template-columns: minmax(0, 1fr); }
  .art-chips { margin-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) { .art-card { transition: none; } .art-card:hover { transform: none; } }
