/* ----------------------------------------------------------------------------------
   ERS Kalite - motion layer (paired with assets/js/ers-motion.js)
   Every hidden "before" state is scoped to html.ers-motion, which the script only sets when
   motion is allowed; without JS or with reduced motion the page renders fully static.
   Transforms used for entrances go through `transform`; scroll/pointer offsets go through the
   independent `translate` / `rotate` / `scale` properties, so the two never overwrite each other.
------------------------------------------------------------------------------------- */

:root {
  --rv-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --rv-ease-io: cubic-bezier(0.76, 0, 0.24, 1);
  --rv-dur: 1s;
}


/* ---------- scroll progress ---------- */
.ers-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 100000;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: #03519C;
  will-change: transform;
}

/* ---------- generic reveals ---------- */
.ers-motion [data-rv] {
  transition:
    opacity var(--rv-dur) var(--rv-ease) var(--rv-delay, 0s),
    transform var(--rv-dur) var(--rv-ease) var(--rv-delay, 0s),
    clip-path 1.2s var(--rv-ease-io) var(--rv-delay, 0s);
}

.ers-motion [data-rv]:not(.is-in):not([data-rv="clip"]):not([data-rv="words"]) {
  opacity: 0;
}

.ers-motion [data-rv="up"]:not(.is-in) {
  transform: translate3d(0, 46px, 0);
}

.ers-motion [data-rv="left"]:not(.is-in) {
  transform: translate3d(-56px, 0, 0);
}

.ers-motion [data-rv="right"]:not(.is-in) {
  transform: translate3d(56px, 0, 0);
}

/* cards rise out of a slight tilt, like they are being laid on the table */
.ers-motion [data-rv="card"]:not(.is-in) {
  transform: perspective(900px) translate3d(0, 60px, 0) rotateX(14deg) scale(0.96);
}

.ers-motion [data-rv="zoom"]:not(.is-in) {
  transform: scale(0.9);
}

.ers-motion [data-rv="fade"]:not(.is-in) {
  transform: none;
}

.ers-motion [data-rv].is-in {
  opacity: 1;
}


/* ---------- image wipes ---------- */
/* the frame wipes open bottom-to-top while the photo inside settles from a zoom */
.ers-motion [data-rv="clip"] {
  opacity: 1;
}

/* --rv-r is the element's own corner radius (set by the script) so the wipe keeps its corners */
.ers-motion [data-rv="clip"]:not(.is-in) {
  opacity: 1;
  clip-path: inset(100% 0 0 0 round var(--rv-r, 0px));
}

.ers-motion [data-rv="clip"].is-in {
  clip-path: inset(0 0 0 0 round var(--rv-r, 0px));
}

.ers-motion [data-rv="clip"] img {
  transition: scale 1.6s var(--rv-ease) var(--rv-delay, 0s), transform 0.6s ease;
}

.ers-motion [data-rv="clip"]:not(.is-in) img {
  scale: 1.35;
}

/* a bare <img> (no frame around it) wipes and settles by itself */
.ers-motion img[data-rv="clip"] {
  transition: clip-path 1.3s var(--rv-ease-io) var(--rv-delay, 0s), scale 1.8s var(--rv-ease) var(--rv-delay, 0s);
}

.ers-motion img[data-rv="clip"]:not(.is-in) {
  scale: 1.12;
}

/* ---------- split headings ---------- */
.rv-w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  /* room for Turkish diacritics (İ, Ş, Ğ) and descenders inside the mask */
  padding: 0.16em 0.05em 0.12em;
  margin: -0.16em -0.05em -0.12em;
}

.rv-wi {
  display: inline-block;
  transform-origin: 0 100%;
}

/* the word wrappers are plain spans; keep heading rules like `.ers-hero2 h1 span` (the blue word)
   off them - they inherit the colour of whatever span they sit in */
.ers-motion .rv-w,
.ers-motion .rv-wi {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: inherit;
}

.ers-motion [data-rv="words"] {
  opacity: 1;
  transform: none;
}

.ers-motion [data-rv="words"] .rv-wi {
  transition: transform 1.1s var(--rv-ease) calc(var(--rv-delay, 0s) + var(--i, 0) * 70ms);
}

.ers-motion [data-rv="words"]:not(.is-in) .rv-wi {
  transform: translate3d(0, 140%, 0) rotate(5deg);
}

