/* RK Motion Library v1.0, copiado sem alteração de henriqueneves142-oss/rk-motion-library por
   testes/ferramentas/montar-motion.py. Não editar à mão: rode o script de novo. */

/* ===== TX-004 · text/character-stagger ===== */
/* ==========================================================================
   TX-004 · Character Stagger — RK Motion Library v1.0
   Requires script.js. Each character animates individually, so this is only
   ever appropriate for short display text.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --char-duration: 700ms;
  --char-stagger: 24ms;
  --char-delay: 0ms;
  --char-distance: 16px;
  --char-rotate: 6deg;
  --char-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Words stay atomic so the line never breaks in the middle of one. */
[data-motion="char-stagger"] .rk-char-word {
  display: inline-block;
  white-space: nowrap;
}

[data-motion="char-stagger"] .rk-char {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, var(--char-distance), 0) rotate(var(--char-rotate));
  transform-origin: 50% 100%;
  transition:
    opacity var(--char-duration) var(--char-ease),
    transform var(--char-duration) var(--char-ease);
  transition-delay: calc(var(--char-delay) + var(--rk-char-index, 0) * var(--char-stagger));
  will-change: opacity, transform;
}

[data-motion="char-stagger"].is-revealed .rk-char {
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="char-stagger"] .rk-char {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===== TX-001 · text/line-reveal ===== */
/* ==========================================================================
   TX-001 · Line Reveal — RK Motion Library v1.0
   Requires script.js, which splits the text into real line boxes and rebuilds
   them on resize. The mask is a wrapper per line; only the inner span moves.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --line-duration: 900ms;
  --line-stagger: 110ms;
  --line-delay: 0ms;
  --line-distance: 105%;
  --line-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* The mask. Padding plus a matching negative margin keeps descenders (g, y, p)
   from being clipped without changing the layout. */
[data-motion="line-reveal"] .rk-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}

[data-motion="line-reveal"] .rk-line__inner {
  display: block;
  transform: translate3d(0, var(--line-distance), 0);
  transition: transform var(--line-duration) var(--line-ease);
  transition-delay: calc(var(--line-delay) + var(--rk-line-index, 0) * var(--line-stagger));
  will-change: transform;
}

[data-motion="line-reveal"].is-revealed .rk-line__inner {
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="line-reveal"] .rk-line__inner {
    transform: none;
    transition: none;
  }
}

/* ===== TX-002 · text/word-reveal ===== */
/* ==========================================================================
   TX-002 · Word Reveal — RK Motion Library v1.0
   Requires script.js, which wraps each word and assigns it an index.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --word-duration: 640ms;
  --word-stagger: 45ms;
  --word-delay: 0ms;
  --word-distance: 16px;
  --word-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-motion="word-reveal"] .rk-word {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, var(--word-distance), 0);
  transition:
    opacity var(--word-duration) var(--word-ease),
    transform var(--word-duration) var(--word-ease);
  transition-delay: calc(var(--word-delay) + var(--rk-word-index, 0) * var(--word-stagger));
  will-change: opacity, transform;
}

[data-motion="word-reveal"].is-revealed .rk-word {
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="word-reveal"] .rk-word {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===== PG-001 · page-transitions/page-fade-transition ===== */
/* ==========================================================================
   PG-001 · Page Fade Transition — RK Motion Library v1.0
   Requires script.js, which creates the overlay and intercepts same-origin
   link clicks. The overlay is inert and invisible until it is needed.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --page-duration: 420ms;
  --page-ease: cubic-bezier(0.65, 0, 0.35, 1);
  --page-color: #0c0e11;
  --page-enter-duration: 520ms;
  /* If the navigation has not committed by then, the page is restored. */
  --page-timeout: 2400ms;
}

.rk-page-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  background: var(--page-color);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--page-enter-duration) var(--page-ease),
    visibility 0s linear var(--page-enter-duration);
}

/* Entering the page: the overlay starts opaque and fades away. */
html.rk-page-entering .rk-page-overlay {
  opacity: 1;
  visibility: visible;
  transition: none;
}

