/* ===========================================================================
   Site adjustments to the new report design (assets/v2/css/report.css), kept in
   their own file so the design's files stay as delivered. Loaded last.
   =========================================================================== */

/* 23 Nov: tables scroll sideways instead of squeezing, as on the current reports.
   Below 768px every table keeps a 640px floor and scrolls in its card; from 768px
   tables of up to four columns fit the card (five or more keep the floor). The
   company snapshot is excepted: the design stacks it into cards on phones. */
.rp-verify-table { min-width: 640px; }
.rp-verify-table.rp-verify-table--snapshot { min-width: 0; }
@media (max-width: 640px) {
  /* the design's phone rule switches tables to auto layout; with the floor back,
     fixed layout keeps each column at its colgroup share, as on the current reports */
  .rp-verify-table:not(.rp-verify-table--snapshot) { table-layout: fixed; }
}
@media (min-width: 768px) {
  .rp-verify-table:not(:has(col:nth-child(5))) { min-width: 0; }
}

/* 25 Nov (user): anything that scrolls inside the page shows a scrollbar at all times,
   so it is clear there is more: tables and wide charts that scroll sideways, and the
   phone chapter list when it is taller than the panel. Phones hide native scrollbars
   until a finger moves and ignore their styling, so report-site.js draws one, in the
   design's own scrollbar (CopyCat's C1-C6 pill row, .cc-tabs-bar in report-r2.css):
   4px, --sunk track, --ink-4 thumb, 2px radius. It is hidden when nothing overflows.
   The native bar is hidden where the drawn one is used (was: a thin thumb on hover). */
.has-sbar { scrollbar-width: none; }
.has-sbar::-webkit-scrollbar { display: none; }
.rp-sbar { position: relative; height: 4px; margin-top: 10px; border-radius: 2px; background: var(--sunk); touch-action: none; }
.rp-sbar[hidden] { display: none; }
.rp-sbar::before { content: ''; position: absolute; inset: -8px 0; }   /* easier to hit with a finger */
.rp-sbar__thumb { position: absolute; top: 0; left: 0; height: 100%; border-radius: 2px; background: var(--ink-4); cursor: grab; }
.rp-sbar--y { position: absolute; top: 12px; bottom: 12px; right: 4px; width: 4px; height: auto; margin: 0; }
.rp-sbar--y::before { inset: 0 -6px; }
.rp-sbar--y .rp-sbar__thumb { width: 100%; height: auto; }
/* the chapter list's bar appears once the panel has finished opening (.is-settled) */
.rp-mtoc-panel > .rp-sbar--y { opacity: 0; transition: opacity var(--dur-2) var(--ease-out); }
.rp-mtoc-panel.is-settled > .rp-sbar--y { opacity: 1; }
.rp-mtoc-panel > .rp-mtoc-list.has-sbar { padding-right: 10px; }

/* 23 Nov: "Who else does Harbor's jobs" on phones as a connected outline, as on the
   current reports (report-harbor.css, 13 Nov), in the design's dotted line. The
   design's stack left the Harbor box and the jobs unconnected. A spine runs down from
   the Harbor box; each job hangs off it with a tick, and each job's rivals hang off
   that job. The grid is flat (display: contents), so every job and rival group draws
   its own piece of the line, covering the gap above it. */
