/*!
 * NestaConnect Premium Article Stylesheet
 * Scoped under .nc-ch01 — applies only to posts whose body wraps content in
 * <article class="nc-ch01">. Lets editors paste structural HTML only;
 * theme owns the entire visual design.
 *
 * Loaded conditionally by functions.php when the post body contains nc-ch01.
 */

.nc-ch01 {
  --ink-900:#0b1220;
  --ink-800:#101a2d;
  --ink-700:#1a2540;
  --ink-600:#2b3a5b;
  --ink-500:#475574;
  --ink-400:#7a87a3;
  --ink-300:#aab4cd;
  --paper:#fcfbf8;
  --paper-2:#f5f3ec;
  --rule:#e2e2d6;
  --accent:#0c63e7;
  --accent-2:#06b6d4;
  --accent-3:#c5681a;
  --accent-warm:#e9c46a;
  --code-bg:#0b1220;
  --code-edge:rgba(120,170,255,.16);
  --serif: "Fraunces","Source Serif Pro",Georgia,"Times New Roman",serif;
  --sans:  "Inter Tight","Inter",-apple-system,BlinkMacSystemFont,sans-serif;
  --mono:  "JetBrains Mono","Fira Code",ui-monospace,"SF Mono",Menlo,monospace;

  background: var(--paper);
  color: var(--ink-900);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.005em;
  padding: clamp(24px,5vw,56px) clamp(16px,4vw,40px);
  max-width: 880px;
  margin: 0 auto;
  display: block;
}

/* Defuse the default theme article spacing & rules inside .nc-ch01 */
.nc-ch01 *, .nc-ch01 *::before, .nc-ch01 *::after { box-sizing: border-box; }
.nc-ch01 hr { display: none; } /* we use .ch-rule instead */

/* ── Typography ────────────────────────────────────────────── */
.nc-ch01 h1, .nc-ch01 h2, .nc-ch01 h3, .nc-ch01 h4 {
  font-family: var(--serif);
  font-feature-settings: "ss01" 1, "ss02" 1;
  color: var(--ink-900);
  letter-spacing: -0.025em;
  font-weight: 600;
  border: 0;
  background: none;
}
.nc-ch01 .ch-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nc-ch01 .ch-eyebrow::before {
  content: "";
  display: inline-block;
  width: 28px; height: 1px;
  background: var(--accent);
}
.nc-ch01 h1 {
  font-size: clamp(36px,6vw,62px);
  line-height: 1.02;
  margin: 0 0 18px;
  padding: 0;
}
.nc-ch01 h1::after { display: none; } /* defuse theme accent bar */
.nc-ch01 h1 em {
  font-style: italic;
  color: var(--accent-3);
  font-weight: 400;
}
.nc-ch01 .ch-sub {
  font-family: var(--serif);
  font-size: 20px;
  font-style: italic;
  color: var(--ink-500);
  margin: 0 0 32px;
  max-width: 620px;
}
.nc-ch01 .ch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 26px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-500);
  padding: 16px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 48px;
}
.nc-ch01 .ch-meta span strong {
  color: var(--ink-900);
  font-weight: 600;
  margin-left: 6px;
}
.nc-ch01 h2 {
  font-size: clamp(26px,3.5vw,36px);
  line-height: 1.15;
  margin: 64px 0 18px;
  padding: 0;
  position: relative;
}
.nc-ch01 h2::after, .nc-ch01 h2::before { display: none; } /* defuse theme h2 underline */
.nc-ch01 h2 .num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.nc-ch01 h3 {
  font-size: 22px;
  line-height: 1.25;
  margin: 36px 0 12px;
  color: var(--ink-800);
}
.nc-ch01 p { margin: 0 0 18px; color: var(--ink-700); }
.nc-ch01 p.lede {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink-800);
  margin-bottom: 32px;
}
.nc-ch01 p.lede::first-letter {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 4.4em;
  line-height: 0.85;
  float: left;
  margin: 6px 12px 0 0;
  color: var(--accent);
}
.nc-ch01 strong { color: var(--ink-900); font-weight: 600; }
.nc-ch01 em { color: var(--ink-700); font-style: italic; }
.nc-ch01 a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(12,99,231,.3);
  transition: border-color .15s;
}
.nc-ch01 a:hover { border-bottom-color: var(--accent); }

