/* Demo "rita": marking tools, the hand-drawn loop and pen, mark chip, attached photo, "Lägg till" menu, zoom and sketch card (pdf-annotations.css, PdfPreview.tsx). */

/* The window: a wider preview (--rp-split 37.5 in the markup), scrolled to task 4 and zoomed with the preview's + */
/* The zoom is the app's (PdfPreview.tsx): each press of + goes to the next step above the pane's fit percent; the timeline sets data-zoom="1".."3" (the press) and
   the pane's width decides the percent (table below). The pages move with a transform: the lift (--rita-top), the pan (--rita-x, --rita-scroll) and the drop (--rita-down) keep task 4 and the figure in view. */
.rita-window { --rita-fit: calc(100cqw - 56px); --rita-w: var(--rita-fit); --rita-top: 105px; --rita-pad: 28px; --rita-pt: 28px; --rita-bar: 64px; --rita-gap: 4px; }
@container rp (max-width: 760px) { .rita-window { --rita-top: 88px; --rita-pad: 12px; --rita-pt: 16px; --rita-bar: 88px; } }
.rita-window .rp-pdf { container-type: size; }
.rita-window .rp-pages {
  padding-inline: var(--rita-pad); padding-top: var(--rita-pt);   /* the kit's own numbers (28 px; 16 px in the narrow layout), written here because --rita-fig counts on them */
  --rita-lift: calc(0.82 * var(--rita-w) - var(--rita-top));
  --rita-x: max(0px, calc((var(--rita-w) - 100cqw) / 2 + var(--rita-pad)));
  --rita-scroll: clamp(0px, max(calc(var(--rita-pad) + 0.405 * var(--rita-w) - 50cqw), calc(var(--rita-pad) + 0.67 * var(--rita-w) + 8px - 100cqw)), calc(var(--rita-w) + 2 * var(--rita-pad) - 100cqw));
  --rita-fig: calc(var(--rita-pt) + var(--rita-top) + 0.297 * var(--rita-w));
  --rita-down: max(0px, calc(var(--rita-fig) + var(--rita-gap) + var(--rita-bar) - 100cqh));
}
.rita-window .rp-preview[data-zoom="1"] .rp-pages { --rita-w: calc(var(--rita-z1) * 793.7px); }
.rita-window .rp-preview[data-zoom="2"] .rp-pages { --rita-w: calc(var(--rita-z2) * 793.7px); }
.rita-window .rp-preview[data-zoom="3"] .rp-pages { --rita-w: calc(var(--rita-z3) * 793.7px); }
.rita-window .rp-page { width: var(--rita-w); }
.rita-window .rp-pages { transition: transform 0.7s cubic-bezier(0.4, 0.1, 0.2, 1); }
.rita-window .rp-page { transition: width 0.7s cubic-bezier(0.4, 0.1, 0.2, 1); }
.rita-window .rp-pdf.rita-lifted .rp-pages { transform: translate(var(--rita-x), calc(-1 * var(--rita-lift))); }
.rita-window .rp-pdf.rita-lifted.rita-panned .rp-pages { transform: translate(calc(var(--rita-x) - var(--rita-scroll)), calc(-1 * var(--rita-lift) - var(--rita-down))); }
@media (prefers-reduced-motion: reduce) { .rita-window .rp-pages, .rita-window .rp-page { transition: none; } }
.rita-window .rita-zv { display: none; }
.rita-window .rp-preview:not([data-zoom]) .rita-zv[data-z="fit"] { display: inline; }
/* rita:zoom start */
/* pane up to 440 px (fit up to 48 %): + gives 50, 67, 80 % */
@container rp-pdf (max-width: 440.49px) { .rita-window .rp-pages { --rita-z1: 0.5; --rita-z2: 0.67; --rita-z3: 0.8; } }
@container rp-pv (max-width: 412.49px) { .rita-window .rp-preview[data-zoom="1"] .rita-zv[data-z="50"], .rita-window .rp-preview[data-zoom="2"] .rita-zv[data-z="67"], .rita-window .rp-preview[data-zoom="3"] .rita-zv[data-z="80"] { display: inline; } }
/* pane 441 to 575 px (fit 49-65 %): + gives 67, 80, 100 % */
@container rp-pdf (min-width: 440.5px) and (max-width: 575.49px) { .rita-window .rp-pages { --rita-z1: 0.67; --rita-z2: 0.8; --rita-z3: 1; } }
@container rp-pv (min-width: 412.5px) and (max-width: 547.49px) { .rita-window .rp-preview[data-zoom="1"] .rita-zv[data-z="67"], .rita-window .rp-preview[data-zoom="2"] .rita-zv[data-z="80"], .rita-window .rp-preview[data-zoom="3"] .rita-zv[data-z="100"] { display: inline; } }
/* pane 576 to 679 px (fit 66-78 %): + gives 80, 100, 125 % */
@container rp-pdf (min-width: 575.5px) and (max-width: 679.49px) { .rita-window .rp-pages { --rita-z1: 0.8; --rita-z2: 1; --rita-z3: 1.25; } }
@container rp-pv (min-width: 547.5px) and (max-width: 651.49px) { .rita-window .rp-preview[data-zoom="1"] .rita-zv[data-z="80"], .rita-window .rp-preview[data-zoom="2"] .rita-zv[data-z="100"], .rita-window .rp-preview[data-zoom="3"] .rita-zv[data-z="125"] { display: inline; } }
/* pane 680 px and wider (fit 79 % and more): + gives 100, 125, 150 % */
@container rp-pdf (min-width: 679.5px) { .rita-window .rp-pages { --rita-z1: 1; --rita-z2: 1.25; --rita-z3: 1.5; } }
@container rp-pv (min-width: 651.5px) { .rita-window .rp-preview[data-zoom="1"] .rita-zv[data-z="100"], .rita-window .rp-preview[data-zoom="2"] .rita-zv[data-z="125"], .rita-window .rp-preview[data-zoom="3"] .rita-zv[data-z="150"] { display: inline; } }
/* rita:zoom end */
/* The loop and its pen */
/* The svg is the page's pixel grid (1240 x 1754), so the line keeps its shape at any size; 3px on screen, as in the app */
.rita-ink { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.rita-ink path { fill: none; stroke: #b42318; stroke-width: 6.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; stroke-dashoffset: 1.002; }
@container rp (max-width: 760px) { .rita-ink path { stroke-width: 11; } }
@container rp (min-width: 520px) and (max-width: 760px) { .rita-ink path { stroke-width: 7; } }
.rita-ink.is-drawn path { animation: rita-draw 1.5s linear both; }
/* The pen is a crosshair, as over the drawing surface in the app; always at the end of the drawn line */
.rita-pen { position: absolute; z-index: 2; width: 17px; height: 17px; margin: -8.5px 0 0 -8.5px; pointer-events: none; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.rita-pen::before, .rita-pen::after { content: ''; position: absolute; background: #0a2230; }
.rita-pen::before { left: 50%; top: 0; width: 1.5px; height: 100%; margin-left: -0.75px; }
.rita-pen::after { top: 50%; left: 0; height: 1.5px; width: 100%; margin-top: -0.75px; }
.rita-pen.is-drawn { animation: rita-pen 1.5s linear both; }
.rita-start { position: absolute; width: 1px; height: 1px; visibility: hidden; }
/* rita:generated start */
@keyframes rita-draw { 0% { stroke-dashoffset: 1.0000; } 4.17% { stroke-dashoffset: 0.9730; } 8.33% { stroke-dashoffset: 0.9421; } 12.5% { stroke-dashoffset: 0.9078; } 16.67% { stroke-dashoffset: 0.8704; } 20.83% { stroke-dashoffset: 0.8302; } 25% { stroke-dashoffset: 0.7875; } 29.17% { stroke-dashoffset: 0.7428; } 33.33% { stroke-dashoffset: 0.6963; } 37.5% { stroke-dashoffset: 0.6484; } 41.67% { stroke-dashoffset: 0.5995; } 45.83% { stroke-dashoffset: 0.5499; } 50% { stroke-dashoffset: 0.5000; } 54.17% { stroke-dashoffset: 0.4501; } 58.33% { stroke-dashoffset: 0.4005; } 62.5% { stroke-dashoffset: 0.3516; } 66.67% { stroke-dashoffset: 0.3037; } 70.83% { stroke-dashoffset: 0.2572; } 75% { stroke-dashoffset: 0.2125; } 79.17% { stroke-dashoffset: 0.1698; } 83.33% { stroke-dashoffset: 0.1296; } 87.5% { stroke-dashoffset: 0.0922; } 91.67% { stroke-dashoffset: 0.0579; } 95.83% { stroke-dashoffset: 0.0270; } 100% { stroke-dashoffset: 0.0000; } }
@keyframes rita-pen { 0% { left: 35.99%; top: 67.54%; } 4.17% { left: 38.86%; top: 66.30%; } 8.33% { left: 42.50%; top: 65.39%; } 12.5% { left: 46.68%; top: 64.70%; } 16.67% { left: 51.31%; top: 64.20%; } 20.83% { left: 56.33%; top: 63.89%; } 25% { left: 61.66%; top: 63.75%; } 29.17% { left: 67.26%; top: 63.82%; } 33.33% { left: 73.06%; top: 64.11%; } 37.5% { left: 78.99%; top: 64.70%; } 41.67% { left: 84.92%; top: 65.75%; } 45.83% { left: 89.96%; top: 68.12%; } 50% { left: 86.48%; top: 71.29%; } 54.17% { left: 80.59%; top: 72.75%; } 58.33% { left: 74.51%; top: 73.63%; } 62.5% { left: 68.43%; top: 74.15%; } 66.67% { left: 62.45%; top: 74.39%; } 70.83% { left: 56.64%; top: 74.38%; } 75% { left: 51.05%; top: 74.12%; } 79.17% { left: 45.76%; top: 73.60%; } 83.33% { left: 40.87%; top: 72.77%; } 87.5% { left: 36.56%; top: 71.49%; } 91.67% { left: 33.91%; top: 69.24%; } 95.83% { left: 35.92%; top: 67.06%; } 100% { left: 38.92%; top: 65.97%; } }
.rita-start { left: 35.99%; top: 67.54%; }
/* rita:generated end */

/* The marking tools over the top of the preview (Markera) */
.rita-tools {
  position: absolute; top: 12px; left: 50%; translate: -50% 0; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: max-content; max-width: calc(100% - 24px); pointer-events: none; animation: rita-tools-in 150ms var(--rp-ease) both;
}
@keyframes rita-tools-in { from { opacity: 0; transform: translateY(-6px); } }
.rita-bar {
  display: flex; align-items: center; gap: 2px; max-width: 100%; padding: 4px; border: 1px solid var(--rp-glass-edge); border-radius: var(--rp-pill-radius);
  background: var(--rp-glass-solid); box-shadow: var(--rp-float-shadow);
}
.rita-modes { display: flex; gap: 2px; padding: 2px; border-radius: var(--rp-pill-radius); background: var(--rp-fill); }
.rita-tool { display: grid; place-items: center; flex: none; width: 34px; height: 32px; border-radius: var(--rp-pill-radius); color: var(--rp-text-2); }
.rita-modes .rita-tool { width: 32px; height: 30px; }
.rita-tool.is-pressed { background: var(--rp-surface-raised); color: var(--rp-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14), 0 0 0 0.5px var(--rp-line); }
.rita-tool.is-disabled { opacity: 0.4; }
.rita-divider { flex: none; width: 1px; height: 18px; margin: 0 4px; background: var(--rp-line-strong); }
.rita-status { display: flex; justify-content: center; max-width: 100%; }
.rita-status p {
  margin: 0; max-width: min(460px, 100%); padding: 5px 12px; border-radius: var(--rp-pill-radius); background: var(--rp-surface-raised); box-shadow: var(--rp-float-shadow);
  color: var(--rp-text-2); font-size: 12.5px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rita-status .rita-summary { display: inline-flex; align-items: center; gap: 5px; }
.rita-summary .rp-i { color: var(--rp-accent); }
.rita-summary span { color: var(--rp-text); font-weight: 600; }

@container rp (max-width: 400px) {
  .rita-status p { padding: 5px 8px; font-size: 12px; }
}

/* The mark that goes with the next message: a chip above the message box */
.rita-context { padding: 0 4px 6px; }
.rita-context.is-away, .rita-attach.is-away { position: absolute; visibility: hidden; pointer-events: none; }
.rita-chip { display: inline-flex; align-items: center; gap: 9px; max-width: min(100%, 420px); min-height: 44px; padding: 4px 4px 4px 5px; border: 1px solid var(--rp-line); border-radius: 12px; background: var(--rp-surface-2); }
.rita-context:not(.is-away) .rita-chip { animation: rita-chip-in var(--rp-dur) var(--rp-ease) both; }
@keyframes rita-chip-in { from { opacity: 0; transform: translateY(6px) scale(0.97); } }
.rita-chip-lead { flex: none; display: grid; place-items: center; width: 46px; height: 34px; overflow: hidden; border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px var(--rp-line); }
.rita-chip-lead img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rita-chip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.rita-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 600; color: var(--rp-text-2); }
.rita-chip-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--rp-text); }
.rita-chip-remove { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--rp-pill-radius); color: var(--rp-text-2); }

/* The photo of the sketch, attached as "Underlag": the card of the kit (.rp-att), in the assistant's one row (src/global-assistant.css) */
.rita-attach { display: flex; gap: 8px; margin: 0; padding: 12px 10px 2px 0; list-style: none; }
.rita-attach .rp-att { max-width: 240px; }
.rita-card { transition: opacity 0.2s ease; }
.rita-card.is-wait { opacity: 0; }

.rita-addwrap { position: absolute; z-index: 2; left: 0; right: 0; bottom: 63px; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.rita-addin { width: min(100%, 640px); padding-left: 7px; }
.rita-addmenu.rp-menu { position: static; z-index: auto; }
.rita-window .rp-add svg { transition: transform var(--rp-dur) var(--rp-ease); }
.rita-window .rp-add[aria-expanded="true"] { background: var(--rp-fill); color: var(--rp-text); }
.rita-window .rp-add[aria-expanded="true"] svg { transform: rotate(45deg); }
@container rp (max-width: 720px) {
  .rita-addwrap { bottom: 51px; padding: 0; }
  .rita-addin { width: 100%; padding-left: 7px; }
}

/* The sketch photo on a card of the landing page, outside the app (not rp-*, so it never reads as a Provamer screen) */
.rita-skiss {
  position: absolute; z-index: 20; width: 190px; margin: 0; padding: 8px 8px 6px; border-radius: 3px; background: #fff; color: var(--ink, #0a2230);
  box-shadow: 0 0 0 0.5px rgba(10, 34, 48, 0.16), 0 2px 6px rgba(10, 34, 48, 0.14), 0 20px 36px -14px rgba(10, 34, 48, 0.5);
  pointer-events: none; transition: opacity 0.45s ease, transform 0.45s var(--rp-ease, ease);
}
.rita-skiss img { display: block; width: 100%; height: auto; background: #e9ecec; }
.rita-skiss span { display: block; padding: 5px 4px 1px; text-align: center; font: 500 20px/1.1 var(--hand, cursive); color: var(--ink-2, #3e5463); }
.rita-skiss-big { width: 322px; left: max(16px, min(max(96px, 10cqw), calc(37.5cqw - 272px))); top: 150px; transform: rotate(-2deg); }
.rita-skiss-big span { font-size: 25px; }
.rita-skiss.is-away { visibility: hidden; opacity: 0; transform: translateY(14px) rotate(-2deg); }
@container rp (max-width: 760px) {
  .rita-skiss-big { width: 232px; left: calc(50% - 116px); top: 194px; }
  .rita-skiss-big span { font-size: 19px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .rita-skiss { transition: none; } }
