/* page transitions: a short wipe plays on leaving (before a real navigation
   fires) and on arriving (covers by default in critical CSS so there is no
   flash of content before JS can animate it away). Real <a> navigation is
   never hijacked — back/forward, bookmarks and direct links stay native. */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: var(--color-bg);
  pointer-events: none;
}

/* subtle cinematic film grain, pure CSS, no image asset */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Lenis smooth scroll (recommended base rules) */
html.lenis,
html.lenis body {
  height: auto;
}

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

.lenis.lenis-stopped {
  overflow: hidden;
}

/* native cross-document view transitions (progressive enhancement, ignored where unsupported) */
@view-transition {
  navigation: auto;
}

::view-transition-group(root) {
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* custom cursor */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--color-accent);
  pointer-events: none;
  z-index: 300;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out), margin 0.3s var(--ease-out),
    background 0.3s var(--ease-out), opacity 0.2s linear;
}

html.has-custom-cursor,
html.has-custom-cursor a,
html.has-custom-cursor button,
html.has-custom-cursor .btn {
  cursor: none;
}

html.has-custom-cursor .custom-cursor {
  opacity: 1;
}

.custom-cursor.is-interactive {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  background: color-mix(in srgb, var(--color-accent) 25%, transparent);
  border: 1px solid var(--color-accent);
}

.custom-cursor.is-project {
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  background: var(--color-accent);
}

.custom-cursor__label {
  font-size: var(--step--1);
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 0.2s linear;
}

.custom-cursor.is-project .custom-cursor__label {
  opacity: 1;
}

/* cinematic intro overlay (home page only): "The Digital Reveal" —
   a point of light constructs a geometric frame that becomes the mask
   through which the real hero is revealed. No text, no percentage. */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  opacity: 1;
  overflow: hidden;
  will-change: opacity;
}

.intro-overlay__scene {
  width: min(42vw, 42vh, 320px);
  height: min(42vw, 42vh, 320px);
  overflow: visible;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--color-accent) 55%, transparent));
}

.intro-dot {
  fill: var(--color-accent);
  opacity: 0;
  transform-origin: 200px 200px;
}

.intro-line {
  fill: none;
  stroke: var(--color-accent-soft);
  stroke-width: 1.25;
  opacity: 0;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  transform-origin: 200px 200px;
  vector-effect: non-scaling-stroke;
}

.intro-overlay__skip {
  position: absolute;
  right: clamp(1.25rem, 4vw, 2.5rem);
  bottom: clamp(1.25rem, 4vw, 2.5rem);
  font-size: var(--step--1);
  color: var(--color-slate);
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  opacity: 0;
  transition: color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.intro-overlay__skip:hover,
.intro-overlay__skip:focus-visible {
  color: var(--color-text);
  border-color: var(--color-accent);
}

body.is-intro-locked {
  overflow: hidden;
}

/* 3d tilt perspective for project cards */
.project-grid {
  perspective: 1200px;
}

.project-card {
  transform-style: preserve-3d;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .custom-cursor,
  .intro-overlay {
    display: none;
  }
}