/* ── Inline code ───────────────────────────────────────────── */
.nc-ch01 :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(12,99,231,.07);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(12,99,231,.16);
  white-space: nowrap;
}

/* ── Lists ─────────────────────────────────────────────────── */
.nc-ch01 ul, .nc-ch01 ol { padding-left: 0; list-style: none; margin: 0 0 24px; }
.nc-ch01 ul li, .nc-ch01 ol li {
  position: relative;
  padding-left: 26px;
  margin: 10px 0;
  color: var(--ink-700);
  line-height: 1.6;
}
.nc-ch01 ul li::before {
  content: "";
  position: absolute;
  left: 4px; top: 12px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.nc-ch01 ol { counter-reset: nc-ol; }
.nc-ch01 ol li { counter-increment: nc-ol; }
.nc-ch01 ol li::before {
  content: counter(nc-ol, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
  background: none;
  width: auto; height: auto; border-radius: 0;
}

/* ── Section divider ───────────────────────────────────────── */
.nc-ch01 .ch-rule {
  margin: 56px auto;
  width: 100%;
  height: 18px;
  position: relative;
  text-align: center;
  display: block;
}
.nc-ch01 .ch-rule::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: linear-gradient(90deg,transparent,var(--rule) 20%,var(--rule) 80%,transparent);
}
.nc-ch01 .ch-rule::after {
  content: "§";
  position: relative;
  background: var(--paper);
  padding: 0 18px;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-400);
}