/* ---------- details that play after their parent appears ---------- */
.ers-motion .ers-svc-card[data-rv] .ers-svc-icon,
.ers-motion .ers-cx-card[data-rv] .ers-cx-icon,
.ers-motion .ers-mv-card[data-rv] .ers-mv-card-icon,
.ers-motion .ers-acc-item[data-rv] .ers-acc-icon,
.ers-motion .ers-letter-card[data-rv] .ers-letter-icon {
  transition: transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--rv-delay, 0s) + 0.25s);
}

.ers-motion .ers-svc-card[data-rv]:not(.is-in) .ers-svc-icon,
.ers-motion .ers-cx-card[data-rv]:not(.is-in) .ers-cx-icon,
.ers-motion .ers-mv-card[data-rv]:not(.is-in) .ers-mv-card-icon,
.ers-motion .ers-acc-item[data-rv]:not(.is-in) .ers-acc-icon,
.ers-motion .ers-letter-card[data-rv]:not(.is-in) .ers-letter-icon {
  transform: scale(0.3) rotate(-35deg);
}

/* E · R · S: the big letters climb out of the card */
.ers-motion .ers-letter-card[data-rv] .ers-big-letter {
  display: inline-block;
  transition: clip-path 1.1s var(--rv-ease-io) calc(var(--rv-delay, 0s) + 0.2s),
    transform 1.1s var(--rv-ease) calc(var(--rv-delay, 0s) + 0.2s);
}

.ers-motion .ers-letter-card[data-rv]:not(.is-in) .ers-big-letter {
  clip-path: inset(100% 0 0 0);
  transform: translateY(40%);
}

.ers-motion .ers-letter-card[data-rv].is-in .ers-big-letter {
  clip-path: inset(-10% -10% -10% -10%);
}

/* numbered steps: the number stamps in a beat after the row */
.ers-motion .ers-steps li[data-rv] .ers-step-no,
.ers-motion .ers-cx-topic[data-rv] .ers-cx-topic-num {
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--rv-delay, 0s) + 0.2s),
    opacity 0.5s ease calc(var(--rv-delay, 0s) + 0.2s);
}

.ers-motion .ers-steps li[data-rv]:not(.is-in) .ers-step-no,
.ers-motion .ers-cx-topic[data-rv]:not(.is-in) .ers-cx-topic-num {
  transform: scale(0.2);
  opacity: 0;
}

/* list bullets cascade */
.ers-motion .ers-list[data-rv] > li {
  transition: opacity 0.7s var(--rv-ease), transform 0.7s var(--rv-ease);
  transition-delay: calc(var(--rv-delay, 0s) + var(--li, 0) * 60ms);
}

.ers-motion .ers-list[data-rv]:not(.is-in) > li {
  opacity: 0;
  transform: translateX(-18px);
}

/* ---------- scroll-linked parallax (vars written by the script) ---------- */
/* heroes: --sy = px scrolled */
.ers-motion .ers-hero2-bg,
.ers-motion .ers-page-hero-bg {
  translate: 0 calc(var(--sy, 0) * 0.35px);
}

/* the text lifts and fades as the hero scrolls away - desktop only, where the hero fits one screen;
   on narrow screens the text column is tall and would fade while still being read */
@media (min-width: 992px) {
  .ers-motion .ers-hero2-text,
  .ers-motion .ers-page-text {
    translate: 0 calc(var(--sy, 0) * -0.12px);
    opacity: calc(1 - var(--sy, 0) / 750);
  }
}

.ers-motion .ers-hero2-visual {
  translate: 0 calc(var(--sy, 0) * 0.08px);
}

.ers-motion .ers-hero2-shape {
  translate: 0 calc(var(--sy, 0) * -0.1px);
  rotate: calc(var(--sy, 0) * 0.012deg);
}

.ers-motion .ers-page-visual {
  translate: 0 calc(var(--sy, 0) * 0.06px);
}

.ers-motion .ers-page-visual::before {
  translate: 0 calc(var(--sy, 0) * -0.08px);
}

/* framed photos drift inside their frame: --p runs -1 (above centre) .. 1 (below) */
.ers-motion .rv-ipx img {
  scale: 1.16;
  translate: 0 calc(var(--p, 0) * -6.5%);
}

.ers-motion [data-rv="clip"].rv-ipx:not(.is-in) img {
  scale: 1.45;
}

/* the ERS watermark turns slowly as its section passes */
.ers-motion .ers-ers-mark {
  translate: 0 calc(var(--p, 0) * 90px);
  rotate: calc(var(--p, 0) * -28deg);
}

@media (prefers-reduced-motion: reduce) {
  .ers-progress {
    display: none;
  }
}