/* Leaving the page: the overlay fades in, faster than it faded out. */
html.rk-page-leaving .rk-page-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;   /* swallows clicks during the transition */
  transition:
    opacity var(--page-duration) var(--page-ease),
    visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
  .rk-page-overlay { display: none; }
}

/* ===== SC-006 · scroll/scroll-marquee ===== */
/* ==========================================================================
   SC-006 · Scroll Marquee — RK Motion Library v1.0
   Requires script.js. The script writes ONE number on the section:
   --marquee-progress, 0 as the section enters from below and 1 as it leaves
   through the top. Each row turns that into its own drift.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --marquee-shift: 14%;    /* how far a row travels across the whole crossing */
  --marquee-size: 17vw;    /* type size, clamped below */
  --marquee-fade: 0.3;     /* contrast lost per row of depth */
  --marquee-leading: 0.9;  /* line-height: the rows are meant to nearly touch */
}

[data-motion="scroll-marquee"] {
  overflow: hidden;
  user-select: none;
}

[data-motion="scroll-marquee"] .marquee__row {
  display: flex;
  gap: 0.35em;
  width: max-content;
  white-space: nowrap;
  font-size: clamp(40px, var(--marquee-size), 120px);
  line-height: var(--marquee-leading);
  letter-spacing: -0.04em;
  /* progress 0 → +shift, progress 1 → -shift, mirrored per row by --row-dir */
  transform: translate3d(
    calc(var(--marquee-shift) * var(--row-dir, 1) * (1 - var(--marquee-progress, 0.5) * 2)),
    0,
    0
  );
  /* Each row of depth loses a fixed amount of contrast. */
  opacity: calc(1 - var(--row-depth, 0) * var(--marquee-fade));
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="scroll-marquee"] .marquee__row {
    /* The words stay — they are content. Only the drift goes. */
    transform: none;
    will-change: auto;
  }
}

/* ===== SC-002 · scroll/staggered-card-reveal ===== */
/* ==========================================================================
   SC-002 · Staggered Card Reveal — RK Motion Library v1.0
   Requires script.js. One observer watches the container; the children are
   revealed together with an incremental delay computed in CSS.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --stagger-step: 90ms;          /* delay added per item */
  --stagger-distance: 24px;
  --stagger-duration: 720ms;
  --stagger-scale: 0.985;        /* 1 disables the scale entirely */
  --stagger-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger-ready [data-motion="stagger"] > * {
  opacity: 0;
  transform: translate3d(0, var(--stagger-distance), 0) scale(var(--stagger-scale));
  transition:
    opacity var(--stagger-duration) var(--stagger-ease),
    transform var(--stagger-duration) var(--stagger-ease);
  /* --stagger-index is written once per child by script.js. */
  transition-delay: calc(var(--stagger-index, 0) * var(--stagger-step));
  will-change: opacity, transform;
}

.stagger-ready [data-motion="stagger"].is-revealed > * {
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  .stagger-ready [data-motion="stagger"] > * {
    opacity: 1;
    transform: none;
    transition: none;
    transition-delay: 0ms;
  }
}

