/* CSSIC Writing Primitives
   Prefix: w-  (scoped to article pages)
   Depends on: /style.css root variables
   ================================================== */

/* ── Overflow guard (prevents 100vw scrollbar bleed) ── */
html:has(.writing-page), .writing-page { overflow-x: clip; }

/* ── Layout ── */
.article-container {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-md) clamp(1rem, 4vw, 1.5rem) var(--space-md);
}

.article-header {
  text-align: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(var(--navy-rgb), 0.25);
}

.article-header h1 {
  font-size: clamp(1.875rem, 5vw, 2.5rem);
  margin-bottom: var(--space-xs);
  line-height: 1.2;
}

.article-header .subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.article-header .meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

.article-header .meta .author {
  color: var(--navy);
  font-weight: 500;
}
a.author {
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--navy-rgb), 0.25);
  transition: border-color 0.15s ease;
}
a.author:hover {
  border-color: var(--navy);
}
a.author:visited {
  color: var(--navy);
}

.article-body {
  line-height: 1.8;
}

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body h2 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  font-size: 1.5rem;
}

.article-body h3 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xs);
}

.article-body section {
  margin-bottom: var(--space-lg);
}

/* ── Citations (w-cite) ── */
.w-cite {
  font-size: 0.7em;
  font-weight: 600;
  color: var(--red);
  cursor: pointer;
  vertical-align: super;
  line-height: 0;
  padding: 0 2px;
  transition: color 0.15s ease;
  text-decoration: none;
}

.w-cite:hover {
  color: var(--navy);
}

.w-cite-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  background: var(--navy);
  color: #fff;
  padding: 0.625rem 1rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  max-width: 320px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: scale(0.96);
  z-index: 1000;
  box-shadow: 0 4px 24px rgba(12, 45, 72, 0.25);
  pointer-events: none;
}

.w-cite-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
}

.w-cite-tooltip a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  transition: border-color 0.15s ease;
}

.w-cite-tooltip a:hover {
  border-color: #fff;
}

.w-cite-tooltip .cite-num {
  color: var(--light-blue);
  font-weight: 600;
  margin-right: 0.25rem;
}

/* ── Highlights (w-mark) ── */

/* Default / background style */
.w-mark,
.w-mark--bg {
  background: rgba(196, 30, 58, 0.1);
  padding: 0.05em 0.15em;
  border-radius: 2px;
  color: inherit;
}

/* Left-border accent block */
.w-mark--border {
  display: inline;
  background: rgba(var(--navy-rgb), 0.04);
  border-left: 3px solid var(--red);
  padding: 0.1em 0.4em;
  border-radius: 0;
  color: inherit;
}

/* Underline + color shift */
.w-mark--underline {
  background: none;
  border-bottom: 2px dotted var(--red);
  font-weight: 500;
  color: var(--navy);
  padding: 0;
  border-radius: 0;
}

/* Animated reveal highlight (scroll-triggered) */
.w-mark--reveal {
  background: linear-gradient(90deg, rgba(196, 30, 58, 0.12) 50%, transparent 50%);
  background-size: 200% 100%;
  background-position: 100% 0;
  padding: 0.05em 0.15em;
  border-radius: 2px;
  color: inherit;
  transition: background-position 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.w-mark--reveal.revealed {
  background-position: 0 0;
}

/* ── Expandable Sub-links ── */

/* Approach A: Inline Expand (details/summary) */
.w-expand--inline {
  margin: 1rem 0;
  border: none;
}

.w-expand--inline summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 500;
  font-size: 0.9375rem;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s ease;
}

.w-expand--inline summary::-webkit-details-marker { display: none; }
.w-expand--inline summary::marker { display: none; content: ''; }

