/* ============================================================================
   LAB NOTEBOOK — /labwork/<slug>/
   ----------------------------------------------------------------------------
   Loaded after /styles.css, which supplies the tokens, both font stacks,
   .container, .site-header, .site-footer, .btn, .callout-bubbles, .watermark
   and the stage meter.

   One stylesheet for every notebook: the page is generated per folder, so
   nothing here can be specific to one project.

   The numbered circles are round on purpose — they belong to the bubble
   family. Everything else on this site stays square.
============================================================================ */

:root { --font-mono: "IBM Plex Mono", ui-monospace, monospace; }

/* The sticky header is 89px; the bar sits under it, and anything scrolled to
   has to clear both. */
:root { --nb-header: 89px; --nb-bar: 61px; }

/* ----------------------------------------------------------------- Hero */

.nb-hero { border-bottom: 1.5px solid var(--pine); }
.nb-hero .container { padding-top: 28px; padding-bottom: 36px; }
.nb-back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; font-size: 14.5px; }
.nb-hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 28px clamp(32px, 5vw, 64px);
  margin-top: 20px;
}
.nb-hero-copy { flex: 1 1 560px; min-width: 0; }
.nb-h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(40px, 5.2vw, 68px);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--pine);
  max-width: 16ch;
  margin-bottom: 20px;
}
.nb-lede { font-size: clamp(17px, 1.5vw, 19px); line-height: 1.6; color: var(--moss); max-width: 60ch; }
.nb-lede strong { font-weight: 600; color: var(--pine); }

/* The status panel: what stage, what was decided, and when. */
.nb-status {
  flex: 0 1 320px;
  min-width: 0;
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 18px;
  padding-top: 16px;
  border-top: 2px solid var(--pine);
  font-size: 15px;
}
.nb-status dt, .nb-rail-status dt {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--moss);
}
.nb-status dt { padding-top: 3px; }
.nb-status dd, .nb-rail-status dd { margin: 0; color: var(--charcoal); line-height: 1.45; }
.nb-status dd .stage-meter, .nb-rail-status dd .stage-meter { margin-right: 10px; }
.nb-status dd:has(.stage-meter), .nb-rail-status dd:has(.stage-meter) {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--pine);
}
.nb-status strong, .nb-rail-status strong { font-weight: 600; color: var(--pine); }
/* No go is the one decision that gets a mark of its own. */
.nb-nogo-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  margin-right: 8px;
  transform: translateY(-1px);
}

.nb-comments-label { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--hairline); }
.nb-comments { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; }
.nb-comment-when { font-family: var(--font-mono); font-size: 12px; color: var(--moss); }
.nb-comment-text { font-size: 14.5px; line-height: 1.5; color: var(--charcoal); }

.nb-try { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin-top: 28px; }
.nb-try .btn { min-height: 48px; padding: 0 24px; }
.nb-sample-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ------------------------------------------------------ In this notebook */
/* Sticky under the header. It scrolls sideways rather than wrapping, so the
   bar is always one line however many sections a notebook has. */

.nb-toc {
  position: sticky;
  top: var(--nb-header);
  z-index: 20;
  background: var(--linen);
  border-bottom: 1px solid var(--hairline);
}
.nb-toc-row {
  display: flex;
  align-items: center;
  gap: 26px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nb-toc-row::-webkit-scrollbar { display: none; }
.nb-toc-label { flex-shrink: 0; font-weight: 600; font-size: 13px; color: var(--moss); white-space: nowrap; }
.nb-toc-link {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  white-space: nowrap;
  font-size: 14.5px;
  color: var(--pine);
}
.nb-toc-link:hover { color: var(--lake); text-decoration: none; }
.nb-toc-link[aria-current="location"] {
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--pine);
}

/* The numbered circle, in the bar and again on each heading. */
.nb-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--pine);
  border-radius: 50%;
  font-weight: 600;
  font-size: 11.5px;
  line-height: 1;
  color: var(--pine);
}
.nb-toc-link[aria-current="location"] .nb-num,
.nb-section.is-current .nb-num { background: var(--pine); color: var(--linen); }

/* ----------------------------------------------------------- The notes */

.nb-body-row { display: flex; gap: 48px; }
.nb-rail { display: none; }
@media (min-width: 900px) {
  .nb-rail { display: block; flex: 0 0 220px; padding-top: 32px; }
}
.nb-rail-status {
  position: sticky;
  top: calc(var(--nb-header) + var(--nb-bar) + 24px);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 16px;
  border-top: 2px solid var(--pine);
  font-size: 14.5px;
}
.nb-rail-status[hidden] { display: none; }
.nb-status-row { display: flex; flex-direction: column; gap: 4px; }