/* ── Code blocks ───────────────────────────────────────────── */
.nc-ch01 .nc-code {
  margin: 28px 0;
  background: var(--code-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255,255,255,.08) inset,
    0 24px 48px -16px rgba(8,15,30,.18),
    0 8px 16px -8px rgba(8,15,30,.10);
  border: 1px solid var(--code-edge);
  position: relative;
}
.nc-ch01 .nc-code__bar {
  display: flex; align-items: center;
  padding: 10px 12px 10px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.015) 100%);
  border-bottom: 1px solid rgba(120,170,255,.10);
  font-family: var(--mono);
  font-size: 11px;
  gap: 14px;
  min-height: 38px;
}
/* The copy button sits cleanly on the right inside the bar. */
.nc-ch01 .nc-code__copy {
  appearance: none;
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.05);
  color: #c8d4ea;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 6px;
  padding: 5px 11px 5px 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.nc-ch01 .nc-code__copy:hover {
  color: #67e8f9;
  background: rgba(6,182,212,.12);
  border-color: rgba(6,182,212,.40);
  box-shadow: 0 0 0 3px rgba(6,182,212,.10);
}
.nc-ch01 .nc-code__copy:active { transform: translateY(1px); }
.nc-ch01 .nc-code__copy:focus-visible {
  outline: none;
  border-color: rgba(6,182,212,.55);
  box-shadow: 0 0 0 3px rgba(6,182,212,.22);
}
.nc-ch01 .nc-code__copy.is-copied {
  color: #6ee7b7;
  background: rgba(16,185,129,.15);
  border-color: rgba(16,185,129,.45);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
/* When .is-copied is added, the label cross-fades and the icon swaps. */
.nc-ch01 .nc-code__copy svg {
  display: block;
  width: 13px; height: 13px;
  flex-shrink: 0;
  transition: transform .25s cubic-bezier(.4,1.6,.6,1);
}
.nc-ch01 .nc-code__copy.is-copied svg { transform: scale(1.08) rotate(-4deg); }
.nc-ch01 .nc-code__copy-label {
  font-size: 10.5px;
  line-height: 1;
  transition: color .18s;
}
.nc-ch01 .nc-code__dots { display: inline-flex; gap: 6px; }
.nc-ch01 .nc-code__dots span { width: 10px; height: 10px; border-radius: 50%; }
.nc-ch01 .nc-code__dots span:nth-child(1) { background: #ff5f57; }
.nc-ch01 .nc-code__dots span:nth-child(2) { background: #febc2e; }
.nc-ch01 .nc-code__dots span:nth-child(3) { background: #28c941; }
.nc-ch01 .nc-code__lang {
  color: var(--accent-2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}
.nc-ch01 .nc-code pre {
  margin: 0;
  padding: 18px 20px 22px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.75;
  color: #dbe5f1;
  background: transparent;
  border: 0;
  border-radius: 0;
  white-space: pre;
}
.nc-ch01 .nc-code pre::before { display: none; } /* kill theme traffic-light decoration */
.nc-ch01 .tok-kw   { color: #ff89a1; }
.nc-ch01 .tok-str  { color: #ffd47a; }
.nc-ch01 .tok-num  { color: #ffa874; }
.nc-ch01 .tok-key  { color: #8cb6ff; }
.nc-ch01 .tok-com  { color: #5e7299; font-style: italic; }
.nc-ch01 .tok-tag  { color: #ff89a1; }
.nc-ch01 .tok-attr { color: #ffd47a; }
.nc-ch01 .tok-punc { color: #7a87a3; }
.nc-ch01 .tok-op   { color: #f9a8d4; }

/* ── Callouts ──────────────────────────────────────────────── */
.nc-ch01 .callout {
  margin: 32px 0;
  padding: 22px 24px 22px 28px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg,rgba(12,99,231,.04),rgba(6,182,212,.02));
  position: relative;
}
.nc-ch01 .callout--insight { border-left-color: var(--accent); }
.nc-ch01 .callout--warning {
  border-left-color: var(--accent-3);
  background: linear-gradient(135deg,rgba(197,104,26,.05),rgba(233,196,106,.02));
}
.nc-ch01 .callout--quote {
  border-left-color: var(--accent-2);
  background: linear-gradient(135deg,rgba(6,182,212,.04),rgba(12,99,231,.02));
}
.nc-ch01 .callout__label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: block;
}
.nc-ch01 .callout--warning .callout__label { color: var(--accent-3); }
.nc-ch01 .callout--quote   .callout__label { color: var(--accent-2); }
.nc-ch01 .callout p { color: var(--ink-700); }
.nc-ch01 .callout p:last-child { margin-bottom: 0; }
.nc-ch01 .callout cite {
  display: block;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  font-style: normal;
  color: var(--ink-500);
}

/* ── Tables ────────────────────────────────────────────────── */
.nc-ch01 .nc-tablewrap {
  margin: 28px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: #fff;
  box-shadow: 0 1px 2px rgba(8,15,30,.04);
}
.nc-ch01 .nc-tablewrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  margin: 0;
}
.nc-ch01 .nc-tablewrap thead th {
  background: var(--paper-2);
  color: var(--ink-900);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  padding: 13px 18px;
  border-bottom: 1px solid var(--rule);
}
.nc-ch01 .nc-tablewrap tbody td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-700);
  vertical-align: top;
}
.nc-ch01 .nc-tablewrap tbody tr:last-child td { border-bottom: 0; }
.nc-ch01 .nc-tablewrap tbody tr:hover td { background: rgba(12,99,231,.025); }
.nc-ch01 .nc-tablewrap td strong { color: var(--ink-900); }
.nc-ch01 .nc-tablewrap td code { font-size: 12.5px; }

/* ── Summary cards grid ────────────────────────────────────── */
.nc-ch01 .nc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 22px;
  margin: 40px 0;
  perspective: 1200px;
}
.nc-ch01 .nc-card {
  --card-accent: var(--accent);
  --card-accent-2: var(--accent);
  /* Solid-color fallback for renderers without color-mix() (wkhtmltopdf, old Safari/Firefox).
     Modern browsers override this below with tinted gradients. */
  background: #ffffff;
  border-radius: 16px;
  padding: 28px 26px 26px;
  border: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform .35s cubic-bezier(.22,1,.36,1),
    box-shadow .35s cubic-bezier(.22,1,.36,1),
    border-color .25s ease;
  opacity: 1;
  transform: none;
}
@supports (color: color-mix(in srgb, red, blue)) {
  .nc-ch01 .nc-card {
    background:
      radial-gradient(140% 60% at 100% 0%, color-mix(in srgb, var(--card-accent) 8%, transparent) 0%, transparent 60%),
      linear-gradient(180deg, #ffffff 0%, color-mix(in srgb, var(--card-accent) 2.5%, #fcfbf8) 100%);
  }
}
@supports (animation: fadeIn 1s) {
  .nc-ch01 .nc-card {
    opacity: 0;
    transform: translateY(14px);
    animation: nc-card-in .55s cubic-bezier(.22,1,.36,1) forwards;
  }
}
.nc-ch01 .nc-cards > .nc-card:nth-child(1) { animation-delay: .00s; }
.nc-ch01 .nc-cards > .nc-card:nth-child(2) { animation-delay: .08s; }
.nc-ch01 .nc-cards > .nc-card:nth-child(3) { animation-delay: .16s; }
.nc-ch01 .nc-cards > .nc-card:nth-child(4) { animation-delay: .24s; }
.nc-ch01 .nc-cards > .nc-card:nth-child(5) { animation-delay: .32s; }
.nc-ch01 .nc-cards > .nc-card:nth-child(6) { animation-delay: .40s; }

@keyframes nc-card-in {
  to { opacity: 1; transform: translateY(0); }
}

/* Gradient top bar — strokes from one accent to the next */
.nc-ch01 .nc-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--card-accent), var(--card-accent-2));
  z-index: 2;
}
/* Glow blob in the corner; expands on hover */
.nc-ch01 .nc-card::after {
  content: "";
  position: absolute;
  right: -40px; bottom: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--card-accent), transparent 70%);
  opacity: .07;
  pointer-events: none;
  transition: opacity .4s ease, transform .5s cubic-bezier(.22,1,.36,1);
  z-index: 0;
}
.nc-ch01 .nc-card > * { position: relative; z-index: 1; }

.nc-ch01 .nc-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 22px 40px -16px rgba(8,15,30,.18),
    0 0 0 1px var(--card-accent);
  border-color: transparent;
}
@supports (color: color-mix(in srgb, red, blue)) {
  .nc-ch01 .nc-card:hover {
    box-shadow:
      0 22px 40px -16px rgba(8,15,30,.18),
      0 0 0 1px color-mix(in srgb, var(--card-accent) 30%, transparent);
  }
}
.nc-ch01 .nc-card:hover::after {
  opacity: .14;
  transform: scale(1.15);
}

/* Number strip — pill with subtle tint */
.nc-ch01 .nc-card__num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--card-accent);
  letter-spacing: 0.18em;
  margin-bottom: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  /* Fallback */
  background: rgba(12,99,231,.08);
  border: 1px solid rgba(12,99,231,.18);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .nc-ch01 .nc-card__num {
    background: color-mix(in srgb, var(--card-accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--card-accent) 20%, transparent);
  }
}
.nc-ch01 .nc-card h4 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-900);
  margin: 0 0 12px;
  line-height: 1.22;
  letter-spacing: -0.015em;
}
.nc-ch01 .nc-card p {
  font-size: 14px;
  color: var(--ink-500);
  margin: 0 0 16px;
  line-height: 1.55;
}
.nc-ch01 .nc-card ul { margin: 0; padding: 0; list-style: none; }
.nc-ch01 .nc-card li {
  font-size: 13px;
  color: var(--ink-700);
  padding-left: 22px;
  margin: 8px 0;
  position: relative;
  line-height: 1.5;
  transition: transform .2s ease, color .2s ease;
}
.nc-ch01 .nc-card li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 14px; height: 2px;
  background: var(--card-accent);
  border-radius: 2px;
  transition: width .25s cubic-bezier(.22,1,.36,1);
}
.nc-ch01 .nc-card:hover li::before { width: 18px; }
.nc-ch01 .nc-card li code,
.nc-ch01 .nc-card p code {
  background: rgba(12,99,231,.08);
  color: var(--card-accent);
  border: 1px solid rgba(12,99,231,.16);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .nc-ch01 .nc-card li code,
  .nc-ch01 .nc-card p code {
    background: color-mix(in srgb, var(--card-accent) 8%, transparent);
    color: color-mix(in srgb, var(--card-accent) 75%, var(--ink-900));
    border: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent);
  }
}