.w-expand--inline summary::before {
  content: '';
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.w-expand--inline[open] summary::before {
  transform: rotate(45deg);
}

.w-expand--inline summary:hover {
  color: var(--navy);
}

.w-expand--inline .w-expand-body {
  border-left: 3px solid var(--red);
  background: var(--bg);
  padding: 1rem 1.25rem;
  margin: 0.75rem 0 0.75rem 0.25rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
}

.w-expand--inline .w-expand-body p:last-child {
  margin-bottom: 0;
}

/* Smooth animation for inline expand */
.w-expand--inline .w-expand-body {
  overflow: hidden;
}

.w-expand--inline:not([open]) .w-expand-body {
  animation: w-collapse 0.25s ease forwards;
}

.w-expand--inline[open] .w-expand-body {
  animation: w-expand-in 0.3s ease forwards;
}

@keyframes w-expand-in {
  from { opacity: 0; max-height: 0; margin-top: 0; padding-top: 0; padding-bottom: 0; }
  to   { opacity: 1; max-height: 800px; margin-top: 0.75rem; padding-top: 1rem; padding-bottom: 1rem; }
}

/* ── Shared trigger button for B & C ── */
.w-expand-trigger {
  background: rgba(var(--navy-rgb), 0.03);
  border: none;
  color: var(--blue);
  font-weight: 600;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 0.35em 0.6em;
  position: relative;
  transition: color 0.2s ease, background 0.2s ease;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  line-height: 1.4;
}

.w-expand-trigger::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
  transform: rotate(-45deg);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.w-expand-trigger::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--red) 0%, var(--blue) 100%);
  opacity: 0.4;
  transition: opacity 0.2s ease;
  border-radius: 0 0 4px 4px;
}

.w-expand-trigger:hover {
  color: var(--navy);
  background: rgba(var(--navy-rgb), 0.06);
}

.w-expand-trigger:hover::before {
  transform: rotate(0deg);
}

.w-expand-trigger:hover::after {
  opacity: 1;
}

/* ── Approach B: Side Panel (polished) ── */
.w-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(var(--navy-rgb), 0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.w-panel-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

.w-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 88vw);
  height: 100vh;
  background: var(--white);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

.w-panel.visible {
  transform: translateX(0);
  box-shadow: -8px 0 40px rgba(var(--navy-rgb), 0.12);
}

/* Centered panel variant */
.w-panel--centered {
  right: auto;
  left: 50%;
  top: 50%;
  height: auto;
  max-height: 80vh;
  max-width: min(560px, 90vw);
  width: 100%;
  border-radius: 14px;
  transform: translate(-50%, -50%) scale(0.95);
  opacity: 0;
  box-shadow: 0 12px 48px rgba(var(--navy-rgb), 0.18);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.w-panel--centered.visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.w-panel-header {
  background: var(--navy);
  color: #fff;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
}

/* Red accent bar at top of header */
.w-panel-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--light-blue) 100%);
  pointer-events: none;
}

.w-panel--centered .w-panel-header {
  border-radius: 14px 14px 0 0;
}

.w-panel-header h3 {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

/* Kicker label above title */
.w-panel-header .w-panel-kicker {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--light-blue);
  display: block;
  margin-bottom: 0.2rem;
}

.w-panel-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.w-panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.w-panel-content {
  padding: 1.75rem 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text);
}

/* Red left-border accent on first paragraph in panel */
.w-panel-content p:first-child {
  border-left: 3px solid var(--red);
  padding-left: 1rem;
  margin-left: -0.25rem;
}

.w-panel-content p + p {
  margin-top: 1rem;
}

/* Panel footer with source link */
.w-panel-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid rgba(var(--navy-rgb), 0.08);
  background: var(--bg);
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.w-panel-footer a,
.w-panel-footer a:visited {
  color: var(--blue);
}

.w-panel--centered .w-panel-footer {
  border-radius: 0 0 14px 14px;
}

/* ── Approach C: Popup/Modal (polished) ── */
.w-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(var(--navy-rgb), 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.w-modal-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

.w-modal {
  background: var(--white);
  border-radius: 14px;
  max-width: min(620px, 92vw);
  max-height: 75vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(var(--navy-rgb), 0.2), 0 0 0 1px rgba(var(--navy-rgb), 0.05);
  transform: scale(0.94) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
  opacity: 0;
}

.w-modal-backdrop.visible .w-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.w-modal-header {
  background: var(--navy);
  color: #fff;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 14px 14px 0 0;
  flex-shrink: 0;
  position: relative;
}

/* Red accent bar at top */
.w-modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--light-blue) 100%);
  border-radius: 14px 14px 0 0;
}

