/* =========================================================
   HIMA MEKA PENS — Motion & Effects Layer
   Preloader, custom cursor, page transitions, 3D hero mount
   ========================================================= */

/* ---------- Cross-fade base ---------- */
body { transition: opacity .4s ease; }

/* ---------- Preloader ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-secondary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .6s ease, visibility .6s ease;
}
.preloader::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 36px 36px;
}
.preloader.done { opacity: 0; visibility: hidden; pointer-events: none; }

.preloader-inner { position: relative; text-align: center; }

.preloader-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.22em;
  color: rgba(255,255,255,0.55); text-transform: uppercase;
  margin-bottom: 22px;
  opacity: 0; animation: fadeIn .6s ease forwards; animation-delay: .05s;
}
.preloader-eyebrow span { width: 16px; height: 1.5px; background: var(--color-primary); display: inline-block; }

.preloader-ring { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.preloader-ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track {
  fill: none; stroke: rgba(255,255,255,0.10); stroke-width: 2.5;
}
.ring-fill {
  fill: none; stroke: var(--color-primary); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 339.3; stroke-dashoffset: 339.3;
  filter: drop-shadow(0 0 6px rgba(245,130,32,0.55));
}
.preloader-logo {
  position: absolute; top: 50%; left: 50%;
  width: 56px; height: 56px;
  transform: translate(-50%, -50%) scale(0.7);
  object-fit: contain;
  opacity: 0;
  animation: logoIntro 1s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: .1s;
  filter: drop-shadow(0 10px 26px rgba(245,130,32,0.35));
}
@keyframes logoIntro { to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.preloader-meta { margin-top: 22px; }
.preloader-percent { font-family: var(--font-mono); color: #fff; font-size: 1.7rem; font-weight: 600; letter-spacing: 0.02em; }
.preloader-percent .unit { color: var(--color-primary); font-size: 1rem; margin-left: 2px; }
.preloader-label {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.16em;
  color: rgba(255,255,255,0.5); margin-top: 6px; text-transform: uppercase;
}

.preloader-scale {
  display: flex; align-items: flex-end; justify-content: center; gap: 5px;
  margin-top: 18px; height: 14px;
}
.preloader-scale span {
  width: 3px; height: 6px; background: rgba(255,255,255,0.14);
  border-radius: 1px; transition: background .25s ease, height .25s ease;
}
.preloader-scale span:nth-child(5n) { height: 10px; }
.preloader-scale span.lit {
  background: var(--color-primary);
  height: 14px;
  box-shadow: 0 0 6px rgba(245,130,32,0.5);
}

/* ---------- Custom cursor ---------- */
@media (hover: hover) and (pointer: fine) {
  body.has-custom-cursor, body.has-custom-cursor a, body.has-custom-cursor button {
    cursor: none;
  }
  .cursor-dot {
    position: fixed; top: 0; left: 0;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--color-primary);
    pointer-events: none; z-index: 10000;
    will-change: transform;
  }
  .cursor-ring {
    position: fixed; top: 0; left: 0;
    width: 32px; height: 32px; border-radius: 50%;
    border: 1.5px solid rgba(245,130,32,0.55);
    pointer-events: none; z-index: 10000;
    transition: width .25s ease, height .25s ease, border-color .25s ease, background .25s ease;
    will-change: transform;
  }
  .cursor-ring.hover {
    width: 52px; height: 52px;
    background: rgba(245,130,32,0.1);
    border-color: var(--color-primary);
  }
}

/* ---------- Hero 3D mounts (left + right, smaller & subtler) ---------- */
.hero-3d-left, .hero-3d-right {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}
.hero-3d-left {
  top: 16%;
  left: -50px;
  width: 220px; height: 220px;
  opacity: 0.5;
}
.hero-3d-right {
  bottom: 8%;
  right: -40px;
  width: 250px; height: 250px;
  opacity: 0.55;
}
.hero-3d-left canvas, .hero-3d-right canvas { display: block; }

@media (max-width: 1200px) {
  .hero-3d-left { width: 170px; height: 170px; }
  .hero-3d-right { width: 190px; height: 190px; }
}
@media (max-width: 900px) {
  .hero-3d-left, .hero-3d-right { display: none; }
}
