/* Weave Sprint hub route styles. Links after tokens.css, uses only shared
   tokens, and is loaded by exactly one page: /sprint/.

   BRANDCRAFT v4, batch 2 lane L-B. The idiom is the library cluster (DEC-002):
   /sprint is a shelf of books, and library/index.html is the living precedent
   for presenting books. The vitrine, hallmark, book-render and shelf-card
   PATTERNS are ported here rather than reused by reference: library.css is
   route-scoped to /library/ and is not loaded on this page, so every rule the
   markup needs is restated below.

   Stock: one continuous green sheet (--paper-green) from the hero through the
   rights band, torn into at the top, torn out of above the crisis block. The
   search band is a white card floating ON the sheet, not a sheet change: the
   chrome needs scanning contrast, the page does not need another seam.

   Legibility, measured, both themes. On the light green sheet only --ink
   clears the body floor (7.08:1); --ink-2 is 3.88 and the house --marker is
   1.94. So nothing on the sheet runs anything but ink, and the one accent is
   --sp-accent-ink #6B2A16, measured 4.91 on the green and 10.67 on white.
   Dark theme keeps --marker, which measures 5.58 on the deep green and 6.61
   on the dark card. Same ratified per-lane pattern as --lib-accent-ink.

   Rotation: containers only, and only three of them. The hero art plate, the
   two pen annotations, and the fact stamps. Vitrines, shelf cards, chips and
   the rights band are all 0deg: dense reference surfaces and live controls,
   the same ruling library gave its own vitrines and shelf.

   Shadows are the offset-solid ink tint from tokens, never blur glows.
   No dashed or dotted rule is declared anywhere in this file. */

/* ------------------------------------------------------------------ route */

.sprint {
  --sp-accent-ink: #6B2A16;
  --sp-card: var(--cloth-card);
  font-size: 1.0625rem;
  line-height: 1.62;
  color: var(--ink);
}
[data-theme="dark"] .sprint { --sp-accent-ink: var(--marker); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sprint { --sp-accent-ink: var(--marker); }
}

