/* =====================================================================
   Bricks Child GSAP - custom.css
   Each effect is customized per element with variables in Style > CSS:
   %root% { --tw-duration: 1.4s; }
   ===================================================================== */


/* =====================================================================
   1. CUSTOM CURSOR
   Global variables: --cursor-size (12px), --cursor-color (white, --white)
   ===================================================================== */
.bcg-cursor {
  --size: var(--cursor-size, 12px);
  position: fixed;
  top: 0;
  left: 0;
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  border-radius: 50%;
  background: var(--cursor-color, var(--white));
  mix-blend-mode: exclusion;
  pointer-events: none;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.3s;
}

.bcg-cursor.is-visible { opacity: 1; }


/* =====================================================================
   2. TWIST REVEAL   (attribute: data-twist)
   --tw-perspective (200px)  --tw-rotate (-80deg)  --tw-y (100%)
   --tw-duration (1s)        --tw-delay (0.2s)     --tw-ease
   ===================================================================== */
[data-twist] {
  display: inline-block;
  width: fit-content;
}

.bricks-is-frontend [data-twist] {
  opacity: 0;
  transform-origin: 50% 0%;
  transform:
    perspective(var(--tw-perspective, 200px))
    translateY(var(--tw-y, 100%))
    rotateX(var(--tw-rotate, -80deg));
  transition:
    opacity   var(--tw-duration, 1s) var(--tw-ease, cubic-bezier(0.215, 0.61, 0.355, 1)) var(--tw-delay, 0.2s),
    transform var(--tw-duration, 1s) var(--tw-ease, cubic-bezier(0.215, 0.61, 0.355, 1)) var(--tw-delay, 0.2s);
}

.bricks-is-frontend [data-twist].is-twisted {
  opacity: 1;
  transform: perspective(var(--tw-perspective, 200px)) translateY(0) rotateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .bricks-is-frontend [data-twist] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* =====================================================================
   3. UNDERLINE HOVER
   Classes: ul-hover (one sided) | + ul-side | + ul-two | + ul-full
   Container that triggers the hover: ul-trigger
   --ul-color  --ul-thickness (1px)  --ul-offset (2px)
   --ul-duration (0.4s)  --ul-initial (0)  --ul-ease
   ===================================================================== */
.ul-hover {
  position: relative;
  width: fit-content;
}

.ul-hover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--ul-offset, 2px) * -1);
  height: var(--ul-thickness, 1px);
  background: var(--ul-color, currentColor);
  transform: scaleX(var(--ul-initial, 0));
  transform-origin: left;
  transition: transform var(--ul-duration, 0.4s) var(--ul-ease, cubic-bezier(0.65, 0, 0.35, 1));
  pointer-events: none;
}

.ul-hover:hover::after,
.ul-trigger:hover .ul-hover::after {
  transform: scaleX(1);
}

/* Side to Side */
.ul-side::after { transform-origin: right; }
.ul-side:hover::after,
.ul-trigger:hover .ul-side::after { transform-origin: left; }

/* Two Sided */
.ul-two::after { transform-origin: center; }

/* Full Sided */
.ul-full::after { transform: scaleX(1); }
.ul-full:hover::after,
.ul-trigger:hover .ul-full::after {
  animation: ul-redraw calc(var(--ul-duration, 0.4s) * 2) var(--ul-ease, cubic-bezier(0.65, 0, 0.35, 1));
}

@keyframes ul-redraw {
  0%    { transform: scaleX(1); transform-origin: right; }
  50%   { transform: scaleX(0); transform-origin: right; }
  50.1% { transform: scaleX(0); transform-origin: left; }
  100%  { transform: scaleX(1); transform-origin: left; }
}

@media (prefers-reduced-motion: reduce) {
  .ul-hover::after { transition: none; animation: none !important; }
}


