/* Individual-column reading refresh. Loaded after tkpd-columns.css and enabled
 * only by the server-side tkpc-reading-v2 body class. */

body.tkpc-reading-v2 {
  --tkpc-reading-size: 18px;
  --tkpc-reading-ink: #2b2925;
  --tkpc-reading-rule: #e3e1dc;
  --tkpc-reading-marker: #f5e8a3;
}

body.tkpc-reading-v2 .tkpc-prose {
  width: 100%;
  max-width: 680px;
  min-width: 0;
  margin-inline: auto;
  color: var(--tkpc-reading-ink);
  font-family: var(--tkpc-sans);
  font-size: var(--tkpc-reading-size);
  font-weight: 400;
  line-height: 1.95;
  letter-spacing: .025em;
  overflow-wrap: anywhere;
  word-break: normal;
  scroll-margin-top: 150px;
}

body.tkpc-reading-v2 .tkpc-prose.is-large-text { --tkpc-reading-size: 20px; font-size: var(--tkpc-reading-size); }

body.tkpc-reading-v2 .tkpc-prose p {
  margin: 0 0 1.5em;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: inherit;
}

body.tkpc-reading-v2 .tkpc-prose > p:not(.tkpd-column-lead, .tkpd-column-takeaway, .tkpd-column-conclusion, .tkpc-keypoint, .tkpc-conclusion, .has-text-align-center, .has-text-align-right, .article_page_banner_sponser, [data-ad-slot], [class*="code-block"], :has(> img, > a > img, > iframe, > video)) {
  text-indent: 1em;
}

body.tkpc-reading-v2 .tkpc-prose h2,
body.tkpc-reading-v2 .tkpc-prose h3,
body.tkpc-reading-v2 .tkpc-prose h4 {
  padding: 0;
  border: 0;
  background: none;
  color: #282520;
  font-family: var(--tkpc-sans);
  font-weight: 700;
  letter-spacing: .025em;
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

body.tkpc-reading-v2 .tkpc-prose h2 {
  margin: 55px 0 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid #c9bca8;
  font-size: 25px;
  line-height: 1.5;
}

/* H3 stays larger than the body so legacy articles with H3 sections retain
 * a clear hierarchy, including when readers enlarge the body type. */
body.tkpc-reading-v2 .tkpc-prose h3 { margin: 36px 0 20px; font-size: 21px; line-height: 1.6; }
body.tkpc-reading-v2 .tkpc-prose h4 { margin: 28px 0 16px; font-size: 18px; line-height: 1.7; }
body.tkpc-reading-v2 .tkpc-prose > :first-child { margin-top: 0; }
body.tkpc-reading-v2 .tkpc-prose > :last-child { margin-bottom: 0; }

body.tkpc-reading-v2 .tkpc-prose strong,
body.tkpc-reading-v2 .tkpc-prose b {
  color: #242320;
  font-size: inherit;
  font-weight: 700;
}

/* Marks are editorial choices in the stored content, never auto-applied by
 * position. The pale stripe remains continuous when a sentence wraps. */
body.tkpc-reading-v2 .tkpc-prose mark {
  padding: .03em .08em;
  border: 0;
  border-radius: 0;
  background: linear-gradient(to bottom, transparent 65%, var(--tkpc-reading-marker) 65%) !important;
  color: #242320 !important;
  font-size: inherit;
  font-weight: 700;
  line-height: inherit;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Legacy headings already carry their own emphasis. Do not turn whole
 * headings into highlighted passages, even when they contain inline marks. */
body.tkpc-reading-v2 .tkpc-prose :is(h2, h3, h4, h5, h6) mark {
  padding: 0 !important;
  background: none !important;
  color: inherit !important;
  font-weight: inherit;
  box-shadow: none !important;
}

body.tkpc-reading-v2 .tkpc-prose :is(ul, ol) {
  margin-block: 25px;
  padding-inline-start: 1.5em;
  font-size: inherit;
  line-height: inherit;
}

body.tkpc-reading-v2 .tkpc-prose li { margin: 0 0 .6em; overflow-wrap: anywhere; }
body.tkpc-reading-v2 .tkpc-prose ul.wp-block-list { list-style-type: disc; }
body.tkpc-reading-v2 .tkpc-prose :is(ol.wp-block-list, ol.tkpd-column-actions) { list-style-type: decimal; }
body.tkpc-reading-v2 .tkpc-prose :is(ul.wp-block-list, ol.wp-block-list, ol.tkpd-column-actions) > li { list-style-type: inherit; }
body.tkpc-reading-v2 .tkpc-prose li:last-child { margin-bottom: 0; }
body.tkpc-reading-v2 .tkpc-prose li > :is(ul, ol) { margin-block: .6em; }
body.tkpc-reading-v2 .tkpc-prose li > p { margin-bottom: .6em; }

body.tkpc-reading-v2 .tkpc-prose blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--tkpc-accent);
  background: #f5f7f4;
  color: var(--tkpc-reading-ink);
}