/* Long unbreakable drug and syndrome names wrap rather than widen a card. */
.sprint :where(p, li, h1, h2, h3, .shelf-card__title, .vitrine__title) {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sprint :where(img, svg) { max-width: 100%; }
.sprint-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Seam law: the tear is the sheet's first child, its fill is the sheet ABOVE,
   and the sheet carries no top padding. .sheet-green already sets that. The
   green-to-quiet tear rides its own wrapper so the copied crisis section
   stays byte-identical to the study and library instances. */
.torn--cloth { color: var(--cloth); }
.torn--green { color: var(--paper-green); }
.sprint-seam { background: var(--paper-quiet); line-height: 0; }
.sheet-pad { padding-top: var(--space-section); }

.sprint-shell {
  width: min(1184px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.sprint-eyebrow {
  display: block;
  margin: 0 0 0.9rem;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Pen annotations. Caveat, 24px floor enforced by the .pen token; ink on the
   sheet, never the marker terracotta, which does not clear the floor here.
   Two on the page, far apart, both on containers. */
.sprint-annot {
  display: inline-block;
  margin: 1.4rem 0 0;
  transform: rotate(-1.2deg);
}
.sprint-annot--shelf { margin-top: 1rem; transform: rotate(1.1deg); }

/* ------------------------------------------------------------------- hero */

.sprint-hero {
  width: min(1184px, calc(100% - 2.5rem));
  margin-inline: auto;
  padding: clamp(7rem, 13vw, 10rem) 0 clamp(2.5rem, 5vw, 4rem);
}
.sprint-hero__grid { display: grid; gap: clamp(2rem, 5vw, 4rem); }
.sprint-hero__text { max-width: 44rem; }

.sprint-title {
  margin: 0 0 0.6rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.04;
  padding-bottom: 0.28em;
}
/* The scribble runs the darkened terracotta: the house --marker measures
   1.94:1 on this sheet and would read as a smudge. */
.sprint-title .scribbled path { stroke: var(--sp-accent-ink); }

.sprint-sub {
  margin: 0 0 1rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 700;
  line-height: 1.35;
}
.sprint-lede {
  max-width: 62ch;
  margin: 0;
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.6;
}
.sprint-stamps { margin-top: 1.5rem; }
.sprint-stamps .stamp { font-size: 0.84375rem; }

.sprint-hero__art { justify-self: center; }
.sprint-plate { width: min(100%, 26rem); }
/* Riso ink sits ON the paper. The blend lives on the img, never on a wrapped
   ancestor (stacking-context law), and the plate behind it is white so the
   illustration keeps its ground on the coloured sheet (L22). */
.sprint-plate > img { mix-blend-mode: multiply; }
[data-theme="dark"] .sprint-plate > img { mix-blend-mode: normal; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sprint-plate > img { mix-blend-mode: normal; }
}

/* --------------------------------------------------------- search band */

/* Sticky because 44 items is a lot to scan and the search should never be
   more than a glance away. Sits below the floating nav pill, above the sheet,
   and is a white card rather than a sheet change. */
.sprint-search {
  position: sticky;
  z-index: 40;
  top: 76px;
  width: min(1184px, calc(100% - 2.5rem));
  margin: 0 auto var(--space-6);
}
.sprint-search__inner {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: var(--wonky-1);
  background: var(--sp-card);
  box-shadow: var(--shadow-lift);
}
.sprint-searchbox { display: block; flex: 1; min-width: 0; }
.sprint-search__trigger { flex: 0 0 auto; }

/* Pagefind's component CSS pins .pf-searchbox to max-width 480px and
   inline-block, so the width override has to be hard, exactly as on /study. */
.sprint-searchbox .pf-searchbox {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
}
.sprint-searchbox .pf-searchbox-input-wrapper {
  width: 100% !important;
  max-width: none !important;
}
.sprint-searchbox .pf-searchbox-input {
  box-sizing: border-box;
  width: 100% !important;
  max-width: none !important;
  min-height: 44px;
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 1rem;
}
/* The component's own sheet sets the key cap at 11px, under the 12px floor,
   and pins it with a three-ID specificity hack. Overridden hard. */
.pf-trigger-key { font-size: 0.75rem !important; }
.pf-filter {
  position: absolute !important;
  clip: rect(0 0 0 0);
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  white-space: nowrap;
}

/* These --pf-* variables pierce the component's shadow DOM. */
:root {
  --pf-font: var(--font-ui);
  --pf-text: var(--ink);
  --pf-text-secondary: var(--ink-2);
  --pf-text-muted: var(--ink-3);
  --pf-background: var(--cloth-card);
  --pf-border: var(--hairline);
  --pf-border-focus: #0F766E;
  --pf-hover: color-mix(in srgb, var(--thread-sage) 6%, var(--cloth));
  --pf-mark: #0F766E;
  --pf-border-radius: 10px;
  --pf-modal-backdrop: rgba(42, 34, 24, .45);
  --pf-modal-top: 8vh;
  --pf-result-title-font-size: 1.05rem;
  --pf-outline-focus: #0F766E;
  --pf-outline-width: 2px;
}

/* Degraded state. The index is cross-origin on R2, so a bucket, CORS or
   network failure means the custom element never defines. That is a
   different thing from a search returning nothing, and it says so: one quiet
   line naming the four papers, never an empty box the reader types into. */
.sprint-search__down {
  display: none;
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
}
/* The fallback links are the only route left when search is down, so they
   carry the same 44px tap height the chips do, without leaving the sentence. */
.sprint-search__down a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
  color: var(--sp-accent-ink);
  font-weight: 600;
  white-space: nowrap;
  text-underline-offset: 0.18em;
}
.sprint-search__sep { color: var(--ink-3); }
.sprint-search.pf-down .sprint-search__inner { display: block; }
.sprint-search.pf-down .sprint-searchbox,
.sprint-search.pf-down .sprint-search__trigger { display: none; }
.sprint-search.pf-down .sprint-search__down { display: block; }

/* --------------------------------------------------------------- controls */

.sprint-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  align-items: center;
  width: min(1184px, calc(100% - 2.5rem));
  margin: 0 auto 0.6rem;
}
.paper-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* Filter chips are stamps, minus the stamp wobble. These are live controls
   whose fill swaps under the pointer, and a rotated chip flipping state
   mid-click reads as a glitch rather than as a hand. The stamp voice carries,
   the tilt does not. Same departure /study made, same reason. */
.paper-chips .chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 14px;
  border: 2px solid var(--ink);
  border-radius: 4px 9px 5px 10px;
  background: var(--sp-card);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums lining-nums;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-weave),
    color var(--duration-fast) var(--ease-weave);
}
.paper-chips .chip:hover { background: var(--fill-cool); }
.paper-chips .chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cloth-card);
}
.sprint-controls__r {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.sprint-filter {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
}
#filter-text {
  min-width: 12rem;
  min-height: 44px;
  padding: 6px 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--sp-card);
  color: var(--ink);
  font-family: var(--font-ui);
  /* 16px exactly: anything smaller makes iOS Safari zoom the page on focus. */
  font-size: 1rem;
}
.sprint-count,
.sprint-empty {
  width: min(1184px, calc(100% - 2.5rem));
  margin: 0 auto var(--space-8);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums lining-nums;
}
.sprint-empty {
  padding: var(--space-8) 0;
  font-size: 1.0625rem;
  text-align: center;
}