@container (max-width: 640px) {
  .rp-tree { --sp: 18px; --gap: 14px; --ln: var(--rp-dot) dotted var(--line-strong); }
  .rp-tree-box--self { margin-bottom: 0; }
  .rp-tree-branch > .rp-tree-box--job,
  .rp-tree-branch > .rp-tree-leaf { position: relative; margin-left: calc(var(--sp) + 10px); }
  .rp-tree-branch > .rp-tree-box--job { margin-top: var(--gap); }
  /* spine piece, from whatever sits above down to this item */
  .rp-tree-branch > .rp-tree-box--job::before,
  .rp-tree-branch > .rp-tree-leaf::before {
    content: ''; position: absolute;
    left: calc(-1 * var(--sp) - 10px + 8px); top: calc(-1 * var(--gap)); bottom: 0;
    border-left: var(--ln);
  }
  .rp-tree-branch > .rp-tree-leaf::before { top: 0; }
  /* tick from the spine into each job */
  .rp-tree-branch > .rp-tree-box--job::after {
    content: ''; position: absolute;
    left: calc(-1 * var(--sp) - 10px + 8px); top: 50%; width: calc(var(--sp) + 2px);
    border-top: var(--ln);
  }
  /* the spine stops at the last job's tick */
  .rp-tree-branch:last-child > .rp-tree-box--job::before { bottom: 50%; }
  .rp-tree-branch:last-child > .rp-tree-leaf::before { display: none; }
  /* rivals: a line down from their job, with a tick into each rival */
  .rp-tree-leaf { margin-top: 0; padding: 8px 0 0 30px; border-left: 0; }
  .rp-tree-leaf > .rp-tree-box { position: relative; }
  .rp-tree-leaf > .rp-tree-box::before {
    content: ''; position: absolute; left: -18px; top: 50%; width: 18px; border-top: var(--ln);
  }
  .rp-tree-leaf > .rp-tree-box::after {
    content: ''; position: absolute; left: -18px; top: -8px; bottom: -8px; border-left: var(--ln);
  }
  .rp-tree-leaf:last-child > .rp-tree-box::after { bottom: 50%; }
}

/* 23 Nov: the phone chapter list opens and closes like the accordions (.rp-insight-panel:
   grid rows 0fr to 1fr, --dur-3, --ease-out) instead of appearing at once. The list
   scrolls inside the panel when taller than 60vh; closed, it leaves the tab order
   once the transition ends. */
.rp-mtoc-panel {
  display: grid; grid-template-rows: 0fr; overflow: hidden; max-height: none;
  margin-top: 0; padding-block: 0; visibility: hidden;
  transition: grid-template-rows var(--dur-3) var(--ease-out), margin-top var(--dur-3) var(--ease-out),
              padding var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3);
}
.rp-mtoc.is-open .rp-mtoc-panel {
  display: grid; grid-template-rows: 1fr; margin-top: 6px; padding-block: 6px; visibility: visible;
  transition: grid-template-rows var(--dur-3) var(--ease-out), margin-top var(--dur-3) var(--ease-out),
              padding var(--dur-3) var(--ease-out), visibility 0s;
}
.rp-mtoc-panel > .rp-mtoc-list { min-height: 0; max-height: calc(60vh - 12px); overflow: hidden; }
/* scrolling only once fully open (report-site.js sets .is-settled): while the panel
   grows, the list is shorter than its content and would flash a scrollbar */
.rp-mtoc.is-open .rp-mtoc-panel.is-settled > .rp-mtoc-list { overflow-y: auto; }
@media (prefers-reduced-motion: reduce) { .rp-mtoc-panel, .rp-mtoc.is-open .rp-mtoc-panel { transition: none; } }

/* 23 Nov: the phone chapter list floats over the page, as on the current reports
   (report.css: position absolute, top 100%), instead of sitting in the flow. In the
   flow it pushed the page down by its height when opened; Chrome hides that with
   scroll anchoring, iOS Safari has none, so the page jumped. Same look as before: the
   white panel 6px under the bar, inside the bar's frosted paper band. */
.rp-mtoc-panel {
  position: absolute; left: var(--pad); right: var(--pad); top: calc(100% - 8px);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--paper) 90%, transparent);
}
.rp-mtoc.is-open .rp-mtoc-panel { margin-top: 6px; }

/* 23 Nov: claim ledger status pills on one line (as on the current reports and Opalite).
   "Sourced from company material" is ~220px with its padding; the status column was
   38% (as low as ~205px inside), so it wrapped. Pills never wrap, and the column is
   42% (230px+ at the narrowest card, 1100px beside the sidebar). */
