:root {
  color-scheme: dark;
  --bg: #020103;
  --line: rgba(255, 255, 255, 0.08);
  --hot: #ff2d78;
  --cyan: #00f5ff;
  --sun: #ff6a2a;
  --logo-size: clamp(52px, 5vw, 82px);
  font-family: "Space Grotesk", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 45, 120, 0.24), transparent 36rem),
    radial-gradient(circle at 18% 42%, rgba(0, 245, 255, 0.08), transparent 28rem),
    radial-gradient(circle at 74% 68%, rgba(255, 106, 42, 0.13), transparent 30rem),
    #020103;
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(180deg, rgba(2, 1, 3, 0.46), transparent 28vh, rgba(2, 1, 3, 0.58)),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      transparent 1px,
      transparent 5px
    );
  mix-blend-mode: screen;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.045;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.8) 0,
      rgba(255, 255, 255, 0.8) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: overlay;
}

.topline {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(100%, 1920px);
  margin: 0 auto;
  padding: clamp(12px, 1.3vw, 22px) clamp(10px, 1vw, 16px);
}

.topline p {
  margin: 0;
  color: rgba(255, 245, 238, 0.86);
  font-size: clamp(1rem, 2.2vw, 2.5rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: lowercase;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  width: var(--logo-size);
  height: var(--logo-size);
  border-radius: 50%;
  filter: drop-shadow(0 18px 38px rgba(0, 0, 0, 0.42));
  opacity: 0.96;
  transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}

.brand-logo:hover,
.brand-logo:focus-visible {
  opacity: 1;
  outline: none;
  transform: translateY(-2px);
  filter: drop-shadow(0 20px 44px rgba(255, 45, 120, 0.2));
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 16px);
  width: min(100%, 1920px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(10px, 1vw, 16px) clamp(10px, 1vw, 16px);
}

.project-card {
  position: relative;
  display: block;
  aspect-ratio: 144 / 100;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.58);
  text-decoration: none;
  animation: rise 520ms ease both;
  animation-delay: var(--delay);
  isolation: isolate;
}

.project-card:nth-child(6n + 1),
.project-card:nth-child(9n + 5),
.project-card:nth-child(7n + 3),
.project-card.is-featured {
  grid-column: auto;
  grid-row: auto;
}

.project-card::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(180deg, transparent 48%, rgba(2, 1, 3, 0.12)),
    radial-gradient(circle at 50% 0%, rgba(255, 45, 120, 0.08), transparent 58%);
  opacity: 0.28;
  transition: opacity 220ms ease;
}

.project-card:hover,
.project-card:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.2);
}

.project-card:hover::after,
.project-card:focus-visible::after {
  opacity: 0.08;
}

.project-card:hover img,
.project-card:focus-visible img {
  transform: scale(1.01);
  filter: saturate(1.03) contrast(1.02) brightness(1);
}

.project-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  filter: saturate(0.95) contrast(1.02) brightness(0.94);
  transform: scale(1);
  transition: transform 620ms ease, filter 620ms ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-card,
  .project-card:nth-child(6n + 1),
  .project-card:nth-child(9n + 5),
  .project-card:nth-child(7n + 3),
  .project-card.is-featured {
    grid-column: span 1;
    grid-row: span 1;
    aspect-ratio: 144 / 100;
  }
}

@media (max-width: 640px) {
  :root {
    --logo-size: 54px;
  }

  .topline {
    align-items: flex-start;
    padding: 12px 10px;
  }

  .topline p {
    max-width: 270px;
    font-size: clamp(1.15rem, 7vw, 2rem);
  }

  .gallery {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .project-card,
  .project-card:nth-child(6n + 1),
  .project-card:nth-child(9n + 5),
  .project-card:nth-child(7n + 3),
  .project-card.is-featured {
    aspect-ratio: 144 / 100;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