/* --------------------------------------------------------------- vitrines */

.sprint-papers { display: block; }
.vitrine {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.75rem, 5vw, 4rem);
  align-items: center;
  width: min(1184px, calc(100% - 2.5rem));
  margin-inline: auto;
  padding: clamp(2.25rem, 5vw, 3.5rem) 0;
  border-bottom: 2px solid var(--ink);
  scroll-margin-top: 150px;
  background-image: radial-gradient(58% 68% at var(--spot-x, 30%) 44%,
    color-mix(in srgb, var(--stage, var(--thread-teal)) 12%, transparent),
    transparent 64%);
}
.sprint-papers .vitrine:last-of-type { border-bottom: 0; }
.vitrine__text { position: relative; z-index: 1; max-width: 46rem; }
.vitrine__eyebrow {
  display: block;
  margin: 0 0 1rem;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.vitrine__title {
  margin: 0 0 0.5rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.06;
}
.vitrine__subtitle {
  margin: 0 0 1rem;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
}
.vitrine__promise {
  margin: 0 0 1.2rem;
  color: var(--sp-accent-ink);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.4rem);
  font-style: italic;
  line-height: 1.4;
}
.vitrine__what {
  max-width: 62ch;
  margin: 0 0 1.6rem;
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.62;
}
.vitrine__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.vitrine__author {
  margin: 1.1rem 0 0;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
}
.vitrine__stage {
  display: flex;
  align-items: center;
  justify-content: center;
}
.book { position: relative; }
/* The transparent-film render carries no baked shadow; the offset solid drop
   is applied here so it tracks the theme. */
.book__render {
  display: block;
  width: auto;
  max-width: 100%;
  height: clamp(300px, 42vh, 470px);
  filter: drop-shadow(6px 8px 0 rgb(43 35 32 / 18%));
}

/* Hand-ruled hallmark: a matched top-and-bottom pair, never a side tab.
   Pages and Size run tabular so the four rows line up down the set. */
.hallmark {
  margin: 0 0 1.7rem;
  padding: 0.35rem 0;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}
.hallmark__row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.6rem 0.1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
}
.hallmark__row:last-child { border-bottom: 0; }
.hallmark__k {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hallmark__v {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  text-align: right;
}
.hallmark__v--num { font-variant-numeric: tabular-nums lining-nums; }

/* ------------------------------------------------------------------ shelf */

.sprint-shelf {
  width: min(1184px, calc(100% - 2.5rem));
  margin-inline: auto;
  padding: clamp(3rem, 6vw, 5rem) 0 0;
}
.sprint-shelf__head { max-width: 62ch; margin: 0 0 2rem; }
.sprint-shelf__title {
  margin: 0 0 0.7rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.08;
}
.sprint-shelf__lede {
  margin: 0;
  color: var(--ink);
  font-size: 1.0625rem;
}
.sprint-cluster { margin-bottom: clamp(2rem, 4vw, 3rem); }
.sprint-cluster__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--ink);
}
.sprint-cluster__name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}
.sprint-cluster__meta {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}
.sprint-cluster__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

/* Every tile is a white card pasted on the sheet: ink border carrying its own
   paper accent, uneven radius alternating down the grid, offset solid shadow.
   Zero rotation, this is a dense scanning surface. */