/* =====================================================================
   4. SHIFTING ICON   (class: icon-shift)
   --is-distance (6px)  --is-duration (0.3s)  --is-ease
   ===================================================================== */
.icon-shift .icon {
  display: inline-flex;
  transition: transform var(--is-duration, 0.3s) var(--is-ease, cubic-bezier(0.65, 0, 0.35, 1));
}

.icon-shift .icon svg { fill: currentColor; }

.icon-shift:hover .icon,
.ul-trigger:hover .icon-shift .icon {
  transform: translateX(var(--is-distance, 6px));
}

@media (prefers-reduced-motion: reduce) {
  .icon-shift .icon { transition: none; }
}


/* =====================================================================
   5. IMAGE PARALLAX   (attribute: data-parallax)
   ===================================================================== */
[data-parallax] {
  overflow: hidden;
}

[data-parallax] img {
  display: block;
  will-change: transform;
}


/* =====================================================================
   6. SPLIT SIMPLE + BLADE TITLE   (attributes: data-split / data-blade)
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .bricks-is-frontend [data-blade] { visibility: hidden; }
}

/* Room for descender letters (g, p, y) inside the mask: raise
   --split-room on the title, e.g. %root% { --split-room: 0.3em; }
   main.js applies it to every SplitText mask (default 0.25em). */


/* =====================================================================
   7. SCROLL READING   (attribute: data-scroll-read)
   --sr-color (text color)  --sr-dim (text at 20%)
   ===================================================================== */
[data-scroll-read] {
  display: block;
  width: 100%;
}

[data-scroll-read].sr-wipe .sr-line {
  --sr-on:  var(--sr-color, currentColor);
  --sr-off: var(--sr-dim, color-mix(in srgb, currentColor 20%, transparent));
  background-image:
    linear-gradient(var(--sr-on), var(--sr-on)),
    linear-gradient(var(--sr-off), var(--sr-off));
  background-repeat: no-repeat;
  background-size: var(--sr-p, 0%) 100%, 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}


/* =====================================================================
   8. FILL HOVER   (class: fill-hover)
   The background fills from the bottom and the text changes color.
   Direction: fill-hover--top | fill-hover--left | fill-hover--center
   --fh-fill (context heading)  --fh-text (context background)  --fh-duration (0.6s)  --fh-ease
   ===================================================================== */
.fill-hover {
  position: relative;
  isolation: isolate;               /* the layer sits behind the text */
  overflow: hidden;
}

.fill-hover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--fh-fill, var(--ctx-heading, var(--base-ultra-dark)));
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--fh-duration, 0.6s) var(--fh-ease, cubic-bezier(0.165, 0.84, 0.44, 1));
  pointer-events: none;
}

.fill-hover,
.fill-hover * {
  transition: color var(--fh-duration, 0.6s) var(--fh-ease, cubic-bezier(0.165, 0.84, 0.44, 1));
}

@media (hover: hover) {
  .fill-hover:hover::before { transform: scale(1); }

  .fill-hover:hover,
  .fill-hover:hover * { color: var(--fh-text, var(--ctx-bg, var(--white))); }
}

/* Other directions */
.fill-hover--top::before    { transform-origin: top; }
.fill-hover--left::before   { transform: scaleX(0); transform-origin: left; }
.fill-hover--center::before { transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .fill-hover::before,
  .fill-hover,
  .fill-hover * { transition: none; }
}


/* =====================================================================
   9. RIPPLE BUTTON   (class: rbtn — works on the native Bricks Button)
   The mask is ::after and the text copy is ::before (no extra elements
   needed; the JS wraps the text and fills data-text automatically).
   Direction: rbtn--bottom (mask from the bottom, text moves down)
   Exit:      mask-through (the mask keeps going when the hover ends)
   Mask:     --rb-fill (context mask, else primary)  --rb-duration (0.7s)  --rb-ease (ease)
   Text:     --rb-text-hover (text on the mask)  --rb-text-shift (15px)
             --rb-text-duration (0.35s)  --rb-text-ease (ease)
   ===================================================================== */