body.tkpc-reading-v2 .tkpc-prose blockquote > :last-child { margin-bottom: 0; }
body.tkpc-reading-v2 .tkpc-prose :is(cite, figcaption, .wp-caption-text) { font-size: 13px; line-height: 1.8; }

/* Keep opt-in writing-template panels distinct from ordinary paragraphs. */
body.tkpc-reading-v2 .tkpc-prose .tkpd-column-lead {
  margin: 0 0 1.5em;
  padding: 5px 0 5px 16px;
  border: 0;
  border-inline-start: 3px solid var(--tkpc-accent);
  border-radius: 0;
  background: transparent;
  font-size: calc(var(--tkpc-reading-size) + 2px);
  font-weight: 700;
  line-height: 1.8;
  text-indent: 0;
}

body.tkpc-reading-v2 .tkpc-prose .tkpd-column-takeaway {
  margin: 0 0 1.5em;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-indent: 0;
}

body.tkpc-reading-v2 .tkpc-prose ol.tkpd-column-actions { margin: 24px 0 30px; padding: 10px 24px 10px 50px; }
body.tkpc-reading-v2 .tkpc-prose .tkpd-column-actions > li { margin: 0; padding: 15px 0 15px 6px; }
body.tkpc-reading-v2 .tkpc-prose .tkpd-column-conclusion { margin: 24px 0 30px; padding: 20px 24px; text-indent: 0; }
body.tkpc-reading-v2 .tkpc-prose :is(.tkpc-actions, .tkpc-conclusion) h2 { margin-top: 0; }

body.tkpc-reading-v2 .tkpc-prose :is(img, video, iframe, figure, .wp-caption, .wp-block-embed, .wp-block-embed__wrapper) { max-width: 100%; }
body.tkpc-reading-v2 .tkpc-prose :is(img, video) { height: auto; }
body.tkpc-reading-v2 .tkpc-prose :is(pre, .wp-block-table) { min-width: 0; max-width: 100%; overflow-x: auto; }
body.tkpc-reading-v2 .tkpc-prose a { text-decoration: underline; text-underline-offset: .2em; }

/* Author and credits share the text measure and the article's white surface. */
body.tkpc-reading-v2 .tkpc-endmatter {
  box-sizing: border-box;
  width: 100%;
  max-width: 680px;
  margin: 40px auto;
  padding: 28px 0;
  border-top: 1px solid var(--tkpc-reading-rule);
  border-bottom: 1px solid var(--tkpc-reading-rule);
  background: #fff;
  color: var(--tkpc-reading-ink);
  font-family: var(--tkpc-sans);
  font-size: 14px;
  line-height: 1.95;
  letter-spacing: .025em;
  text-align: left;
  overflow-wrap: anywhere;
  scroll-margin-top: 150px;
}

body.tkpc-reading-v2 .tkpc-endmatter *,
body.tkpc-reading-v2 .tkpc-endmatter *::before,
body.tkpc-reading-v2 .tkpc-endmatter *::after { box-sizing: border-box; }

body.tkpc-reading-v2 .tkpc-endmatter .tkpc-endmatter-title {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  background: none;
  color: #282520;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: .025em;
}

body.tkpc-reading-v2 .tkpc-endmatter-profile {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  min-width: 0;
}

body.tkpc-reading-v2 .tkpc-endmatter-profile.has-no-avatar,
body.tkpc-reading-v2 .tkpc-endmatter.has-no-avatar .tkpc-endmatter-profile { grid-template-columns: minmax(0, 1fr); }

body.tkpc-reading-v2 .tkpc-endmatter-avatar { width: 80px; margin: 0; }
body.tkpc-reading-v2 .tkpc-endmatter-avatar img { display: block; width: 80px; height: 80px; max-width: 100%; margin: 0; border-radius: 50%; object-fit: cover; }
body.tkpc-reading-v2 .tkpc-endmatter-info { min-width: 0; }

body.tkpc-reading-v2 .tkpc-endmatter-name {
  margin: 0 0 10px;
  padding: 0;
  color: #282520;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.7;
}

