:root {
  --ink: #f7f9fb;
  --grey-0: #d3d7dd;
  --grey-1: #c1c6ce;
  --grey-2: #adb3bc;
  --grey-3: #979ea8;
  --font: "Inter", "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font);
  font-weight: 300;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(64, 70, 80, .26) 100%),
    linear-gradient(158deg, #d8dbe0 0%, #c3c7ce 42%, #aab0b9 78%, #9ba2ac 100%);
  background-attachment: fixed;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* плавающий источник света */
.light {
  position: fixed;
  inset: -25%;
  pointer-events: none;
  background:
    radial-gradient(38% 32% at 32% 22%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 70%),
    radial-gradient(30% 26% at 76% 74%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 72%);
  filter: blur(28px);
  animation: drift 26s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  50%  { transform: translate3d(1.5%, 1.5%, 0) scale(1.04); }
  100% { transform: translate3d(3%, -1.5%, 0) scale(1.02); }
}

.top {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 34px) clamp(20px, 4vw, 46px);
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
  z-index: 2;
}

.wordmark { font-weight: 500; color: rgba(255, 255, 255, .9); }

.status { display: inline-flex; align-items: center; gap: 9px; }

.status i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #f2f6fb;
  box-shadow: 0 0 0 0 rgba(242, 246, 251, .9), 0 0 12px rgba(255, 255, 255, .8);
  animation: pulse 3.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: .45; box-shadow: 0 0 0 0 rgba(242, 246, 251, .5); }
  50%      { opacity: 1;   box-shadow: 0 0 0 5px rgba(242, 246, 251, 0); }
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(64px, 10vh, 110px) clamp(18px, 4vw, 46px) clamp(34px, 7vh, 84px);
}

.art { align-self: center; justify-self: center; width: min(93vw, 840px, 78svh); }

.scene {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 34px 48px rgba(64, 70, 80, .22));
}

/* свет на сцене живёт своей жизнью */
.visor { animation: visor 5s ease-in-out infinite; }
@keyframes visor {
  0%, 100% { opacity: .92; }
  50%      { opacity: 1; }
}

/* удар молотком: 1,8 с цикл, ось вращения — плечо */
.swing {
  transform-box: view-box;
  transform-origin: 366px 232px;
  animation: swing 1.8s infinite;
  will-change: transform;
}

