/* Runway kit (redesign fase 5): shared pieces for every screen, built by js/components/kit.js; usage in fase5/KIT.md.
 * The blocks reuse the look of css/runway.css (rw-panel, rw-card, rw-coming, rw-pills); this file adds what the kit
 * needs on top, in every style. Motion tokens and curves from transitions.dev (library.html, free items): only
 * transform and opacity (the accordion also animates grid rows, as transitions.dev's own accordion does), ease-out,
 * and prefers-reduced-motion switches all of it off at the end of the file. */

:root {
  --rk-micro: 80ms;
  --rk-quick: 150ms;
  --rk-fast: 250ms;
  --rk-medium: 350ms;
  --rk-slow: 400ms;
  --rk-very-slow: 500ms;
  --rk-stagger: 40ms;
  --rk-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rk-ease-drum: cubic-bezier(0.35, -0.02, 0.43, 1);
}

/* ---------- number pop-in (drum) ---------- */

/* inline (not flex) and clip (not hidden): the glyphs keep the text baseline and innerText stays "1.234,56" */
.rk-num { line-height: 1; }
.rk-num.is-rolling > span { display: inline-block; }
/* the digit itself stays in the DOM (text, screen readers) but is painted by the reel above it */
.rk-drum { position: relative; overflow: clip; -webkit-text-fill-color: transparent; }
.rk-drum::after {
  content: "0\A 1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9";
  position: absolute; top: 0; left: 0; width: 100%;
  line-height: 1; text-align: center; white-space: pre;
  -webkit-text-fill-color: currentColor;
  transform: translateY(calc(var(--d, 0) * -1em));
  animation: rk-roll 740ms var(--rk-ease-drum) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.rk-pop { animation: rk-pop 600ms var(--rk-ease) backwards; animation-delay: calc(50ms + var(--i, 0) * var(--rk-stagger)); }
@keyframes rk-roll { from { transform: translateY(0); } }
@keyframes rk-pop {
  0% { opacity: 0; transform: translateY(0.52em) scale(0.7); }
  55% { opacity: 1; transform: translateY(-0.06em) scale(1.03); }
}

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

.rk-hero .rw-giant { flex-wrap: wrap; }
.rk-hero .rw-giant.is-neg { color: var(--neg); }
.rk-hero .hero-ctas { margin-top: 16px; }
.rk-hero .hero-ctas > * { min-height: 44px; }
.rk-hero .rk-hero-note { margin: 12px 0 0; color: var(--ink-48); font-size: 12.5px; }

/* ---------- cards strip: any number of cards ---------- */

.rk-strip .rw-card { position: relative; }
.rk-strip .rw-detail { white-space: normal; }
.rk-strip .rk-card-action { justify-self: start; min-height: 44px; margin: 4px 0 -8px; padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
@media (min-width: 900px) {
  .rw-strip.rk-strip { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* ---------- Coming up list ---------- */

.rk-list { min-width: 0; border-radius: var(--r-card); }
.rk-list header { gap: 12px; }
.rk-list header .menu-left { right: 0; left: auto; } /* a menu opened from the header's right side stays on screen */
.rk-list .rk-header-value { font-size: 17px; font-weight: 650; }
.rk-group + .rk-group { margin-top: 4px; }
.rk-group-label { margin: 10px 0 0; color: var(--ink-48); font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em; }
.rk-row { min-height: 60px; padding: 10px 0; }
.rk-row.has-trail { grid-template-columns: 40px minmax(0, 1fr) auto auto; }
.rk-row-main { min-width: 0; }
.rk-row-main .rw-item-title { white-space: normal; overflow-wrap: anywhere; }
.rk-row-main > * + * { margin-top: 2px; }
/* .has-more on a listRow: its `extra` (a wide block) takes the full row under the title, the value spans both lines */
.rk-row.has-more { row-gap: 0; }
.rk-row.has-more > .rk-row-main { display: contents; }
.rk-row.has-more > .rk-av { grid-row: 1 / span 2; }
.rk-row.has-more .rw-item-title,
.rk-row.has-more .rw-item-sub { grid-column: 2; }
.rk-row.has-more > .rw-item-value { grid-column: 3; grid-row: 1 / span 2; }
.rk-row .rw-item-value.is-neg { color: var(--neg); }
.rk-row .rw-item-value.is-pos { color: var(--pos); }
.rk-empty { padding: 8px 0 12px; }
.rk-av { flex: none; }
.rk-av svg, .rk-av .icon { width: 20px; height: 20px; }
.rk-av-blue { background: var(--blue); }
.rk-av-green { background: var(--green); }
.rk-av-red { background: var(--red); }
.rk-av-amber { background: var(--yellow); }
.rk-av-ink { background: #33415c; }
.rk-av-soft { background: var(--bg); color: var(--ink); }
/* the dark theme lightens these tones: dark initials keep the contrast */
:root[data-theme="dark"] :is(.rk-av-blue, .rk-av-amber, .rk-av-green) { color: #0b1220; }

/* ---------- sliding segmented pill outside the hero ---------- */

.rw-pills.rk-seg { width: fit-content; max-width: 100%; margin: 0; padding: 4px; border-radius: 26px; background: var(--bg); }
.rk-seg .rw-ind { top: 4px; background: var(--canvas); }

/* ---------- accordion: chevron morph + grid-rows height ---------- */

.rk-acc-btn { min-height: 52px; }
.rk-chev { display: inline-grid; place-items: center; width: 20px; height: 20px; transition: transform var(--rk-fast) var(--rk-ease); }
.rk-chev svg { width: 16px; height: 16px; }
.rk-acc-btn[aria-expanded="true"] .rk-chev { transform: rotate(90deg); }
.rk-acc-panel { display: grid; grid-template-rows: 1fr; padding: 0; transition: grid-template-rows var(--rk-medium) var(--rk-ease), opacity var(--rk-fast) var(--rk-ease); }
.rk-acc-panel.is-opening { grid-template-rows: 0fr; opacity: 0; }
.rk-acc-inner { min-height: 0; overflow: hidden; }
.rk-acc .acc-list { margin: 0; padding: 0 0 8px; list-style: none; }
.rk-acc .acc-list > li { padding: 10px 0; font-size: inherit; }

/* ---------- skeleton -> reveal ---------- */

.rk-skeleton { display: grid; gap: 10px; padding: 4px 0; }
.rk-bone { display: block; height: 52px; border-radius: 16px; background: var(--runway-skeleton, rgba(14, 23, 38, 0.07)); animation: rk-pulse 1000ms ease-in-out infinite; }
.rk-bone:first-of-type { width: 60%; height: 20px; border-radius: 10px; }
.rk-reveal { animation: rk-reveal var(--rk-slow) ease-in-out backwards; }
@keyframes rk-pulse { 50% { opacity: 0.5; } }
@keyframes rk-reveal { from { opacity: 0; } }

/* ---------- feedback: error shake, success check, toast ---------- */

/* a new error message shakes once by itself; kit shake() replays it on a node already on screen */
.sheet .form-error,
.action-error,
.rk-shake { animation: rk-shake 280ms linear; }
@keyframes rk-shake {
  28.57% { transform: translateX(6px); }
  57.14% { transform: translateX(-6px); }
  78.57% { transform: translateX(4px); }
}

/* Success check: the disc rises turning in, then the tick draws (sheet.js fillSaved) */
.check-pop { background: var(--green); animation: rk-ok-in var(--rk-very-slow) var(--rk-ease) both; }
.check-pop .check-draw { animation-delay: 80ms; }
@keyframes rk-ok-in { from { opacity: 0; transform: translateY(40px) rotate(80deg) scale(0.6); } }

/* Toast open/close: opens in 350 ms, closes in 250 ms */
.toast { transform: translateY(-12px) scale(0.97); transition: opacity var(--rk-fast) var(--rk-ease), transform var(--rk-fast) var(--rk-ease); }
.toast.is-in { transform: none; transition-duration: var(--rk-medium); }

/* ---------- modal scale-in from the button that opened it (kit scaleFrom) ---------- */

.sheet.rk-from { transform: translate(-50%, -50%) scale(0.92); transition: transform var(--rk-fast) var(--rk-ease), opacity var(--rk-fast) var(--rk-ease); }
.sheet.rk-from.is-open { transform: translate(-50%, -50%); transition-duration: var(--rk-medium); }
.action-sheet.rk-from:not(.is-popover) { transform: translate(-50%, -50%) scale(0.92); transition: transform var(--rk-fast) var(--rk-ease), opacity var(--rk-fast) var(--rk-ease); }
.overlay.is-open .action-sheet.rk-from:not(.is-popover) { transform: translate(-50%, -50%); transition-duration: var(--rk-medium); }
@media (max-width: 833px) {
  .sheet.rk-from,
  .action-sheet.rk-from:not(.is-popover) { transform: translateY(24px) scale(0.94); }
  .sheet.rk-from.is-open,
  .overlay.is-open .action-sheet.rk-from:not(.is-popover) { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rk-drum::after, .rk-pop, .rk-bone, .rk-reveal, .rk-shake, .sheet .form-error, .action-error, .check-pop { animation: none; }
  .rk-chev, .rk-acc-panel, .toast, .sheet.rk-from, .action-sheet.rk-from { transition: none; }
}
