/* Note detail pages (articles). Loads after site.css and case.css, which provide
   .back, .label and .toc (sticky section nav); the contact band is in site.css. */

/* Hero (note pages and notes index): big title, subtitle in the right half (same split as the case pages) */
.note-hero { padding-top: clamp(40px, 7vw, 96px); }
.note-heading {
  margin-top: clamp(16px, 2.5vw, 28px);
  max-width: 16ch;
  font-size: var(--fs-display);
  line-height: 1;
  letter-spacing: -.015em;
  font-weight: 500;
  text-wrap: balance;
}
.note-sub {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px;
  margin-top: clamp(28px, 4vw, 56px);
}
.note-sub p { grid-column: 2; max-width: 44ch; font-size: var(--fs-h4); line-height: 1.45; }
@media (max-width: 800px) { .note-sub { display: block; } }

/* Long section titles wrap in the sommaire, so the marker stays on the first line at full size */
.note-layout .toc a { align-items: flex-start; min-height: 0; padding-block: 7px; line-height: 1.3; }
.note-layout .toc a::before { flex: none; margin-top: .65em; }

/* Prose: text holds a reading measure, figures and code use the full column */
.prose { --measure: 66ch; max-width: 920px; font-size: var(--fs-body); line-height: 1.7; }
.prose > * { max-width: var(--measure); }
.prose > figure, .prose > pre, .prose > .embed { max-width: none; }
.prose section { scroll-margin-top: 24px; }
.prose section > * { max-width: var(--measure); }
.prose section > figure, .prose section > pre, .prose section > .embed { max-width: none; }
.prose section + section { margin-top: clamp(64px, 8vw, 112px); }

.prose h2 {
  font-size: var(--fs-h3); line-height: 1.1; letter-spacing: -.008em; font-weight: 500;
  text-wrap: balance;
}
.prose h3 { margin-top: 40px; font-size: var(--fs-h4); line-height: 1.3; letter-spacing: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 1.1em 0 0; }
.prose h2 + p, .prose h3 + p { margin-top: 20px; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose em { font-style: italic; }

/* Intro: the opening paragraphs, set larger like the case-page lede */
.prose .intro p { font-size: var(--fs-h4); line-height: 1.5; color: var(--ink); letter-spacing: -.01em; }
.prose .intro p + p { margin-top: .9em; }

/* Links: underlined in rule tone, darken on hover */
.prose a {
  color: var(--ink);
  text-decoration: underline 1px var(--rule); text-underline-offset: 4px;
  transition: text-decoration-color .2s var(--ease);
}
.prose a:hover { text-decoration-color: var(--ink); }

/* Lists: a short rule instead of a bullet (same mark as the section nav) */
.prose ul, .prose ol { padding: 0; list-style: none; }
.prose li { position: relative; padding-left: 28px; }
.prose li + li { margin-top: .55em; }
.prose ul > li::before {
  content: ""; position: absolute; left: 0; top: .85em;
  width: 14px; height: 1px; background: var(--grey);
}
.prose ol { counter-reset: n; }
.prose ol > li { counter-increment: n; }
.prose ol > li::before {
  content: counter(n); position: absolute; left: 0; top: 0;
  font-size: .85em; line-height: 2; color: var(--grey); font-variant-numeric: tabular-nums;
}

/* Quote */
.prose blockquote {
  padding-left: 24px; border-left: 1px solid var(--ink);
  font-size: var(--fs-h4); line-height: 1.45; color: var(--ink);
}

/* Code: inline as a quiet chip, blocks on the night tone */
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .86em;
  padding: .12em .4em; border-radius: 6px;
  background: var(--card); color: var(--ink);
  overflow-wrap: anywhere;
}
.prose pre {
  margin: 28px 0 0; padding: clamp(18px, 2vw, 26px);
  border-radius: var(--radius-sm);
  background: var(--night); color: var(--night-ink);
  overflow-x: auto; scrollbar-width: thin;
  font-size: 14px; line-height: 1.7;
}
.prose pre code { padding: 0; background: none; color: inherit; font-size: inherit; overflow-wrap: normal; }
.prose pre[data-lang]::before {
  content: attr(data-lang); display: block; margin-bottom: 10px;
  font-family: var(--font); font-size: 12px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--night-grey);
}