@keyframes swing {
  0%   { transform: rotate(-32deg); animation-timing-function: cubic-bezier(.5, .05, .7, .2); }
  28%  { transform: rotate(-32deg); animation-timing-function: cubic-bezier(.55, .02, .62, .22); }
  42%  { transform: rotate(0deg);   animation-timing-function: cubic-bezier(.15, .85, .35, 1); }
  47%  { transform: rotate(3.5deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  60%  { transform: rotate(-8deg);  animation-timing-function: cubic-bezier(.35, 0, .5, 1); }
  100% { transform: rotate(-32deg); }
}

/* кисть докручивает молоток */
.wrist {
  transform-box: view-box;
  transform-origin: 438px 252px;
  animation: wrist 1.8s infinite;
}

@keyframes wrist {
  0%   { transform: rotate(-42deg); animation-timing-function: cubic-bezier(.5, .05, .7, .2); }
  28%  { transform: rotate(-42deg); animation-timing-function: cubic-bezier(.55, .02, .62, .22); }
  42%  { transform: rotate(0deg);   animation-timing-function: cubic-bezier(.15, .85, .35, 1); }
  47%  { transform: rotate(7deg);   animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  60%  { transform: rotate(-10deg); animation-timing-function: cubic-bezier(.35, 0, .5, 1); }
  100% { transform: rotate(-42deg); }
}

/* искры, пыль и щепки — только в момент касания */
.fx { opacity: 0; animation: fx 1.8s linear infinite; }
@keyframes fx {
  0%, 41%  { opacity: 0; }
  42.5%    { opacity: 1; }
  55%      { opacity: .75; }
  66%, 100% { opacity: 0; }
}

.impact {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: impact 1.8s ease-out infinite;
}
@keyframes impact {
  0%, 42% { opacity: 0;   transform: scale(.7); }
  45%     { opacity: .9;  transform: scale(1.1); }
  58%     { opacity: 0;   transform: scale(1.5); }
  100%    { opacity: 0;   transform: scale(1.5); }
}

.chip {
  transform-box: fill-box;
  transform-origin: center;
  animation: chip 1.8s ease-out infinite;
}
@keyframes chip {
  0%, 42% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  45%     { opacity: 1; }
  68%     { opacity: 0; transform: translate(-18px, -20px) rotate(-55deg); }
  100%    { opacity: 0; transform: translate(-18px, -20px) rotate(-55deg); }
}
.c2 { animation-name: chip2; }
@keyframes chip2 {
  0%, 42% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  45%     { opacity: 1; }
  68%     { opacity: 0; transform: translate(20px, -14px) rotate(45deg); }
  100%    { opacity: 0; transform: translate(20px, -14px) rotate(45deg); }
}

.dust {
  transform-box: fill-box;
  transform-origin: center;
  animation: dust 1.8s ease-out infinite;
}
@keyframes dust {
  0%, 42% { opacity: 0;    transform: scale(.4); }
  46%     { opacity: .55;  transform: scale(1); }
  66%     { opacity: 0;    transform: scale(2); }
  100%    { opacity: 0;    transform: scale(2); }
}

/* сигара: огонёк вспыхивает раз в 3 секунды */
.ember {
  transform-box: fill-box;
  transform-origin: center;
  animation: ember 3s ease-in-out infinite;
}
@keyframes ember {
  0%, 58%   { opacity: .55; transform: scale(.9);  fill: #d9713a; }
  64%       { opacity: 1;   transform: scale(1.2); fill: #ffb070; }
  72%       { opacity: .95; transform: scale(1.06); fill: #ff9350; }
  82%, 100% { opacity: .55; transform: scale(.9);  fill: #d9713a; }
}

.ember-glow {
  transform-box: fill-box;
  transform-origin: center;
  opacity: .18;
  animation: emberGlow 3s ease-in-out infinite;
}
@keyframes emberGlow {
  0%, 58%   { opacity: .18; transform: scale(.8); }
  64%       { opacity: 1;  transform: scale(1.45); }
  76%       { opacity: .35; transform: scale(1); }
  82%, 100% { opacity: .18; transform: scale(.8); }
}

/* дым: струйки */
.smoke {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: smoke 9s ease-in-out infinite alternate;
}
.s2 { animation-duration: 11s; animation-delay: -3s; }
@keyframes smoke {
  0%   { transform: translateY(0) scaleY(1) skewX(0deg); opacity: .2; }
  45%  { opacity: .42; }
  100% { transform: translateY(-26px) scaleY(1.12) skewX(3deg); opacity: .14; }
}

/* дым: клубы поднимаются и растворяются */
.puff {
  fill: #f6f8fb;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: puff 3.4s linear infinite;
}
.p1 { animation-delay: 0s;     --dx: -18px; }
.p2 { animation-delay: -.9s;   --dx: 10px; }
.p3 { animation-delay: -1.7s;  --dx: -6px; }
.p4 { animation-delay: -2.4s;  --dx: 16px; }
.p5 { animation-delay: -3s;    --dx: -12px; }

@keyframes puff {
  0%   { opacity: 0;   transform: translate(0, 0) scale(.5); }
  14%  { opacity: .62; }
  55%  { opacity: .38; }
  100% { opacity: 0;   transform: translate(var(--dx), -124px) scale(2.3); }
}

/* подпись */
.caption {
  margin: 0;
  justify-self: center;
  text-align: center;
  font-size: clamp(17px, 2.05vw, 28px);
  line-height: 1.42;
  letter-spacing: -.005em;
  color: #fbfcfe;
  text-shadow: 0 2px 26px rgba(48, 53, 62, .35), 0 1px 2px rgba(48, 53, 62, .18);
}

.line { display: block; white-space: nowrap; }
.line span { display: inline-block; }

.l1 > span { animation: word 9s cubic-bezier(.22, .61, .36, 1) infinite; }
.l2 {
  font-size: .82em;
  color: rgba(250, 252, 255, .78);
  margin-top: .28em;
}
.l2 > span { animation: word 9s cubic-bezier(.22, .61, .36, 1) infinite; }

.l1 > span:nth-child(1) { animation-delay: .05s; }
.l1 > span:nth-child(2) { animation-delay: .18s; }
.l1 > span:nth-child(3) { animation-delay: .31s; }
.l1 > span:nth-child(4) { animation-delay: .44s; }
.l2 > span:nth-child(1) { animation-delay: .70s; }
.l2 > span:nth-child(2) { animation-delay: .83s; }
.l2 > span:nth-child(3) { animation-delay: .96s; }

@keyframes word {
  0%       { opacity: 0; filter: blur(9px); transform: translateY(10px); }
  13%      { opacity: 1; filter: blur(0);   transform: translateY(0); }
  84%      { opacity: 1; filter: blur(0);   transform: translateY(0); }
  94%, 100% { opacity: 0; filter: blur(7px); transform: translateY(-4px); }
}

@media (max-width: 720px) {
  .stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(40px, 12vh, 120px);
    padding-bottom: clamp(28px, 6vh, 60px);
  }
  .art { width: 106vw; flex: none; }
  .caption { font-size: clamp(16px, 4.4vw, 22px); }
}

@media (prefers-reduced-motion: reduce) {
  .light, .status i, .visor, .ember, .ember-glow, .smoke, .puff,
  .swing, .wrist, .fx, .impact, .chip, .dust { animation: none; }
  .fx { opacity: 0; }
  .line span { animation: none; opacity: 1; filter: none; transform: none; }
}
