/* Draft view: the page as an edited draft. The first version's wording is struck through in red just
   before the words that replaced it, the current words are underlined in red with a small numbered pin,
   and a margin column of notes says why each one changed (mockup option D, "A + C combined").
   Everything here sits under html[data-view="draft"], which view-switch.js sets on every page.
   Final view never sees any of it: site.css hides the draft-only markup outside Draft view.
   --accent on --paper is 4.86:1 (WCAG AA needs 4.5:1), so the Draft red is the site's own accent. */

/* ---------- Grid paper ---------- */
html[data-view="draft"] body {
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
}

/* ---------- Marks: the current words, underlined, with their note's number ---------- */
/* A rule under the whole mark, its number included (a border, as in the mockup, so it runs unbroken
   under the pin and never skips descenders). */
html[data-view="draft"] .dv-mark { border-bottom: 2px solid var(--accent); }
html[data-view="draft"] h1 .dv-mark { border-bottom-width: 4px; }
/* On a case-study title the inline box's border hung below the title's tight line and landed on the
   subtitle (Dec 4 audit). As an inline-block the mark is one line tall, so the rule sits right under it. */
html[data-view="draft"] .case__head h1 .dv-mark { display: inline-block; }
/* The number pin, shared by marks (sup.dv-num) and notes (li::before). Sized in px so it reads the
   same beside body text and beside the 156px title. */
html[data-view="draft"] .dv-num,
html[data-view="draft"] .dv-notes li::before {
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  font: 600 10px/1 var(--mono);
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  -webkit-text-stroke: 0;
}
/* On a mark the pin stays a plain inline box (padding makes the circle), so a line never breaks
   between the marked words and their number. */
html[data-view="draft"] .dv-num {
  margin-left: 3px;
  padding: 2px 5px;
  vertical-align: super;
}
/* On the title, the pin sits at the top of the line rather than at a superscript's height. */
html[data-view="draft"] h1 .dv-num { margin-left: 6px; vertical-align: top; }
html[data-view="draft"] .dv-notes li::before {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
}

/* ---------- Old wording: struck through in red, just before its mark ---------- */
html[data-view="draft"] .dv-was {
  background: var(--paper); /* red text on plain paper, off the grid lines */
  color: var(--accent);
  text-decoration: line-through 2px var(--accent);
}
/* Section headings and labels: a gap, so the struck words don't run into their replacement. */
html[data-view="draft"] :is(.case__section h2, .lead-in__label) .dv-was { margin-right: .4em; }
/* On the title, the old name sits on its own smaller line above the new one. */
html[data-view="draft"] h1 .dv-was {
  display: block;
  width: fit-content;
  margin-bottom: .12em;
  font-size: max(22px, .3em);
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.1;
  text-decoration-thickness: max(2px, .04em);
}

/* ---------- Margin notes ---------- */
/* Below 1220px each list stacks under the title block, or, on the work pages, draft-notes.js moves each
   note to just after its paragraph or bullet (round C, below). Without JavaScript a list stays under
   its section's text. */
html[data-view="draft"] .dv-notes {
  max-width: 38em;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
}
/* The selectors carry .dv-notes so they outrank the case study's own list rules (.case__section li). */
/* The small red and grey note text sits on plain paper, not on the grid lines, which would take it
   below 4.5:1 where a line runs through it. (Ink text stays above 8:1 on the grid.) */
