/* Nikita Korablev — site design system */

@import url("https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Instrument+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap");

:root {
  --bg: #070707;
  --surface: #111111;
  --surface-2: #1a1a1a;
  --text: #edeae4;
  --muted: #7d7a74;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #d4ff4d;
  --accent-dim: rgba(212, 255, 77, 0.14);
  --tile-gap: 0;
  --covers-reveal: 0;
  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

/* ── Navigation ── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(7, 7, 7, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
  animation: navIn 0.8s var(--ease) both;
}

.nav--scrolled {
  background: rgba(7, 7, 7, 0.92);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

@keyframes navIn {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav-inner {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.nav-left {
  justify-self: start;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-left a,
.nav-right a {
  position: relative;
  display: inline-block;
}

.nav-left a::after,
.nav-right a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.nav-left a:hover::after,
.nav-right a:hover::after {
  transform: scaleX(1);
}

.nav-center {
  justify-self: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(14px, 2.2vw, 18px);
  letter-spacing: 0.1em;
  text-transform: none;
}

.nav-right {
  justify-self: end;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-right a { color: var(--muted); }
.nav-right a:hover { color: var(--accent); }

/* ── Layout ── */

.wrap {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  padding: 0 20px;
}

/* ── Home: Hero ── */

.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 0 60px;
  position: relative;
  z-index: 2;
}

.hero-inner {
  width: 100%;
  position: relative;
  z-index: 3;
  opacity: calc(1 - (var(--covers-reveal) * 0.9));
  transform: translateY(calc(var(--covers-reveal) * -24px));
  will-change: opacity, transform;
  transition: opacity 0.1s linear, transform 0.1s linear;
}

.hero-inner > * {
  animation: heroIn 1s var(--ease) both;
}

.hero-inner > *:nth-child(1) { animation-delay: 0.15s; }
.hero-inner > *:nth-child(2) { animation-delay: 0.28s; }
.hero-inner > *:nth-child(3) { animation-delay: 0.42s; }
.hero-inner > *:nth-child(4) { animation-delay: 0.56s; }

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

.hero-eyebrow::before,
.hero-eyebrow::after {
  content: "";
  width: 0;
  height: 1px;
  background: var(--line);
  animation: lineGrow 0.8s var(--ease) 0.5s both;
}

.hero-eyebrow::after {
  animation-delay: 0.65s;
}

@keyframes lineGrow {
  to { width: 32px; }
}

.hero-title {
  margin: 0 auto;
  max-width: 920px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.hero-title em {
  font-style: normal;
  color: var(--accent);
  animation: accentGlow 4s ease-in-out infinite;
}

@keyframes accentGlow {
  0%, 100% { text-shadow: 0 0 0 transparent; }
  50%      { text-shadow: 0 0 24px rgba(212, 255, 77, 0.25); }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
}

.hero-subrow {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.link-telegram,
.hero-subrow a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  cursor: pointer;
  position: relative;
  z-index: 20;
  pointer-events: auto;
  transition: color 0.2s, border-color 0.2s, opacity 0.2s;
}

.link-telegram:hover,
.hero-subrow a:hover {
  color: var(--text);
  border-color: var(--text);
  opacity: 0.85;
}

.hero-down {
  margin-top: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text);
  transition: border-color 0.25s var(--ease), color 0.25s, transform 0.25s var(--ease);
  animation: bob 2.4s var(--ease) infinite;
}

.hero-down:hover {
  border-color: var(--accent);
  color: var(--accent);
  animation: none;
  transform: translateY(2px);
}

.hero-down svg { width: 16px; height: 16px; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ── Home: Work grid ── */

#work {
  margin-top: -38vh;
  padding-top: 38vh;
  position: relative;
  z-index: 5;
  pointer-events: none;
}

.grid-wrap {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  pointer-events: none;
}

.cover-grid {
  column-count: 4;
  column-gap: 0;
  line-height: 0;
  opacity: 1;
  transform: translateY(calc((1 - var(--covers-reveal)) * 32px));
  will-change: transform;
  pointer-events: none;
  transition: transform 0.15s linear;
}

.cover-grid.is-active {
  pointer-events: auto;
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  break-inside: avoid;
  margin: 0;
  background: var(--surface);
  cursor: default;
  vertical-align: top;
  content-visibility: auto;
  contain-intrinsic-size: 360px 480px;
}

.tile:not(.tile--disabled) { cursor: pointer; }

button.tile {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  font: inherit;
  text-align: inherit;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

button.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tile-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: var(--surface);
  background-repeat: no-repeat;
}

.tile img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
  opacity: 0;
  transition: opacity 0.4s var(--ease), transform 0.55s var(--ease), filter 0.4s;
  filter: brightness(0.92);
}

.tile img.is-loaded {
  opacity: 1;
}