.w-modal-header h3 {
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.w-modal-header .w-modal-kicker {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--light-blue);
  display: block;
  margin-bottom: 0.2rem;
}

.w-modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.w-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.w-modal-content {
  padding: 1.75rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text);
}

/* Red left-border accent on first paragraph in modal */
.w-modal-content p:first-child {
  border-left: 3px solid var(--red);
  padding-left: 1rem;
  margin-left: -0.25rem;
}

.w-modal-content p + p {
  margin-top: 1rem;
}

/* Modal footer */
.w-modal-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid rgba(var(--navy-rgb), 0.08);
  background: var(--bg);
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-radius: 0 0 14px 14px;
  flex-shrink: 0;
}

/* ── Interactive Toggle Chart (w-chart) ── */
.w-chart-container {
  margin: var(--space-lg) 0;
  background: var(--bg);
  border-radius: 10px;
  padding: 1.5rem;
}

.w-chart-toggles {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.w-chart-toggle {
  background: var(--white);
  border: 1.5px solid rgba(var(--navy-rgb), 0.15);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.w-chart-toggle:hover {
  border-color: var(--blue);
  color: var(--navy);
}

.w-chart-toggle.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.w-chart-area {
  min-height: 180px;
}

.w-chart-area svg {
  width: 100%;
  display: block;
}

.w-bar-group {
  cursor: default;
}

.w-bar-label {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  fill: var(--text);
}

.w-bar-rect {
  rx: 4;
  ry: 4;
  transition: width 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.w-bar-value {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  fill: var(--text);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.w-bar-group:hover .w-bar-value {
  opacity: 1;
}

.w-bar-source {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 10px;
  fill: var(--text-muted);
}

.w-chart-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-style: italic;
}

/* ── Conference Timeline (w-timeline) ── */
.w-timeline {
  position: relative;
  padding: var(--space-md) 0;
  margin: var(--space-lg) 0;
}

.w-timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--light-blue);
}

.w-timeline-node {
  position: relative;
  padding-left: 56px;
  margin-bottom: var(--space-md);
  cursor: pointer;
}

.w-timeline-node::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--light-blue);
  transition: all 0.25s ease;
  z-index: 1;
}

.w-timeline-node.active::before,
.w-timeline-node:hover::before {
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(196, 30, 58, 0.15);
}

.w-timeline-title {
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
  transition: color 0.15s ease;
}

.w-timeline-node:hover .w-timeline-title {
  color: var(--red);
}

.w-timeline-summary {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.w-timeline-detail {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.25s ease;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
  margin-top: 0;
}

.w-timeline-node.expanded .w-timeline-detail {
  max-height: 500px;
  opacity: 1;
  margin-top: 0.75rem;
}

/* ── Placeholder (for deferred visuals) ── */
.w-placeholder {
  background: var(--bg);
  border: 2px dashed rgba(var(--navy-rgb), 0.15);
  border-radius: 10px;
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  margin: var(--space-lg) 0;
}

.w-placeholder-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.w-placeholder-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--navy);
  margin-top: 0.5rem;
}

/* ── References list ── */
.w-references {
  border-top: 1px solid rgba(var(--navy-rgb), 0.1);
  padding-top: var(--space-lg);
  margin-top: var(--space-xl);
  counter-reset: ref-counter;
}

.w-references h2 {
  font-size: 1.25rem;
  margin-top: 0;
  margin-bottom: var(--space-sm);
}

.w-references ol {
  list-style: none;
  padding: 0;
}

.w-references li {
  counter-increment: ref-counter;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-muted);
  padding: 0.4rem 0;
  padding-left: 2rem;
  position: relative;
}

