/* THE BLUE PENCIL · evolved layout (board). Loads after styles.css and form.css, and before the page's own v2-<page>.css.
   Layout B, "the marked-up manuscript": one long unlined white page on the desk, the red margin line at its left,
   a reading column and a wide margin on its right. The proofreading marks sit along the LEFT, outside the red line.
   Every colour, width and size comes from tokens.css. No script. Marks are decoration: aria-hidden, never meaning. */

:root {
  --col: 40rem;   /* the reading column */
  --gap: 96px;    /* the gutter the arrows cross */
}

/* ── the page: one framed sheet, the red line at its left ── */
.ms {
  position: relative;
  width: min(1400px, calc(100% - 56px));
  margin: 0 auto 96px;
  padding: 92px 56px 96px 100px;
  background-color: var(--page);
  border: var(--w-frame) solid var(--ink);
}
.ms::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 64px;
  width: var(--w-margin);
  background-color: var(--margin);
  pointer-events: none;
}

/* each section is a two-column sheet: [reading column] [the margin] */
.ms-sec,
.psg {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, var(--col)) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: start;
}
.ms-sec > *,
.psg > * { grid-column: 1; min-width: 0; }
.ms-sec > .mn,
.psg > .mn { grid-column: 2; }
.ms-sec + .ms-sec { margin-top: 112px; }

/* a passage nested in a section spans the whole sheet (the home page's three reasons, the team) */
.ms-sec > .psg { grid-column: 1 / -1; }

/* the inner pages' hero is the same page as the manuscript under it: same width, same red line, and the
   desk's grain runs on behind both (no flat band). The home hero keeps its own approved rules. */
body:not(.home) .hero {
  --hp-pad: 46px 56px 44px 100px;
  --hp-mline: 64px;
  padding: 56px 0 48px;
  background: none;
}
body:not(.home) .hero > .wrap {
  width: min(1400px, calc(100% - 56px));
  max-width: none;
}
@media (max-width: 859px) {
  body:not(.home) .hero {
    --hp-pad: 30px 20px 32px 52px;
    --hp-mline: 34px;
    padding: 36px 0 40px;
  }
  body:not(.home) .hero > .wrap { width: calc(100% - 2 * var(--gutter, 24px)); }
}

/* heads sit in the reading column under a 1.5px ink rule */
h2.ms-h {
  margin: 0 0 var(--s4);
  padding-top: var(--s3);
  border-top: var(--w-head-rule) solid var(--ink);
  font-family: var(--fd);
  font-weight: var(--w-head);
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
h2.big-h {
  font-weight: var(--w-display);
  font-size: clamp(2.5rem, 5.2vw, 4.2rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

/* the running text is the page itself */
.tx,
.tx p {
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink);
}
p.tx, .tx p { margin: 0; }
.lead-tx { font-family: var(--fd); font-size: 21px; line-height: 1.5; }

/* the coach's words inside a heading */
.blue {
  font-family: var(--fd);
  font-style: italic;
  font-weight: var(--w-read);
  color: var(--ultra);
}

/* ── marks (the sprite: assets/marks-v2.svg) ── */
svg.pm {
  fill: none;
  stroke: var(--ultra);
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
  display: block;
  flex: none;
}
/* a mark along the left, outside the red line: the item is positioned, the mark hangs into the page's left gutter */
.has-lm { position: relative; }
svg.lm {
  position: absolute;
  left: -88px;
  top: 0.2em;
  width: 44px;
  height: 36px;
  max-width: none;
}
/* a word ringed or boxed: the mark sits on the words, the words never move */
.ringed,
.boxed {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.ringed { margin-left: 0.14em; }
.boxed { padding: 0 0.12em; margin: 0 0.06em; }
svg.ring-mk {
  position: absolute;
  left: -0.24em;
  top: -0.08em;
  width: calc(100% + 0.5em);
  height: 1.34em;
  max-width: none;
  pointer-events: none;
}
svg.box-mk {
  position: absolute;
  left: -0.12em;
  top: -0.1em;
  width: calc(100% + 0.24em);
  height: calc(100% + 0.2em);
  max-width: none;
  pointer-events: none;
}

/* ── the coach's margin notes: Caveat, margin notes only ── */
.mn {
  position: relative;
  margin: 0;
  font-family: var(--fh);
  font-style: normal;
  font-weight: var(--w-hand);
  font-size: var(--fs-hand);
  line-height: 1.12;
  color: var(--ultra);
  max-width: 26rem;
}
p.mn { font-size: 34px; }
h3.mn { font-size: 42px; line-height: 1.05; letter-spacing: 0; font-variation-settings: normal; }

/* ── a list whose items each carry a mark in the left gutter ── */
ol.ml, ul.ml { list-style: none; margin: 0; padding: 0; }
.ml > li { position: relative; }
.ml > li + li { margin-top: var(--s4); }
.ml > li h3 { margin: 0 0 6px; font-size: 1.4rem; }
.ml > li p { margin: 0; }

/* ── the close: the last passage, the button under the words ── */
.ms-cta > h2 { border-top-width: var(--w-frame); }
.ms-cta .tx p { margin-bottom: var(--s4); }

/* the margin's own quiet edge, decoration only */
@media (min-width: 1180px) {
  .ms::after {
    content: "";
    position: absolute;
    top: 72px;
    bottom: 72px;
    left: calc(100px + var(--col) + var(--gap) / 2);
    width: var(--w-rule);
    background-color: var(--rule);
    pointer-events: none;
  }
}

@media (max-width: 1099px) {
  :root { --gap: 64px; --col: 32rem; }
}

/* narrow: the margin folds under its words, in the markup's own order */
@media (max-width: 859px) {
  .ms {
    width: calc(100% - 2 * var(--gutter, 24px));
    padding: 56px 20px 64px 52px;
  }
  .ms::before { left: 34px; }
  .ms-sec,
  .psg { display: block; }
  .ms-sec + .ms-sec { margin-top: 80px; }
  .mn { margin: 0 0 var(--s3); }
  p.mn { font-size: 26px; }
  h3.mn { font-size: 30px; }
  .tx, .tx p { font-size: 17px; }
  svg.lm { left: -50px; width: 28px; height: 24px; }
}

@media (forced-colors: active) {
  .ms { border-color: CanvasText; }
  .ms::before { background-color: Highlight; }
  svg.pm { stroke: CanvasText; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