.rp-ledger .rp-verify-badge { white-space: nowrap; }
/* 25 Nov (user, later): the status column is exactly the widest pill (237px) plus the cell's
   14px padding each side; the claims get the rest (at 54/46% the status column had a wide
   empty gap while the claims wrapped early). */
.rp-ledger .rp-verify-table col:first-child { width: auto !important; }
.rp-ledger .rp-verify-table col:last-child { width: 266px !important; }

/* 24 Nov: the label above each chapter title is an h4 (was a p). .rp-chapter-numeral
   sets its size, colour, margin and square; this drops the browser's heading bold so
   it looks exactly as before. */
h4.rp-chapter-numeral { font-weight: var(--w-regular); }

/* 24 Nov (PageSpeed): the hero intro (.rp-dek) is the page's largest paint (LCP). The
   design kept it at opacity 0 until site.js had run, then faded it in after the title's
   words (--t-sub): about 3 s on a throttled phone, which held mobile Performance at 88.
   It now shows from the first paint; the title's word blur-in and the meta's fade stay.
   (Specificity 0,4,0 to beat site-r2.css's .js-anim.is-loaded :is(.rp-dek, …).) */
.js-anim .rp-hero .rp-dek.rp-dek { opacity: 1; filter: none; transform: none; animation: none; }

/* 24 Nov (user, CopyCat review): phone chapter bar.
   (1) The label in the bar ("At a glance") had the bottom of its g, p, y cut off: the
   design sets the bar's font at line-height 1 and the label clips (overflow hidden, for
   the "…"), so letters below the line were cropped. A taller line box keeps them; the
   bar's height and the label's position are unchanged (the bar centres it). */
.rp-mtoc-label { line-height: 1.4; }
/* (2) With the list open, its frosted edge cut through the progress bar. As in the
   design, the open list now sits 6px under the bar and the progress bar moves below the
   list, sliding with it (report-site.js sets --mtoc-open-h, the list's open height);
   the list still floats over the page (23 Nov, no page jump on iOS). The frosted band
   under the list reaches past the progress bar; the bar stays above the list's band. */
.rp-mtoc-bar { position: relative; z-index: 1; }
.rp-mtoc-panel { top: calc(100% - 19px); }   /* .rp-mtoc's 8px padding + the progress bar's 8px margin and 3px height */
.rp-mtoc.is-open .rp-mtoc-panel {
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--paper) 90%, transparent), 0 11px 0 8px color-mix(in srgb, var(--paper) 90%, transparent);
}
.rp-mtoc .rp-progress { transition: transform var(--dur-3) var(--ease-out); }
.rp-mtoc.is-open .rp-progress { transform: translateY(var(--mtoc-open-h, 0px)); }
@media (prefers-reduced-motion: reduce) { .rp-mtoc .rp-progress { transition: none; } }

/* 24 Nov (user, CopyCat review): a heading that follows a card in Research gaps
   (CopyCat's "How we calculated the numbers") sat directly on the card above. It now
   has room above it, more than below, so it reads with the card it introduces. */
.rp-tail > .rp-chart + .rp-refs-head { margin-top: clamp(48px, 5vw, 80px); }

/* ==== 25 Nov: Squid on phones ============================================== */
/* "How a change becomes part of the trusted model", stacked: the chip sits under the
   icons, so the dotted line down the steps runs into it (it stopped short beside it,
   in the text column). It covers the line's end, so the line reads as joining it. */
@container (max-width: 640px) {
  .sq-pl-node.is-key .sq-pl-tag { grid-column: 1 / -1; grid-row: 4; justify-self: start; position: relative; z-index: 1; left: auto; top: auto; transform: none; margin-top: 10px; }
}
/* "Where copies come from" on phones: the study-tool boxes wrap as on the previous
   design (squid-2), all three alike ("Study / tool A"): its padding (12px 16px), its
   16px gap, and its 12px medium "Copied …" line. */