/* ===== SC-001 · scroll/fade-up-reveal ===== */
/* ==========================================================================
   SC-001 · Fade Up Reveal — RK Motion Library v1.0
   Requires script.js, which adds the `reveal-ready` class to <html>.
   Nothing is hidden until the script confirms it can reveal it again, so the
   page is never left blank if JavaScript fails to load.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --reveal-distance: 28px;
  --reveal-duration: 760ms;
  --reveal-delay: 0ms;
  --reveal-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --reveal-start-opacity: 0;
}

.reveal-ready [data-motion="reveal"] {
  opacity: var(--reveal-start-opacity);
  transform: translate3d(0, var(--reveal-distance), 0);
  transition:
    opacity var(--reveal-duration) var(--reveal-ease) var(--reveal-delay),
    transform var(--reveal-duration) var(--reveal-ease) var(--reveal-delay);
  will-change: opacity, transform;
}

.reveal-ready [data-motion="reveal"].is-revealed {
  opacity: 1;
  transform: none;
  /* Dropped as soon as the element has arrived: will-change is a promise the
     compositor keeps paying for until it is removed. */
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-ready [data-motion="reveal"] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===== SC-005 · scroll/sticky-stack ===== */
/* ==========================================================================
   SC-005 · Sticky Card Stack — RK Motion Library v1.0
   Requires script.js. The script writes ONE number per card — --stack-progress,
   how much of that card the next one already covers. Every visual consequence
   is composed here in CSS.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --stack-top: 88px;      /* where the first card parks */
  --stack-step: 12px;     /* each card parks one step lower — that is the depth */
  --stack-gap: 14px;      /* space between cards before they start stacking */
  --stack-scale: 0.92;    /* scale of a fully covered card */
  --stack-fade: 0.72;     /* apparent opacity of a fully covered card */
  --stack-blur: 2px;      /* blur of a fully covered card */
  --stack-blur-start: 0.35; /* progress at which the blur starts, 0–1 */
  --stack-veil: Canvas;   /* what a receding card fades TOWARD — the page, see below */
}

[data-motion="sticky-stack"] {
  display: grid;
  gap: var(--stack-gap);
}

[data-motion="sticky-stack"] .stack__card {
  position: sticky;
  top: calc(var(--stack-top) + var(--index, 0) * var(--stack-step));
  /* The card must be opaque: a stack is cards covering cards. */
  isolation: isolate;
  transform: scale(calc(1 - (1 - var(--stack-scale)) * var(--stack-progress, 0)));
  filter: blur(
    calc(
      var(--stack-blur) *
      max(0, (var(--stack-progress, 0) - var(--stack-blur-start)) / (1 - var(--stack-blur-start)))
    )
  );
  transform-origin: 50% 0;
  will-change: transform;
}

/*
 * A receding card fades toward the PAGE, not toward transparency.
 * Lowering the card's own opacity would make it glass: you would read the card
 * behind it through the card in front, which reads as a rendering bug rather
 * than as depth. A veil on top loses the same amount of contrast and stays
 * opaque.
 */
[data-motion="sticky-stack"] .stack__card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--stack-veil);
  opacity: calc((1 - var(--stack-fade)) * var(--stack-progress, 0));
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="sticky-stack"] .stack__card {
    position: static;
    transform: none;
    filter: none;
    will-change: auto;
  }
  [data-motion="sticky-stack"] .stack__card::after { opacity: 0; }
}

/* ===== MI-004 · microinteractions/icon-arrow-shift ===== */
/* ==========================================================================
   MI-004 · Icon Arrow Shift — RK Motion Library v1.0
   CSS only. Two arrows travel inside a clipped slot so the icon never appears
   to jump back; it simply keeps moving forward.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --arrow-duration: 420ms;
  --arrow-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --arrow-size: 16px;
  --arrow-gap: 8px;
  --arrow-text-shift: 0px;
}

[data-motion="arrow-shift"] {
  display: inline-flex;
  align-items: center;
  gap: var(--arrow-gap);
  text-decoration: none;
}

[data-motion="arrow-shift"] .arrow-link__slot {
  display: block;
  width: var(--arrow-size);
  height: var(--arrow-size);
  overflow: hidden;
}

[data-motion="arrow-shift"] .arrow-link__track {
  display: flex;
  width: calc(var(--arrow-size) * 2);
  /* The second arrow starts one slot to the left of the viewport. */
  transform: translate3d(calc(var(--arrow-size) * -1), 0, 0);
  transition: transform var(--arrow-duration) var(--arrow-ease);
}

[data-motion="arrow-shift"] .arrow-link__track > * { flex: none; }

[data-motion="arrow-shift"]:hover .arrow-link__track,
[data-motion="arrow-shift"]:focus-visible .arrow-link__track {
  transform: translate3d(0, 0, 0);
}