.w-references li::before {
  content: counter(ref-counter) ".";
  position: absolute;
  left: 0;
  font-weight: 600;
  color: var(--red);
  font-size: 0.75rem;
}

.w-references li a {
  color: var(--blue);
  word-break: break-all;
}

/* ── Executive Summary ── */
.w-exec-summary {
  background: var(--bg);
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  margin-bottom: var(--space-lg);
  border-left: 4px solid var(--red);
}
.w-exec-summary p {
  margin-bottom: 1rem;
  line-height: 1.7;
  font-size: 0.9375rem;
}
.w-exec-summary p:last-child {
  margin-bottom: 0;
}
.w-exec-summary .w-exec-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--red);
  margin-bottom: 0.75rem;
  display: block;
}
.w-exec-summary .w-exec-stat {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.4;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .article-container {
    padding: var(--space-md) 1rem var(--space-sm);
  }

  .article-header h1 {
    font-size: 1.625rem;
  }

  .article-header .subtitle {
    font-size: 1rem;
  }

  .w-chart-container {
    padding: 1rem;
  }

  .w-chart-toggles {
    gap: 0.35rem;
  }

  .w-chart-toggle {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
  }

  .w-timeline::before {
    left: 14px;
  }

  .w-timeline-node {
    padding-left: 44px;
  }

  .w-timeline-node::before {
    left: 7px;
    width: 16px;
    height: 16px;
  }
}

/* ── Test page utilities ── */
.test-section {
  margin: var(--space-xl) 0;
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid rgba(var(--navy-rgb), 0.1);
}

.test-section:last-child {
  border-bottom: none;
}

.test-label {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-bottom: var(--space-sm);
}

.test-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  font-style: italic;
}

/* ── Test Hub ── */
.w-test-hub {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: var(--space-lg) 0;
}

.w-test-card {
  display: block;
  background: var(--white);
  border: 1.5px solid rgba(var(--navy-rgb), 0.1);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.w-test-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 16px rgba(var(--navy-rgb), 0.08);
}

.w-test-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--light-blue) 100%);
  border-radius: 10px 10px 0 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.w-test-card:hover::before {
  opacity: 1;
}

.w-test-card-label {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.w-test-card h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 0.35rem;
}

.w-test-card p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.w-feedback {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(var(--navy-rgb), 0.08);
}

.w-feedback label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.4rem;
}

.w-feedback textarea {
  width: 100%;
  min-height: 60px;
  border: 1.5px solid rgba(var(--navy-rgb), 0.15);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  resize: vertical;
  transition: border-color 0.15s ease;
}

.w-feedback textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.w-feedback-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.w-copy-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.w-copy-btn:hover {
  background: var(--blue);
}

.w-copy-btn.copied {
  background: #2d8f4e;
}

/* ── Visualization Engine (viz.js) ── */
.w-viz-funnel,
.w-viz-compare {
  margin: var(--space-lg) 0;
  background: var(--white);
  border: 1.5px solid rgba(var(--navy-rgb), 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  overflow: hidden;
}

.w-viz-controls {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.w-viz-stage-btn {
  background: var(--bg);
  border: 1.5px solid rgba(var(--navy-rgb), 0.12);
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.w-viz-stage-btn:hover {
  border-color: var(--blue);
  color: var(--navy);
}

.w-viz-stage-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.w-viz-svg-wrap {
  width: 100%;
  min-height: 120px;
}

.w-viz-svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.w-viz-info {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text);
}

.w-viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.w-viz-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.w-viz-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .w-viz-funnel,
  .w-viz-compare {
    padding: 1rem;
  }

  .w-viz-stage-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.6875rem;
  }
}

/* ── Talent Funnel Widget ── */
.w-funnel {
  position: relative;
  margin: 2rem -1rem;
}

.w-funnel-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding-top: var(--nav-height);
  box-sizing: border-box;
}

.w-funnel-text {
  text-align: center;
  margin-bottom: 0.75rem;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  width: 100%;
  max-width: 560px;
  padding: 0 1rem;
  flex-shrink: 0;
}

