/* =========================================================
   IRA Lifecare — modern motion layer
   Motion-primitives style effects + Haikei-style SVG waves/blobs
   + realtime colour (driven by time of day, cursor and scroll).
   Everything reads --rt1/--rt2/--rt3 which modern.js updates live.
   ========================================================= */

@property --mp-ang {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

:root {
  /* H S L channels — used as hsl(var(--rt1) / .3) */
  --rt1: 190 62% 46%;
  --rt2: 24 70% 55%;
  --rt3: 215 62% 52%;
  --mp-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

::selection {
  background: hsl(var(--rt1) / 0.28);
}

:focus-visible {
  outline: 2px solid hsl(var(--rt1));
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Page curtain (shown once per session) ---------- */
html.mp-loading::before,
html.mp-leaving::before {
  content: "";
  position: fixed;
  inset: 0;
  background: #16303a;
  z-index: 9998;
}
html.mp-loading::after,
html.mp-leaving::after {
  content: "IRA Lifecare";
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  color: #f7f3ec;
  font: 600 28px/1 "Fraunces", serif;
  letter-spacing: 0.02em;
  animation: mp-pulse 1.1s ease-in-out infinite;
}
/* Safety net: if JS never runs, the curtain lifts by itself */
html.mp-loading::before {
  animation: mp-curtain 0.9s cubic-bezier(0.76, 0, 0.24, 1) 3s forwards;
}
html.mp-loading::after {
  animation: mp-pulse 1.1s ease-in-out infinite, mp-hide 0.3s ease 3s forwards;
}
html.mp-leaving::before {
  animation: mp-curtain 0.9s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}
html.mp-leaving::after {
  animation: mp-hide 0.35s ease forwards;
}
@keyframes mp-curtain {
  to {
    transform: translateY(-100%);
  }
}
@keyframes mp-hide {
  to {
    opacity: 0;
  }
}
@keyframes mp-pulse {
  50% {
    opacity: 0.55;
  }
}

/* ---------- Scroll progress ---------- */
.mp-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9990;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(
    90deg,
    hsl(var(--rt1)),
    hsl(var(--rt2)),
    hsl(var(--rt3))
  );
  pointer-events: none;
}

/* ---------- Header: glass + hide on scroll down ---------- */
#siteHeader {
  transition:
    transform 0.45s var(--mp-ease),
    box-shadow 0.3s ease,
    background-color 0.3s ease !important;
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}
#siteHeader.mp-hide {
  transform: translateY(-110%);
}
@media (min-width: 768px) {
  #navLinks {
    position: relative;
    isolation: isolate;
  }
}
.mp-pill {
  position: absolute;
  top: 50%;
  left: 0;
  height: 36px;
  border-radius: 999px;
  background: hsl(var(--rt1) / 0.14);
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  transform: translate(0, -50%);
  transition:
    transform 0.4s var(--mp-ease),
    width 0.4s var(--mp-ease),
    opacity 0.25s ease;
}

/* ---------- Custom cursor ---------- */
.mp-cursor-dot,
.mp-cursor-ring {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 9995;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mp-cursor-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: hsl(var(--rt2));
}
.mp-cursor-ring {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 1.5px solid hsl(var(--rt1) / 0.85);
  transition:
    opacity 0.25s ease,
    width 0.3s var(--mp-ease),
    height 0.3s var(--mp-ease),
    margin 0.3s var(--mp-ease),
    background-color 0.3s ease;
}
html.mp-cursor-on .mp-cursor-dot,
html.mp-cursor-on .mp-cursor-ring {
  opacity: 1;
}
.mp-cursor-ring.is-link {
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  background: hsl(var(--rt1) / 0.12);
}
.mp-cursor-ring.is-card {
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-style: dashed;
}

/* ---------- Split text (TextEffect: blur-in per word) ---------- */
.mp-w {
  display: inline-block;
  white-space: pre;
}
.mp-wi {
  display: inline-block;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(0.45em);
  transition:
    opacity 0.7s var(--mp-ease),
    filter 0.7s var(--mp-ease),
    transform 0.7s var(--mp-ease);
  transition-delay: calc(var(--i, 0) * 55ms);
  will-change: opacity, filter, transform;
}
.mp-in .mp-wi {
  opacity: 1;
  filter: none;
  transform: none;
}