[data-motion="arrow-shift"] .arrow-link__text {
  display: inline-block;
  transition: transform var(--arrow-duration) var(--arrow-ease);
}

[data-motion="arrow-shift"]:hover .arrow-link__text,
[data-motion="arrow-shift"]:focus-visible .arrow-link__text {
  transform: translate3d(calc(var(--arrow-text-shift) * -1), 0, 0);
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="arrow-shift"] .arrow-link__track,
  [data-motion="arrow-shift"] .arrow-link__text {
    transition: none;
  }
}

/* ===== MI-001 · microinteractions/magnetic-button ===== */
/* ==========================================================================
   MI-001 · Magnetic Button — RK Motion Library v1.0
   Requires: markup with [data-motion="magnetic"], script.js
   Configure with the custom properties below (they can be set on :root, on a
   section, or on a single button).
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

/* Configuration -------------------------------------------------------------
   Declared on :root so a page, a section or a single element can override it.
   Element-level declarations always win over these. */
:root {
  --magnetic-strength: 0.34;      /* 0–1: how far the button follows the cursor */
  --magnetic-radius: 110;         /* px: capture distance around the button     */
  --magnetic-ease-factor: 0.18;   /* 0–1: how fast the button chases the cursor */
  --magnetic-label-shift: 0.4;    /* 0–1: extra drift applied to the label      */
  --magnetic-release: 520ms;      /* return-to-rest duration                    */
  --magnetic-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.magnetic {
  /* Runtime state, written by script.js. Never set these by hand. */
  --magnetic-x: 0px;
  --magnetic-y: 0px;

  position: relative;
  transform: translate3d(var(--magnetic-x), var(--magnetic-y), 0);
  transition: transform var(--magnetic-release) var(--magnetic-ease);
}

/* While the pointer is captured the script drives every frame, so the
   transition must get out of the way. */
.magnetic.is-magnetic-engaged {
  transition: none;
}

.magnetic__label {
  display: inline-block;
  transform: translate3d(
    calc(var(--magnetic-x) * var(--magnetic-label-shift)),
    calc(var(--magnetic-y) * var(--magnetic-label-shift)),
    0
  );
  transition: transform var(--magnetic-release) var(--magnetic-ease);
}
.magnetic.is-magnetic-engaged .magnetic__label { transition: none; }

/* Keyboard users get an equivalent, non-pointer affordance. */
.magnetic:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* Touch and reduced-motion users get the static button, with nothing lost. */
@media (hover: none), (pointer: coarse) {
  .magnetic { transform: none; transition: none; }
  .magnetic__label { transform: none; transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .magnetic,
  .magnetic__label {
    transform: none !important;
    transition: none !important;
  }
}

/* ===== MI-002 · microinteractions/button-fill-reveal ===== */
/* ==========================================================================
   MI-002 · Button Fill Reveal — RK Motion Library v1.0
   CSS only. Requires markup with [data-motion="fill-reveal"] and an inner
   label element so the text can sit above the fill layer.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --fill-duration: 420ms;
  --fill-ease: cubic-bezier(0.65, 0, 0.35, 1);
  /* Where the fill enters from. inset(top right bottom left) at 100% is the
     closed state, so `inset(100% 0 0 0)` fills upward from the bottom edge. */
  --fill-from: inset(100% 0 0 0);
  --fill-label-lift: 0px;
}

[data-motion="fill-reveal"] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

[data-motion="fill-reveal"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: currentColor;
  clip-path: var(--fill-from);
  transition: clip-path var(--fill-duration) var(--fill-ease);
}

[data-motion="fill-reveal"]:hover::before,
[data-motion="fill-reveal"]:focus-visible::before {
  clip-path: inset(0 0 0 0);
}

/* The label swaps to the page background colour so it stays readable on the
   filled surface. `Canvas` follows the active colour-scheme automatically. */
[data-motion="fill-reveal"] .fill-button__label {
  display: inline-block;
  transition: color var(--fill-duration) var(--fill-ease),
    transform var(--fill-duration) var(--fill-ease);
}

[data-motion="fill-reveal"]:hover .fill-button__label,
[data-motion="fill-reveal"]:focus-visible .fill-button__label {
  color: Canvas;
  transform: translateY(calc(var(--fill-label-lift) * -1));
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="fill-reveal"]::before {
    transition: none;
  }
  [data-motion="fill-reveal"] .fill-button__label {
    transition: color 0.001ms;
    transform: none;
  }
}