html[data-view="draft"] .dv-notes li {
  background: var(--paper);
  margin: 0 0 18px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--accent);
  font-size: 13.5px;
  line-height: 1.45;
  text-wrap: pretty;
}
html[data-view="draft"] .dv-notes li:last-child { margin-bottom: 0; }
html[data-view="draft"] .dv-notes li::before {
  content: attr(value);
  margin-right: 6px;
  vertical-align: 1px;
}
html[data-view="draft"] .dv-note-was {
  display: block;
  margin: 3px 0;
  font: 12px/1.4 var(--mono);
  color: var(--accent);
  text-decoration: line-through 1.5px var(--accent);
}
html[data-view="draft"] .dv-note-when {
  display: block;
  margin-top: 4px;
  font: 10.5px/1.4 var(--mono);
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* A work page with no notes yet says so once, under its header. */
html[data-view="draft"] .dv-soon {
  width: fit-content;
  background: var(--paper);
  margin-top: 18px;
  font: 500 11px/1.4 var(--mono);
  color: var(--accent);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ---------- Wide: notes in a margin column ---------- */
/* At 1220px and up, each section becomes two columns: the text keeps its full 38em measure (608px,
   what Final view gives it at these widths) and the notes sit to its right. The At a glance column
   gives up the room, down to 200px. 1220px is the narrowest page where all of that fits: 40px gutters
   x2 + 200px glance + 56px gap + 608px text + 32px gap + a 244px notes column (20cqw) = 1220px.
   Any narrower and the text would have to shrink below its Final measure, so between 761px and
   1219px the notes sit in the text, after their paragraphs, as on a phone. A section's notes stay
   level with its heading; the title's notes sit in the header's margin, below the switch (which
   lives in the header's top padding). */
@container page (min-width: 1220px) {
  html[data-view="draft"] .case {
    --dv-col: clamp(220px, 20cqw, 250px);
    --dv-gap: 32px;
    grid-template-columns: minmax(200px, 1fr) minmax(0, calc(38em + var(--dv-gap) + var(--dv-col)));
  }
  html[data-view="draft"] .case__section {
    display: grid;
    grid-template-columns: minmax(0, 38em) var(--dv-col);
    column-gap: var(--dv-gap);
    align-items: start;
    max-width: none;
  }
  html[data-view="draft"] .case__section > * { grid-column: 1; }
  html[data-view="draft"] .case__head:has(> .dv-notes) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--dv-col);
    column-gap: var(--dv-gap);
    align-items: start;
  }
  html[data-view="draft"] :is(.case__section, .case__head) > .dv-notes {
    grid-column: 2;
    grid-row: 1;
    margin-top: 8px;
  }
}

/* ---------- About page: notes on the Rail Board ---------- */
/* The grid paper shows through, and each tile gets a dashed blueprint edge so the board still reads as
   tiles. A tile's notes sit inside it, under a dashed rule; the rail's notes sit between its tiles. */