.shelf-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: hidden;
  padding: 1.05rem 1.15rem 1.1rem;
  border: 2px solid color-mix(in srgb, var(--tile-accent, var(--ink)) 34%,
    var(--ink));
  border-radius: var(--wonky-1);
  background: var(--sp-card);
  box-shadow: var(--shadow-soft);
  transition: transform var(--duration-ui) var(--ease-weave),
    border-radius var(--duration-ui) var(--ease-weave),
    box-shadow var(--duration-ui) var(--ease-weave);
}
.shelf-card:nth-child(even) { border-radius: var(--wonky-2); }
.shelf-card:hover {
  transform: translateY(-3px);
  border-radius: var(--wonky-3);
  box-shadow: var(--shadow-lift);
}
.shelf-card > *:not(.tile-deco) { position: relative; z-index: 1; }
.tile-deco {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  color: var(--tile-accent, var(--ink));
  opacity: 0.14;
  pointer-events: none;
}
.shelf-card:hover .tile-deco { opacity: 0.22; }
.shelf-card__n {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 10px 3px;
  border: 2px solid color-mix(in srgb, var(--tile-accent, var(--ink)) 55%,
    var(--ink));
  border-radius: 4px 9px 5px 10px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums lining-nums;
}
.shelf-card__title {
  flex: 1;
  margin: 0.15rem 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.24;
}
.shelf-card__meta {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  margin: 0;
  color: var(--ink-2);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums lining-nums;
}
.shelf-card__dot { color: var(--ink-3); }
.shelf-card__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.1rem;
  margin: 0.35rem 0 0;
}
.shelf-card__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--sp-accent-ink);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
}
.shelf-card__link:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.shelf-card__link:active { transform: scale(.97); }

/* ------------------------------------------------------------------ rights */

/* Licence text at 0deg always, zero annotation, zero decoration. Disciplined
   on the page's own paper rather than switched to the quiet surface, which is
   reserved for the zones DESIGN-V4 part 7 names explicitly. */
.sprint-rights {
  width: min(1184px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) 0 clamp(3.5rem, 7vw, 6rem);
}
.sprint-rights__inner {
  max-width: 68ch;
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 2px solid var(--ink);
  border-radius: var(--radius-card);
  background: var(--sp-card);
  transform: none;
}
.sprint-rights__title {
  margin: 0 0 1rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.12;
}
.sprint-rights p {
  margin: 0 0 1rem;
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: 1.62;
}
.sprint-rights p:last-child { margin-bottom: 0; }
.sprint-rights__by { color: var(--ink) !important; font-weight: 600; }
.sprint-rights .sprint-eyebrow { color: var(--ink-2); }

/* ------------------------------------------------------------- responsive */

@media (min-width: 600px) {
  .sprint-cluster__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .sprint-cluster__grid { grid-template-columns: repeat(3, 1fr); }
  .sprint-hero__grid {
    grid-template-columns: minmax(0, 7fr) minmax(16rem, 5fr);
    align-items: center;
  }
  .vitrine { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .vitrine:nth-of-type(even) { --spot-x: 70%; }
  .vitrine:nth-of-type(even) .vitrine__stage { order: 1; }
  .vitrine:nth-of-type(even) .vitrine__text { order: 2; }
  .sprint-search { top: 88px; }
}
@media (min-width: 1200px) {
  .sprint-cluster__grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 599px) {
  .sprint-search__inner { padding: 0.7rem; }
  /* Tighter chips on a phone so a filter row is a row, not a stack. The 44px
     tap height and the 14px label floor both survive; only the side padding
     and the tracking give way. */
  .sprint-controls { gap: 0.6rem; }
  .paper-chips { gap: 0.4rem; }
  .paper-chips .chip {
    padding: 4px 10px;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
  }
  .sprint-controls__r { width: 100%; }
  #filter-text { flex: 1; min-width: 0; }
  .book__render { height: clamp(260px, 46vw, 340px); }
  .sprint-hero { padding-top: 6.5rem; }
}

/* ------------------------------------------------------------ motion floor */

@media (prefers-reduced-motion: reduce) {
  .shelf-card,
  .paper-chips .chip { transition: none; }
  .shelf-card:hover { transform: none; }
  .shelf-card__link:active { transform: none; }
}