/* ===== MI-003 · microinteractions/underline-sweep ===== */
/* ==========================================================================
   MI-003 · Underline Sweep — RK Motion Library v1.0
   CSS only. The underline is a pseudo-element scaled on the X axis, so the
   animation runs on the compositor instead of repainting a background.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --underline-duration: 380ms;
  --underline-ease: cubic-bezier(0.65, 0, 0.35, 1);
  --underline-thickness: 1px;
  --underline-offset: 3px;
  --underline-opacity: 1;
}

[data-motion="underline-sweep"] {
  position: relative;
  text-decoration: none;
}

[data-motion="underline-sweep"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--underline-offset) * -1);
  height: var(--underline-thickness);
  background: currentColor;
  opacity: var(--underline-opacity);
  /* Rest state anchors to the right, so leaving retracts to the right while
     entering grows from the left: one continuous sweep, not a rewind. */
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform var(--underline-duration) var(--underline-ease);
}

[data-motion="underline-sweep"]:hover::after,
[data-motion="underline-sweep"]:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* Keeps the current page marked without any motion. */
[data-motion="underline-sweep"][aria-current]::after {
  transform: scaleX(1);
  transform-origin: left center;
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="underline-sweep"]::after {
    transition: opacity 0.001ms;
    transform: scaleX(1);
    opacity: 0;
  }
  [data-motion="underline-sweep"]:hover::after,
  [data-motion="underline-sweep"]:focus-visible::after {
    opacity: var(--underline-opacity);
  }
}

/* ===== MI-005 · microinteractions/press-feedback ===== */
/* ==========================================================================
   MI-005 · Press Feedback — RK Motion Library v1.0
   CSS only. The one interaction that has no hover: the press itself.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --press-scale: 0.965;      /* how far a pressed control gives way */
  --press-scale-large: 0.985; /* the same press on a card-sized target */
  --press-duration: 140ms;
  /* Slight overshoot on release, none on the way down: a control should yield
     instantly and come back with a little life. */
  --press-ease: cubic-bezier(0.34, 1.3, 0.64, 1);
}

[data-motion="press"] {
  transition: transform var(--press-duration) var(--press-ease);
  /* Removes the 300ms grey flash Android and iOS paint over a tapped element,
     which otherwise arrives after this animation and overrides it visually. */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

[data-motion="press"]:active {
  transform: scale(var(--press-scale));
  /* The press must beat any easing already running, or a control tapped twice
     in a row feels sticky. */
  transition-duration: 0ms;
}

/* A large target moves less for the same perceived give: scale is proportional,
   perception is not. */
[data-motion="press"].press--card:active {
  transform: scale(var(--press-scale-large));
}

@media (prefers-reduced-motion: reduce) {
  [data-motion="press"] {
    transition: none;
  }
  [data-motion="press"]:active {
    transform: none;
    /* Something still has to acknowledge the press. */
    opacity: 0.8;
  }
}

/* ===== ST-002 · section-transitions/sheet-morph ===== */
/* ==========================================================================
   ST-002 · Sheet Morph — RK Motion Library v1.0
   Requires script.js. The sheet is laid out at its FINAL size here; the script
   measures both rectangles and animates the sheet from the button's box to
   this one. Nothing in this file describes the intermediate state.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --sheet-duration: 520ms;
  --sheet-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sheet-inset: 12px;        /* gap between the sheet and the screen edges */
  --sheet-radius: 28px;       /* corner of the open sheet */
  --sheet-trigger-radius: 999px; /* corner of the button it grows out of */
  --sheet-min-height: 260px;
  --sheet-content-delay: 180ms;
  --sheet-backdrop-blur: 4px;
  --sheet-backdrop: rgba(20, 16, 13, 0.56);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--sheet-backdrop);
  backdrop-filter: blur(var(--sheet-backdrop-blur));
  -webkit-backdrop-filter: blur(var(--sheet-backdrop-blur));
  opacity: 0;
  transition: opacity var(--sheet-duration) var(--sheet-ease);
}

