/*
 * TechWire article template.
 *
 * Every selector is prefixed `twc-` and every custom property is scoped to
 * `.twc-page` rather than `:root`, so nothing here can reach Flatsome,
 * WooCommerce or any plugin — and nothing of theirs reaches in.
 *
 * Base colours are the measured values from the reference design. Derived
 * states (hover, tints, borders) are generated in OKLch from those.
 */

.twc-page {
  --twc-bg: #f5f5f5;
  --twc-surface: #ffffff;
  --twc-ink: #26222f;
  --twc-fg: #4c455f;
  --twc-accent: #805aed;
  --twc-accent-deep: #6d4cc7;

  --twc-muted: oklch(0.52 0.032 296.8);
  --twc-border: oklch(0.905 0.008 296.8);
  --twc-border-strong: oklch(0.84 0.012 296.8);
  --twc-accent-hover: oklch(0.506 0.2106 290.3);
  --twc-accent-tint: oklch(0.968 0.022 290.3);
  --twc-accent-tint-edge: oklch(0.9 0.055 290.3);
  --twc-rail-track: oklch(0.92 0.012 296.8);
  --twc-code-bg: oklch(0.962 0.004 296.8);

  --twc-measure: 68ch;
  --twc-radius: 10px;
  --twc-shadow: 0 1px 2px oklch(0.26 0.025 298.8 / 0.06), 0 8px 24px oklch(0.26 0.025 298.8 / 0.06);

  /* Flatsome's sticky header height. Override per-site if yours differs. */
  --twc-header-h: 90px;

  background: var(--twc-bg);
  color: var(--twc-fg);
  font: 400 18px/1.75 Inter, system-ui, sans-serif;
}

.twc-page *,
.twc-page *::before,
.twc-page *::after { box-sizing: border-box; }

.twc-page h1,
.twc-page h2,
.twc-page h3,
.twc-page h4 {
  font-family: Sora, Inter, system-ui, sans-serif;
  font-weight: 700;
  color: var(--twc-ink);
  letter-spacing: -0.018em;
  line-height: 1.2;
  margin: 0;
}

.twc-page a { color: var(--twc-accent); text-underline-offset: 3px; }
.twc-page a:hover { color: var(--twc-accent-hover); }
.twc-page :focus-visible { outline: 3px solid var(--twc-accent); outline-offset: 3px; border-radius: 4px; }
.twc-page img { max-width: 100%; height: auto; display: block; }

@media (prefers-reduced-motion: reduce) {
  .twc-page *,
  .twc-page *::before,
  .twc-page *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

.twc-shell { width: min(100% - 40px, 1240px); margin-inline: auto; }

/* ── Reading progress ─────────────────────────────────────────── */
.twc-progress {
  position: fixed; inset: 0 auto auto 0; height: 3px; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: var(--twc-accent); z-index: 999;
}

/* ── Breadcrumb ───────────────────────────────────────────────── */
.twc-crumbs { width: min(100% - 40px, 1240px); margin: 22px auto 0; font-size: 13px; color: var(--twc-muted); }
.twc-crumbs ol { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; list-style: none; margin: 0; padding: 0; }
.twc-crumbs a { color: var(--twc-muted); text-decoration: none; }
.twc-crumbs a:hover { color: var(--twc-accent-hover); text-decoration: underline; }
.twc-crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--twc-border-strong); }
.twc-crumbs [aria-current] { color: var(--twc-ink); font-weight: 600; }

/* ── Layout ───────────────────────────────────────────────────── */
.twc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; align-items: start; padding: 28px 0 96px; }
.twc-article { min-width: 0; max-width: var(--twc-measure); }

/* ── Article head ─────────────────────────────────────────────── */
.twc-eyebrow {
  display: inline-block; margin-bottom: 14px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--twc-accent-deep); text-decoration: none;
}
.twc-eyebrow:hover { color: var(--twc-accent-hover); text-decoration: underline; }

