/* Ride Free brand kit: brush strokes (highlight, underline, hover underline).
   Pair with rf-brush.js. The stroke colour is currentColor of --rf-mark, which the page sets by
   ground: Fern on Paper and Bone, Dune on Charcoal. Nothing in the script hard-codes a colour. */

:root {
  /* brand colours, by name */
  --rf-charcoal: #1A1A18;
  --rf-paper: #F4F2EC;
  --rf-bone: #F2ECE0;
  --rf-fern: #038C65;
  --rf-fern-bright: #0BBF8C;
  --rf-dune: #DCC6A2;
  --rf-white: #FFFFFF;
  --rf-ink: #1A1917;

  /* the mark colour for the current ground (override per section) */
  --rf-mark: var(--rf-fern);
  /* text on Charcoal is White; text on a stroke is Ink or White, whichever contrasts more */

  /* tuning (em values are relative to the marked text's font size) */
  --rf-brush-ease: cubic-bezier(.5, .08, .25, 1);   /* the hand: quick attack, long settle */
  --rf-brush-ul-thickness: .15em;                   /* underline thickness */
  --rf-brush-ul-gap: 0em;                           /* underline top, below the text box */
  --rf-brush-lift: 240ms;                           /* hover underline lift-off */
  --rf-brush-dash-indent: 40px;                     /* dash bullets hang in this indent */
}

/* optional ground helpers: a section that sets its own background, text and mark colours */
[data-rf-ground] { isolation: isolate; }
[data-rf-ground="charcoal"] { background: var(--rf-charcoal); color: var(--rf-white); --rf-mark: var(--rf-dune); }
[data-rf-ground="paper"] { background: var(--rf-paper); color: var(--rf-ink); --rf-mark: var(--rf-fern); }
[data-rf-ground="bone"] { background: var(--rf-bone); color: var(--rf-ink); --rf-mark: var(--rf-fern); }

/* ---- hosts ---- */
[data-brush] { position: relative; }
[data-brush="highlight"] { -webkit-box-decoration-break: slice; box-decoration-break: slice; }

/* the art layer: behind the text of the whole ground, never catches the pointer */
.rfb-art {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  overflow: visible; pointer-events: none; z-index: -1;
  color: var(--rf-mark, currentColor);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rfb-svg { position: absolute; display: block; overflow: visible; }

/* dash bullets: a short brush dash hanging in the list indent, the text set past it */
[data-brush-list="dash"] { list-style: none; padding-left: var(--rf-brush-dash-indent); }
[data-brush="dash"] { list-style: none; }
[data-brush="dash"]::marker { content: none; }

/* highlight text: switches to Ink or White (whichever contrasts more with the stroke) once drawn */
.rfb-hl.rfb-drawn > .rfb-text,
.rfb-hl.rfb-drawn > .rfb-text * { color: var(--rfb-on); -webkit-text-fill-color: var(--rfb-on); }
/* while the stroke is drawing on a ground where the text changes colour, the change follows the brush */
.rfb-hl.rfb-sweep > .rfb-text {
  color: transparent; -webkit-text-fill-color: transparent;
  -webkit-background-clip: text; background-clip: text;
  background-repeat: no-repeat;
  -webkit-box-decoration-break: slice; box-decoration-break: slice;
}
.rfb-hl.rfb-sweep > .rfb-text * { -webkit-text-fill-color: transparent; }

/* ---- hover underline: draws in on hover and keyboard focus, lifts off (erased along the
   direction of travel) on leave. The script sets each path's offsets (--rfb-o0/o1 draw,
   --rfb-l0/l1 lift) to where its paint starts and ends, so the whole transition is visible. ---- */
.rfb-hv-rv { stroke-dashoffset: var(--rfb-o0, 1); transition: stroke-dashoffset 0s linear var(--rf-brush-lift); }
.rfb-hv-lo { stroke-dashoffset: var(--rfb-l1, -1); transition: stroke-dashoffset var(--rf-brush-lift) cubic-bezier(.4, 0, .6, 1); }
.rfb-trigger:hover .rfb-hv-rv,
.rfb-trigger:focus-visible .rfb-hv-rv,
.rfb-trigger.rfb-hot .rfb-hv-rv {
  stroke-dashoffset: var(--rfb-o1, 0);
  transition: stroke-dashoffset var(--rfb-dur, 380ms) var(--rf-brush-ease) var(--rfb-delay, 0ms);
}
.rfb-trigger:hover .rfb-hv-lo,
.rfb-trigger:focus-visible .rfb-hv-lo,
.rfb-trigger.rfb-hot .rfb-hv-lo { stroke-dashoffset: var(--rfb-l0, 0); transition: none; }
/* the current page / active state: always drawn */
.rfb-hover.rfb-active .rfb-hv-rv { stroke-dashoffset: var(--rfb-o1, 0) !important; transition: none !important; }
.rfb-hover.rfb-active .rfb-hv-lo { stroke-dashoffset: var(--rfb-l0, 0) !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .rfb-hv-rv, .rfb-hv-lo,
  .rfb-trigger:hover .rfb-hv-rv, .rfb-trigger:focus-visible .rfb-hv-rv, .rfb-trigger.rfb-hot .rfb-hv-rv,
  .rfb-trigger:hover .rfb-hv-lo, .rfb-trigger:focus-visible .rfb-hv-lo, .rfb-trigger.rfb-hot .rfb-hv-lo { transition: none !important; }
}

/* ---- print: every highlight and underline finished; hover-only underlines hidden ---- */
@media print {
  /* Chromium's paginator drops or misplaces absolutely positioned boxes near a page break, so
     in print the art is an in-flow anchor (a zero-size inline-block at the start of the marked
     text) holding relatively positioned strokes that travel with their line. The script
     re-measures for the paper as printing starts. */
  .rfb-art { position: relative; display: inline-block; vertical-align: baseline; }
  .rfb-svg { position: relative; display: block; }
  .rfb-cb { padding-top: .15em; }
  /* strokes still carrying screen geometry stay out of the print layout (a stroke wider than the
     paper would make the browser shrink the whole print) until the script has re-measured them */
  html:not(.rfb-printready) .rfb-art { display: none; }
  /* dash bullets hang in the list indent: kept absolutely positioned (re-measured for the paper) */
  .rfb-dash > .rfb-art { position: absolute; display: block; }
  .rfb-dash .rfb-svg { position: absolute; }
  /* data-brush-print="screen": fixed-size layouts keep their screen geometry as drawn */
  .rfb-ps.rfb { position: relative !important; }
  html .rfb-ps > .rfb-art { position: absolute !important; display: block !important; }
  .rfb-ps .rfb-svg { position: absolute !important; margin: 0 !important; }
  .rfb-rv { stroke-dashoffset: 0 !important; }
  .rfb-hl > .rfb-text, .rfb-hl > .rfb-text * { background: none !important; }
  html.rfb-printready .rfb-hl > .rfb-text, html.rfb-printready .rfb-hl > .rfb-text * {
    color: var(--rfb-on) !important; -webkit-text-fill-color: var(--rfb-on) !important;
  }
  html:not(.rfb-printready) .rfb-hl > .rfb-text, html:not(.rfb-printready) .rfb-hl > .rfb-text * {
    color: inherit !important; -webkit-text-fill-color: currentColor !important;
  }
  .rfb-hover:not(.rfb-active) .rfb-art { display: none; }
}