.w-funnel-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--navy);
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
  display: inline-block;
  transition: background 0.4s ease;
}
.w-funnel-label.red { background: var(--red); }

.w-funnel-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  line-height: 1.2;
  min-height: 2.4em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
}


.w-funnel-stat {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1;
  margin: 0.3rem 0;
  transition: none;
}

.w-funnel-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  max-width: 440px;
  min-height: 2.7em;
}

.w-funnel-pct {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  margin-top: 0.4rem;
}

.w-funnel-viz {
  width: 100%;
  max-width: 420px;
  position: relative;
  flex: 1 1 0;
  min-height: 180px;
}
.w-funnel-viz canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
}

.w-funnel-scale {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  opacity: 0.5;
  transition: opacity 0.35s ease;
}

.w-funnel-progress {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  align-items: center;
}
.w-funnel-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(12, 45, 72, 0.15);
  transition: background 0.3s ease, transform 0.3s ease;
}
.w-funnel-pip.active {
  background: var(--navy);
  transform: scale(1.3);
}
.w-funnel-pip.red { background: var(--red); }

.w-funnel-spacer {
  height: 85vh;
  pointer-events: none;
}
.w-funnel-spacer:first-of-type {
  height: 20vh;
}

/* ── Scrollytelling two-column layout ── */
.w-scrolly {
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  box-sizing: border-box;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.w-scrolly-text {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 1.5rem);
  box-sizing: border-box;
  line-height: 1.8;
}
.w-scrolly-text section {
  margin-bottom: var(--space-lg);
}
.w-scrolly-text p {
  margin-bottom: 1.25rem;
}
.w-scrolly-text h2 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  font-size: 1.5rem;
}
.w-scrolly-text h2:first-child,
.w-scrolly-text section:first-child h2,
.article-body section:first-child h2 {
  margin-top: 0;
}
/* Mobile: inline centered funnel widget */
.w-scrolly-viz {
  display: block;
  max-width: 400px;
  margin: var(--space-lg) auto;
  padding: 0 clamp(1rem, 4vw, 1.5rem);
  box-sizing: border-box;
}
.w-scrolly-sticky {
  position: relative;
  top: auto;
  padding: 0.5rem 0;
}
/* Desktop (≥1200px): sidebar mode */
@media (min-width: 1200px) {
  .w-scrolly-viz {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% + 348px);
    width: 240px;
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .w-scrolly-sticky {
    position: sticky;
    top: calc(var(--nav-height, 60px) + 1rem);
  }
  .w-scrolly-sticky .w-funnel--inline .w-funnel-sticky {
    min-height: auto;
    padding-top: 0;
  }
  .w-scrolly-sticky .w-funnel-label {
    font-size: 0.55rem;
    padding: 0.15rem 0.4rem;
    margin-bottom: 0.25rem;
  }
  .w-scrolly-sticky .w-funnel-text {
    min-height: auto;
    margin-bottom: 0.25rem;
    text-align: left;
    align-items: flex-start;
  }
  .w-scrolly-sticky .w-funnel-title {
    font-size: 0.85rem;
    min-height: 0;
  }
  .w-scrolly-sticky .w-funnel-stat {
    font-size: 1.4rem;
    margin: 0.15rem 0;
  }
  .w-scrolly-sticky .w-funnel-desc {
    font-size: 0.65rem;
    min-height: 0;
    line-height: 1.4;
    max-width: 240px;
  }
  .w-scrolly-sticky .w-funnel-pct {
    font-size: 0.55rem;
    padding: 0.1rem 0.35rem;
    margin-top: 0.2rem;
  }
  .w-scrolly-sticky .w-funnel-scale {
    font-size: 0.55rem;
    margin-top: 0.25rem;
    text-align: left;
    width: 100%;
  }
  .w-scrolly-sticky .w-funnel-viz {
    max-width: 240px;
  }
  .w-scrolly-sticky .w-funnel-progress {
    gap: 4px;
    margin-top: 0.4rem;
  }
  .w-scrolly-sticky .w-funnel-pip {
    width: 6px;
    height: 6px;
  }
}