.tile:not(.tile--disabled):hover img.is-loaded {
  transform: scale(1.04);
  filter: brightness(1);
}

/* Scroll reveal (footer only) */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.85s var(--ease), transform 0.85s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tile-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  opacity: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, transparent 55%);
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
}

.tile:not(.tile--disabled):hover .tile-label { opacity: 1; }

.tile-label-inner {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  transform: translateY(8px);
  transition: transform 0.35s var(--ease);
}

.tile:not(.tile--disabled):hover .tile-label-inner { transform: translateY(0); }

.tile--disabled img { filter: brightness(0.75) saturate(0.6); }
.tile--disabled::after {
  content: var(--badge-soon, "soon");
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(7,7,7,0.7);
  padding: 4px 8px;
  border: 1px solid var(--line);
}

/* ── Footer ── */

.footer {
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 20px;
}

.footer-heading {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
}

.footer-heading span { color: var(--accent); }

.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
}

.contacts a,
.nav-right a {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.contacts a:hover,
.nav-right a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.back-link {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.back-link:hover { color: var(--accent); }

/* ── FAB ── */

.fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 60;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s var(--ease), border-color 0.2s, color 0.2s;
}

.fab.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.fab svg { width: 16px; height: 16px; }

/* ── Video lightbox (home) ── */

.video-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.video-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.video-lightbox[hidden] {
  display: none;
}

.video-lightbox:not([hidden]) {
  display: grid;
}

.video-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.video-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 96vw);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.35s var(--ease);
}

.video-lightbox__panel--portrait {
  width: auto;
  max-width: min(480px, 96vw);
}

.video-lightbox.is-open .video-lightbox__panel {
  transform: translateY(0) scale(1);
}

.video-lightbox__close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(7, 7, 7, 0.8);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.video-lightbox__close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.video-lightbox__title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.video-lightbox__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.video-lightbox__frame.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.08) 0 28%, transparent 29%),
    rgba(0, 0, 0, 0.35);
  animation: lightboxPulse 1.2s ease-in-out infinite;
}

@keyframes lightboxPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.video-lightbox__frame video,
.video-lightbox__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  object-fit: contain;
}

.video-lightbox__error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.video-lightbox__error a {
  color: var(--accent);
}

body.lightbox-open {
  overflow: hidden;
}

/* ── Project pages ── */

.page-project .nav-inner {
  max-width: 1120px;
}

.project-main {
  max-width: 1060px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 36px) 20px 80px;
}

.page-project .project-header {
  animation: heroIn 0.9s var(--ease) 0.1s both;
}

.page-project .project-cover {
  animation: heroIn 0.9s var(--ease) 0.22s both;
}

.page-project .project-media {
  animation: heroIn 0.9s var(--ease) 0.34s both;
}

.page-project .project-cover img {
  transition: transform 0.6s var(--ease);
}

.page-project .project-cover:hover img {
  transform: scale(1.02);
}

.project-header {
  margin-bottom: 28px;
}

.project-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.project-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.project-meta {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.project-meta:empty { display: none; }

.project-cover {
  margin: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}

.project-cover img {
  width: 100%;
  height: auto;
}

.project-media {
  margin-top: 20px;
  display: grid;
  gap: 16px;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  transition: box-shadow 0.4s var(--ease);
}

.video-frame--portrait {
  width: min(100%, calc(85vh * 9 / 16));
  max-height: min(85vh, 920px);
  margin: 0 auto;
}

.video-frame:hover {
  box-shadow: 0 0 0 1px var(--accent-dim), 0 16px 48px rgba(0, 0, 0, 0.45);
}

.video-frame iframe,
.video-frame video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.note {
  border: 1px dashed var(--line);
  padding: 16px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.note:empty { display: none; }

.note code {
  font-size: 12px;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── Responsive ── */

@media (max-width: 1100px) {
  .cover-grid { column-count: 3; }
}

@media (max-width: 700px) {
  .nav-inner { padding: 0 16px; }
  .wrap { padding: 0 16px 70px; }
  .section-label { padding: 0 16px; }
  .hero-subrow { flex-direction: column; align-items: center; gap: 6px; }
  .cover-grid { column-count: 2; }
  .nav-right { display: none; }
}

@media (max-width: 520px) {
  .cover-grid { column-count: 1; }
  @keyframes lineGrow {
    to { width: 20px; }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .nav,
  .hero-inner > *,
  .hero-eyebrow::before,
  .hero-eyebrow::after,
  .page-project .project-header,
  .page-project .project-cover,
  .page-project .project-media { animation: none; }
  .hero-title em { animation: none; }
  .hero-down { animation: none; }
  .reveal,
  .tile img { transition: none; opacity: 1; }
  .tile img.is-loaded { opacity: 1; }
  .cover-grid { transform: none; transition: none; }
  .nav-left a::after,
  .nav-right a::after { display: none; }
}