.rbtn {
  --rb-shift: var(--rb-text-shift, 15px);
  --rb-tdur:  var(--rb-text-duration, 0.35s);
  --rb-tez:   var(--rb-text-ease, ease);
  --rb-mdur:  var(--rb-duration, 0.7s);
  --rb-mez:   var(--rb-ease, ease);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  cursor: pointer;
  text-decoration: none;
}

/* Text copy that slides in on hover */
.rbtn::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  color: var(--mb-text-hover, var(--rb-text-hover, var(--ctx-btn-mask-text, inherit)));
  opacity: 0;
  transform: translateY(var(--rb-shift));
  transition: opacity var(--rb-tdur) var(--rb-tez), transform var(--rb-tdur) var(--rb-tez);
  pointer-events: none;
}

/* Mask: a drop that falls and fills the button */
.rbtn::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: -100%;
  left: 50%;
  width: 100%;
  height: 100%;
  translate: -50% 0;
  border-radius: 50%;
  background: var(--mb-fill, var(--rb-fill, var(--ctx-btn-mask, var(--primary))));
  transition:
    top var(--rb-mdur) var(--rb-mez),
    width var(--rb-mdur) var(--rb-mez),
    border-radius var(--rb-mdur) var(--rb-mez);
  pointer-events: none;
}

.rbtn__text {
  position: relative;
  z-index: 2;
  transition: opacity var(--rb-tdur) var(--rb-tez), transform var(--rb-tdur) var(--rb-tez);
}

@media (hover: hover) {
  .rbtn:hover::before {
    opacity: 1;
    transform: translateY(0);
    transition-duration: calc(var(--rb-tdur) * 1.5);
  }
  .rbtn:hover .rbtn__text {
    opacity: 0;
    transform: translateY(calc(var(--rb-shift) * -1));
  }
  .rbtn:hover::after {
    top: 0;
    width: 150%;
    border-radius: 0;
  }
}

/* Variant: everything reversed (mask rises from the bottom) */
.rbtn--bottom { --rb-shift: calc(var(--rb-text-shift, 15px) * -1); }
.rbtn--bottom::after { top: 100%; }

/* mask-through: when the hover ends the mask keeps going
   (normal: exits at the bottom · rbtn--bottom: exits at the top) */
.rbtn.is-out::after          { top: 100%; }
.rbtn--bottom.is-out::after  { top: -100%; }
.rbtn.is-reset::after {
  transition: none !important;
  top: -100% !important;
  width: 100% !important;
  border-radius: 50% !important;
}
.rbtn--bottom.is-reset::after { top: 100% !important; }

@media (prefers-reduced-motion: reduce) {
  .rbtn::before,
  .rbtn::after,
  .rbtn__text { transition: none; }
}

/* =====================================================================
   10. SWISS BUTTONS (editorial line)
   Flat, no rounding, thin rules, arrows and numbers.
   They take the background colors (bg--*), just like my-button.
   In Bricks: Button with Style = None and NO icon (the CSS adds the arrow).

   sw-arrow   Link with arrow and rule: the rule completes and the arrow moves
   sw-index   Bordered box with an arrow cell: wipe from the left
              and the arrow cell turns accent
   sw-num     Number + text with a top rule: an accent bar grows and
              the text moves away from the number. Number via data-num="01"

   Shared variables (Style > CSS, %root% { … }):
   --sw-color     button color                (context heading)
   --sw-accent    accent color                (context mask: primary)
   --sw-duration  speed                       (0.45s)
   --sw-ease      curve                       (cubic-bezier(0.7, 0, 0.2, 1))
   --sw-line      line thickness              (1px)
   ===================================================================== */