/* ── Inline / embedded mode ── */
.w-funnel--inline .w-funnel-sticky {
  position: relative;
  height: auto;
  min-height: 0;
  padding-top: 1rem;
}
.w-funnel--inline .w-funnel-label {
  display: none;
}
.w-funnel--inline .w-funnel-spacer {
  display: none;
}
.w-funnel--inline .w-funnel-progress {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  justify-content: center;
  margin-top: 0.75rem;
}
.w-funnel--inline .w-funnel-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.w-funnel--inline .w-funnel-nav button {
  background: var(--bg);
  border: 1.5px solid rgba(var(--navy-rgb), 0.15);
  border-radius: 6px;
  padding: 0.35rem 0.8rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.w-funnel--inline .w-funnel-nav button:hover {
  border-color: var(--blue);
  color: var(--navy);
}

@media (max-width: 640px) {
  .w-funnel { margin: 2rem 0; }
  .w-funnel-viz { max-width: 220px; }
  .w-funnel-text { min-height: 80px; }
  .w-funnel-title { font-size: 1.3rem; }
  .w-funnel-stat { font-size: 2rem; }
  .w-funnel-desc { font-size: 0.78rem; min-height: 4.8em; }
}

/* ── Detail links (inline panel triggers) ── */
.w-detail-link {
  background: rgba(196, 30, 58, 0.1);
  padding: 0.05em 0.2em;
  border-radius: 2px;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1.5px dotted var(--red);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.w-detail-link:hover {
  background: rgba(196, 30, 58, 0.18);
  border-bottom-style: solid;
}
.w-detail-link:visited,
.w-detail-link:active {
  color: inherit;
  background: rgba(196, 30, 58, 0.1);
  border-bottom: 1.5px dotted var(--red);
}

/* ── Funnel tap hint ── */
.w-funnel-tap-hint {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  opacity: 0.7;
  transition: opacity 0.4s ease;
}
.w-funnel-tap-hint.faded { opacity: 0; }

/* ── Funnel prev/next arrows ── */
.w-funnel-arrows {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
}
.w-funnel-arrows button {
  background: none;
  border: 1.5px solid rgba(var(--navy-rgb), 0.15);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.w-funnel-arrows button:hover {
  border-color: var(--blue);
  color: var(--navy);
}
.w-funnel-arrows button:disabled {
  opacity: 0.25;
  cursor: default;
}
.w-funnel-arrows .w-funnel-stage-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 4em;
  text-align: center;
}

/* Hide tap hint on desktop */
@media (min-width: 769px) {
  .w-funnel-tap-hint { display: none; }
}

/* ── Compare Chart (SW vs HW bars) ── */
.w-compare-chart {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(var(--navy-rgb), 0.08);
  border-radius: 12px;
  background: rgba(var(--navy-rgb), 0.015);
}
.w-compare-chart h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
.w-compare-row {
  margin-bottom: 1rem;
}
.w-compare-row:last-child { margin-bottom: 0; }
.w-compare-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.35rem;
}
.w-compare-bars {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.w-compare-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 1.5rem;
}
.w-compare-bar-name {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  width: 5.5rem;
  flex-shrink: 0;
  text-align: right;
}
.w-compare-bar-track {
  flex: 1;
  height: 100%;
  background: rgba(var(--navy-rgb), 0.04);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.w-compare-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.w-compare-bar-fill--sw {
  background: var(--blue);
}
.w-compare-bar-fill--hw {
  background: var(--red);
}
.w-compare-bar-value {
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 3.5rem;
  flex-shrink: 0;
}
.w-compare-bar-value--sw { color: var(--blue); }
.w-compare-bar-value--hw { color: var(--red); }

.w-compare-legend {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
}
.w-compare-legend span::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: middle;
}
.w-compare-legend .leg-sw::before { background: var(--blue); }
.w-compare-legend .leg-hw::before { background: var(--red); }
.w-compare-source {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

