/* =========================================================
   Learning Rewired Lab
   Design Lab Detail System  —  v2 (light editorial)
   Shared template for Design Lab sub-pages
   File: /assets/css/lab-detail.css

   Direction:
   - Light editorial framing (white page, navy ink, violet accent)
   - Interactive demos remain dark "stages" via page-specific CSS
   - Inter / navy / violet — matches Perspectives, Newsletter, Studio
   - Page-specific CSS handles each custom demo/interaction
   ========================================================= */

:root {
  --dld-ink: #0f172a;
  --dld-muted: #475569;
  --dld-muted-strong: #334155;
  --dld-faint: #64748b;
  --dld-soft: #f1f5f9;
  --dld-line: #e7ecf2;
  --dld-line-strong: #dbe3ec;

  /* dark-stage tokens (interactive panels, code, closing) */
  --dld-deep: #0b1224;
  --dld-navy: #0b1224;
  --dld-stage-line: rgba(148, 163, 184, 0.16);
  --dld-stage-soft: rgba(255, 255, 255, 0.04);

  /* light surfaces */
  --dld-panel: #ffffff;
  --dld-panel-soft: #f8fafc;
  --dld-panel-strong: #ffffff;

  /* violet accent system */
  --dld-accent: #6d4aff;
  --dld-accent-deep: #5b34c9;
  --dld-accent-soft: rgba(109, 74, 255, 0.08);
  --dld-accent-light: #c4b5fd;

  /* legacy accent names repointed to violet (back-compat) */
  --dld-cyan: #6d4aff;
  --dld-lime: #5b34c9;
  --dld-gold: #6d4aff;
  --dld-pink: #6d4aff;
  --dld-danger: #e11d48;

  --dld-shadow: 0 24px 60px rgba(15, 23, 42, 0.10);
  --dld-shadow-soft: 0 16px 40px rgba(15, 23, 42, 0.07);
  --dld-radius-xl: 24px;
  --dld-radius-lg: 20px;
  --dld-radius-md: 16px;
  --dld-radius-sm: 12px;
  --dld-max: 1080px;
  --dld-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* =========================================================
   Base Page Shell
   ========================================================= */

body {
  margin: 0;
  color: var(--dld-ink);
  font-family: var(--dld-font);
  background: #ffffff;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* old dark grid + glow overlays removed for the light system */
body::before,
body::after {
  content: none;
  display: none;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-shell,
main,
#site-header,
#site-footer {
  position: relative;
  z-index: 1;
}

.dld-page,
.ac-resource-page,
.ctm-page,
.resource-detail-page {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  padding: clamp(1rem, 3vw, 1.5rem) 24px clamp(5rem, 10vw, 7rem);
  background: transparent !important;
  color: var(--dld-ink);
  font-family: var(--dld-font);
  overflow: visible;
}

.dld-page *,
.dld-page *::before,
.dld-page *::after,
.ac-resource-page *,
.ac-resource-page *::before,
.ac-resource-page *::after,
.ctm-page *,
.ctm-page *::before,
.ctm-page *::after,
.resource-detail-page *,
.resource-detail-page *::before,
.resource-detail-page *::after {
  box-sizing: border-box;
}

.dld-shell,
.ac-resource-inner,
.ctm-shell,
.resource-detail-inner {
  width: min(var(--dld-max), 100%);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* =========================================================
   Breadcrumbs
   ========================================================= */

.dld-breadcrumb,
.ac-resource-breadcrumbs,
.resource-detail-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  width: min(var(--dld-max), 100%);
  margin: 1.5rem auto clamp(1rem, 3vw, 1.5rem);
  color: var(--dld-faint);
  font-size: 0.82rem;
  font-weight: 600;
}

.dld-breadcrumb a,
.ac-resource-breadcrumbs a,
.resource-detail-breadcrumb a {
  color: var(--dld-muted);
  text-decoration: none;
}

.dld-breadcrumb a:hover,
.ac-resource-breadcrumbs a:hover,
.resource-detail-breadcrumb a:hover {
  color: var(--dld-accent);
}

.dld-breadcrumb span,
.ac-resource-breadcrumbs span,
.resource-detail-breadcrumb span {
  color: #cbd5e1;
}

.dld-breadcrumb strong,
.ac-resource-breadcrumbs strong,
.resource-detail-breadcrumb strong {
  color: var(--dld-ink);
  font-weight: 700;
}

/* =========================================================
   Shared Hero  (light)
   ========================================================= */

.dld-hero,
.ac-resource-hero,
.resource-detail-hero {
  position: relative;
  overflow: visible;
  max-width: none;
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(0.5rem, 2vw, 1rem);
  border: 0;
  border-radius: 0;
  text-align: left;
  background: transparent;
  box-shadow: none;
}

.dld-hero::after,
.ac-resource-hero::after,
.resource-detail-hero::after {
  content: none;
  display: none;
}

.dld-eyebrow,
.dld-kicker,
.dld-card-label,
.ac-eyebrow,
.ac-card-label,
.bdc-kicker,
.ctm-eyebrow,
.ctm-small-eyebrow,
.resource-detail-eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 0.5rem;
  min-height: auto;
  margin: 0 0 1.25rem;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--dld-accent-soft);
  color: var(--dld-accent-deep);
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
}