:root :is(.sw-arrow, .sw-index, .sw-num) {
  --sw-c:   var(--sw-color, var(--ctx-heading));
  --sw-a:   var(--sw-accent, var(--ctx-btn-mask));
  --sw-on:  var(--sw-accent-text, var(--ctx-btn-mask-text));
  --sw-d:   var(--sw-duration, 0.45s);
  --sw-e:   var(--sw-ease, cubic-bezier(0.7, 0, 0.2, 1));
  --sw-l:   var(--sw-line, 1px);
  position: relative;
  display: inline-flex;
  align-items: center;
  background: none;
  border-radius: 0;
  color: var(--sw-c);
  text-decoration: none;
  cursor: pointer;
}

/* ---- sw-arrow ------------------------------------------------------
   --sw-arrow-icon  arrow         ("→")   e.g. "↗"
   --sw-gap         text–arrow gap (0.6em)
   --sw-line-start  how much of the rule shows at rest, 0 to 1 (0.25)
   --------------------------------------------------------------------- */
:root .sw-arrow {
  gap: var(--sw-gap, 0.6em);
  padding: 0 0 0.35em;
}
:root .sw-arrow::before {               /* rule */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--sw-l);
  background: currentColor;
  transform: scaleX(var(--sw-line-start, 0.25));
  transform-origin: left;
  transition: transform var(--sw-d) var(--sw-e);
}
:root .sw-arrow::after {                /* arrow */
  content: var(--sw-arrow-icon, "→");
  display: inline-block;
  transition: transform var(--sw-d) var(--sw-e);
}

/* ---- sw-index ------------------------------------------------------
   --sw-arrow-icon  cell arrow           ("→")
   --sw-fill        wipe color           (button color)
   --sw-fill-text   hover text           (context background)
   --sw-cell        cell width           (3.2em)
   --sw-case        capitalization       (uppercase) · none = normal
   --sw-tracking    letter spacing       (0.08em)
   Uses its own, softer timing: --sw-duration (0.8s) and
   --sw-ease (cubic-bezier(0.22, 1, 0.36, 1)). The text and the cell
   change with a small delay, once the wipe has passed.
   --------------------------------------------------------------------- */
:root .sw-index {
  --sw-d: var(--sw-duration, 0.8s);
  --sw-e: var(--sw-ease, cubic-bezier(0.22, 1, 0.36, 1));
  isolation: isolate;
  overflow: hidden;
  padding: 0.95em calc(var(--sw-cell, 3.2em) + 1.2em) 0.95em 1.2em;
  border: var(--sw-l) solid var(--sw-c);
  text-transform: var(--sw-case, uppercase);
  letter-spacing: var(--sw-tracking, 0.08em);
  transition: color var(--sw-d) var(--sw-e);
}
:root .sw-index::before {               /* wipe */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--sw-fill, var(--sw-c));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--sw-d) var(--sw-e);
}
:root .sw-index::after {                /* arrow cell */
  content: var(--sw-arrow-icon, "→");
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sw-cell, 3.2em);
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: var(--sw-l) solid var(--sw-c);
  letter-spacing: 0;
  transition:
    background-color var(--sw-d) var(--sw-e),
    color var(--sw-d) var(--sw-e);
}

/* ---- sw-num --------------------------------------------------------
   Attribute data-num="01" (the number shown)
   --sw-bar         accent bar thickness          (4px)
   --sw-gap         number–text gap               (0.9em)
   --sw-gap-hover   gap on hover                  (1.6em)
   --sw-num-size    number size                   (1em = same as text)
   --sw-width       minimum width                 (14em)
   --------------------------------------------------------------------- */
:root .sw-num {
  align-items: baseline;
  gap: var(--sw-gap, 0.9em);
  min-width: var(--sw-width, 14em);
  padding: 0.85em 0 0;
  border-top: var(--sw-l) solid currentColor;
  transition: gap var(--sw-d) var(--sw-e);
}
:root .sw-num::before {                 /* number */
  content: attr(data-num);
  font-size: var(--sw-num-size, 1em);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  transition: color var(--sw-d) var(--sw-e);
}
:root .sw-num::after {                  /* accent bar */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--sw-l) * -1);
  height: var(--sw-bar, 4px);
  background: var(--sw-a);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--sw-d) var(--sw-e);
}