.twc-article__title { font-size: clamp(32px, 5vw, 50px); line-height: 1.1; margin-bottom: 20px; }
.twc-standfirst { font-size: 21px; line-height: 1.6; color: var(--twc-muted); margin: 0 0 28px; }

.twc-byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 18px 0; border-block: 1px solid var(--twc-border);
  font-size: 14px; color: var(--twc-muted);
}
.twc-byline strong { color: var(--twc-ink); font-weight: 600; }
.twc-byline__dot { width: 3px; height: 3px; border-radius: 50%; background: var(--twc-border-strong); }

.twc-figure { margin: 32px 0; }
.twc-figure img { width: 100%; border-radius: var(--twc-radius); }
.twc-figure figcaption { margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--twc-muted); }

/* ── Answer box + takeaways ───────────────────────────────────── */
.twc-answer {
  background: var(--twc-accent-tint); border: 1px solid var(--twc-accent-tint-edge);
  border-radius: var(--twc-radius); padding: 24px 26px; margin: 36px 0;
}
.twc-answer__label { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--twc-accent-deep); margin-bottom: 10px; }
.twc-answer__body p { margin: 0; font-size: 19px; line-height: 1.65; color: var(--twc-ink); }

.twc-takeaways {
  border: 1px solid var(--twc-border); border-radius: var(--twc-radius);
  background: var(--twc-surface); padding: 24px 26px; margin: 28px 0;
}
.twc-takeaways__label { font-size: 17px; margin-bottom: 14px; }
.twc-takeaways ul { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.twc-takeaways li { font-size: 16px; line-height: 1.6; }

/* ── Table of contents ────────────────────────────────────────── */
.twc-toc__title { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--twc-muted); margin-bottom: 14px; }
.twc-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: twctoc; }
.twc-toc li { counter-increment: twctoc; }
.twc-toc a {
  display: block; padding: 7px 0 7px 16px; border-left: 2px solid var(--twc-rail-track);
  font-size: 14.5px; line-height: 1.45; color: var(--twc-muted); text-decoration: none;
}
.twc-toc a::before { content: counter(twctoc) ". "; color: var(--twc-border-strong); font-variant-numeric: tabular-nums; }
.twc-toc a:hover { color: var(--twc-ink); border-left-color: var(--twc-border-strong); background: var(--twc-code-bg); }
.twc-toc a.is-current { color: var(--twc-accent-deep); border-left-color: var(--twc-accent); font-weight: 600; }
.twc-toc a.is-current::before { color: var(--twc-accent); }

.twc-rail { position: sticky; top: calc(var(--twc-header-h) + 24px); display: grid; gap: 28px; }
.twc-rail__toc { max-height: calc(100vh - var(--twc-header-h) - 190px); overflow-y: auto; }

.twc-toc-mobile {
  display: none; border: 1px solid var(--twc-border); border-radius: var(--twc-radius);
  background: var(--twc-surface); padding: 0 22px; margin: 28px 0;
}
.twc-toc-mobile summary {
  cursor: pointer; padding: 18px 0; font-family: Sora, sans-serif; font-weight: 700; font-size: 16px;
  color: var(--twc-ink); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.twc-toc-mobile summary::-webkit-details-marker { display: none; }
.twc-toc-mobile summary::after {
  content: ""; width: 9px; height: 9px; flex: none;
  border-right: 2px solid var(--twc-muted); border-bottom: 2px solid var(--twc-muted);
  transform: rotate(45deg) translateY(-2px); transition: transform 0.2s;
}
.twc-toc-mobile[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.twc-toc-mobile .twc-toc { padding-bottom: 20px; }

/* ── Post body (everything the editor produces) ───────────────── */
.twc-article__body > h2 { font-size: clamp(24px, 3.2vw, 31px); margin: 56px 0 16px; scroll-margin-top: calc(var(--twc-header-h) + 20px); }
.twc-article__body > h3 { font-size: 20px; margin: 36px 0 12px; scroll-margin-top: calc(var(--twc-header-h) + 20px); }
.twc-article__body p { margin: 0 0 20px; }
.twc-article__body ul,
.twc-article__body ol { margin: 0 0 22px; padding-left: 24px; display: grid; gap: 9px; }
.twc-article__body li { line-height: 1.7; }
.twc-article__body strong { color: var(--twc-ink); font-weight: 600; }
.twc-article__body blockquote {
  border-left: 3px solid var(--twc-accent); background: var(--twc-code-bg);
  padding: 16px 20px; border-radius: 0 var(--twc-radius) var(--twc-radius) 0;
  margin: 0 0 26px; font-size: 16px; line-height: 1.65;
}
.twc-article__body blockquote p:last-child { margin-bottom: 0; }
.twc-article__body code {
  font: 600 0.88em/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--twc-code-bg); border: 1px solid var(--twc-border);
  border-radius: 5px; padding: 2px 6px; color: var(--twc-ink);
}
.twc-article__body figure { margin: 32px 0; }
.twc-article__body figure img { border-radius: var(--twc-radius); }
.twc-article__body figcaption { margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--twc-muted); }

