/* ============================================================
   GRUPO CREA — magic layer (Awwwards mode)
   Preloader · aurora · leaf canvas · custom cursor · hover cards
   split-text · velocity marquee · pinned hero · grain
   ============================================================ */

/* ---------- stacking: pinned hero, page slides over ---------- */
.hero {
  position: sticky;
  top: 0;
  min-height: 100svh;
  padding-bottom: 0;
  z-index: 1;
}
.hero > * { position: relative; z-index: 2; }
.hero-media { flex: 1; height: auto; min-height: 240px; }

#after-hero {
  position: relative;
  z-index: 2;
  background: var(--bg);
  border-radius: 36px 36px 0 0;
  margin-top: -34px;
  padding-top: 12px;
  box-shadow: 0 -26px 60px -30px oklch(0.25 0.04 190 / 0.4);
  overflow: hidden;
}
#after-hero .marquee { margin-top: 10px; }

@media (max-width: 768px) {
  .hero { position: static; min-height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .hero { position: static; min-height: auto; }
}

/* ---------- preloader ---------- */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: transform 0.95s cubic-bezier(0.76, 0, 0.24, 1);
}
#preloader.lift { transform: translateY(-102%); border-radius: 0 0 48px 48px; box-shadow: 0 40px 80px -30px oklch(0.25 0.04 190 / 0.4); }
#preloader.done { display: none; }

.pl-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
}
.pl-logo {
  width: min(92vw, 1440px);
  height: auto;
  opacity: 0;
  transform: scale(0.9) translateY(12px);
  filter: blur(6px);
  -webkit-mask-image: linear-gradient(75deg, #000 35%, #0006 55%, #000 75%);
  mask-image: linear-gradient(75deg, #000 35%, #0006 55%, #000 75%);
  -webkit-mask-size: 280% 100%;
  mask-size: 280% 100%;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
}
#preloader.play .pl-logo {
  animation: pllogo 1.15s var(--ease-out) 0.15s forwards,
             plsheen 1.25s var(--ease-out) 0.35s forwards;
}
#preloader.quick.play .pl-logo {
  animation: pllogo 0.85s var(--ease-out) 0.05s forwards,
             plsheen 0.95s var(--ease-out) 0.2s forwards;
}
@keyframes pllogo {
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes plsheen {
  to { -webkit-mask-position: 0% 0; mask-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
  #preloader { display: none; }
}

/* ---------- aurora hero background ---------- */
.aurora {
  position: absolute;
  inset: -18%;
  z-index: 0 !important;
  pointer-events: none;
  filter: blur(72px);
  will-change: transform;
}
.aurora b {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
}
.aurora .a1 {
  width: 44vw; height: 44vw;
  left: 4%; top: 12%;
  background: var(--teal);
  animation: drift1 24s ease-in-out infinite alternate;
}
.aurora .a2 {
  width: 36vw; height: 36vw;
  right: 6%; top: 4%;
  background: var(--lime);
  animation: drift2 19s ease-in-out infinite alternate;
}
.aurora .a3 {
  width: 40vw; height: 40vw;
  right: 18%; bottom: 6%;
  background: var(--mint);
  animation: drift3 28s ease-in-out infinite alternate;
}
.aurora .a4 {
  width: 24vw; height: 24vw;
  left: 30%; bottom: 18%;
  background: var(--leaf);
  opacity: 0.42;
  animation: drift2 33s ease-in-out infinite alternate-reverse;
}
@keyframes drift1 { to { transform: translate(9%, 14%) scale(1.18); } }
@keyframes drift2 { to { transform: translate(-12%, 8%) scale(0.88); } }
@keyframes drift3 { to { transform: translate(7%, -12%) scale(1.12); } }
body[data-motion="sutil"] .aurora b,
body[data-motion="sutil"] .leaf-canvas { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .aurora b { animation: none; }
}

/* ---------- leaf particle canvas ---------- */
.leaf-canvas {
  position: absolute;
  inset: 0;
  z-index: 4 !important;
  pointer-events: none;
}

/* ---------- split text ---------- */
[data-split] .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}
[data-split] .ch {
  display: inline-block;
  transform: translateY(118%);
  transition: transform 0.85s var(--ease-out);
  transition-delay: calc(var(--i) * 0.028s);
}
.h2[data-split].rv { transform: none; }
.h2[data-split].rv.in .ch { transform: none; }

.display .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.display .ln .ch {
  display: inline-block;
  transform: translateY(118%);
  transition: transform 1s var(--ease-out) calc(0.12s + var(--i) * 0.045s);
}
.intro.go .display .ln .ch { transform: none; }

.rotor i .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.55em) rotate(8deg);
  transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
  transition-delay: calc(var(--i) * 0.04s);
}
.rotor i.on .ch { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  [data-split] .ch, .display .ln .ch, .rotor i .ch {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
}

/* ---------- clip-reveal images ---------- */
.ncard .ph {
  clip-path: inset(100% 0 0 0 round var(--radius));
  transition: clip-path 1.1s var(--ease-out), transform 0.4s var(--ease-out);
}
.ncard.rv.in .ph { clip-path: inset(0 0 0 0 round var(--radius)); }
@media (prefers-reduced-motion: reduce) {
  .ncard .ph { clip-path: none; transition: none; }
}

/* ---------- custom cursor ---------- */
@media (pointer: fine) {
  body[data-cursor="on"], body[data-cursor="on"] * { cursor: none !important; }
}
#cur-dot, #cur-ring {
  position: fixed;
  left: 0; top: 0;
  z-index: 95;
  pointer-events: none;
  border-radius: 99px;
  opacity: 0;
}
body[data-cursor="on"] #cur-dot.live,
body[data-cursor="on"] #cur-ring.live { opacity: 1; }
#cur-dot {
  width: 7px; height: 7px;
  background: var(--ink);
  margin: -3.5px 0 0 -3.5px;
}
#cur-ring {
  width: 38px; height: 38px;
  margin: -19px 0 0 -19px;
  border: 1.5px solid oklch(0.27 0.035 200 / 0.55);
  display: grid;
  place-items: center;
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out),
              margin 0.3s var(--ease-out), background 0.3s, border-color 0.3s, opacity 0.3s;
}
#cur-ring span {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bg);
  opacity: 0;
  transition: opacity 0.2s;
}
#cur-ring.hov {
  width: 56px; height: 56px;
  margin: -28px 0 0 -28px;
  background: oklch(0.27 0.035 200 / 0.08);
}
#cur-ring.view {
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  background: var(--ink);
  border-color: var(--ink);
}
#cur-ring.view span { opacity: 1; }

/* ---------- wing hover preview card ---------- */
#wing-card {
  position: fixed;
  left: 0; top: 0;
  z-index: 55;
  width: 290px;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.3s, transform 0.45s var(--ease-out);
  box-shadow: 0 30px 70px -20px oklch(0.25 0.04 190 / 0.5);
  will-change: left, top;
}
#wing-card.show { opacity: 1; transform: scale(1); }
#wing-card .wc-pane {
  position: absolute;
  inset: 0;
  display: none;
  border-radius: 0;
}
#wing-card .wc-pane.on { display: grid; }
#wing-card .wc-pane img {
  width: 70%;
  margin: 0 auto;
}
@media (pointer: coarse), (max-width: 768px) {
  #wing-card, #cur-dot, #cur-ring { display: none; }
}

/* ---------- grain ---------- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
  opacity: 0.045;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="180" height="180"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="2" stitchTiles="stitch"/></filter><rect width="180" height="180" filter="url(%23n)"/></svg>');
}