/* ---------- Scroll reveal upgrade (blur + softer travel) ---------- */
main .reveal {
  transition-property: opacity, transform, filter, box-shadow, border-color !important;
  transition-duration: 0.9s, 0.9s, 0.9s, 0.4s, 0.4s !important;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1) !important;
}
main .reveal.opacity-0 {
  filter: blur(6px);
}
main .reveal.opacity-100 {
  filter: blur(0);
}
main .reveal.translate-y-6 {
  --tw-translate-y: 16px;
}

/* ---------- Spotlight cards (follow the cursor) ---------- */
.mp-card {
  transition:
    box-shadow 0.4s ease,
    border-color 0.4s ease;
}
.mp-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    hsl(var(--rt1) / 0.16),
    hsl(var(--rt2) / 0.06) 45%,
    transparent 70%
  );
  z-index: 1;
}
.mp-card:hover::before {
  opacity: 1;
}
main .mp-card:hover {
  box-shadow: 0 30px 60px -30px hsl(var(--rt1) / 0.45);
  border-color: hsl(var(--rt1) / 0.45);
}

/* ---------- Border trail (rotating realtime-colour border) ---------- */
.mp-trail::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--mp-ang),
    transparent 0 62%,
    hsl(var(--rt1)) 82%,
    hsl(var(--rt2)) 100%
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
  animation: mp-spin 5s linear infinite;
  pointer-events: none;
  z-index: 2;
}
@keyframes mp-spin {
  to {
    --mp-ang: 360deg;
  }
}

/* ---------- Magnetic + shine buttons ---------- */
.mp-mag {
  transition:
    translate 0.35s var(--mp-ease),
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}
.mp-shine {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.mp-shine::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(
    100deg,
    transparent,
    hsl(var(--rt1) / 0.45),
    hsl(var(--rt2) / 0.35),
    transparent
  );
  transform: skewX(-20deg);
  transition: left 0.7s var(--mp-ease);
  z-index: -1;
  pointer-events: none;
}
.mp-shine:hover::after {
  left: 130%;
}

/* ---------- Tilt + parallax images ---------- */
.mp-tilt {
  transition: transform 0.35s var(--mp-ease);
  will-change: transform;
}
.mp-tilt.is-active {
  transition: transform 0.08s linear;
}
.mp-tilt img {
  transform: scale(1.12) translate3d(0, var(--py, 0px), 0);
  will-change: transform;
}

/* ---------- Aurora / blob background (Haikei-style) ---------- */
.mp-aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}
.mp-aurora.is-dark {
  z-index: 15;
  mix-blend-mode: screen;
}
.mp-aurora i {
  position: absolute;
  width: min(60vw, 640px);
  height: min(60vw, 640px);
  filter: blur(70px);
  opacity: 0.32;
  border-radius: 63% 37% 54% 46% / 55% 48% 52% 45%;
  animation:
    mp-drift 22s ease-in-out infinite alternate,
    mp-morph 14s ease-in-out infinite;
}
.mp-aurora.is-dark i {
  opacity: 0.42;
}
.mp-aurora i:nth-child(1) {
  background: hsl(var(--rt1));
  left: -12%;
  top: -30%;
}
.mp-aurora i:nth-child(2) {
  background: hsl(var(--rt2));
  right: -14%;
  top: 6%;
  animation-duration: 28s, 17s;
  animation-direction: alternate-reverse, normal;
}
.mp-aurora i:nth-child(3) {
  background: hsl(var(--rt3));
  left: 28%;
  bottom: -46%;
  animation-duration: 32s, 19s;
}
@keyframes mp-drift {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  to {
    transform: translate3d(8vw, 6vh, 0) rotate(40deg);
  }
}
@keyframes mp-morph {
  0%,
  100% {
    border-radius: 63% 37% 54% 46% / 55% 48% 52% 45%;
  }
  33% {
    border-radius: 40% 60% 35% 65% / 60% 35% 65% 40%;
  }
  66% {
    border-radius: 55% 45% 68% 32% / 42% 62% 38% 58%;
  }
}