@media (max-width: 600px) {
  .sq-vt-kids { gap: 16px; }
  .sq-vt-kids::before { left: calc((100% - 32px) / 6); right: calc((100% - 32px) / 6); }
  .sq-vt-kids .sq-vt-box { padding: 12px 16px; }
  /* specific enough to beat the design's figure-wide font-size: inherit (0,3,0) */
  .rp-chapters-body .sq-vt-kids .sq-vt-box em { margin-top: 6px; font-size: 12px; font-weight: var(--w-medium); line-height: 1.3; }
}

/* 25 Nov: no orphans (a single word alone on the last line), mainly on phones, as on
   the current reports (report.css: text-wrap pretty on the dek and paragraphs). Short
   text (headings, titles, chips, legend and figure labels; tables since 25 Nov evening: below) is
   balanced, so its lines come out even; running text, captions and references are
   "pretty", which avoids a lone last word where the browser can. */
.rp-page main :is(h1, h2, h3, h4, .rp-chart-title, .rp-prose-sub, .rp-stats-heading, .rp-chart-legend li,
  .rp-bio__tag, .rp-insight-head-text, .rp-tree-name, .rp-tree-note, .rp-tree-meta,
  .rp-timeline-event, .rp-timeline-sub, .sq-pl-node strong, .sq-pl-node > span, .rp-flow strong,
  .rp-flow li > span, .rp-stat-caption, .rp-meta li) { text-wrap: balance; }
.rp-page main :is(p, li, figcaption, blockquote, .rp-ref-text, .rp-dek) { text-wrap: pretty; }
.rp-page main :is(.rp-chart-legend li, .rp-meta li) { text-wrap: balance; }
.rp-page .foot2__brand p { text-wrap: balance; }   /* 25 Nov: "…or start with a company." ended on one word */

/* 25 Nov: Squid's "Our dated calls": the date never wraps (report-r2.css), and its column
   was 20% (~100px of text at the table's narrowest), so "30 November 2026" (137px) ran
   into the prediction. Columns 27 / 40 / 33%: the date fits down to the 611px table. */
.sq-calls col:nth-child(1) { width: 27% !important; }
.sq-calls col:nth-child(2) { width: 40% !important; }
.sq-calls col:nth-child(3) { width: 33% !important; }

/* 25 Nov: InstaAgent's "Founder comparison" table: six columns whose longest words
   ("CharacterQuilt", "Shyamsundar", "Connections", "McDonough") need ~102% of a 640px
   table, so they overflowed their cells. It is 700px at least (scrolls a little more on
   phones), its columns sized to those words. */
.rp-verify-table.rp-verify-table--inputs { min-width: 700px; }
.rp-verify-table--inputs col:nth-child(1) { width: 17% !important; }
.rp-verify-table--inputs col:nth-child(2) { width: 17.5% !important; }
.rp-verify-table--inputs col:nth-child(3) { width: 19% !important; }
.rp-verify-table--inputs col:nth-child(4) { width: 14% !important; }
.rp-verify-table--inputs col:nth-child(5) { width: 14% !important; }
.rp-verify-table--inputs col:nth-child(6) { width: 18.5% !important; }

/* 25 Nov: bar charts with reference lines (hk-sqcharts hbarRefs): the dotted lines run
   behind the bar labels and values, which carry a card-coloured halo so they stay legible. */
.rp-sq.rp-sq--refs .l, .rp-sq.rp-sq--refs .v { paint-order: stroke; stroke: var(--raised); stroke-width: 5px; stroke-linejoin: round; }

/* 25 Nov (user, phone screenshots): on a highlighted chart row (tap or hover: the row's
   band is --sunk at 70%), the labels' card-coloured halo showed as a blotchy box around
   the text ("14 years, $48.9M", "15%"). On that row the halo takes the band's colour, so
   it still covers the dotted reference lines but no longer shows against the band. */