body.tkpc-reading-v2 .tkpc-endmatter-bio { margin: 0 0 12px; padding: 0; font-size: 14px; font-weight: 400; line-height: 1.95; white-space: pre-line; }
body.tkpc-reading-v2 .tkpc-endmatter-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin: 0; padding: 0; }
body.tkpc-reading-v2 .tkpc-endmatter a { color: var(--tkpc-accent); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
body.tkpc-reading-v2 .tkpc-endmatter-name a,
body.tkpc-reading-v2 .tkpc-endmatter-links a { display: inline-flex; align-items: center; gap: 6px; min-width: 44px; min-height: 44px; padding-block: 7px; }
body.tkpc-reading-v2 .tkpc-endmatter-links a { max-width: 100%; font-size: 14px; line-height: 1.7; }
body.tkpc-reading-v2 .tkpc-endmatter a:focus-visible { outline: 2px solid var(--tkpc-accent); outline-offset: 4px; }

body.tkpc-reading-v2 .tkpc-endmatter-credits {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: start;
  gap: 10px 24px;
  margin: 24px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--tkpc-reading-rule);
}

body.tkpc-reading-v2 .tkpc-endmatter-credits h3 {
  margin: 0;
  padding: 3px 0 0;
  border: 0;
  background: none;
  color: #282520;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: .025em;
}

body.tkpc-reading-v2 .tkpc-endmatter-credits p { min-width: 0; margin: 0; padding: 0; font-size: 14px; font-weight: 400; line-height: 1.95; white-space: pre-line; }
body.tkpc-reading-v2 .tkpc-endmatter-credits.is-credits-only { grid-template-columns: minmax(0, 1fr); }

@media (min-width: 901px) and (max-width: 1100px) {
  body.tkpc-reading-v2 { --tkpc-reading-size: 17px; }
}

@media (max-width: 600px) {
  body.tkpc-reading-v2 { --tkpc-reading-size: 16px; }
  body.tkpc-reading-v2 .tkpc-prose,
  body.tkpc-reading-v2 .tkpc-endmatter { scroll-margin-top: 125px; }
  body.tkpc-reading-v2 .tkpc-prose.is-large-text { --tkpc-reading-size: 19px; }
  body.tkpc-reading-v2 .tkpc-prose h2 { margin: 40px 0 24px; padding-bottom: 15px; font-size: 23px; }
  body.tkpc-reading-v2 .tkpc-prose h3 { margin: 30px 0 18px; font-size: 20px; }
  body.tkpc-reading-v2 .tkpc-prose h4 { margin: 24px 0 14px; font-size: 18px; }
  body.tkpc-reading-v2 .tkpc-prose blockquote { padding: 18px; }
  body.tkpc-reading-v2 .tkpc-prose .tkpd-column-conclusion { padding: 18px; }
  body.tkpc-reading-v2 .tkpc-prose ol.tkpd-column-actions { padding: 8px 18px 8px 43px; }
  body.tkpc-reading-v2 .tkpc-endmatter { margin-block: 32px; padding-block: 24px; }
  body.tkpc-reading-v2 .tkpc-endmatter .tkpc-endmatter-title { margin-bottom: 20px; font-size: 18px; }
  body.tkpc-reading-v2 .tkpc-endmatter-profile { grid-template-columns: 64px minmax(0, 1fr); gap: 14px 16px; }
  body.tkpc-reading-v2 .tkpc-endmatter-avatar { width: 64px; }
  body.tkpc-reading-v2 .tkpc-endmatter-avatar img { width: 64px; height: 64px; }
  body.tkpc-reading-v2 .tkpc-endmatter-info { display: contents; }
  body.tkpc-reading-v2 .tkpc-endmatter-name { grid-column: 2; align-self: center; margin: 0; font-size: 17px; }
  body.tkpc-reading-v2 .tkpc-endmatter-bio,
  body.tkpc-reading-v2 .tkpc-endmatter-links { grid-column: 1 / -1; margin: 0; }
  body.tkpc-reading-v2 .tkpc-endmatter-profile.has-no-avatar .tkpc-endmatter-name,
  body.tkpc-reading-v2 .tkpc-endmatter.has-no-avatar .tkpc-endmatter-name { grid-column: 1; }
  body.tkpc-reading-v2 .tkpc-endmatter-credits { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 20px; padding-top: 20px; }
  body.tkpc-reading-v2 .tkpc-endmatter-credits h3 { padding-top: 0; }
}

@media (forced-colors: active) {
  body.tkpc-reading-v2 .tkpc-prose mark { background: transparent !important; color: CanvasText !important; text-decoration: underline; }
  body.tkpc-reading-v2 .tkpc-prose :is(h2, h3, h4, h5, h6) mark { text-decoration: none; }
}