.resource-detail-eyebrow::before {
  display: none;
}

.dld-hero h1,
.ac-resource-hero h1,
.resource-detail-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 16ch;
  margin: 0;
  color: var(--dld-ink);
  font-size: clamp(2.75rem, 6.6vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 800;
  text-align: left;
  text-wrap: balance;
  padding: 0;
  overflow: visible;
}

.dld-hero h1 span,
.ac-resource-hero h1 span,
.resource-detail-gradient,
.resource-detail-hero h1 span {
  display: inline-block;
  padding: 0;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--dld-accent);
}

.dld-hero-intro,
.ac-hero-intro,
.resource-detail-intro {
  position: relative;
  z-index: 1;
  max-width: 60ch;
  margin: 1.5rem 0 0;
  color: var(--dld-muted);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.65;
  text-align: left;
}

.dld-hero-actions,
.ac-hero-actions,
.resource-detail-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 1.875rem;
}

/* =========================================================
   Buttons
   ========================================================= */

.dld-btn,
.ac-btn,
.ctm-btn,
.ctm-control,
.resource-detail-button,
.resource-detail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.5rem;
  border-radius: 12px;
  border: 0;
  text-decoration: none !important;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease;
}

.dld-btn:hover,
.ac-btn:hover,
.ctm-btn:hover,
.ctm-control:hover,
.resource-detail-button:hover,
.resource-detail-btn:hover {
  transform: translateY(-2px);
}

.dld-btn.primary,
.dld-btn.primary:visited,
.ac-btn.primary,
.ac-btn.primary:visited,
.ctm-btn.primary,
.ctm-btn.primary:visited,
.ctm-control.primary,
.resource-detail-button.primary,
.resource-detail-button.primary:visited,
.resource-detail-btn.primary,
.resource-detail-btn.primary:visited {
  color: #ffffff !important;
  background: var(--dld-accent) !important;
  box-shadow: 0 12px 26px rgba(109, 74, 255, 0.26) !important;
}

.dld-btn.primary:hover,
.ac-btn.primary:hover,
.ctm-btn.primary:hover,
.resource-detail-button.primary:hover,
.resource-detail-btn.primary:hover {
  box-shadow: 0 16px 34px rgba(109, 74, 255, 0.32) !important;
}