.sheet-backdrop[data-open] { opacity: 1; }
.sheet-backdrop[hidden] { display: none; }

.sheet {
  position: fixed;
  z-index: 1001;
  left: var(--sheet-inset);
  right: var(--sheet-inset);
  bottom: max(var(--sheet-inset), env(safe-area-inset-bottom));
  min-height: var(--sheet-min-height);
  border-radius: var(--sheet-radius);
  /* The script scales from the button's box to this one, so the origin has to
     be the corner both rectangles are measured from. */
  transform-origin: top left;
}

.sheet[hidden] { display: none; }

/*
 * The content waits for the box to finish changing shape. During the morph the
 * sheet is scaled non-uniformly, which would stretch every glyph inside it —
 * so the content is simply not visible until the shape is right.
 */
.sheet__content {
  opacity: 0;
  transform: translate3d(0, 12px, 0);
}

.sheet[data-open] .sheet__content {
  animation: sheet-content var(--sheet-duration) var(--sheet-ease) var(--sheet-content-delay) both;
}

@keyframes sheet-content {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Without the script the sheet never opens, so its content must not be stuck
   invisible if someone reaches it another way. */
html:not(.rk-sheet-ready) .sheet__content { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .sheet-backdrop { transition-duration: 1ms; }
  .sheet[data-open] .sheet__content { animation-duration: 1ms; animation-delay: 0ms; }
}

/* ===== LD-001 · loading/branded-page-loader ===== */
/* ==========================================================================
   LD-001 · Branded Page Loader — RK Motion Library v1.0
   Requires script.js. The overlay must be real markup so it is painted with
   the first frame; a script-injected loader always arrives too late.
   ========================================================================== */

/* --- Motion --------------------------------------------------------------- */

:root {
  --loader-color: #0c0e11;
  --loader-exit-duration: 700ms;
  --loader-exit-ease: cubic-bezier(0.83, 0, 0.17, 1);
  --loader-bar-duration: 340ms;
  --loader-bar-height: 2px;
  --loader-bar-width: 180px;
  --loader-min-display: 600ms;   /* read by script.js */
}

[data-motion="page-loader"] {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  background: var(--loader-color);
  transform-origin: top;
  transition: transform var(--loader-exit-duration) var(--loader-exit-ease);
}

[data-motion="page-loader"] .loader__inner {
  display: grid;
  justify-items: center;
  gap: 14px;
  transition: opacity 260ms ease;
}

[data-motion="page-loader"] .loader__track {
  display: block;
  width: var(--loader-bar-width);
  height: var(--loader-bar-height);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

[data-motion="page-loader"] .loader__bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  transform: scaleX(var(--loader-progress, 0));
  transform-origin: left;
  transition: transform var(--loader-bar-duration) cubic-bezier(0.16, 1, 0.3, 1);
}

/* Exit: the whole curtain retracts upward once loading is complete. */
[data-motion="page-loader"].is-complete .loader__inner { opacity: 0; }

[data-motion="page-loader"].is-leaving {
  transform: scaleY(0);
}

/* Removed from the render tree entirely once it has left. */
[data-motion="page-loader"].is-done {
  display: none;
}

/* While the loader is up the page must not scroll behind it. */
html.rk-loading, html.rk-loading body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  [data-motion="page-loader"] { transition: none; }
  [data-motion="page-loader"] .loader__bar { transition: none; }
  [data-motion="page-loader"] .loader__inner { transition: none; }
}