/* Editor tables: scroll rather than blow out the measure on small screens. */
.twc-article__body .wp-block-table,
.twc-article__body figure.wp-block-table {
  overflow-x: auto; margin: 0 0 26px;
  border: 1px solid var(--twc-border); border-radius: var(--twc-radius); background: var(--twc-surface);
}
.twc-article__body table { border-collapse: collapse; width: 100%; min-width: 540px; font-size: 15px; }
.twc-article__body caption { caption-side: top; text-align: left; padding: 16px 18px 0; font-size: 13px; color: var(--twc-muted); }
.twc-article__body th,
.twc-article__body td { padding: 13px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--twc-border); }
.twc-article__body thead th {
  font-size: 11.5px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--twc-muted); background: var(--twc-code-bg); line-height: 1.35;
}
.twc-article__body tbody th { font-weight: 600; color: var(--twc-ink); }
.twc-article__body tbody tr:last-child th,
.twc-article__body tbody tr:last-child td { border-bottom: 0; }

/* ── FAQ ──────────────────────────────────────────────────────── */
.twc-faq-section h2,
.twc-sources-section h2 { font-size: clamp(24px, 3.2vw, 31px); margin: 56px 0 16px; scroll-margin-top: calc(var(--twc-header-h) + 20px); }

.twc-faq { display: grid; gap: 12px; margin: 0 0 26px; }
.twc-faq details { border: 1px solid var(--twc-border); border-radius: var(--twc-radius); background: var(--twc-surface); padding: 0 22px; }
.twc-faq details[open] { border-color: var(--twc-border-strong); }
.twc-faq summary {
  cursor: pointer; padding: 18px 0; font-family: Sora, sans-serif; font-weight: 700; font-size: 17px;
  line-height: 1.4; color: var(--twc-ink); list-style: none; display: flex; justify-content: space-between; gap: 16px;
}
.twc-faq summary::-webkit-details-marker { display: none; }
.twc-faq summary:hover { color: var(--twc-accent-deep); }
.twc-faq summary::after { content: "+"; flex: none; font-family: Inter, sans-serif; font-size: 22px; line-height: 1; color: var(--twc-accent); font-weight: 400; }
.twc-faq details[open] summary::after { content: "\2013"; }
.twc-faq__answer { padding: 0 0 20px; font-size: 16.5px; line-height: 1.7; }
.twc-faq__answer p:last-child { margin-bottom: 0; }

/* ── Sources + author ─────────────────────────────────────────── */
.twc-sources { margin: 0 0 26px; padding-left: 22px; display: grid; gap: 11px; font-size: 15.5px; }
.twc-sources li { line-height: 1.6; color: var(--twc-muted); }
.twc-sources cite { font-style: normal; color: var(--twc-ink); font-weight: 600; }