/* Figures: images sit on the stage tone, like project media */
.prose figure { margin: clamp(32px, 4vw, 48px) 0 0; }
.prose figure img, .prose figure video {
  width: 100%; border-radius: var(--radius-sm); background: var(--card);
}
.prose figure.on-stage { padding: clamp(14px, 2.4vw, 32px); border-radius: var(--radius); background: var(--stage); }
.prose figcaption { margin-top: 14px; font-size: 14px; line-height: 1.5; color: var(--grey); }

/* Media slot: an image still to capture. Replace the div with <img> when it exists. */
.media-slot {
  display: grid; place-items: center; aspect-ratio: 16 / 9;
  padding: 24px; border-radius: var(--radius); background: var(--stage);
  border: 1px dashed var(--rule);
  text-align: center; font-size: 14px; line-height: 1.5; color: var(--grey);
}
.media-slot span { max-width: 44ch; }

/* Video embed (YouTube, Vimeo): 16:9, lazy iframe */
.embed { margin-top: clamp(32px, 4vw, 48px); aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: var(--stage); }
.embed iframe { display: block; width: 100%; height: 100%; border: 0; }

/* Next note */
.note-next { margin-top: clamp(80px, 10vw, 140px); border-block: 1px solid var(--rule); }
.note-next a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px 24px;
  padding-block: 28px 32px;
}
.note-next .label { grid-column: 1 / -1; }
.note-next-title {
  font-size: var(--fs-h3); line-height: 1.1; letter-spacing: -.008em; font-weight: 500; color: var(--ink);
}
.note-next-arrow { font-size: 24px; color: var(--ink); transition: transform .3s var(--ease); }
.note-next a:hover .note-next-arrow { transform: translateX(6px); }

.prose .note-next a { text-decoration: none; }

/* Notes index: title and line on one split row, then the shared note rows (site.css) on the same split,
   title left and description right, under the hero line. */
.notes-head, .notes-index .note-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.notes-head { display: grid; gap: 16px 24px; align-items: end; padding-top: clamp(40px, 7vw, 96px); }
.notes-head .note-heading { margin: 0; }
.notes-head p { max-width: 32ch; padding-bottom: .5em; font-size: var(--fs-h4); line-height: 1.45; }
.notes-index { padding-block: clamp(48px, 6vw, 88px) clamp(96px, 12vw, 168px); }
@media (max-width: 800px) {
  .notes-head, .notes-index .note-row { grid-template-columns: minmax(0, 1fr); }
}

/* Line illustrations: same drawing language as the EDI surfaces diagram.
   Strokes draw in as the figure scrolls into view; narrow screens scroll the drawing sideways. */
.illus { color: var(--grey); }
.illus-scroll { overflow-x: auto; scrollbar-width: none; }
.illus svg { width: 100%; min-width: 540px; max-width: 720px; margin-inline: auto; overflow: visible; }
.illus .ln { fill: none; stroke: currentColor; stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.illus .ink { color: var(--ink); }
.illus .ln.faint { stroke-opacity: .45; }
.illus .ln.thick { stroke-width: 2; }
.illus .ln.dash { stroke-dasharray: 4 6; }
/* Drawn lines scale with the figure: non-scaling strokes break the pathLength dash trick in Chrome */
.illus .ln.draw { vector-effect: none; }
@media (max-width: 640px) {
  /* Edge to edge, starting centred; swipe sideways for the rest */
  .prose figure.illus { margin-inline: calc(-1 * var(--inset)); padding-inline: 0; border-radius: 0; }
  .illus-scroll { scroll-snap-type: x mandatory; }
  .illus svg { scroll-snap-align: center; padding-inline: 16px; box-sizing: content-box; }
}
.illus text { fill: currentColor; font-family: inherit; }
.illus .t1 { font-size: 16px; font-weight: 700; fill: var(--ink); }
.illus .t2 { font-size: 14px; }
.illus .t3 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.illus .mono { font: 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .illus .draw {
      stroke-dasharray: 1; stroke-dashoffset: 1;
      animation: illus-draw linear both; animation-timeline: view(); animation-range: entry 0% entry 100%;
    }
    @keyframes illus-draw { to { stroke-dashoffset: 0; } }
  }
}
