/* Animated signature (public/js/signature-core.js renders the SVG; public/js/signature.js replays it). Each stroke is a
   <use class="sig__p"> carrying --l (dash length), --sd (start) and --st (duration). Without .sig--anim it is simply
   drawn. Ink colours are per-viewer-theme custom properties; with none set it inherits the text colour. */
.sig { display: block; height: auto; max-width: 100%; overflow: visible; --sig-c: var(--sig-ink, currentColor); --sig-c2: var(--sig-ink2, currentColor); --sig-r: var(--sig-rose); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sig { --sig-c: var(--sig-ink-d, currentColor); --sig-c2: var(--sig-ink2-d, currentColor); --sig-r: var(--sig-rose-d); }
}
:root[data-theme="dark"] .sig, :root .sig-on-dark .sig { --sig-c: var(--sig-ink-d, currentColor); --sig-c2: var(--sig-ink2-d, currentColor); --sig-r: var(--sig-rose-d); }
:root .sig-on-light .sig { --sig-c: var(--sig-ink, currentColor); --sig-c2: var(--sig-ink2, currentColor); --sig-r: var(--sig-rose); }
.sig--glow { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--sig-c) 55%, transparent)); }

.sig__p--rose { stroke: var(--sig-r); }

/* Only `to` sets the offset: each stroke starts from its own --l. Hidden until its turn, so round caps leave no dots. */
.sig--anim .sig__p { stroke-dasharray: var(--l) var(--l); stroke-dashoffset: var(--l); visibility: hidden; animation: sig-draw var(--st) var(--sig-ease, linear) var(--sd) forwards; }
@keyframes sig-draw { from { visibility: visible; } to { visibility: visible; stroke-dashoffset: 0; } }
/* wait until scrolled into view (signature.js adds .is-go; .js-anim is dropped if scripts never start) */
.js-anim .sig[data-sig-start="visible"]:not(.is-go) .sig__p { animation-play-state: paused; }
/* scrolled away and set to be written again on the way back: blank until then (signature.js) */
.sig--anim.is-waiting .sig__p { animation: none; }
/* once per visit: already drawn on the next pages (the class is set in <head>, so nothing flashes) */
.sig-seen .sig[data-sig-replay="session"] .sig__p { animation: none; stroke-dasharray: none; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .sig .sig__p { animation: none !important; stroke-dasharray: none !important; visibility: visible !important; } }
@media print { .sig .sig__p { animation: none !important; stroke-dasharray: none !important; visibility: visible !important; } }

/* the rose that writes: signature.js shows it only while the pen is moving; its ink turns red for "Rose" */
.sig__rose { visibility: hidden; pointer-events: none; }
.sig__rose.is-writing { visibility: visible; }
.sig__rose-ink { transition: fill .15s; }
.sig__rose.is-red .sig__rose-ink { fill: var(--sig-r); }
@media (prefers-reduced-motion: reduce) { .sig__rose { display: none; } }
@media print { .sig__rose { display: none; } }

/* header */
.nav__brand--sig { display: inline-flex; align-items: center; flex: none; }
.sig--header { height: calc(var(--nav-h) - 20px); width: auto; max-width: min(240px, 52vw); transition: height .3s var(--ease-out, ease); }
/* leave room for the header buttons: on phones four round ones (QR code, palette, light/dark, menu) */
@media (max-width: 860px) { .sig--header { max-width: min(240px, calc(100vw - 2 * var(--gutter) - 190px)); } }
@media (max-width: 600px) { .sig--header { max-width: min(240px, calc(100vw - 2 * var(--gutter) - 208px)); } }
@media (max-width: 360px) { .sig--header { max-width: calc(100vw - 2 * var(--gutter) - 196px); } }
.nav__brand--sig:focus-visible { outline-offset: 4px; }

/* home hero: fills the dark panel; --sig-w is the size setting */
.hero__sig { margin: 0 auto .5em; line-height: 0; }
.hero__sig .sig-on-dark { display: block; }
.hero__sig .sig { width: calc(var(--sig-w, 100) * 1%); max-height: 34vh; margin-inline: auto; }

/* share pages */
.sh-sign { margin: 10px 0 0; }
.sh-sign .sig { width: min(100%, 320px); max-height: 150px; }