/* ---- Hover ---------------------------------------------------------- */
@media (hover: hover) {
  :root .sw-arrow:hover::before { transform: scaleX(1); }
  :root .sw-arrow:hover::after  { transform: translateX(0.35em); }

  :root .sw-index:hover {
    color: var(--sw-fill-text, var(--ctx-bg));
    transition-delay: calc(var(--sw-d) * 0.15);
  }
  :root .sw-index:hover::before    { transform: scaleX(1); }
  :root .sw-index:hover::after {
    background-color: var(--sw-a);
    color: var(--sw-on);
    transition-delay: calc(var(--sw-d) * 0.35);
  }

  :root .sw-num:hover          { gap: var(--sw-gap-hover, 1.6em); }
  :root .sw-num:hover::before  { color: var(--ctx-accent); }
  :root .sw-num:hover::after   { transform: scaleX(1); }
}

/* Keyboard: same effect on visible focus */
:root :is(.sw-arrow, .sw-index, .sw-num):focus-visible {
  outline: var(--sw-l) solid var(--sw-a);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  :root :is(.sw-arrow, .sw-index, .sw-num),
  :root :is(.sw-arrow, .sw-index, .sw-num)::before,
  :root :is(.sw-arrow, .sw-index, .sw-num)::after { transition: none; }
}


/* =====================================================================
   11-15. Effects added in 1.9.0 (main.js). Only what the effect needs:
   colors, sizes and layout stay in your Bricks classes.
   ===================================================================== */

/* 11. Highlight list: items dim until they reach the middle of the screen */
.bricks-is-frontend .is-highlighting > * {
  opacity: var(--hl-dim, 0.14);
  transition: opacity var(--ppql-dur-base, 0.4s) var(--ppql-ease-out, ease-out);
}
.bricks-is-frontend .is-highlighting > .is-past   { opacity: var(--hl-past, 0.45); }
.bricks-is-frontend .is-highlighting > .is-active { opacity: 1; }

/* 12. Swap: list items dim the same way; media stack on top of each other */
.bricks-is-frontend .is-swapping [data-swap-item] {
  opacity: var(--hl-dim, 0.14);
  transition: opacity var(--ppql-dur-base, 0.4s) var(--ppql-ease-out, ease-out);
}
.bricks-is-frontend .is-swapping [data-swap-item].is-past   { opacity: var(--hl-past, 0.45); }
.bricks-is-frontend .is-swapping [data-swap-item].is-active { opacity: 1; }
.bricks-is-frontend [data-swap-media] { backface-visibility: hidden; }

/* 15. Grid overlay: hidden until G is pressed */
[data-grid-overlay]:not(.is-on) { display: none !important; }
[data-grid-overlay] { pointer-events: none; }


/* =====================================================================
   18-19. Effects added in 1.14.0 (main.js)
   ===================================================================== */

/* 18. Stack: the cards scale from their top edge */
.bricks-is-frontend [data-stack] > * { will-change: transform; }

/* 19. Peek: the floating image next to the cursor */
.bcg-peek {
  position: fixed; left: 0; top: 0; z-index: 9998; pointer-events: none;
  margin: 2.4rem 0 0 2.4rem; opacity: 0; transform-origin: 0 0;
  transition: opacity 0.25s ease, scale 0.35s var(--ppql-ease-out, ease-out);
  scale: 0.9;
}
.bcg-peek.is-on { opacity: 1; scale: 1; }
.bcg-peek img { display: block; width: 100%; height: auto; }
@media (hover: none), (pointer: coarse) { .bcg-peek { display: none; } }
