/*
 * ToolkitStack — "Foundations First" whitepaper.
 * Loaded on the whitepaper page and on the landing page (for the injected popup
 * fragment). Reuses the landing design-system custom properties defined on
 * `.tks-landing`; values fall back to literals so the fragment is safe anywhere.
 */

.tks-whitepaper {
  --tks-wp-read: 680px;
  --tks-wp-wide: 1000px;
  display: block;
}

.tks-whitepaper .tks-wp-wrap {
  width: 100%;
  max-width: var(--tks-wp-read);
  margin: 0 auto;
  padding: 0 24px;
}

.tks-whitepaper .tks-wp-wrap--wide {
  max-width: var(--tks-wp-wide);
}

/* Full-width bands; reading column centred inside. */
.tks-whitepaper .tks-wp-section {
  padding: 72px 0;
  background: var(--tks-landing-canvas, #f7f7f4);
  color: var(--tks-landing-ink, #1d2430);
}

.tks-whitepaper .tks-wp-section--tinted {
  background: var(--tks-landing-tint, #efeee9);
}

.tks-whitepaper .tks-wp-section--dark {
  background: var(--tks-landing-navy, #0d1827);
  color: #ffffff;
}

.tks-whitepaper .tks-wp-section + .tks-wp-section {
  border-top: 1px solid var(--tks-landing-border, #dedbd3);
}

.tks-whitepaper .tks-wp-section--dark,
.tks-whitepaper .tks-wp-section--tinted {
  border-top: 0;
}

.tks-whitepaper p {
  font-size: 18px;
  line-height: 1.75;
  margin: 0 0 20px;
}

.tks-whitepaper h2 {
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 6px 0 22px;
  color: var(--tks-landing-navy, #0d1827);
}

.tks-whitepaper .tks-wp-section--dark h2 {
  color: #ffffff;
}

.tks-whitepaper h3 {
  font-size: 19px;
  margin: 0 0 8px;
  color: var(--tks-landing-navy, #0d1827);
}

.tks-whitepaper .tks-landing-eyebrow {
  color: var(--tks-landing-accent, #7c3aed);
}

/* ---- Hero ---- */
.tks-whitepaper .tks-wp-hero {
  background: var(--tks-landing-navy, #0d1827);
  color: #ffffff;
  padding: 92px 0 76px;
}

.tks-whitepaper .tks-wp-hero h1 {
  font-size: clamp(32px, 5vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 8px 0 20px;
  color: #ffffff;
}

.tks-whitepaper .tks-wp-hero__lede {
  font-size: 20px;
  line-height: 1.7;
  color: var(--tks-landing-muted-light, #d7dee8);
  margin-bottom: 28px;
}

.tks-whitepaper .tks-wp-hero .tks-landing-eyebrow {
  color: #b79bff;
}

/* ---- Failure-mode 2x2 grid ---- */
.tks-whitepaper .tks-wp-failure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.tks-whitepaper .tks-wp-failure-grid article {
  background: var(--tks-landing-card, #ffffff);
  border: 1px solid var(--tks-landing-border, #dedbd3);
  border-left: 4px solid var(--tks-landing-accent, #7c3aed);
  border-radius: var(--tks-landing-radius-sm, 12px);
  padding: 20px;
}

.tks-whitepaper .tks-wp-failure-grid p {
  font-size: 16px;
  margin: 0;
  color: var(--tks-landing-muted, #626b78);
}

/* ---- Six-step method ---- */
.tks-whitepaper .tks-wp-steps {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.tks-whitepaper .tks-wp-steps li {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--tks-landing-card, #ffffff);
  border: 1px solid var(--tks-landing-border, #dedbd3);
  border-radius: var(--tks-landing-radius-sm, 12px);
  padding: 20px 22px;
}

.tks-whitepaper .tks-wp-steps__num {
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--tks-landing-accent, #7c3aed);
  line-height: 1.2;
}

.tks-whitepaper .tks-wp-steps p {
  font-size: 16px;
  margin: 0;
  color: var(--tks-landing-muted, #626b78);
}

/* ---- Pull-quote (shared style) ---- */
.tks-whitepaper .tks-wp-pullquote {
  margin: 8px 0 24px;
  padding: 6px 0 6px 24px;
  border-left: 4px solid var(--tks-landing-accent, #7c3aed);
}

.tks-whitepaper .tks-wp-pullquote p {
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--tks-landing-navy, #0d1827);
  margin: 0;
}

/* ---- Callouts (shared tinted-callout family) ---- */
.tks-wp-callout {
  border-radius: var(--tks-landing-radius, 16px);
  padding: 22px 24px;
  margin: 26px 0 0;
}

.tks-wp-callout strong {
  display: block;
  font-size: 17px;
  margin-bottom: 8px;
  color: var(--tks-landing-navy, #0d1827);
}

.tks-wp-callout p {
  font-size: 16px;
  margin: 0;
  color: var(--tks-landing-muted, #626b78);
}

.tks-wp-callout--card {
  background: var(--tks-landing-card, #ffffff);
  border: 1px solid var(--tks-landing-border, #dedbd3);
}

.tks-wp-callout--tinted {
  background: var(--tks-landing-accent-soft, #ede7ff);
  border: 1px solid #d9ccff;
}

.tks-wp-callout--note {
  background: var(--tks-landing-card, #ffffff);
  border: 1px dashed var(--tks-landing-border-strong, #cbc7bc);
}

.tks-wp-callout--accent {
  background: var(--tks-landing-accent, #7c3aed);
  border: 1px solid var(--tks-landing-accent-dark, #5b21b6);
}

.tks-wp-callout--accent strong,
.tks-wp-callout--accent p {
  color: #ffffff;
}

.tks-whitepaper .tks-wp-takeaways {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.tks-whitepaper .tks-wp-takeaways li {
  position: relative;
  padding-left: 26px;
  font-size: 16px;
  color: var(--tks-landing-ink, #1d2430);
}

.tks-whitepaper .tks-wp-takeaways li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tks-landing-accent, #7c3aed);
}

/* ---- Stat strip / stat card (shared component) ---- */
.tks-stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 28px 0 0;
}

.tks-stat-strip--pair {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tks-whitepaper .tks-wp-substat-label {
  margin: 26px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tks-landing-muted, #626b78);
}

.tks-stat-card {
  background: var(--tks-landing-card, #ffffff);
  border: 1px solid var(--tks-landing-border, #dedbd3);
  border-radius: var(--tks-landing-radius-sm, 12px);
  padding: 20px;
  text-align: left;
}

.tks-stat-card dt,
.tks-stat-card > strong {
  display: block;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--tks-landing-navy, #0d1827);
  font-variant-numeric: tabular-nums;
}

.tks-stat-card dd,
.tks-stat-card > span {
  display: block;
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--tks-landing-muted, #626b78);
}

.tks-stat-card--positive {
  border-color: #bfe6cd;
  background: #f1faf4;
}

.tks-stat-card--positive dt,
.tks-stat-card--positive > strong {
  color: var(--tks-landing-green, #168a4a);
}

/* ---- Recovery-curve diagram ---- */
.tks-whitepaper .tks-wp-figure {
  margin: 24px 0 28px;
  padding: 20px;
  background: var(--tks-landing-card, #ffffff);
  border: 1px solid var(--tks-landing-border, #dedbd3);
  border-radius: var(--tks-landing-radius, 16px);
}

.tks-whitepaper .tks-wp-curve {
  width: 100%;
  height: auto;
}

.tks-whitepaper .tks-wp-curve__axis {
  stroke: var(--tks-landing-border-strong, #cbc7bc);
  stroke-width: 1.5;
}

.tks-whitepaper .tks-wp-curve__line {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.tks-whitepaper .tks-wp-curve__line--visibility {
  stroke: var(--tks-landing-accent, #7c3aed);
}

.tks-whitepaper .tks-wp-curve__line--revenue {
  stroke: var(--tks-landing-green, #168a4a);
}

.tks-whitepaper .tks-wp-curve__dot--visibility {
  fill: var(--tks-landing-accent, #7c3aed);
}

.tks-whitepaper .tks-wp-curve__dot--revenue {
  fill: var(--tks-landing-green, #168a4a);
}

.tks-whitepaper .tks-wp-curve__lag {
  stroke: var(--tks-landing-muted, #626b78);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.tks-whitepaper .tks-wp-curve__lag-label {
  font-size: 14px;
  font-weight: 600;
  fill: var(--tks-landing-muted, #626b78);
}

.tks-whitepaper .tks-wp-curve__tick {
  font-size: 13px;
  fill: var(--tks-landing-muted, #626b78);
}

.tks-whitepaper .tks-wp-curve__tick--end {
  text-anchor: end;
}

.tks-whitepaper .tks-wp-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 14px;
}

.tks-whitepaper .tks-wp-legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--tks-landing-muted, #626b78);
}

.tks-whitepaper .tks-wp-legend__swatch {
  width: 16px;
  height: 4px;
  border-radius: 2px;
  display: inline-block;
}

.tks-whitepaper .tks-wp-legend__swatch--visibility {
  background: var(--tks-landing-accent, #7c3aed);
}

.tks-whitepaper .tks-wp-legend__swatch--revenue {
  background: var(--tks-landing-green, #168a4a);
}

.tks-whitepaper .tks-wp-section--dark .tks-landing-btn--primary {
  background: #ffffff;
  color: var(--tks-landing-navy, #0d1827);
  border-color: #ffffff;
}

/* ---- Full-screen popup ---- */
.tks-whitepaper-modal {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--tks-landing-canvas, #f7f7f4);
  color: var(--tks-landing-ink, #1d2430);
  overflow: hidden;
}

.tks-whitepaper-modal::backdrop {
  background: rgba(13, 24, 39, 0.72);
  backdrop-filter: blur(4px);
}

.tks-whitepaper-modal[open] {
  display: flex;
  flex-direction: column;
}

body.tks-modal-open {
  overflow: hidden;
}

.tks-whitepaper-modal__bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px max(20px, calc((100% - 1000px) / 2));
  background: rgba(13, 24, 39, 0.97);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tks-whitepaper-modal__eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b79bff;
  font-weight: 600;
}

.tks-whitepaper-modal__bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tks-whitepaper-modal__open,
.tks-whitepaper-modal__close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.tks-whitepaper-modal__open {
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: transparent;
}

.tks-whitepaper-modal__close {
  color: var(--tks-landing-navy, #0d1827);
  background: #ffffff;
  border: 1px solid #ffffff;
}

.tks-whitepaper-modal__close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.tks-whitepaper-modal__open:focus-visible,
.tks-whitepaper-modal__close:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.55);
  outline-offset: 2px;
}

.tks-whitepaper-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tks-whitepaper-modal__body .tks-wp-hero {
  padding-top: 56px;
}

.tks-whitepaper-modal__body[aria-busy="true"]::before {
  content: "Loading…";
  display: block;
  padding: 80px 24px;
  text-align: center;
  color: var(--tks-landing-muted, #626b78);
}

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .tks-whitepaper .tks-wp-section {
    padding: 52px 0;
  }

  .tks-whitepaper .tks-wp-failure-grid {
    grid-template-columns: 1fr;
  }

  .tks-whitepaper .tks-wp-hero {
    padding: 72px 0 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tks-whitepaper-modal::backdrop {
    backdrop-filter: none;
  }
}

@media print {
  .tks-landing-header,
  .tks-sticky-mobile-cta,
  .tks-landing-footer,
  .tks-whitepaper-modal__bar {
    display: none !important;
  }

  .tks-whitepaper .tks-wp-section {
    padding: 24px 0;
    background: #ffffff !important;
    color: #000000 !important;
    border-top: 1px solid #cccccc;
  }

  .tks-whitepaper .tks-wp-section--dark {
    background: #ffffff !important;
  }

  .tks-whitepaper .tks-wp-section--dark h2,
  .tks-whitepaper .tks-wp-hero h1,
  .tks-whitepaper .tks-wp-hero__lede {
    color: #000000 !important;
  }
}