.nb-notes { flex: 1 1 auto; min-width: 0; padding: 28px 0 40px; }
.nb-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 28px;
  scroll-margin-top: 150px;
}
/* Bands rather than rules: every second section, so a long notebook reads as
   a sequence instead of a wall. */
.nb-section.is-band { background: var(--linen-shade); }
.nb-h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--pine);
}
.nb-h2 .nb-num { width: 28px; height: 28px; font-size: 13.5px; }

.nb-body { display: flex; flex-direction: column; gap: 18px; max-width: 680px; }
/* The question the notebook is answering, in the notebook's own voice. */
.nb-lead {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--pine);
  max-width: 34ch;
}
.nb-p { font-size: 16.5px; line-height: 1.65; color: var(--charcoal); max-width: 62ch; }
.nb-p em, .nb-list em { font-style: italic; color: var(--moss); }
.nb-list {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--charcoal);
}
.nb-list li { padding-left: 6px; max-width: 62ch; }

.nb-figure {
  margin: 0;
  background: var(--white);
  border: 1px solid var(--hairline-card);
  border-top: 3px solid var(--sage);
}
.nb-figure img { display: block; width: 100%; height: auto; }
.nb-figure figcaption {
  padding: 12px 16px;
  border-top: 1px solid var(--hairline-card);
  font-size: 14px;
  line-height: 1.5;
  color: var(--moss);
}

/* ---------------------------------------------------------- The sample */

.nb-sample {
  background: var(--linen-shade);
  border-top: 1px solid var(--hairline);
  scroll-margin-top: 150px;
}
.nb-sample .container { padding-top: clamp(40px, 5vw, 64px); padding-bottom: clamp(40px, 5vw, 64px); }
.nb-sample-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 24px;
}
.nb-sample-intro { margin-top: 10px; font-size: 16px; line-height: 1.6; color: var(--moss); max-width: 62ch; }
.nb-step[hidden] { display: none; }
.nb-step-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.nb-step-text { font-size: 15px; line-height: 1.5; color: var(--charcoal); }
.nb-step-text strong { font-weight: 600; color: var(--pine); }
.nb-step-btns { display: flex; gap: 10px; }
.nb-step-back, .nb-step-next {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--pine);
  border-radius: 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
}
.nb-step-back { background: var(--white); color: var(--pine); }
.nb-step-next { background: var(--pine); color: var(--linen); }
.nb-step-back[disabled], .nb-step-next[disabled] { opacity: 0.4; cursor: default; }

/* ------------------------------------------------------------- The CTAs */

.nb-ctas { border-top: 1px solid var(--hairline); }
.nb-cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 20px;
  padding-top: clamp(40px, 5vw, 64px);
  padding-bottom: clamp(56px, 6vw, 88px);
}
.nb-cta {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 0 18px;
  padding: 28px 28px 30px;
}
.nb-cta-pine { background: var(--pine); }
.nb-cta-linen { background: var(--linen-shade); border: 1px solid var(--hairline-card); }
.nb-cta-mark { width: 140px; right: -28px; top: -18px; opacity: 0.08; }
.nb-cta > .callout-bubbles { position: relative; margin-top: 2px; }
.nb-cta-copy { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.nb-cta-title { font-family: var(--font-head); font-weight: 500; font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; }
.nb-cta-body { font-size: 16px; line-height: 1.6; }
.nb-cta-pine .nb-cta-title { color: var(--linen); }
.nb-cta-pine .nb-cta-body { color: var(--mint); }
.nb-cta-linen .nb-cta-title { color: var(--pine); }
.nb-cta-linen .nb-cta-body { color: var(--moss); }
/* No blue on the dark ground: its button is Amber. */
.nb-cta-amber {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 4px;
  padding: 0 22px;
  background: var(--amber);
  color: var(--pine);
  font-weight: 600;
  font-size: 15px;
}
.nb-cta-amber:hover { background: var(--linen); color: var(--pine); text-decoration: none; }
.nb-cta-pine a:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.nb-cta-linen .btn { margin-top: 4px; }

@media (max-width: 559px) {
  .nb-section { padding-left: 0; padding-right: 0; }
  .nb-section.is-band { padding-left: 20px; padding-right: 20px; }
}
