/* Article page: head, cover on a vellum mount, the reading column with its
   e-file progress rail, prose styles for imported bodies, disclaimer, related
   articles (cards come from css/pages/insights.css) and the closing panel. */

/* The article has its own reading line (it tracks the body, not the whole page) */
html[data-page="article"] .progress { display: none; }
.read-line { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 55; background: currentColor; color: var(--fg, #111); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }
html[data-theme="dark"] .read-line { color: #ecebe7; }

/* ---------- Head ---------- */
.art-head { padding-block: clamp(2.5rem, 6vw, 5.5rem) clamp(2rem, 4vw, 3.5rem); }
.art-head .page-head { max-width: 62rem; margin-inline: auto; }
.art-head h1 { margin-top: 1.25rem; font-size: var(--d-1); line-height: 1.2; letter-spacing: -.02em; }
/* SplitText masks (lines and words): room for Michroma's deep descenders while they rise */
.art-head h1 > div, .art-related .sec-head h2 > div, #end-panel h2 > div { padding-bottom: .18em; margin-bottom: -.18em; }
.art-meta { display: flex; flex-wrap: wrap; align-items: center; margin-top: 1.75rem; font-size: .9375rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.art-meta > * + *::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 .75rem .15rem; background: currentColor; opacity: .55; transform: rotate(45deg); }

/* ---------- Cover ---------- */
.art-cover-wrap { position: relative; overflow-x: clip; overflow-y: visible; padding-block: 2.5rem; margin-block: -2.5rem; }
.art-cover-wrap .drawing { right: calc(var(--gutter) - 2.5rem); top: -2.5rem; width: min(30rem, 40%); height: 70%; --sq: 3.5rem; }
.art-cover { position: relative; z-index: 1; max-width: 64rem; margin-inline: auto; padding: clamp(.5rem, 1.1vw, .9rem); }
.art-cover { --ar: 16 / 9; }
/* the frame has the image ratio (--ar, from the page); square and tall covers are narrowed so the frame stays under the height cap */
.art-cover .cover { --ar: inherit; }
/* no approved artwork: the topic's piece on a softly blurred board, as a 21:9 band */
.art-cover.ph-band { max-width: 64rem; }
.art-cover.ph-band .ph-piece { width: 12%; max-width: 5.5rem; }
.art-cover.tall { max-width: min(64rem, calc(min(70vh, 40rem) * var(--ratio, 1))); }
/* a light overscan for the drift inside the mount (article.js moves it by at most 2.5%) */
.art-cover .cover img { position: absolute; left: 0; top: -3%; width: 100%; height: 106%; transition: none; }

/* ---------- Reading column + rail ---------- */
.art-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 42rem) minmax(0, 1fr); column-gap: clamp(1.5rem, 4vw, 4rem); padding-block: clamp(3rem, 7vw, 5.5rem) 0; }
.prose { grid-column: 2; min-width: 0; }
.read-rail { grid-column: 1; grid-row: 1; justify-self: end; height: 100%; }
.read-rail[hidden] { display: none; }
.rail-inner { --rs: 1.5rem; position: sticky; top: calc(50vh - 8rem); width: calc(var(--rs) + 1.5rem); }
.rail-file { display: grid; }
.rf { display: grid; grid-template-columns: 1.5rem var(--rs); align-items: center; height: var(--rs); }
.rf .rk { font-size: .6875rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.rf .rsq { width: var(--rs); height: var(--rs); background: var(--tb-l); box-shadow: -1px 0 0 var(--tb-edge), 1px 0 0 var(--tb-edge); transition: background-color .4s; }
.rf.d .rsq { background: var(--tb-d); }
.rf:first-child .rsq { box-shadow: -1px 0 0 var(--tb-edge), 1px 0 0 var(--tb-edge), 0 -1px 0 var(--tb-edge); }
.rf:last-child .rsq { box-shadow: -1px 0 0 var(--tb-edge), 1px 0 0 var(--tb-edge), 0 1px 0 var(--tb-edge); }
.rf.on .rsq { background: color-mix(in srgb, var(--fg) 12%, var(--tb-l)); }
.rf.d.on .rsq { background: color-mix(in srgb, var(--fg) 18%, var(--tb-d)); }
.rail-fl { display: block; margin-left: 1.5rem; width: var(--rs); text-align: center; font-family: var(--display); font-size: .75rem; color: var(--muted); margin-top: .3rem; }
.rail-pawn, .rail-queen { position: absolute; left: 1.5rem; top: 0; width: var(--rs); height: var(--rs); padding: .12rem; z-index: 2; pointer-events: none; transform: translateY(var(--py, calc(var(--rs) * 6))); }
.rail-pawn [data-piece], .rail-queen [data-piece] { width: 100%; height: 100%; filter: drop-shadow(0 3px 2px rgba(0,0,0,.2)); }
.rail-queen { opacity: 0; transform: translateY(0); }
.rail-left { margin-top: .9rem; width: 7rem; font-size: .75rem; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .prose { font-size: 1.0625rem; }
  .prose > p:first-child { font-size: 1.125rem; }
  .art-cover-wrap .drawing { right: 0; top: 0; width: 60%; --sq: 2.5rem; }
}
@media (max-width: 1100px) {
  .art-grid { grid-template-columns: minmax(0, 1fr); }
  .prose { grid-column: 1; max-width: 42rem; margin-inline: auto; width: 100%; }
  .read-rail { display: none; }
}

/* ---------- Prose (imported bodies, sanitised by rich()) ---------- */
.prose { font-size: 1.125rem; line-height: 1.78; color: var(--fg); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.3em; }
.prose p, .prose li { color: color-mix(in srgb, var(--fg) 90%, var(--bg)); }
.prose > p:first-child { font-size: 1.25rem; line-height: 1.65; color: var(--fg); }
.prose strong, .prose b { font-weight: 600; color: var(--fg); }
.prose h2, .prose h3 { font-family: var(--display); font-weight: 400; color: var(--fg); letter-spacing: -.01em; text-wrap: balance; }
.prose h2 { margin-top: 2.6em; font-size: clamp(1.25rem, 1.9vw, 1.6rem); line-height: 1.35; }
.prose h3 { margin-top: 2.3em; font-size: clamp(1.05rem, 1.35vw, 1.2rem); line-height: 1.45; }
.prose h4 { margin-top: 2em; font-size: 1.1875rem; line-height: 1.45; font-weight: 600; color: var(--fg); }
.prose h2 strong, .prose h3 strong, .prose h2 b, .prose h3 b { font-weight: 400; }
.prose h4 strong, .prose h4 b { font-weight: inherit; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: .75em; }
.prose a { text-decoration: underline; text-decoration-color: var(--line-2); text-decoration-thickness: 1px; text-underline-offset: .25em; transition: text-decoration-color .3s; }
.prose a:hover { text-decoration-color: currentColor; }
.prose ul, .prose ol { display: grid; gap: .55em; }
.prose li { position: relative; padding-left: 1.6em; }
.prose li > p { margin: 0; color: inherit; }
.prose li > p + p { margin-top: .5em; }
.prose ul > li::before { content: ""; position: absolute; left: .2em; top: .72em; width: .42em; height: .42em; background: var(--fg); opacity: .7; }
.prose ol { counter-reset: n; }
.prose ol > li { counter-increment: n; padding-left: 2em; }
.prose ol > li::before { content: counter(n) "."; position: absolute; left: 0; top: .12em; font-family: var(--display); font-size: .8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.prose li ul, .prose li ol { margin-top: .55em; }
.prose blockquote { margin: 2em 0; padding: .2em 0 .2em 1.5em; border-left: 2px solid var(--fg); font-size: 1.1875rem; line-height: 1.6; color: var(--fg); }
.prose blockquote p { color: inherit; }
.prose blockquote > * + * { margin-top: .75em; }
.prose img { width: 100%; height: auto; margin-block: 2.25em; border-radius: 2px; filter: grayscale(1) contrast(1.03); background: var(--sq-a); }
html[data-theme="dark"] .prose img { filter: grayscale(1) brightness(.84) contrast(1.05); }
.prose figure { margin-block: 2.25em; }
.prose figure img { margin: 0; }
.prose figcaption { margin-top: .6em; font-size: .875rem; color: var(--muted); }
/* a thematic break: a short strip of board */
.prose hr { border: 0; width: 3rem; height: .75rem; margin: 3em auto; background: repeating-conic-gradient(var(--tb-d) 0 25%, var(--tb-l) 0 50%) 0 0 / 1.5rem 1.5rem; box-shadow: 0 0 0 1px var(--tb-edge); }
.prose table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .96875rem; line-height: 1.5; margin-block: 2em; -webkit-overflow-scrolling: touch; }
.prose th, .prose td { padding: .7rem 1.25rem .7rem 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); min-width: 8rem; }
.prose th, .prose thead td { font-weight: 600; color: var(--fg); border-bottom-color: var(--line-2); }
.prose td p, .prose th p { margin: 0; }
.prose code { font-size: .9em; padding: .1em .3em; background: var(--sq-a); border-radius: 2px; }
.prose pre { overflow-x: auto; padding: 1rem; background: var(--sq-a); font-size: .9375rem; }
.prose br + br { display: none; }

/* ---------- Disclaimer ---------- */
.art-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 42rem) minmax(0, 1fr); column-gap: clamp(1.5rem, 4vw, 4rem); padding-block: clamp(3rem, 6vw, 4.5rem) clamp(4rem, 8vw, 6rem); }
.disclaimer { grid-column: 2; padding-top: 1.25rem; border-top: 1px solid var(--line-2); font-size: .875rem; line-height: 1.6; color: var(--muted); }
@media (max-width: 1100px) { .art-foot { grid-template-columns: minmax(0, 1fr); } .disclaimer { grid-column: 1; max-width: 42rem; margin-inline: auto; width: 100%; } }

/* ---------- Related + closing panel ---------- */
.art-related .sec-head h2 { font-size: clamp(1.35rem, 2.3vw, 2.1rem); }
.rel-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(1.25rem, 2.6vw, 2.75rem); row-gap: 2.75rem; margin-top: clamp(2.25rem, 5vw, 3.5rem); }
.art-related .all-link { margin-top: 2.5rem; }
.art-end { padding-bottom: clamp(5rem, 10vw, 8rem); }
.end-panel { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2rem clamp(2rem, 5vw, 5rem); align-items: end; padding: clamp(2rem, 5vw, 4rem); }
.end-panel h2 { font-size: clamp(1.6rem, 3.4vw, 3rem); line-height: 1.15; }
.end-panel p { margin-top: 1.25rem; max-width: 32rem; color: var(--fg-2); font-size: 1.125rem; }
.end-panel .ctas { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: flex-end; }
@media (max-width: 860px) {
  .rel-grid .post[data-size="r"] { grid-column: 1 / -1; }
  .end-panel { grid-template-columns: 1fr; }
  .end-panel .ctas { justify-content: flex-start; }
}
@media (min-width: 861px) and (max-width: 1100px) { .rel-grid .post[data-size="r"] .ex { display: none; } }