/* only labels that carry the halo: values and reference labels everywhere, row labels on
   charts with reference lines (.rp-sq--refs) */
.rp-sq .sqg.is-hot :is(.v, .mk), .rp-sq.rp-sq--refs .sqg.is-hot .l { stroke: color-mix(in srgb, var(--sunk) 70%, var(--raised)); }

/* 25 Nov (user): the Ask box's question field is a one-row textarea that grows with its
   text (report-site.js), so a long placeholder ("How does Squid compare with Nira
   Energy?") wraps onto a second line on phones instead of being cut off. Same font and
   size as before (16px on phones, so iOS does not zoom on focus); one line on desktop. */
textarea.ask__input { display: block; overflow: hidden; align-self: center; }

/* 25 Nov (user): citation tooltips the same size in every report. They carried each
   reference's full text, so CopyCat's (mostly one line) and Squid's (annotated notes, up
   to ~1,000 characters) looked unrelated. The tooltip now shows at most three lines of
   the reference; a longer one ends in "…" with a "See full reference" link to it in the
   list (report-site.js). The reference list itself is unchanged. */
.rp-tip .rp-ref-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.rp-tip__in { overflow-y: visible; max-height: none; }
.rp-tip .rp-tip__more { display: inline-block; margin-top: 6px; color: var(--orange); text-decoration: none; font-weight: var(--w-medium); }
.rp-tip .rp-tip__more:hover, .rp-tip .rp-tip__more:focus-visible { color: #FFFFFF; text-decoration: none; }

/* 25 Nov (user): the scroll fade on figures and cards was too slow when scrolling fast
   (700ms, starting only once 8% of the box was on screen, so boxes sat empty). Shorter
   and with less travel; report-site.js also starts it just before the box comes into view. */
.js-rp .rp-chart, .js-rp .rp-insights, .js-rp .rp-stat-card, .js-rp .rp-pullquote { transform: translateY(10px); transition: opacity 350ms var(--ease-out), transform 350ms var(--ease-out); }

/* 25 Nov (user): every table wraps "pretty" (Research gaps, claim ledger and the rest),
   like running text, instead of balanced: cells and headings, the claim ledger's claims
   (.rp-verify-claim) and the cell labels; taken out of the balance list above. */
.rp-page main :is(th, td, .rp-verify-claim, .rp-cell-label) { text-wrap: pretty; }

/* 25 Nov (user): accordion text runs the full width of its box (report.css caps
   .rp-insight-text at 72ch, which left a wide empty strip on the right). */
.rp-insight-text { max-width: none; }

/* 25 Nov (user, Harbor): the moves chart's right column was 140px and "Back toward
   software" (143px) put "software" alone on a second line; 152px fits every label. */
.rp-moves { --state-w: 152px; }

/* 25 Nov (user): the load animation was late on phones. (1) When the page has already
   painted before the scripts ran (slow phone), report-site.js adds .hk-late: the header,
   title and tags just show, instead of vanishing and animating in again seconds later.
   (2) Otherwise the same blur-in, quicker: words 25ms apart over 500ms (were 55ms /
   900ms), header 450ms (700ms), tags straight after the title. */
.hk-late.js-anim :is(.nav .frame > *, .rp-hero h1 .w, .rp-hero .rp-meta) { opacity: 1 !important; filter: none !important; transform: none !important; animation: none !important; }
.js-anim.is-loaded body.rp-page .nav .frame > * { animation-duration: 450ms; }
.js-anim.is-loaded body.rp-page .rp-hero h1 .w { animation-duration: 500ms; animation-delay: calc(60ms + var(--i) * 25ms); }
.js-anim.is-loaded body.rp-page .rp-hero .rp-meta { animation-duration: 500ms; animation-delay: 380ms; }
