/* =========================================================
   ROPE SCROLLBAR (v3)
   A twisted cord fixed to the right edge of the viewport with a
   small felt flower doll hanging from it. The doll's height
   follows the real scroll position; rope-scroll.js adds the
   swing. The rope layer never catches clicks or touches; only
   the doll itself can be grabbed (mouse or finger), plus the
   rope strip for mouse clicks.
   Everything here is scoped to .rope-scroll / .has-rope-scroll,
   so without JavaScript the site keeps its normal scrollbar.
========================================================= */

/* the native scrollbar is hidden only once the rope is running */
html.has-rope-scroll{scrollbar-width:none}
html.has-rope-scroll::-webkit-scrollbar{width:0;height:0;display:none}

.rope-scroll{
  --rope-a:#d9b58f;               /* cord */
  --rope-edge:rgba(92,58,30,.55); /* cord outline */
  --rope-dark:rgba(120,78,40,.55);/* twist grooves */
  --rope-b:rgba(255,246,232,.7);  /* light on the cord */
  --doll-felt:#fbe4ec;
  --doll-felt-hi:#fff7fa;
  --doll-felt-lo:#efc3d3;
  --doll-line:rgba(70,25,45,.42);
  --doll-ink:#2a1b22;
  --doll-cheek:#f59ab8;

  position:fixed;
  top:0;
  right:0;
  width:56px;
  height:100%;
  z-index:900;               /* under the header (1000), overlays (1500) and cart (2000) */
  pointer-events:none;
  opacity:1;
  transition:opacity .35s ease;
  contain:layout style;
}
.rope-scroll.is-idle{opacity:0}   /* page too short to scroll */

.rope-scroll .rope-svg{position:absolute;inset:0;display:block;width:100%;height:100%;overflow:visible}

body.light .rope-scroll{
  --rope-a:#b98a5f;
  --rope-edge:rgba(84,52,26,.6);
  --rope-dark:rgba(96,60,30,.5);
  --rope-b:rgba(255,240,222,.75);
  --doll-line:rgba(70,25,45,.48);
}
body.water .rope-scroll{
  --rope-a:#cbe9ef;
  --rope-edge:rgba(20,70,85,.5);
  --rope-dark:rgba(60,120,135,.45);
  --rope-b:rgba(255,255,255,.75);
}

/* the cord: outline + body + twist grooves + a soft light along it = a round, twisted cord */
.rope-scroll .rope-edge,
.rope-scroll .rope-base,
.rope-scroll .rope-twist,
.rope-scroll .rope-shine{fill:none;stroke-linecap:round;stroke-linejoin:round}
.rope-scroll .rope-edge{stroke:var(--rope-edge);stroke-width:3.7}
.rope-scroll .rope-base{stroke:var(--rope-a);stroke-width:2.6}
.rope-scroll .rope-twist{stroke:var(--rope-dark);stroke-width:2.2;stroke-linecap:butt;stroke-dasharray:1.2 2.4}
.rope-scroll .rope-shine{stroke:var(--rope-b);stroke-width:.75;opacity:.8}
.rope-scroll .rope-knot{fill:var(--rope-a);stroke:var(--rope-edge);stroke-width:1}
.rope-scroll .rope-knot-shine{fill:var(--rope-b)}

/* the doll: its own small layer, moved only with transform (smooth even on slow phones) */
.rope-scroll .doll{
  position:absolute;left:0;top:0;
  width:96px;height:124px;
  transform-origin:48px 16px;          /* where the cord is tied on */
  will-change:transform;
  backface-visibility:hidden;
}
.rope-scroll .doll-svg{display:block;width:96px;height:124px;overflow:visible;
  filter:drop-shadow(0 3px 3px rgba(0,0,0,.28))}