/* ---------- Layered waves (Haikei-style), injected by JS ---------- */
.mp-wave {
  position: relative;
  height: 56px;
  margin-top: -55px;
  margin-bottom: -1px;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}
@media (min-width: 768px) {
  .mp-wave {
    height: 84px;
    margin-top: -83px;
  }
}
.mp-wave svg {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 200%;
  height: 100%;
  display: block;
  animation: mp-wave 22s linear infinite;
}
.mp-wave svg:nth-child(1) {
  opacity: 0.28;
  animation-duration: 30s;
}
.mp-wave svg:nth-child(2) {
  opacity: 0.55;
  animation-duration: 21s;
  animation-direction: reverse;
}
.mp-wave svg:nth-child(3) {
  opacity: 1;
  animation-duration: 38s;
}
@keyframes mp-wave {
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

/* ---------- Partner marquee (InfiniteSlider) ---------- */
.mp-marquee-section {
  position: relative;
}
.mp-marquee {
  position: relative;
  overflow: hidden;
  padding: 10px 0;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 8%,
    #000 92%,
    transparent
  );
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.mp-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: mp-scroll 70s linear infinite;
}
.mp-marquee.mp-rev .mp-track {
  animation-direction: reverse;
  animation-duration: 85s;
}
.mp-marquee:hover .mp-track {
  animation-play-state: paused;
}
@keyframes mp-scroll {
  to {
    transform: translate3d(-50%, 0, 0);
  }
}
.mp-item {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: clamp(36px, 6vw, 84px);
  line-height: 1.15;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(247, 243, 236, 0.55);
  transition:
    color 0.4s ease,
    -webkit-text-stroke-color 0.4s ease;
  cursor: default;
}
.mp-marquee.mp-solid .mp-item {
  color: rgba(247, 243, 236, 0.92);
  -webkit-text-stroke: 0;
}
.mp-item:hover {
  color: hsl(var(--rt1));
  -webkit-text-stroke-color: hsl(var(--rt1));
}
.mp-marquee.mp-solid .mp-item:hover {
  color: hsl(var(--rt2));
}
.mp-sep {
  flex: none;
  width: clamp(18px, 2.4vw, 30px);
  height: clamp(18px, 2.4vw, 30px);
  margin: 0 clamp(22px, 3.4vw, 54px);
  color: hsl(var(--rt2));
  animation: mp-rot 9s linear infinite;
}
@keyframes mp-rot {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Live colour chip ---------- */
.mp-live {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(22, 48, 58, 0.12);
  background: rgba(247, 243, 236, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  color: #16303a;
  font: 500 12.5px/1 "Inter", sans-serif;
  cursor: pointer;
  box-shadow: 0 14px 34px -18px rgba(22, 48, 58, 0.5);
  transition:
    transform 0.3s var(--mp-ease),
    box-shadow 0.3s ease;
}
.mp-live:hover {
  transform: translateY(-2px);
}
@media (min-width: 900px) {
  .mp-live {
    display: inline-flex;
  }
}
.mp-live .sw {
  display: inline-flex;
}
.mp-live .sw b {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-left: -4px;
  border: 2px solid #f7f3ec;
}
.mp-live .sw b:first-child {
  margin-left: 0;
  background: hsl(var(--rt1));
}
.mp-live .sw b:nth-child(2) {
  background: hsl(var(--rt2));
}
.mp-live .sw b:nth-child(3) {
  background: hsl(var(--rt3));
}
.mp-live[aria-pressed="true"] .st::after {
  content: " · paused";
  color: #5c6b70;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html.mp-loading::before,
  html.mp-loading::after,
  html.mp-leaving::before,
  html.mp-leaving::after {
    display: none;
  }
  .mp-wi {
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }
  .mp-aurora i,
  .mp-wave svg,
  .mp-trail::after,
  .mp-sep {
    animation: none;
  }
  .mp-track {
    animation: none;
  }
  .mp-marquee {
    overflow-x: auto;
  }
  main .reveal {
    filter: none !important;
  }
}