html[data-view="draft"] .main--board { background: transparent; }
html[data-view="draft"] .tile { outline: 1px dashed var(--blue-line); outline-offset: -1px; }
html[data-view="draft"] .board .dv-notes { max-width: none; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--blue-line); }
html[data-view="draft"] .board .dv-notes li { color: var(--ink); padding: 6px 10px 6px 12px; }
html[data-view="draft"] .board__rail > .dv-notes { margin-top: 0; padding-top: 0; border-top: 0; }
html[data-view="draft"] .board h1 .dv-mark { border-bottom-width: 4px; } /* as on the work pages' titles */
/* Section words carry a 3px rule on every page (Home and Work set theirs below). */
html[data-view="draft"] .board .section-word .dv-mark { border-bottom-width: 3px; }
/* An old section name sits on its own small line above the new one, like the old title on a work page. */
html[data-view="draft"] .section-word .dv-was { display: block; width: fit-content; margin-bottom: 6px; font: 400 16px/1.2 var(--sans); letter-spacing: 0; -webkit-text-stroke: 0; }
html[data-view="draft"] .tool-tile__name .dv-was { display: block; width: fit-content; font-weight: 400; font-size: 13px; }
html[data-view="draft"] .tile__label .dv-mark { border-bottom-color: #e6a08a; }
/* The monogram's pin goes in the tile's corner: outlined initials have nothing to underline. */
html[data-view="draft"] .monogram .dv-mark { border-bottom: 0; }
html[data-view="draft"] .monogram .dv-num { position: absolute; top: 12px; right: 12px; margin: 0; background: var(--paper); color: var(--accent); }
/* Wide: the title's note sits in a column beside the intro, as on the work pages. */
@container page (min-width: 1100px) {
  html[data-view="draft"] .board__intro { display: grid; grid-template-columns: minmax(0, 1fr) 240px; column-gap: 28px; align-items: start; }
  html[data-view="draft"] .board__intro > * { grid-column: 1; }
  html[data-view="draft"] .board__intro > .dv-notes { grid-column: 2; grid-row: 1 / span 4; margin-top: 64px; padding-top: 0; border-top: 0; }
}

/* ---------- One paper sheet per block, at every width (round C, Dan's picks Nov 19) ---------- */
/* The grid ran straight through the words, taking grey text to 3.49:1 and rust to 2.84:1 where a
   line crossed a letter. Here each block of text sits on a sheet of plain paper drawn by its ::before,
   and the grid shows only around the sheets: in a strip at the page edges and in the gaps between
   blocks. The sheet is a pseudo-element so nothing moves: it reaches --dv-in past each side into the
   gutter, and starts --dv-t below the block's top (its top padding, less some paper above the first
   line). Below 1220px, notes sit right after the paragraph or bullet they explain
   (draft-notes.js); at 1220px and up they stay in the margin column, on the same sheet. Each group
   sits on a shaded slip with a small tab. Ink on paper is 13.8:1, grey 5.8:1, rust 4.9:1; on the
   slip 13.1, 5.5 and 4.6:1. */
html[data-view="draft"] :is(.site-header__bar, .case__head, .case__section, .next-project,
    .intro, .how, .lead-in, .proof, main > .section) {
  --dv-in: 24px;
  --dv-t: 0px;
  --dv-b: -14px;
  position: relative;
  isolation: isolate;
}
html[data-view="draft"] :is(.site-header__bar, .case__head, .case__section, .next-project,
    .intro, .how, .lead-in, .proof, main > .section)::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: var(--dv-t) calc(-1 * var(--dv-in)) var(--dv-b);
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--grid-major);
}
html[data-view="draft"] .site-header__bar { --dv-t: 8px; --dv-b: 0px; }
html[data-view="draft"] .case__head { --dv-t: 18px; }
html[data-view="draft"] .case__section { --dv-t: 50px; }
html[data-view="draft"] .next-project { --dv-b: 82px; }
/* The poster name's letters reach far above its line box on wide screens, so the intro's sheet starts
   right under the header's. */
html[data-view="draft"] .intro { --dv-t: 0px; --dv-b: 0px; }
html[data-view="draft"] .how { --dv-t: 30px; --dv-b: 0px; }
html[data-view="draft"] .lead-in { --dv-t: 50px; }
html[data-view="draft"] .proof { --dv-t: 42px; }
html[data-view="draft"] main > .section { --dv-t: 36px; } /* the outlined section words grow with the page */
html[data-view="draft"] main > .section:last-child { --dv-b: 90px; }

/* Notes: a shaded slip under its paragraph, with a "Why it changed" tab over each group. The tab is
   decoration (its alt text is empty), since the list is already labelled "Draft notes". */