.dld-btn.secondary,
.dld-btn.secondary:visited,
.ac-btn.secondary,
.ac-btn.secondary:visited,
.ctm-btn.secondary,
.ctm-btn.secondary:visited,
.ctm-control.secondary,
.resource-detail-button.secondary,
.resource-detail-button.secondary:visited,
.resource-detail-btn.secondary,
.resource-detail-btn.secondary:visited {
  color: var(--dld-ink) !important;
  border: 1px solid var(--dld-line) !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.dld-btn.secondary:hover,
.ac-btn.secondary:hover,
.ctm-btn.secondary:hover,
.resource-detail-button.secondary:hover,
.resource-detail-btn.secondary:hover {
  border-color: #cbd5e1 !important;
  background: var(--dld-panel-soft) !important;
}

.dld-btn:disabled,
.ac-btn:disabled,
.ctm-btn:disabled,
.ctm-control:disabled,
.resource-detail-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* =========================================================
   Section Rhythm
   ========================================================= */

.dld-section,
.ac-section,
.ctm-summary-section,
.ctm-pro-section,
.ctm-best-section,
.ctm-design-section,
.ctm-code-section,
.ctm-related-section,
.ctm-preview-section,
.ctm-build-section,
.ctm-opening-section {
  position: relative;
  margin-top: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 0;
}

.ctm-summary-section,
.ctm-pro-section,
.ctm-best-section,
.ctm-design-section,
.ctm-code-section,
.ctm-related-section,
.ctm-preview-section {
  margin-bottom: 0;
}

.dld-section-heading,
.ac-section-heading,
.ctm-section-header,
.resource-detail-demo-header,
.resource-detail-code-header {
  max-width: 840px;
  margin: 0 0 1.5rem;
  text-align: left;
}

.dld-section-heading.compact,
.ac-section-heading.compact {
  margin-bottom: 0;
}

.dld-section-heading h2,
.ac-section-heading h2,
.ac-feature-band h2,
.ac-info-card h2,
.ac-resource-cta h2,
.ctm-summary-copy h2,
.ctm-section-header h2,
.ctm-pro-card h2,
.ctm-build-section h2,
.ctm-closing h2,
.resource-detail-section h2,
.resource-detail-demo-header h2,
.resource-detail-code-header h2,
.resource-detail-comparison-copy h2,
.resource-detail-closing h2 {
  margin: 0;
  color: var(--dld-ink);
  font-size: clamp(1.65rem, 3.2vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 800;
  text-wrap: balance;
}

.dld-section-heading p:not(.dld-eyebrow),
.ac-section-heading p:not(.ac-eyebrow),
.ac-feature-band p,
.ac-info-card p,
.ac-resource-cta p,
.ctm-opening-section p,
.ctm-build-section p,
.ctm-section-header p,
.ctm-summary-section p,
.ctm-pro-card p,
.ctm-closing p,
.resource-detail-section p,
.resource-detail-demo-header p,
.resource-detail-code-header p,
.resource-detail-closing p {
  max-width: 66ch;
  margin: 0.875rem 0 0;
  color: var(--dld-muted);
  font-size: 1.03rem;
  line-height: 1.7;
}

.ctm-opening-section p:first-child {
  color: var(--dld-ink);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  font-weight: 800;
}

/* =========================================================
   Shared Panels / Cards  (light)
   ========================================================= */

.dld-panel,
.dld-card,
.ac-info-card,
.ac-feature-band,
.ac-resource-cta,
.ctm-opening-section,
.ctm-build-section,
.ctm-summary-section,
.ctm-pro-card,
.resource-detail-demo-section,
.resource-detail-comparison {
  border: 1px solid var(--dld-line);
  border-radius: var(--dld-radius-lg);
  background: var(--dld-panel-soft);
  box-shadow: none;
  backdrop-filter: none;
}

.dld-card,
.ac-info-card,
.ctm-info-card,
.ctm-related-card,
.resource-detail-info-card,
.resource-detail-column,
.resource-detail-mini-grid div {
  padding: clamp(1.25rem, 3vw, 1.625rem);
  border: 1px solid var(--dld-line);
  border-radius: var(--dld-radius-md);
  background: var(--dld-panel);
  box-shadow: none;
}

.dld-card h3,
.ac-info-card h3,
.ctm-info-card h3,
.ctm-related-card h3,
.resource-detail-info-card h3,
.resource-detail-column h3,
.resource-detail-mini-grid h3 {
  margin: 0;
  color: var(--dld-ink);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.dld-card p,
.ac-info-card p,
.ctm-info-card p,
.ctm-related-card p,
.resource-detail-info-card p,
.resource-detail-column p,
.resource-detail-mini-grid p {
  margin: 0.625rem 0 0;
  color: var(--dld-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.dld-card span,
.ac-process-grid span,
.ctm-info-card span,
.ctm-related-card span,
.resource-detail-info-card span,
.resource-detail-column span,
.resource-detail-mini-grid span {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.625rem;
  color: var(--dld-accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ac-info-card ul,
.ctm-pro-list ul,
.resource-detail-info-card ul {
  margin: 0.85rem 0 0;
  padding-left: 1.1rem;
  color: var(--dld-muted);
  line-height: 1.7;
}

.ac-info-card li + li,
.resource-detail-info-card li + li {
  margin-top: 0.35rem;
}

/* =========================================================
   Shared Grids
   ========================================================= */

.dld-grid-2,
.ac-two-column,
.resource-detail-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.dld-grid-3,
.resource-detail-card-grid,
.resource-detail-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.dld-grid-4,
.ac-process-grid,
.ctm-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.ac-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.75fr) minmax(0, 0.9fr);
  gap: 1rem;
}

.ctm-related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

/* =========================================================
   Feature Bands
   ========================================================= */

.dld-feature-band,
.ac-feature-band {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(1rem, 4vw, 2rem);
  align-items: center;
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--dld-panel-soft);
}

/* =========================================================
   Code Blocks  (dark accent on light page)
   ========================================================= */

.dld-code-card,
.ac-code-card,
.ctm-code-card,
.resource-detail-code-box {
  overflow: hidden;
  border: 1px solid var(--dld-stage-line);
  border-radius: var(--dld-radius-md);
  background: var(--dld-deep);
  box-shadow: 0 24px 56px rgba(8, 15, 40, 0.28);
}

.dld-code-card pre,
.ac-code-card pre,
.ctm-code-card pre,
.resource-detail-code-box pre {
  margin: 0;
  max-height: 680px;
  overflow: auto;
  padding: clamp(1rem, 3vw, 1.35rem);
}

.dld-code-card code,
.ac-code-card code,
.ctm-code-card code,
.resource-detail-code-box code {
  color: #cbd5e1;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.84rem;
  line-height: 1.7;
  white-space: pre;
}

/* =========================================================
   Process Cards
   ========================================================= */

.ac-process-grid article,
.dld-process-card {
  padding: 1.5rem;
  border: 1px solid var(--dld-line);
  border-radius: var(--dld-radius-md);
  background: var(--dld-panel);
  box-shadow: none;
}

.ac-process-grid h3,
.dld-process-card h3 {
  margin: 0;
  color: var(--dld-ink);
  font-size: 1.05rem;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.ac-process-grid p,
.dld-process-card p {
  margin: 0.625rem 0 0;
  color: var(--dld-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* =========================================================
   CTAs / Closing  (dark band on light page)
   ========================================================= */

.dld-cta,
.ac-resource-cta,
.resource-detail-closing,
.ctm-closing {
  position: relative;
  overflow: hidden;
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 0;
  border-radius: var(--dld-radius-xl);
  text-align: center;
  background: var(--dld-deep);
  box-shadow: none;
}

.dld-cta::before,
.ac-resource-cta::before,
.resource-detail-closing::before,
.ctm-closing::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -80px;
  transform: translateX(-50%);
  width: 420px;
  height: 300px;
  background: radial-gradient(circle, rgba(109, 74, 255, 0.3), transparent 70%);
  pointer-events: none;
}

.dld-cta .dld-eyebrow,
.ac-resource-cta .ac-eyebrow {
  position: relative;
  margin-inline: auto;
  background: rgba(109, 74, 255, 0.18);
  color: var(--dld-accent-light);
}

.dld-cta h2,
.ac-resource-cta h2,
.resource-detail-closing h2,
.ctm-closing h2 {
  position: relative;
  margin-left: auto;
  margin-right: auto;
  color: #ffffff;
}

.dld-cta p,
.ac-resource-cta p,
.resource-detail-closing p,
.ctm-closing p {
  position: relative;
  margin-left: auto;
  margin-right: auto;
  color: rgba(226, 232, 240, 0.78);
}

.dld-cta .dld-btn,
.ac-resource-cta .ac-btn,
.resource-detail-closing .resource-detail-button,
.ctm-closing .resource-detail-button {
  margin-top: 1.5rem;
}

/* =========================================================
   Related Cards
   ========================================================= */

.ctm-related-card,
.dld-related-card {
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.ctm-related-card:hover,
.dld-related-card:hover {
  transform: translateY(-3px);
  border-color: var(--dld-accent-light);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
}

.ctm-related-card strong,
.dld-related-card strong {
  display: inline-flex;
  margin-top: 0.875rem;
  color: var(--dld-accent);
  font-weight: 700;
}

/* =========================================================
   Calm the Moment Compatibility Layer
   ========================================================= */

.ctm-page::before,
.ctm-page::after {
  display: none;
}

.ctm-summary-section {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1.5rem;
  align-items: stretch;
  padding: clamp(1.5rem, 4vw, 2.35rem);
  background: var(--dld-panel-soft);
}

.ctm-summary-stats {
  display: grid;
  gap: 0.9rem;
}

.ctm-summary-stats div,
.ctm-pro-list {
  border: 1px solid var(--dld-line);
  border-radius: var(--dld-radius-md);
  background: var(--dld-panel);
  box-shadow: none;
}

.ctm-summary-stats div {
  padding: 1.25rem;
}

.ctm-summary-stats strong {
  display: block;
  color: var(--dld-ink);
  font-size: 2.65rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.ctm-summary-stats span {
  display: block;
  margin-top: 0.5rem;
  color: var(--dld-accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ctm-pro-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 1.8rem;
  padding: clamp(1.5rem, 4vw, 2.35rem);
}

.ctm-pro-list {
  padding: 1.5rem;
}

.ctm-pro-list h3 {
  margin: 0 0 1rem;
  color: var(--dld-ink);
}

.ctm-pro-list ul {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.ctm-pro-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--dld-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ctm-pro-list li::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--dld-accent);
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1100px) {
  .ctm-summary-section,
  .ctm-pro-card {
    grid-template-columns: 1fr;
  }

  .ctm-card-grid,
  .ac-process-grid,
  .dld-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ctm-related-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .ac-overview-grid,
  .dld-grid-2,
  .dld-grid-3,
  .ac-two-column,
  .ac-two-column.reverse,
  .resource-detail-card-grid,
  .resource-detail-columns,
  .resource-detail-mini-grid,
  .dld-feature-band,
  .ac-feature-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dld-page,
  .ac-resource-page,
  .ctm-page,
  .resource-detail-page {
    padding: 1rem 18px 5rem;
  }

  .dld-shell,
  .ac-resource-inner,
  .ctm-shell,
  .resource-detail-inner {
    width: min(100%, var(--dld-max));
  }

  .dld-breadcrumb,
  .ac-resource-breadcrumbs,
  .resource-detail-breadcrumb {
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
  }

  .dld-hero,
  .ac-resource-hero,
  .resource-detail-hero {
    padding: 1.25rem 0 0.5rem;
    border-radius: 0;
  }

  .dld-hero h1,
  .ac-resource-hero h1,
  .resource-detail-hero h1 {
    font-size: clamp(2.5rem, 13vw, 3.5rem);
    line-height: 1;
  }

  .dld-hero-actions,
  .ac-hero-actions,
  .resource-detail-actions,
  .ctm-hero-actions {
    width: 100%;
    align-items: stretch;
  }

  .dld-btn,
  .ac-btn,
  .ctm-btn,
  .resource-detail-button,
  .resource-detail-btn {
    width: 100%;
  }

  .ctm-card-grid,
  .ac-process-grid,
  .dld-grid-4 {
    grid-template-columns: 1fr;
  }

  .dld-code-card pre,
  .ac-code-card pre,
  .ctm-code-card pre,
  .resource-detail-code-box pre {
    max-height: 520px;
  }
}

/* =========================================================
   Chart Motion Kit Compatibility Layer  (light)
   Supports /resource-lab/chart-motion-kit/
   ========================================================= */

.cmk-page {
  background: transparent !important;
  color: var(--dld-ink) !important;
}

.cmk-inner {
  width: min(var(--dld-max), 100%);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.cmk-section,
.cmk-snapshot,
.cmk-preview-section,
.cmk-design-section,
.cmk-code-section,
.cmk-related,
.cmk-closing {
  position: relative;
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.cmk-intro-section,
.cmk-snapshot,
.cmk-preview-section,
.cmk-design-section,
.cmk-code-section {
  border: 1px solid var(--dld-line);
  border-radius: var(--dld-radius-lg);
  background: var(--dld-panel-soft);
  box-shadow: none;
  backdrop-filter: none;
}

.cmk-closing {
  border: 0;
  border-radius: var(--dld-radius-xl);
  background: var(--dld-deep);
  overflow: hidden;
}

.cmk-intro-section,
.cmk-snapshot,
.cmk-preview-section,
.cmk-design-section,
.cmk-code-section,
.cmk-closing {
  padding: clamp(1.5rem, 4vw, 2.35rem);
}

.cmk-section h2,
.cmk-snapshot h2,
.cmk-preview-header h2,
.cmk-design-header h2,
.cmk-code-header h2,
.cmk-related-header h2 {
  margin: 0;
  color: var(--dld-ink);
  font-size: clamp(1.65rem, 3.2vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 800;
  text-wrap: balance;
}

.cmk-closing h2 {
  margin: 0 auto;
  color: #ffffff;
  font-size: clamp(1.65rem, 3.2vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.cmk-section p,
.cmk-snapshot p,
.cmk-preview-header p,
.cmk-design-header p,
.cmk-code-header p,
.cmk-related-header p {
  color: var(--dld-muted);
  line-height: 1.7;
}

.cmk-closing p {
  position: relative;
  margin-inline: auto;
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.65;
}

.cmk-intro-section p:first-child {
  color: var(--dld-ink);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.cmk-small-eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--dld-accent-soft);
  color: var(--dld-accent-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.cmk-snapshot {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1.5rem;
  align-items: stretch;
  background: var(--dld-panel-soft);
}

.cmk-snapshot-grid,
.cmk-metric-grid,
.cmk-use-grid,
.cmk-design-grid,
.cmk-related-grid,
.cmk-outcome-grid {
  display: grid;
  gap: 1rem;
}

.cmk-snapshot-grid {
  grid-template-columns: 1fr;
}

.cmk-use-grid,
.cmk-design-grid,
.cmk-outcome-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cmk-related-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cmk-stat-card,
.cmk-demo-card,
.cmk-use-card,
.cmk-design-card,
.cmk-related-card,
.cmk-metric-card,
.cmk-compare-card,
.cmk-outcome-card,
.cmk-outcome-feedback {
  border: 1px solid var(--dld-line);
  border-radius: var(--dld-radius-md);
  background: var(--dld-panel);
  box-shadow: none;
}

.cmk-stat-card,
.cmk-demo-card,
.cmk-use-card,
.cmk-design-card,
.cmk-related-card,
.cmk-metric-card,
.cmk-compare-card,
.cmk-outcome-card,
.cmk-outcome-feedback {
  padding: clamp(1.25rem, 3vw, 1.625rem);
}

.cmk-stat-card strong,
.cmk-metric-card strong,
.cmk-outcome-card strong {
  display: block;
  color: var(--dld-ink);
}

.cmk-stat-card span,
.cmk-card-header span,
.cmk-use-card span,
.cmk-design-card span,
.cmk-related-card span,
.cmk-compare-card span,
.cmk-outcome-card span {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.625rem;
  color: var(--dld-accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cmk-demo-card h3,
.cmk-use-card h3,
.cmk-design-card h3,
.cmk-related-card h3,
.cmk-compare-card h4,
.cmk-outcome-feedback h4 {
  margin: 0;
  color: var(--dld-ink);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.cmk-demo-card p,
.cmk-use-card p,
.cmk-design-card p,
.cmk-related-card p,
.cmk-compare-card p,
.cmk-outcome-feedback p {
  margin: 0.625rem 0 0;
  color: var(--dld-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.cmk-demo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.cmk-demo-wide {
  grid-column: 1 / -1;
}

.cmk-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.25rem;
}

.cmk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 1.05rem;
  border-radius: 12px;
  border: 0;
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.cmk-btn:hover {
  transform: translateY(-2px);
}

.cmk-btn.primary {
  color: #ffffff;
  background: var(--dld-accent);
  box-shadow: 0 12px 26px rgba(109, 74, 255, 0.26);
}

.cmk-btn.secondary {
  color: var(--dld-ink);
  border: 1px solid var(--dld-line);
  background: #ffffff;
  box-shadow: none;
}

.cmk-bar-track,
.cmk-mini-bars b {
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.cmk-bar-fill,
.cmk-mini-bars i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--dld-accent);
}

.cmk-ring {
  background:
    conic-gradient(var(--dld-accent) var(--ring-value, 0%), #eef2f7 0);
}

.cmk-ring-inner {
  background: #ffffff;
}

.cmk-code-box {
  overflow: hidden;
  border: 1px solid var(--dld-stage-line);
  border-radius: var(--dld-radius-md);
  background: var(--dld-deep);
  box-shadow: 0 24px 56px rgba(8, 15, 40, 0.28);
}

.cmk-code-box pre {
  margin: 0;
  max-height: 680px;
  overflow: auto;
  padding: clamp(1rem, 3vw, 1.35rem);
}

.cmk-code-box code {
  color: #cbd5e1;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.84rem;
  line-height: 1.7;
  white-space: pre;
}

.cmk-related-card {
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.cmk-related-card:hover {
  transform: translateY(-3px);
  border-color: var(--dld-accent-light);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
}

.cmk-related-card strong {
  display: inline-flex;
  margin-top: 0.875rem;
  color: var(--dld-accent);
  font-weight: 700;
}

@media (max-width: 980px) {
  .cmk-snapshot,
  .cmk-demo-grid,
  .cmk-use-grid,
  .cmk-design-grid,
  .cmk-related-grid,
  .cmk-outcome-grid {
    grid-template-columns: 1fr;
  }

  .cmk-demo-wide {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .cmk-toggle-row,
  .cmk-btn {
    width: 100%;
  }
}
