/* ============ BASE ============ */
html {
  cursor: none;
}
@media (hover: none) {
  html { cursor: auto; }
  .cursor-dot, .cursor-ring { display: none; }
}

/* ============ CUSTOM CURSOR ============ */
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 8px; height: 8px;
  background: #0a0a0a;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  background: #fff;
}
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 40px; height: 40px;
  border: 1px solid #fff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width .3s ease, height .3s ease, opacity .3s ease;
  mix-blend-mode: difference;
}
.cursor-ring.hovering {
  width: 72px; height: 72px;
  opacity: .6;
}

/* ============ GRAIN ============ */
.grain {
  position: fixed;
  inset: -100%;
  z-index: 60;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  30% { transform: translate(3%, -15%); }
  50% { transform: translate(12%, 9%); }
  70% { transform: translate(9%, 4%); }
  90% { transform: translate(-1%, 7%); }
}

/* ============ OUTLINE TEXT ============ */
.outline-text {
  color: transparent;
  -webkit-text-stroke: 2px #0a0a0a;
}
.outline-text-light {
  color: transparent;
  -webkit-text-stroke: 2px #f4f4f2;
}
@media (max-width: 768px) {
  .outline-text { -webkit-text-stroke-width: 1.2px; }
  .outline-text-light { -webkit-text-stroke-width: 1.2px; }
}

/* ============ REVEAL ON SCROLL ============ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity .9s cubic-bezier(.16, 1, .3, 1), transform .9s cubic-bezier(.16, 1, .3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ MASK REVEAL (заглавия) ============ */
.mask-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}
.mask-inner {
  transform: translateY(115%) rotate(2deg);
  transform-origin: left top;
  transition: transform 1.1s cubic-bezier(.16, 1, .3, 1);
  transition-delay: var(--d, 0s);
  will-change: transform;
}
.reveal-mask.visible .mask-inner {
  transform: translateY(0) rotate(0deg);
}

/* ============ HERO ============ */
.hero-logo {
  position: absolute;
  right: -5%;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(300px, 40vw, 640px);
  opacity: .06;
  z-index: -1;
}

/* ============ MARQUEE ============ */
.marquee {
  display: flex;
  animation: marquee 30s linear infinite;
}
.marquee:hover {
  animation-play-state: paused;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============ NAV ============ */
.nav-link {
  position: relative;
  padding-bottom: 4px;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .4s cubic-bezier(.16, 1, .3, 1);
}
.nav-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ============ WORK CARDS ============ */
.work-img {
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: #0f0f0f;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.1s cubic-bezier(.16, 1, .3, 1);
}
.work-card.visible .work-img {
  clip-path: inset(0 0 0% 0);
}
.work-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: grayscale(100%) contrast(1.02);
  transform: scale(1.12);
  transition: filter .7s ease, transform 1.2s cubic-bezier(.16, 1, .3, 1);
}
.work-card.visible .work-img img {
  transform: scale(1.02);
}
.work-card.visible:hover .work-img img {
  filter: grayscale(0%);
  transform: scale(1.06);
}

@media (max-width: 768px) {
  .work-img img {
    filter: grayscale(0%);
  }
  .work-card.visible:hover .work-img img {
    transform: scale(1.02);
  }
}
.work-card.hidden-card {
  display: none;
}

/* ============ FILTER BUTTONS ============ */
.filter-btn {
  padding: .6rem 1.4rem;
  border: 1px solid rgba(244, 244, 242, .25);
  border-radius: 999px;
  transition: all .3s ease;
}
.filter-btn:hover,
.filter-btn.active {
  background: #f4f4f2;
  color: #0a0a0a;
  border-color: #f4f4f2;
}

/* ============ CONTACT ============ */
.contact-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(400px, 55vw, 900px);
  opacity: .04;
  filter: invert(1);
}

/* ============ SCROLL PROGRESS ============ */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: #0a0a0a;
  width: 0%;
  z-index: 100;
  mix-blend-mode: difference;
  pointer-events: none;
}
@media (max-width: 768px) {
  .scroll-progress { height: 3px; }
}

/* ============ HEADER HIDE/SHOW ============ */
header {
  transition: transform .5s cubic-bezier(.16, 1, .3, 1), opacity .5s ease;
}
header.hidden-nav {
  transform: translateY(-100%);
  opacity: 0;
}

/* ============ HERO LOGO PARALLAX ============ */
.hero-logo {
  will-change: transform;
}

/* ============ WORK CARD LIFT ============ */
.work-card {
  transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}
.work-card:hover {
  transform: translateY(-8px);
}

/* ============ NAV MAGNETIC ============ */
.nav-link {
  display: inline-block;
  transition: transform .3s cubic-bezier(.16, 1, .3, 1);
}

/* ============ SERVICE ROW ARROW ============ */
.service-row {
  position: relative;
}
.service-row h3 {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
.service-row h3::after {
  content: '→';
  font-size: 0.7em;
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity .4s ease, transform .5s cubic-bezier(.16, 1, .3, 1);
}
.service-row:hover h3::after {
  opacity: 1;
  transform: translateX(0);
}

/* ============ MOBILE MENU ============ */
#mobile-menu.open {
  display: flex;
}
.mobile-link {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease;
}
#mobile-menu.open .mobile-link {
  opacity: 1;
  transform: translateY(0);
}
#mobile-menu.open .mobile-link:nth-child(1) { transition-delay: .1s; }
#mobile-menu.open .mobile-link:nth-child(2) { transition-delay: .18s; }
#mobile-menu.open .mobile-link:nth-child(3) { transition-delay: .26s; }
#mobile-menu.open .mobile-link:nth-child(4) { transition-delay: .34s; }