html[data-view="draft"] .dv-notes li { background: var(--box); padding: 6px 10px 6px 12px; color: var(--ink); }
html[data-view="draft"] .dv-notes--after { margin: 14px 0 18px; }
html[data-view="draft"] .dv-notes li + li { margin-top: 0; }
html[data-view="draft"] :is(.case__section, main > .section, .proof, .case__head, .board) .dv-notes::before {
  content: "Why it changed" / "";
  display: block;
  width: fit-content;
  padding: 2px 8px 2px 12px;
  background: var(--accent);
  color: var(--paper);
  font: 500 10px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
@container page (max-width: 900px) {
  html[data-view="draft"] .how { --dv-t: 22px; }
}
@container page (max-width: 560px) {
  html[data-view="draft"] :is(.site-header__bar, .case__head, .case__section, .next-project,
      .intro, .how, .lead-in, .proof, main > .section) { --dv-in: 12px; }
  html[data-view="draft"] .site-header__bar { --dv-t: 4px; }
  html[data-view="draft"] .case__head { --dv-t: 10px; }
  html[data-view="draft"] .case__section { --dv-t: 34px; }
  html[data-view="draft"] .next-project { --dv-b: 58px; }
  html[data-view="draft"] .lead-in { --dv-t: 30px; }
  html[data-view="draft"] .proof { --dv-t: 30px; }
  html[data-view="draft"] main > .section { --dv-t: 50px; }
  html[data-view="draft"] main > .section:last-child { --dv-b: 58px; }
}

/* ---------- Words for screen readers (Step 5, Nov 19) ---------- */
/* A strikethrough has no meaning out loud, so struck wording was read straight into its replacement
   ("Command Center Job Hub"). Each struck phrase now says "was" and its replacement "now". The labels
   are CSS alt text: nothing shows on screen and no page wording changes. A mark with no old wording
   before it gets no label. */
html[data-view="draft"] :is(.dv-was, .dv-note-was)::before { content: "" / "was:"; }
html[data-view="draft"] .dv-was + .dv-mark::before { content: "" / "now:"; }

/* ---------- About, How I work: one pin style (Step 5, Nov 19) ---------- */
/* The sentence's own footnote numbers become round pins like Draft view's, drawn as rings so they
   don't read as Draft notes 1 to 3 (those are filled). */
html[data-view="draft"] .redline__num {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 3px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: var(--paper);
  font: 600 13px/1 var(--mono);
  vertical-align: super;
}
html[data-view="draft"] .redline__notes { counter-reset: fn; padding-left: 0; list-style: none; }
html[data-view="draft"] .redline__notes li { counter-increment: fn; }
html[data-view="draft"] .redline__notes li::before {
  content: counter(fn);
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font: 600 10px/1 var(--mono);
  vertical-align: 1px;
}

/* ---------- Switching view ---------- */
/* The draft marks fade in when the visitor picks Draft view (.view-changed, set on the first press), not
   when a page opens already in Draft view from a link. */
@media (prefers-reduced-motion: no-preference) {
  html.view-changed[data-view="draft"] :is(.dv-was, .dv-num, .dv-notes, .dv-soon) { animation: dv-in .3s ease both; }
}
@keyframes dv-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Home: the Made by hand timeline (Nov 18) ---------- */
/* The old label sits on its own small line above the outlined heading, as on About's section words. */
html[data-view="draft"] .section__head--notes .section-word .dv-mark { border-bottom-width: 3px; }
html[data-view="draft"] .section__head--notes .dv-notes li { color: var(--ink); padding: 6px 10px 6px 12px; }
html[data-view="draft"] .timeline__lede, html[data-view="draft"] .timeline__small { background: var(--paper); }
/* The dashed ChatGPT line is already rust, so its mark needs no second rule under the words. */
html[data-view="draft"] .timeline__gate .dv-mark { border-bottom: 0; }
/* Wide: the three notes sit in a column beside the heading and lede. */
@container page (min-width: 1100px) {
  html[data-view="draft"] .section__head--notes { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 22cqw, 300px); column-gap: 40px; align-items: start; }
  html[data-view="draft"] .section__head--notes > * { grid-column: 1; }
  html[data-view="draft"] .section__head--notes > .dv-notes { grid-column: 2; grid-row: 1 / span 3; margin-top: 12px; }
}

/* ---------- Home: How I work and the notes near the top (Nov 18) ---------- */
/* The sentence and the lines beside it sit on plain paper, off the grid lines. */
html[data-view="draft"] .how__sentence, html[data-view="draft"] .how__keep { background: var(--paper); }
html[data-view="draft"] .proof .dv-notes { margin: 0 0 22px; }
html[data-view="draft"] .proof .dv-notes li { color: var(--ink); padding: 6px 10px 6px 12px; }
html[data-view="draft"] .section__head--notes .dv-notes { margin-top: 20px; }

/* Off the clock band (Nov 26): the struck old title sits on the dark band, so no paper sheet behind it. */
html[data-view="draft"] .band .dv-was { background: none; color: #e07a5a; }