/* ── Card accent variants — paired colors for the gradient bar ── */
.nc-ch01 .nc-card--blue    { --card-accent:#0c63e7; --card-accent-2:#06b6d4; }
.nc-ch01 .nc-card--cyan    { --card-accent:#06b6d4; --card-accent-2:#0c63e7; }
.nc-ch01 .nc-card--copper  { --card-accent:#c5681a; --card-accent-2:#e9c46a; }
.nc-ch01 .nc-card--amber   { --card-accent:#b88314; --card-accent-2:#e9c46a; }
.nc-ch01 .nc-card--emerald { --card-accent:#058a6e; --card-accent-2:#10b981; }
.nc-ch01 .nc-card--violet  { --card-accent:#7c3aed; --card-accent-2:#a78bfa; }
.nc-ch01 .nc-card--rose    { --card-accent:#e11d48; --card-accent-2:#fb7185; }

/* ── Diagram figures ───────────────────────────────────────── */
.nc-ch01 figure.nc-diagram {
  margin: 40px 0;
  padding: 0;
  background: none;
  border: 0;
  position: relative;
  opacity: 1;
  transform: none;
}
@supports (animation-timeline: scroll()) or (animation: fadeIn 1s) {
  .nc-ch01 figure.nc-diagram {
    opacity: 0;
    transform: translateY(12px);
    animation: nc-fade-up .6s cubic-bezier(.22,1,.36,1) forwards;
    animation-delay: .1s;
  }
}
.nc-ch01 figure.nc-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 12px;
  background:
    radial-gradient(circle at 0% 0%, rgba(12,99,231,.04) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(6,182,212,.04) 0%, transparent 50%),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
  border: 1px solid var(--rule);
  box-shadow:
    0 1px 0 rgba(255,255,255,.6) inset,
    0 12px 32px -16px rgba(8,15,30,.10);
  padding: 6px;
}
.nc-ch01 figure.nc-diagram figcaption {
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 16px;
}
.nc-ch01 figure.nc-diagram figcaption::before {
  content: "Fig. ";
  color: var(--accent);
  font-weight: 600;
}

@keyframes nc-fade-up {
  to { opacity: 1; transform: translateY(0); }
}

/* ── SVG motion utilities — referenced from diagrams by class name ── */
/* Use class="nc-flow-arrow" on an SVG <line> or <path> to get an
   animated dash that "flows" along the stroke direction (data
   moving through the pipeline). */
.nc-ch01 svg .nc-flow-arrow {
  stroke-dasharray: 6 6;
  animation: nc-dash-flow 1.4s linear infinite;
}
@keyframes nc-dash-flow {
  to { stroke-dashoffset: -24; }
}
/* Soft pulse — for "active" nodes in a flow */
.nc-ch01 svg .nc-pulse {
  transform-origin: center;
  transform-box: fill-box;
  animation: nc-pulse 2.2s ease-in-out infinite;
}
@keyframes nc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
/* Subtle node lift — for SVG groups with class="nc-node" — works only
   when figure is hovered for restraint. */
.nc-ch01 figure.nc-diagram:hover svg .nc-node {
  transition: transform .35s cubic-bezier(.22,1,.36,1);
}

/* Respect reduced-motion preference — kill all animations gracefully */
@media (prefers-reduced-motion: reduce) {
  .nc-ch01 figure.nc-diagram,
  .nc-ch01 .nc-card,
  .nc-ch01 svg .nc-flow-arrow,
  .nc-ch01 svg .nc-pulse {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── Tag chips ─────────────────────────────────────────────── */
.nc-ch01 .nc-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nc-ch01 .nc-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--ink-900);
  color: #cae0ff;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

/* ── Next-chapter strip ───────────────────────────────────── */
.nc-ch01 .nc-next {
  margin-top: 56px;
  padding: 28px 28px 28px 32px;
  background-color: var(--ink-900);
  background-image:
    radial-gradient(circle at 90% 25%,rgba(6,182,212,.22),transparent 55%),
    linear-gradient(110deg,var(--ink-900) 0%,var(--ink-700) 100%);
  color: #d8e1f0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.nc-ch01 .nc-next__label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 6px;
}
.nc-ch01 .nc-next__title,
.nc-ch01 h3.nc-next__title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: #ffffff !important;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.01em;
  /* Subtle gradient sheen on the title for premium feel */
  background: linear-gradient(120deg, #ffffff 0%, #e0f2fe 60%, #67e8f9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nc-ch01 .nc-next a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent-2);
  border: 1px solid rgba(6,182,212,.4);
  padding: 10px 18px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all .2s;
  background: transparent;
}
.nc-ch01 .nc-next a:hover {
  background: rgba(6,182,212,.1);
  color: #fff;
  border-color: var(--accent-2);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nc-ch01 { font-size: 16px; }
  .nc-ch01 h2 { margin-top: 48px; }
  .nc-ch01 .nc-code pre { font-size: 12px; }
  .nc-ch01 .nc-tablewrap thead th,
  .nc-ch01 .nc-tablewrap tbody td { padding: 10px 12px; font-size: 13px; }
  .nc-ch01 .nc-cards { grid-template-columns: 1fr; }
  .nc-ch01 .ch-meta { gap: 10px 18px; font-size: 11px; }
  .nc-ch01 .nc-next { padding: 22px; }
  .nc-ch01 .nc-next__title { font-size: 18px; }
}

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .nc-ch01 { color: #000; background: #fff; }
  .nc-ch01 .nc-code { background: #f6f7f9; box-shadow: none; }
  .nc-ch01 .nc-code pre { color: #111; }
  .nc-ch01 .nc-next { background: #f6f7f9; color: #111; }
  /* When printing, the gradient-clip on the title becomes invisible —
     force solid dark text */
  .nc-ch01 .nc-next__title,
  .nc-ch01 h3.nc-next__title {
    background: none !important;
    -webkit-text-fill-color: #0b1220 !important;
    color: #0b1220 !important;
  }
}

/* ── Dark mode ─────────────────────────────────────────────── */
/* Theme toggle sets body.nc-theme-dark. We override only the surfaces
 * that need to flip (paper, cards, tables, callouts) — code blocks and
 * the "Up next" strip are already dark in light mode and stay correct. */
body.nc-theme-dark .nc-ch01 {
  --ink-900:#f5f7fb;
  --ink-800:#e3e8f1;
  --ink-700:#c2cbdb;
  --ink-600:#9ba6bd;
  --ink-500:#7d8aa3;
  --ink-400:#5e6c87;
  --ink-300:#3f4d6a;
  --paper:#0b1220;
  --paper-2:#101a2d;
  --rule:#22304e;
  --accent:#5b9bff;
  --accent-2:#3dd6f0;
  --accent-3:#f59e3f;
  --accent-warm:#fbd16a;
  --code-bg:#060b18;
  --code-edge:rgba(120,170,255,.10);
  background: var(--paper);
  color: var(--ink-700);
}

/* Body & lead text */
body.nc-theme-dark .nc-ch01 p          { color: var(--ink-700); }
body.nc-theme-dark .nc-ch01 p.lede     { color: var(--ink-800); }
body.nc-theme-dark .nc-ch01 strong     { color: var(--ink-900); }
body.nc-theme-dark .nc-ch01 em         { color: var(--ink-600); }
body.nc-theme-dark .nc-ch01 h1,
body.nc-theme-dark .nc-ch01 h2,
body.nc-theme-dark .nc-ch01 h3,
body.nc-theme-dark .nc-ch01 h4         { color: var(--ink-900); }
body.nc-theme-dark .nc-ch01 .ch-sub    { color: var(--ink-500); }
body.nc-theme-dark .nc-ch01 .ch-meta   { color: var(--ink-500); }
body.nc-theme-dark .nc-ch01 .ch-meta span strong { color: var(--ink-900); }
body.nc-theme-dark .nc-ch01 ul li,
body.nc-theme-dark .nc-ch01 ol li      { color: var(--ink-700); }
body.nc-theme-dark .nc-ch01 p.lede::first-letter { color: var(--accent); }

/* Links */
body.nc-theme-dark .nc-ch01 a {
  color: var(--accent);
  border-bottom-color: rgba(91,155,255,.35);
}
body.nc-theme-dark .nc-ch01 a:hover    { border-bottom-color: var(--accent); }

/* Inline code */
body.nc-theme-dark .nc-ch01 :not(pre) > code {
  background: rgba(91,155,255,.10);
  color: #9fc1ff;
  border-color: rgba(91,155,255,.22);
}

/* Section divider — § stays visible on dark bg */
body.nc-theme-dark .nc-ch01 .ch-rule::before {
  background: linear-gradient(90deg,transparent,var(--rule) 20%,var(--rule) 80%,transparent);
}
body.nc-theme-dark .nc-ch01 .ch-rule::after {
  background: var(--paper);
  color: var(--ink-500);
}

/* Tables — flip surface, keep zebra subtle */
body.nc-theme-dark .nc-ch01 .nc-tablewrap {
  background: var(--paper-2);
  border-color: var(--rule);
}
body.nc-theme-dark .nc-ch01 .nc-tablewrap thead th {
  background: #161f36;
  color: var(--ink-900);
  border-bottom-color: var(--rule);
}
body.nc-theme-dark .nc-ch01 .nc-tablewrap tbody td {
  color: var(--ink-700);
  border-bottom-color: var(--rule);
}
body.nc-theme-dark .nc-ch01 .nc-tablewrap tbody tr:hover td {
  background: rgba(91,155,255,.05);
}
body.nc-theme-dark .nc-ch01 .nc-tablewrap td strong { color: var(--ink-900); }

/* Callouts — slightly stronger tint on dark */
body.nc-theme-dark .nc-ch01 .callout {
  background: linear-gradient(135deg,rgba(91,155,255,.07),rgba(61,214,240,.03));
}
body.nc-theme-dark .nc-ch01 .callout--warning {
  background: linear-gradient(135deg,rgba(245,158,63,.08),rgba(251,209,106,.03));
}
body.nc-theme-dark .nc-ch01 .callout--quote {
  background: linear-gradient(135deg,rgba(61,214,240,.07),rgba(91,155,255,.03));
}
body.nc-theme-dark .nc-ch01 .callout p { color: var(--ink-700); }
body.nc-theme-dark .nc-ch01 .callout cite { color: var(--ink-500); }

/* Summary cards — the headline fix from Image 1 */
body.nc-theme-dark .nc-ch01 .nc-card {
  background: var(--paper-2);
  border-color: var(--rule);
}
body.nc-theme-dark .nc-ch01 .nc-card h4 { color: var(--ink-900); }
body.nc-theme-dark .nc-ch01 .nc-card p  { color: var(--ink-500); }
body.nc-theme-dark .nc-ch01 .nc-card li { color: var(--ink-700); }
body.nc-theme-dark .nc-ch01 .nc-card:hover {
  box-shadow: 0 16px 32px -12px rgba(0,0,0,.5);
  border-color: var(--card-accent,var(--accent));
}
body.nc-theme-dark .nc-ch01 .nc-card::after { opacity: .08; }
body.nc-theme-dark .nc-ch01 .nc-card:hover::after { opacity: .14; }
/* Brighter card accent colors for dark mode contrast */
body.nc-theme-dark .nc-ch01 .nc-card--blue    { --card-accent:#5b9bff; }
body.nc-theme-dark .nc-ch01 .nc-card--cyan    { --card-accent:#3dd6f0; }
body.nc-theme-dark .nc-ch01 .nc-card--copper  { --card-accent:#f59e3f; }
body.nc-theme-dark .nc-ch01 .nc-card--amber   { --card-accent:#fbd16a; }
body.nc-theme-dark .nc-ch01 .nc-card--emerald { --card-accent:#34d4b0; }

/* Diagrams — the SVGs have a baked rect background (#fcfbf8) we DROPPED in
 * the body HTML. Now apply a CSS background so they have a frame in both modes. */
.nc-ch01 figure.nc-diagram svg {
  background: var(--paper-2);
  border: 1px solid var(--rule);
}
body.nc-theme-dark .nc-ch01 figure.nc-diagram svg {
  background: var(--paper-2);
  border-color: var(--rule);
}
/* Make SVG shape strokes brighter on dark; the SVGs use raw colors but
 * mix-blend keeps them readable against the dark backdrop. */
body.nc-theme-dark .nc-ch01 figure.nc-diagram svg text {
  fill: var(--ink-800);
}
body.nc-theme-dark .nc-ch01 figure.nc-diagram svg rect[fill="#fff"],
body.nc-theme-dark .nc-ch01 figure.nc-diagram svg circle[fill="#fff"] {
  fill: #1a2540;
}
body.nc-theme-dark .nc-ch01 figure.nc-diagram svg rect[fill="#f5f3ec"] {
  fill: #14203a;
}
body.nc-theme-dark .nc-ch01 figure.nc-diagram figcaption { color: var(--ink-500); }

/* Tag chips on header — dark mode keeps them readable */
body.nc-theme-dark .nc-ch01 .nc-tag {
  background: #14203a;
  color: #9fc1ff;
}

/* Up-next strip — already dark in light mode; in dark mode use a slightly
 * different gradient so it stands apart from the page background */
body.nc-theme-dark .nc-ch01 .nc-next {
  background-color: #0a1024;
  background-image:
    radial-gradient(circle at 90% 25%,rgba(61,214,240,.22),transparent 55%),
    linear-gradient(110deg,#0a1024 0%,#16223b 100%);
  border: 1px solid var(--rule);
}

/* Code-block scroll bar in dark mode — subtle */
body.nc-theme-dark .nc-ch01 .nc-code pre::-webkit-scrollbar { height: 8px; }
body.nc-theme-dark .nc-ch01 .nc-code pre::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.08); border-radius: 4px;
}
