/* =====================================================================
 * Site motion layer — public pages (see site-motion.js)
 * Public design system only: Obsidian, Solar Gold, Dusk Violet.
 * ===================================================================== */

/* ---- Lenis ---- */
html.lenis,
html.lenis body {
  height: auto;
}

html.lenis {
  scroll-behavior: auto !important;
}

.lenis [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

/* ---- Parallax: individual properties so the element's own transform stays intact ---- */
.sm-parallax {
  scale: 1.1;
  translate: 0 var(--sm-py, 0);
  will-change: translate;
}

/* ---- Magnet ---- */
.sm-magnet {
  transition: translate 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Spotlight ---- */
.sm-spot-host {
  position: relative;
}

.sm-spot-iso {
  isolation: isolate;
}

.sm-spot {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.sm-spot.is-on {
  opacity: 1;
}

.sm-spot-glow {
  position: absolute;
  left: 0;
  top: 0;
  width: 420px;
  height: 420px;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 197, 66, 0.13) 0%, rgba(120, 113, 205, 0.08) 38%, transparent 68%);
  will-change: transform;
}

/* ---- "Sides" link cards: the three faces of the site (art director, developer, creator).
   Shared by the homepage, /developer and /creator so the pages point at each other the same way. ---- */
.or-sides-section {
  position: relative;
  padding: clamp(72px, 8vw, 128px) 0;
  background: #080811;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.or-sides-inner {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4.2vw, 72px);
}

.or-sides-kicker {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f5c542;
}

.or-sides-title {
  margin: 0 0 clamp(28px, 4vw, 56px);
  max-width: 50rem;
  font-size: clamp(2rem, 4.3vw, 4.2rem);
  font-weight: 800;
  line-height: 1.28;
  color: #f6f4ff;
}

html[lang="en"] .or-sides-title {
  line-height: 1.06;
  letter-spacing: -0.03em;
}

/* Texts inside carry lang="ar" / lang="en"; show the page language only. */
html[lang="en"] .or-sides-section [lang="ar"],
html:not([lang="en"]) .or-sides-section [lang="en"],
html[lang="en"] .or-sides [lang="ar"],
html:not([lang="en"]) .or-sides [lang="en"] {
  display: none !important;
}

.or-sides {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 22px);
}

.or-sides-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* One colour per side: --side is the tint (r, g, b), --side-ink the readable text colour. */
.or-side {
  --side: 245, 197, 66;
  --side-ink: #f5c542;
}
.or-side[data-side="dev"] {
  --side: 120, 113, 205;
  --side-ink: #a9a3f0;
}
.or-side[data-side="creator"] {
  --side: 255, 158, 170;
  --side-ink: #ff9eaa;
}

.or-side {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: clamp(150px, 15vw, 220px);
  padding: clamp(20px, 2.2vw, 32px);
  border: 1px solid rgba(var(--side), 0.26);
  border-radius: clamp(16px, 1.6vw, 24px);
  background: linear-gradient(160deg, rgba(var(--side), 0.1) 0%, rgba(var(--side), 0.02) 60%), rgba(255, 255, 255, 0.02);
  color: #f6f4ff;
  text-decoration: none;
  transition: border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.or-side-tag {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--side-ink);
}

.or-side-title {
  font-size: clamp(1.25rem, 2.1vw, 1.9rem);
  font-weight: 800;
  line-height: 1.35;
  color: #f6f4ff;
}

html[lang="en"] .or-side-title {
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.or-side-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(236, 233, 255, 0.68);
}

.or-side-go {
  margin-top: auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(var(--side), 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.or-side-go::before {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--side-ink);
  border-inline-end: 2px solid var(--side-ink);
  transform: rotate(45deg);
}

html[dir="rtl"] .or-side-go::before {
  transform: rotate(-45deg);
}

/* The page you are on sits in the middle and reads strongest. */
.or-side.is-current {
  border-color: rgba(var(--side), 0.65);
  background: linear-gradient(160deg, rgba(var(--side), 0.2) 0%, rgba(var(--side), 0.05) 65%), rgba(255, 255, 255, 0.02);
  box-shadow: 0 18px 50px rgba(var(--side), 0.12);
}

.or-side-here {
  margin-top: auto;
  align-self: flex-start;
  min-height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(var(--side), 0.45);
  border-radius: 999px;
  color: var(--side-ink);
  font-size: 0.8rem;
  font-weight: 600;
}

.or-side:focus-visible {
  outline: 2px solid var(--side-ink);
  outline-offset: 4px;
}

@media (hover: hover) {
  a.or-side:hover {
    border-color: rgba(var(--side), 0.7);
  }
  .or-side:hover .or-side-go {
    transform: translate3d(calc(var(--or-go, 1) * 6px), 0, 0);
    border-color: var(--side-ink);
  }
  html[dir="rtl"] .or-side:hover .or-side-go {
    --or-go: -1;
  }
}

@media (max-width: 820px) {
  .or-sides,
  .or-sides-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .or-side {
    min-height: 0;
  }
}

/* ---- Language switch: the old language pushes forward and fades, the new one settles in.
   Both stay at or above full size, so no page edge is ever exposed. ---- */
html.lang-switching::view-transition-old(root) {
  animation: smLangOut 0.34s cubic-bezier(0.4, 0, 1, 1) both;
}

html.lang-switching::view-transition-new(root) {
  animation: smLangIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

@keyframes smLangOut {
  to {
    opacity: 0;
    transform: scale(1.02);
  }
}

@keyframes smLangIn {
  from {
    opacity: 0;
    transform: scale(1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  html.lang-switching::view-transition-old(root),
  html.lang-switching::view-transition-new(root) {
    animation: none;
  }
  .sm-parallax {
    scale: none;
    translate: none;
  }
  .sm-magnet,
  .sm-spot {
    transition: none;
  }
}
