/*
 * Hand-made marks: the handwritten note, the brush strokes under the words
 * of a title, the torn paint edge of a photo, the paint patches behind a
 * price. Loaded where one is printed: Azul\Blocks\marked() and handnote()
 * enqueue it, as do the blocks and templates that write the classes
 * themselves. In the cascade right after base.css.
 */

/* Handwritten note: a short line in the hand face, with an optional curved
   arrow drawn in SVG. Colour follows the context (brown on cream, white on
   a photo). Four per page at most, or it turns to noise. */
.handnote { display: inline-flex; align-items: flex-end; gap: 6px; color: var(--azul-brown); font-family: var(--azul-font-hand); font-size: 1.35rem; font-weight: 500; line-height: 1.1; transform: rotate(-4deg); }
.handnote--white { color: #fff; }
.handnote--coral { color: var(--azul-coral); }
.handnote__arrow { flex: none; width: 44px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.handnote--left { flex-direction: row-reverse; transform: rotate(3deg); }
.handnote--left .handnote__arrow { transform: scaleX(-1); }

/* Hand-drawn marks under (or around) words of a title: *word* in a block
   title becomes one .ink-mark per word (see Azul\Blocks\marked()). Each
   mark is a brush stroke used as a mask (scripts/ink-marks.py), filled with
   --mark-color. Brush strokes take one of three hands so words differ. */
.ink-mark { position: relative; display: inline-block; isolation: isolate; }
.ink-mark::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -.06em;
  bottom: -.21em;
  left: -.03em;
  height: .2em;
  background: var(--mark-color, #d4572c);
  -webkit-mask: url("../img/marks/brush-1.svg") center / 100% 100% no-repeat;
  mask: url("../img/marks/brush-1.svg") center / 100% 100% no-repeat;
}
.ink-mark:not([class*="--"]) + .ink-mark::after { -webkit-mask-image: url("../img/marks/brush-2.svg"); mask-image: url("../img/marks/brush-2.svg"); }
.ink-mark:not([class*="--"]) + .ink-mark + .ink-mark::after { -webkit-mask-image: url("../img/marks/brush-3.svg"); mask-image: url("../img/marks/brush-3.svg"); }
/* Script-brush: the passage in the hand font, the arched brush stroke
   under it. */
.ink-mark--script-brush { font-family: var(--azul-font-hand); font-size: 1.2em; font-weight: 700; line-height: .9; letter-spacing: 0; white-space: nowrap; }
/* Arched passage (see arched() in the blocks module): each letter keeps its
   own box so it can rise and tilt. */
.ink-arch__l { display: inline-block; white-space: pre; }
/* The whole passage, underline included, rises slightly to the right. */
.ink-arch { margin-top: .16em; transform: rotate(-2deg); transform-origin: left 70%; }
.ink-mark--script-brush::after { right: 10%; bottom: -.36em; left: 10%; height: .34em; -webkit-mask-image: url("../img/marks/arch.webp"); mask-image: url("../img/marks/arch.webp"); }
/* Stroke: one brush stroke under the whole passage, in the title face. */
.ink-mark--stroke { white-space: nowrap; }
.ink-mark--stroke::after { right: -.04em; bottom: -.2em; left: 0; height: .17em; }
/* Arch: one long arched brush stroke under the whole passage, overshooting
   it a little on both sides. */
.ink-mark--arch { white-space: nowrap; }
.ink-mark--arch::after { right: -.35em; bottom: -.5em; left: -.3em; height: .5em; -webkit-mask-image: url("../img/marks/arch.webp"); mask-image: url("../img/marks/arch.webp"); }
/* Arch-soft: the same stroke, flatter, for short passages. */
.ink-mark--arch-soft { white-space: nowrap; }
.ink-mark--arch-soft::after { right: -.2em; bottom: -.3em; left: -.15em; height: .3em; -webkit-mask-image: url("../img/marks/arch-soft.webp"); mask-image: url("../img/marks/arch-soft.webp"); }

/* Painted photo: ragged, streaked paint edges on the left, top and bottom,
   straight on the right where it bleeds off (.torn-edge on the img).
   Nine-slice mask from Maxime's own texture at full resolution
   (scripts/paint-mask/texture-mask.mjs): the corners are only ever scaled
   down, the edges only stretched along their length. */
.torn-edge {
  -webkit-mask-box-image: url("../img/paint-edge.webp") 160 1 90 270 fill / 46px 0 30px 90px stretch;
  mask-border: url("../img/paint-edge.webp") 160 1 90 270 fill / 46px 0 30px 90px stretch;
}

/* Paint patches behind a short text. .paint-splash: a white brush patch
   (assets/img/paint-splash.webp, from Maxime's own texture) over a navy one
   showing at its edges. .paint-stroke: one long horizontal brush stroke from Maxime's own
   texture: the paint (paint-stroke.webp) and, over it, its streaks
   (paint-stroke-shade.webp) in a darker tone. */
.paint-splash,
.paint-stroke { position: relative; isolation: isolate; }
.paint-splash::before,
.paint-splash::after,
.paint-stroke::before,
.paint-stroke::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -4% -3%;
  -webkit-mask: url("../img/paint-splash.webp") center / 100% 100% no-repeat;
  mask: url("../img/paint-splash.webp") center / 100% 100% no-repeat;
}
.paint-splash::before { background: var(--azul-navy); opacity: .8; transform: translate(-1.5%, 3%) rotate(-1.5deg) scale(1.03, 1.06); }
.paint-splash::after { background: var(--splash-color, #fbfaf7); }
.paint-stroke::before,
.paint-stroke::after { inset: -12% -7% -12% -6%; -webkit-mask-image: url("../img/paint-stroke.webp"); mask-image: url("../img/paint-stroke.webp"); }
.paint-stroke::before { background: var(--splash-color, #fff); }
.paint-stroke::after { background: var(--splash-shade, #8d969e); opacity: .45; -webkit-mask-image: url("../img/paint-stroke-shade.webp"); mask-image: url("../img/paint-stroke-shade.webp"); }

/* Phone: a marked passage longer than the line wraps inside its mark
   instead of pushing the page wider than the screen. */
@media (max-width: 719px) {
  .ink-mark { max-width: 100%; }
  .ink-mark:is(.ink-mark--script-brush, .ink-mark--stroke, .ink-mark--arch, .ink-mark--arch-soft) { white-space: normal; }
}