.rope-scroll .dg-felt-hi{stop-color:var(--doll-felt-hi)}
.rope-scroll .dg-felt{stop-color:var(--doll-felt)}
.rope-scroll .dg-felt-lo{stop-color:var(--doll-felt-lo)}
.rope-scroll .dg-dress-hi{stop-color:#fff;stop-opacity:.42}
.rope-scroll .dg-dress-lo{stop-color:#fff;stop-opacity:0}
.rope-scroll .dg-petal-hi{stop-color:#fff}
.rope-scroll .dg-petal{stop-color:var(--accent,#f9a8c4)}
.rope-scroll .dg-cheek{stop-color:var(--doll-cheek)}

.rope-scroll .doll-felt,
.rope-scroll .doll-head{fill:url(#ikd-felt);stroke:var(--doll-line);stroke-width:.8}
.rope-scroll .doll-head-shine{fill:none;stroke:#fff;stroke-width:1.1;stroke-linecap:round;opacity:.7}
.rope-scroll .doll-dress{fill:var(--accent,#f9a8c4);stroke:var(--doll-line);stroke-width:.8}
.rope-scroll .doll-dress-light{fill:url(#ikd-dress)}
.rope-scroll .doll-dress-fold{fill:none;stroke:rgba(0,0,0,.12);stroke-width:.7;stroke-linecap:round}
.rope-scroll .doll-stitch{fill:none;stroke:rgba(255,255,255,.8);stroke-width:.75;stroke-dasharray:1.4 1.5;stroke-linecap:round}
.rope-scroll .doll-shade{fill:rgba(60,20,40,.16)}
.rope-scroll .doll-petal{fill:url(#ikd-petal);stroke:var(--doll-line);stroke-width:.55}
.rope-scroll .doll-bud{fill:#ffd98a;stroke:rgba(150,100,20,.35);stroke-width:.4}
.rope-scroll .doll-bud-shine{fill:#fff;opacity:.8}
.rope-scroll .doll-ink{fill:var(--doll-ink)}
.rope-scroll .doll-ink-line{fill:none;stroke:var(--doll-ink);stroke-width:.9;stroke-linecap:round}
.rope-scroll .doll-shine{fill:#fff}
.rope-scroll .doll-cheek{fill:url(#ikd-cheek);opacity:.9}
.rope-scroll .doll-loop{fill:none;stroke:var(--rope-a);stroke-width:1.7}
.rope-scroll .doll-thread{fill:none;stroke:var(--rope-a);stroke-width:1.3;stroke-linecap:round}
.rope-scroll .doll-loop-shine{fill:none;stroke:var(--rope-b);stroke-width:.6;stroke-linecap:round}

.rope-scroll .doll-eyes{
  transform-box:fill-box;
  transform-origin:center;
  animation:doll-blink 5.5s infinite;
}
@keyframes doll-blink{
  0%,93%,100%{transform:scaleY(1)}
  95%{transform:scaleY(.12)}
}

/* the doll can be grabbed and dragged like a scrollbar thumb (mouse or finger).
   touch-action:none stops the page from scrolling under a finger holding the doll;
   touches anywhere else on the page scroll normally. */
.rope-scroll .doll{pointer-events:auto;touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;cursor:default}
.rope-scroll .doll-svg,.rope-scroll .doll-svg *{pointer-events:none}
.rope-scroll .doll-hit{fill:transparent}   /* bigger, invisible grab area for fingers */
.rope-scroll .rope-track{fill:transparent;pointer-events:none}
@media (hover:hover) and (pointer:fine){
  .rope-scroll .doll{pointer-events:auto;cursor:grab}
  .rope-scroll .rope-track{pointer-events:auto;cursor:pointer}
  .rope-scroll.is-dragging .doll{cursor:grabbing}
}
.rope-scroll.is-dragging{transition:none}
.rope-scroll.is-lifted{z-index:1100}   /* while held/springing back: above the header and mobile tab bar, still under overlays (1500) */
.rope-scroll.is-lifted .doll-svg{filter:drop-shadow(0 7px 6px rgba(0,0,0,.3))}   /* picked up: the shadow drops away */
html.rope-dragging,html.rope-dragging *{cursor:grabbing !important;user-select:none !important;-webkit-user-select:none !important}

/* tablet */
@media (max-width:1100px){
  .rope-scroll{width:50px}
}
/* mobile */
@media (max-width:600px){
  .rope-scroll{width:40px}
  .rope-scroll .rope-edge{stroke-width:3.2}
  .rope-scroll .rope-base{stroke-width:2.2}
  .rope-scroll .rope-twist{stroke-width:1.9}
}

/* low-end phones (lite mode): the same cord and doll, without the extra light and shadow layers */
html.ik-lite .rope-scroll .rope-shine{display:none}
html.ik-lite .rope-scroll .doll-svg,
html.ik-lite .rope-scroll.is-lifted .doll-svg{filter:none}

@media (prefers-reduced-motion:reduce){
  .rope-scroll .doll-eyes{animation:none}
}

@media print{
  .rope-scroll{display:none}
}
