/* Charles Tech — reading interface, 6 November 2026. No third-party assets. */
:root {
  --ct-surface: #fff;
  --ct-soft: #f7f8fa;
  --ct-line: #e3e6eb;
  --ct-text: #171a21;
  --ct-muted: #626875;
  --ct-accent: #d92f4b;
  --ct-accent-hover: #ba2440;
  --ct-tint: #fff1f3;
  --ct-radius: 14px;
  --accent: var(--ct-accent);
  --accent-hover: var(--ct-accent-hover);
}
html.dark {
  --ct-surface: #16191f;
  --ct-soft: #1d2129;
  --ct-line: #343b47;
  --ct-text: #f1f3f7;
  --ct-muted: #b2bac8;
  --ct-accent: #fb7185;
  --ct-accent-hover: #fda4af;
  --ct-tint: #33212a;
}

/* Shared controls: consistent geometry, keyboard focus and contrast. */
body > header #search-open,
body > header #theme-toggle,
body > header button.md\:hidden { min-height: 44px; min-width: 44px; }
.btn-modern { min-height: 44px; justify-content: center; }
.btn-modern-primary { background: #d92f4b; }
.btn-modern-primary:hover { background: #ba2440; }
.ct-article :is(a, button, summary):focus-visible,
.ct-related a:focus-visible,
.nlbox :is(input, button):focus-visible {
  outline: 2px solid var(--ct-accent);
  outline-offset: 4px;
}

/* Article rhythm, without changing text, images or advertising slots. */
article.ct-article { padding-top: 28px; padding-bottom: 56px; gap: 40px; }
.ct-article .ct-breadcrumbs { margin-bottom: 20px; line-height: 1.6; color: var(--ct-muted); }
.ct-article .ct-breadcrumbs :is(a, span) { color: var(--ct-muted) !important; }
.ct-article .ct-breadcrumbs > span:last-child { min-width: 0; max-width: 100%; }
.ct-article .ct-article-header { margin-bottom: 20px; }
.ct-article .ct-article-kicker { margin-bottom: 12px; letter-spacing: .16em; font-weight: 650; }
.ct-article .ct-article-title {
  font-size: clamp(2rem, 3.8vw, 3.1rem);
  line-height: 1.13;
  letter-spacing: -.035em;
  text-wrap: balance;
  overflow-wrap: break-word;
  margin-bottom: 0;
}
.ct-article .ct-article-byline {
  margin-top: 20px; padding-top: 0; border-top: 0;
  gap: 12px; align-items: center; color: var(--ct-muted);
}
.ct-article .ct-article-byline > a :is(img, div) { width: 40px; height: 40px; }
.ct-article .ct-article-byline > div { min-width: 0; }
.ct-article .ct-article-byline p { line-height: 1.6; }
.ct-article .ct-article-byline p:first-child { font-size: 13px; }
.ct-article .ct-article-byline p:last-child { font-size: 12px; }
.ct-article .sw-actions {
  gap: 12px; margin: 0 0 22px; padding: 14px 0;
  min-height: 0; contain-intrinsic-size: auto 84px;
  border-color: var(--ct-line);
}
.ct-article .sw-actions-group { gap: 7px; min-width: 0; }
.ct-article .sw-actions .sw-actions-label { color: var(--ct-muted) !important; font-size: 10px; font-weight: 600; }
.ct-article .sw-actions .sw-btn {
  min-height: 36px; height: auto; padding: 8px 11px;
  background: var(--ct-surface); color: var(--ct-text); border-color: var(--ct-line);
}
.ct-article .sw-actions .sw-btn:hover {
  background: var(--ct-soft); color: var(--ct-text); border-color: var(--ct-muted);
}
.ct-article .ct-article-hero { margin-bottom: 28px; }
.ct-article .ct-article-hero > img { border-radius: var(--ct-radius); box-shadow: none; }
.ct-article .prose-article > p { text-align: left; hyphens: manual; -webkit-hyphens: manual; }
.ct-article .prose-article :is(h2, h3) { line-height: 1.3; }
.ct-article .prose-article > :is(p, ul, ol):first-child { margin-top: 0; }
.ct-article .prose-article > p > a:not([class]),
.ct-article .prose-article > :is(ul, ol) a:not([class]) {
  color: var(--ct-accent); text-decoration-color: currentColor; text-underline-offset: 3px;
}
.ct-article .prose-article > p > a:not([class]):hover,
.ct-article .prose-article > :is(ul, ol) a:not([class]):hover { background: var(--ct-tint); color: var(--ct-accent); }
.ct-article .prose-article blockquote { border-color: var(--ct-accent); }

/* Neutral panels with the same radius and useful contrast in both themes. */
.ct-article :is(.side-toc, .side-share, .toc-box, .ct-author-card) {
  border: 1px solid var(--ct-line); border-radius: var(--ct-radius);
  background: var(--ct-soft); box-shadow: none;
}
.ct-article :is(.side-toc, .side-share) { padding: 16px; }
.ct-article :is(.side-title, .toc-title, .side-toc-toggle) { color: var(--ct-muted); }
.ct-article .side-toc-toggle { min-height: 28px; }
.ct-article .side-toc ol { max-height: min(42vh, 380px); overflow-y: auto; overscroll-behavior: contain; }
.ct-article .side-toc ol li { margin: 0; }
.ct-article .side-toc ol li::before { color: var(--ct-muted); top: 9px; }
.ct-article .side-toc ol li a {
  color: var(--ct-muted); padding: 7px 8px; border-radius: 0 7px 7px 0;
  border-left-width: 2px; line-height: 1.45;
}
.ct-article .side-toc ol li a:hover { background: var(--ct-surface); color: var(--ct-text); }
.ct-article .side-toc ol li a.is-active { background: var(--ct-tint); color: var(--ct-text); border-left-color: var(--ct-accent); }
.ct-article .toc-box { border-left: 3px solid var(--ct-accent); padding: 16px; margin-bottom: 24px; }
.ct-article .toc-list { color: var(--ct-text); }
.ct-article .toc-list li a { display: inline-block; padding: 5px 0; }
.ct-article .ct-sidebar-stack { top: 8rem; }
.ct-article .ct-sidebar-stack > * + * { margin-top: 18px; }
.ct-article .side-share-btns { gap: 6px; }
.ct-article .side-share-btns :is(a, button) {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-color: var(--ct-line); background: var(--ct-surface); color: var(--ct-text);
}
.ct-article .side-share-btns :is(a, button):hover { border-color: var(--ct-accent); background: var(--ct-tint); color: var(--ct-text); transform: none; }
.ct-article .side-share-btns svg { width: 18px; height: 18px; display: block; }
.ct-article .side-share-btns svg.ct-share-icon--stroke { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ct-article .side-share-btns button[data-copied="1"] { background: var(--ct-tint); border-color: var(--ct-accent); color: var(--ct-accent); }
.ct-share-status { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ct-article .ct-author-card { padding: 24px; margin-top: 32px; }
.ct-article .ct-author-card > p:first-child { color: var(--ct-muted); }
.ct-article .ct-author-card > p:nth-child(3) { color: var(--ct-muted); line-height: 1.7; }

/* One subscription form per article; the sidebar points to it. */
.ct-newsletter-end { scroll-margin-top: 9rem; }
.ct-article .ct-newsletter-link {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--ct-line); border-radius: var(--ct-radius);
  padding: 16px; color: var(--ct-text); background: var(--ct-surface); text-decoration: none;
}
.ct-article .ct-newsletter-link:hover { border-color: var(--ct-accent); background: var(--ct-tint); }
.ct-newsletter-link > svg:first-child { width: 32px; height: 32px; padding: 6px; background: var(--ct-tint); color: var(--ct-accent); border-radius: 8px; flex-shrink: 0; }
.ct-newsletter-link > svg:last-child { width: 18px; height: 18px; margin-left: auto; flex-shrink: 0; }
.ct-newsletter-link strong { display: block; font-size: 14px; line-height: 1.4; }
.ct-newsletter-link small { display: block; margin-top: 3px; font-size: 12px; color: var(--ct-muted); }
form.nlbox {
  background: var(--ct-soft); border-color: var(--ct-line); border-radius: var(--ct-radius);
  padding: 24px;
}
.nlbox .nlbox__title { color: var(--ct-text); }
.nlbox .nlbox__text, .nlbox .nlbox__legal { color: var(--ct-muted); }
.nlbox .nlbox__kicker { color: var(--ct-accent); }
.nlbox .nlbox__input {
  min-height: 46px; border-radius: 10px; background: var(--ct-surface);
  color: var(--ct-text); border-color: var(--ct-line); font-size: 16px;
}
.nlbox .nlbox__input::placeholder { color: var(--ct-muted); opacity: 1; }
.nlbox .nlbox__btn { min-height: 46px; border-radius: 10px; background: #d92f4b; color: white; }
.nlbox .nlbox__btn:hover { background: #ba2440; }
html.dark form.nlbox { background: var(--ct-soft); border-color: var(--ct-line); }
html.dark .nlbox .nlbox__input { background: var(--ct-surface); color: var(--ct-text); border-color: var(--ct-line); }
html.dark .nlbox :is(.nlbox__text, .nlbox__legal) { color: var(--ct-muted); }

/* Reading tables: overflow stays inside the table, never the whole page. */
.ct-article .prose-article .ct-table-block { margin: 1.5em 0; }
.ct-article .prose-article .ct-table-scroll {
  width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
  border: 1px solid var(--ct-line); border-radius: var(--ct-radius);
  background: var(--ct-surface); scrollbar-width: thin;
  scrollbar-color: var(--ct-muted) var(--ct-soft);
}
.ct-table-scroll:focus-visible { outline: 2px solid var(--ct-accent); outline-offset: 4px; }
.ct-article .prose-article table.ct-reading-table {
  display: table; width: 100%; min-width: var(--ct-table-min, 540px);
  margin: 0; border-collapse: separate; border-spacing: 0; table-layout: auto;
  font-size: 14px; line-height: 1.6; text-align: left;
}
.ct-article .prose-article table.ct-reading-table thead { display: table-header-group; }
.ct-article .prose-article table.ct-reading-table tbody { display: table-row-group; width: auto; }
.ct-article .prose-article table.ct-reading-table tr {
  display: table-row; width: auto; margin: 0; border: 0; border-radius: 0;
  background: var(--ct-surface) !important;
}
.ct-article .prose-article table.ct-reading-table :is(th, td) {
  display: table-cell; width: auto; padding: 13px 16px; vertical-align: top;
  border: 0; border-bottom: 1px solid var(--ct-line); background: transparent;
  color: var(--ct-text); text-align: left; font-size: 14px; line-height: 1.6;
  white-space: normal; word-break: normal; overflow-wrap: break-word; hyphens: manual;
  font-variant-numeric: tabular-nums;
}
.ct-article .prose-article table.ct-reading-table :is(th, td):first-child { font-weight: 600; min-width: 140px; }
.ct-article .prose-article table.ct-reading-table td::before { display: none; }
.ct-article .prose-article table.ct-reading-table tbody tr:nth-child(even) { background: var(--ct-soft) !important; }
.ct-article .prose-article table.ct-reading-table :is(thead, .ct-table-heading) :is(th, td) {
  color: var(--ct-text); background: var(--ct-soft); font-weight: 700;
  border-bottom: 2px solid var(--ct-line);
}
.ct-article .prose-article table.ct-reading-table tbody tr:last-child > :is(th, td) { border-bottom: 0; }
.ct-article .prose-article table.ct-reading-table caption { padding: 12px 16px; text-align: left; font-weight: 600; color: var(--ct-text); }
.ct-article .prose-article figure.wp-block-table.ct-table-figure { border: 0; background: transparent; box-shadow: none; overflow: visible; margin: 1.5em 0; }
.ct-article .prose-article figure.wp-block-table.ct-table-figure .ct-table-block { margin: 0; }
.ct-article .prose-article p.ct-table-hint {
  margin: 8px 2px 0; font-size: 12px; line-height: 1.5; color: var(--ct-muted); text-align: left;
}
.ct-table-hint[hidden] { display: none !important; }

/* Related articles, same-theme links and products: consistent cards. */
.ct-related { padding-top: 40px; padding-bottom: 40px; background: var(--ct-soft) !important; }
.ct-related .ct-related-title { margin-bottom: 24px; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2; }
.ct-related-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.ct-related-card {
  display: flex; flex-direction: column; height: 100%; min-width: 0;
  overflow: hidden; border: 1px solid var(--ct-line); border-radius: var(--ct-radius);
  background: var(--ct-surface); color: var(--ct-text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.ct-related-card:hover { border-color: var(--ct-muted); box-shadow: 0 5px 18px rgb(0 0 0 / .05); }
.ct-related-card .ct-card-image { aspect-ratio: 16 / 10; margin: 0; border-radius: 0; background: var(--ct-soft); overflow: hidden; }
.ct-related-card .ct-card-image img { width: 100%; height: 100%; object-fit: cover; }
.ct-card-placeholder { display: grid; place-items: center; height: 100%; color: var(--ct-muted); }
.ct-card-placeholder svg { width: 40px; height: 40px; }
.ct-related-card .ct-card-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ct-related-card .ct-card-title { font-size: 18px; line-height: 1.4; letter-spacing: -.02em; margin: 0; }
.ct-related-card .ct-card-excerpt { margin: 0; font-size: 14px; line-height: 1.65; color: var(--ct-muted); }
.ct-related-card .ct-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 10px; font-size: 12px; color: var(--ct-muted); }
.ct-card-footer svg { width: 18px; height: 18px; color: var(--ct-accent); }
.ct-related .ct-theme-link { border-radius: var(--ct-radius); background: var(--ct-surface); border-color: var(--ct-line); }
.ct-related .ct-theme-link h3 { line-height: 1.4; }
.ct-related .ct-theme-link:hover { border-color: var(--ct-muted); background: var(--ct-surface); }
.ct-product-card { display: block; border: 1px solid var(--ct-line); border-radius: var(--ct-radius); padding: 16px; background: var(--ct-surface); }
.ct-product-card:hover { border-color: var(--ct-muted); }
.ct-product-card h3 { line-height: 1.4; }
@media (min-width: 768px) { .ct-related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { article.ct-article { grid-template-columns: minmax(0, 1fr) 280px; } }
@media (min-width: 1280px) { article.ct-article { grid-template-columns: minmax(0, 1fr) 296px; gap: 48px; } }
@media (max-width: 767px) {
  article.ct-article { padding-top: 20px; gap: 28px; }
  .ct-article .ct-breadcrumbs { margin-bottom: 16px; font-size: 11px; }
  .ct-article .ct-article-title { font-size: clamp(1.85rem, 7.5vw, 2.5rem); line-height: 1.16; }
  .ct-article .ct-article-byline { margin-top: 16px; }
  .ct-article .sw-actions { gap: 10px; padding: 12px 0; margin-bottom: 18px; }
  .ct-article .sw-actions-group { width: 100%; gap: 7px; }
  .ct-article .sw-actions-label { width: 100%; margin: 0 0 1px; }
  .ct-article .sw-actions .sw-btn { min-height: 44px; padding: 10px 12px; }
  .ct-article .ct-article-hero { margin-left: 0; margin-right: 0; margin-bottom: 22px; }
  .ct-article .prose-article { font-size: 17px; line-height: 1.75; }
  .ct-article .prose-article h2 { font-size: 1.4rem; }
  .ct-article .ct-author-card { padding: 20px; }
  .ct-newsletter-end form.nlbox { padding: 20px; }
  .ct-newsletter-end .nlbox__input, .ct-newsletter-end .nlbox__btn { width: 100%; flex-basis: 100%; }
  .ct-related { padding-top: 28px; padding-bottom: 28px; }
}
@media (max-width: 480px) {
  .ct-article .sw-actions-group:last-child { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-article .sw-actions-group:last-child .sw-actions-label { grid-column: 1 / -1; }
  .ct-article .sw-actions-group:last-child .sw-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ct-article *, .ct-related *, .nlbox *, .btn-modern { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