.twc-author {
  display: flex; gap: 20px; align-items: flex-start;
  border: 1px solid var(--twc-border); border-radius: var(--twc-radius);
  background: var(--twc-surface); padding: 24px 26px; margin: 44px 0 0;
}
.twc-author__avatar {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  background: var(--twc-accent-tint); color: var(--twc-accent-deep);
  display: grid; place-items: center; font: 700 20px/1 Sora, sans-serif;
}
.twc-author__name { font-size: 17px; margin-bottom: 6px; }
.twc-author__name a { color: var(--twc-ink); text-decoration: none; }
.twc-author__name a:hover { color: var(--twc-accent-deep); text-decoration: underline; }
.twc-author p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--twc-muted); }

/* ── Rail card ────────────────────────────────────────────────── */
.twc-card {
  border: 1px solid var(--twc-border); border-radius: var(--twc-radius);
  background: var(--twc-surface); padding: 24px; box-shadow: var(--twc-shadow);
}
.twc-card h2 { font-size: 17px; margin-bottom: 8px; }
.twc-card p { margin: 0 0 16px; font-size: 14.5px; line-height: 1.6; color: var(--twc-muted); }

/* ── Related ──────────────────────────────────────────────────── */
.twc-related { border-top: 1px solid var(--twc-border); padding: 48px 0 0; }
.twc-related h2 { font-size: 24px; margin-bottom: 24px; }
.twc-related__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; list-style: none; padding: 0; margin: 0; }
.twc-related__card img { width: 100%; aspect-ratio: 960 / 624; object-fit: cover; border-radius: var(--twc-radius); margin-bottom: 12px; }
.twc-related__card h3 { font-size: 17px; line-height: 1.35; }
.twc-related__card a { color: var(--twc-ink); text-decoration: none; }
.twc-related__card a:hover { color: var(--twc-accent-deep); text-decoration: underline; }

.twc-comments { padding: 48px 0 80px; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .twc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .twc-article { max-width: none; }
  .twc-rail { position: static; display: none; }
  .twc-toc-mobile { display: block; }
  .twc-related__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .twc-page { font-size: 17px; }
  .twc-standfirst { font-size: 19px; }
  .twc-answer__body p { font-size: 18px; }
  .twc-related__grid { grid-template-columns: 1fr; gap: 24px; }
  .twc-layout { padding-bottom: 64px; }
}

/* ── Rail signup form (markup from blog-child bc_ux_signup_form) ── */
.twc-card .twc-brief__form { display: block; margin: 0; }
.twc-card .twc-brief__form input[type="email"] {
  width: 100%; height: auto; margin: 0 0 10px; padding: 11px 14px;
  border: 1px solid var(--twc-border-strong); border-radius: 7px; box-shadow: none;
  font: 400 15px Inter, sans-serif; color: var(--twc-ink); background: var(--twc-surface);
}
.twc-card .twc-brief__form input[type="email"]::placeholder { color: var(--twc-muted); }
.twc-card .twc-brief__form input[type="email"]:focus { border-color: var(--twc-accent); outline: none; }
.twc-card .twc-brief__form button {
  display: block; width: 100%; min-height: 46px; margin: 0; padding: 0 16px;
  border: 1px solid var(--twc-accent); border-radius: 7px; background: var(--twc-accent);
  font: 600 15px Inter, sans-serif; letter-spacing: normal; text-transform: none; color: #fff; cursor: pointer;
}
.twc-card .twc-brief__form button:hover { background: var(--twc-accent-hover); border-color: var(--twc-accent-hover); }

/* ── Host theme fit (Flatsome header is 90px, reference 72px) ─── */
.twc-page.page-wrapper { padding-top: 12px; }
.twc-page .twc-layout { padding-top: 12px; }
.twc-related__card .tw-card__img--empty {
  display: block; aspect-ratio: 960 / 624; margin-bottom: 12px; border-radius: var(--twc-radius);
  background: linear-gradient(135deg, #b8f5dc, #e3dafd);
}
