:root {
  --paper:        #ffffff;
  --blush:        #ffe0fa;

  --blush-wash:   #fff5fd;
  --rose:         #a32d86;  
  --rose-soft:    #e58fce;
  --ink:          #2b1a26;  
  --ink-muted:    #7a6373; 

  --pill-bg:      #ffffff;
  --pill-border:  #ffe0fa;
  --skeleton:     #fff0fb;
  --shadow:       rgba(163, 45, 134, .30);
  --tip-bg:       #2b1a26;
  --tip-fg:       #ffffff;
  --blob:         #ffe0fa;
  --blob-op:      .70;
  --grain-op:     .030;

  --z-blobs:   0;
  --z-content: 10;
  --z-ui:      20;
  --z-grain:   30;

  --px: 0;
  --py: 0;

  --ease: cubic-bezier(.16, 1, .3, 1);
}

[data-theme="dark"] {
  --paper:        #150f14;
  --blush:        #ffe0fa;

  --blush-wash:   #1e161d;
  --rose:         #ffc9f2;
  --rose-soft:    #7b3a68;
  --ink:          #ffe9fb;
  --ink-muted:    #c4a5bd;

  --pill-bg:      #1e161d;
  --pill-border:  #372834;
  --skeleton:     #241a23;
  --shadow:       rgba(0, 0, 0, .62);
  --tip-bg:       #ffe0fa;
  --tip-fg:       #2b1a26;
  --blob:         #ff8ce4;
  --blob-op:      .19;
  --grain-op:     .045;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Outfit", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}

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

button { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:where(a, button):focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 4px;
  border-radius: 999px;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 40px 20px;
  perspective: 1200px;
  overflow: hidden;
}

.stage::before {
  content: "";
  position: absolute;
  z-index: var(--z-blobs);
  left: 50%;
  top: 50%;
  width: min(760px, 96vw);
  aspect-ratio: 1.25;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, var(--blob) 0%, transparent 66%);
  opacity: calc(var(--blob-op) * .55);
  pointer-events: none;
  transition: opacity .5s var(--ease);
}

.blob {
  position: absolute;
  z-index: var(--z-blobs);
  border-radius: 50%;
  pointer-events: none;
  opacity: var(--blob-op);
  will-change: transform;
  transition: opacity .5s var(--ease);
}

.blob--a {
  width: 58vmax; height: 58vmax;
  left: -20vmax; top: -18vmax;
  background: radial-gradient(circle at 50% 50%, var(--blob) 0%, transparent 66%);
  animation: drift-a 34s ease-in-out infinite;
}

.blob--b {
  width: 50vmax; height: 50vmax;
  right: -18vmax; bottom: -20vmax;
  background: radial-gradient(circle at 50% 50%, var(--blob) 0%, transparent 64%);
  animation: drift-b 46s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  34%      { transform: translate3d(7vw, -4vh, 0) scale(1.09); }
  67%      { transform: translate3d(-3vw, 5vh, 0) scale(.95); }
}

@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  40%      { transform: translate3d(-6vw, 4vh, 0) scale(1.06); }
  72%      { transform: translate3d(4vw, -3vh, 0) scale(.97); }
}

.card {
  position: relative;
  z-index: var(--z-content);
  display: grid;
  justify-items: center;
  gap: 30px;
  width: 100%;
  max-width: 460px;
  transform-style: preserve-3d;
  transform:
    translate3d(calc(var(--px) * 7px), calc(var(--py) * 5px), 0)
    rotateX(calc(var(--py) * -4.5deg))
    rotateY(calc(var(--px) * 5.5deg));
}

.layer { transform-style: preserve-3d; }
.layer--avatar  { transform: translateZ(52px); }
.layer--id      { transform: translateZ(26px); display: grid; justify-items: center; gap: 10px; }
.layer--socials { transform: translateZ(38px); }

.reveal {
  animation: rise .95s var(--ease) both;
  animation-delay: var(--d, 0ms);
}

.reveal--bloom { animation-name: bloom; }

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

@keyframes bloom {
  from { opacity: 0; transform: scale(.84); }
  to   { opacity: 1; transform: none; }
}

.avatar {
  position: relative;
  width: clamp(136px, 36vw, 188px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.avatar__halo {
  position: absolute;
  inset: -58%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--blush) 0%, transparent 60%);
  opacity: 1;
  pointer-events: none;
  animation: breathe 6.5s ease-in-out infinite;
  will-change: transform;
}

[data-theme="dark"] .avatar__halo {
  background: radial-gradient(circle, #ff8ce4 0%, transparent 58%);
  opacity: .34;
}

@keyframes breathe {
  0%, 100% { transform: scale(1);    opacity: .82; }
  50%      { transform: scale(1.09); opacity: 1; }
}

.ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    transparent 0 40%,
    var(--rose-soft) 60%,
    var(--rose) 74%,
    transparent 90%
  );
  will-change: transform;
}

.ring--out {
  inset: -17%;
  --w: 1.5px;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--w)), #000 calc(100% - var(--w)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--w)), #000 calc(100% - var(--w)));
  animation: spin 16s linear infinite;
  opacity: .85;
}

.ring--in {
  inset: -8%;
  --w: 1px;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--w)), #000 calc(100% - var(--w)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--w)), #000 calc(100% - var(--w)));
  animation: spin 10s linear infinite reverse;
  opacity: .55;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.avatar__frame {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--skeleton);
  box-shadow:
    0 0 0 6px var(--paper),
    0 0 0 7px var(--blush),
    0 22px 46px -16px var(--shadow);
  transition: box-shadow .5s var(--ease);
}

.avatar__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--paper) 50%, transparent 80%);
  opacity: .7;
  transform: translateX(-100%);
  animation: shimmer 1.5s linear infinite;
}

.avatar__frame.is-loaded::after { display: none; }

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity .6s var(--ease), transform .8s var(--ease);
}

.is-loaded .avatar__img { opacity: 1; transform: none; }

.name {
  margin: 0;
  font-size: clamp(2.6rem, 11vw, 4.2rem);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1.12;
  padding-bottom: .06em;
}

.handle {
  position: relative;
  display: inline-block;
  padding: 0 .06em .04em;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: inherit;
  line-height: inherit;
  transition: color .35s var(--ease);
}

.handle::before {
  content: "";
  position: absolute;
  left: .06em; right: .06em;
  bottom: 0;
  height: 4px;
  border-radius: 999px;
  background: var(--blush);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .5s var(--ease);
}

.handle:hover::before,
.handle:focus-visible::before { transform: scaleX(1); }
.handle:hover  { color: var(--rose); }
.handle:active { transform: scale(.985); }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--blush);
  color: var(--rose);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px) scale(.92);
  transition: opacity .34s var(--ease), transform .34s var(--ease);
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.is-error { background: var(--rose); color: var(--paper); }

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.social {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  box-shadow: 0 6px 18px -12px var(--shadow);
  text-decoration: none;
  transition:
    transform .42s var(--ease),
    background-color .3s var(--ease),
    border-color .3s var(--ease),
    box-shadow .42s var(--ease);
}

.social:hover {
  transform: translateY(-7px) scale(1.07);
  background: var(--blush);
  border-color: var(--blush);
  box-shadow: 0 18px 30px -14px var(--shadow);
}

[data-theme="dark"] .social:hover {
  background: var(--rose-soft);
  border-color: var(--rose-soft);
}

.social:active { transform: translateY(-2px) scale(.97); }

.social__glyph {
  width: 22px;
  height: 22px;
  background-color: var(--rose);
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
  transition: transform .42s var(--ease), background-color .3s var(--ease);
}

.social__glyph--openvk { width: 20px; height: 20px; }

.social:hover .social__glyph { transform: scale(1.1); }

.social::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--tip-bg);
  color: var(--tip-fg);
  font-size: .74rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}

.social:hover::after,
.social:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

.theme-toggle {
  position: fixed;
  z-index: var(--z-ui);
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  cursor: pointer;
  transition:
    transform .42s var(--ease),
    background-color .3s var(--ease),
    border-color .3s var(--ease);
}

.theme-toggle:hover {
  transform: rotate(-18deg) scale(1.08);
  background: var(--blush);
  border-color: var(--blush);
}

[data-theme="dark"] .theme-toggle:hover {
  background: var(--rose-soft);
  border-color: var(--rose-soft);
}

.theme-toggle:active { transform: scale(.94); }

.theme-toggle__glyph {
  width: 18px;
  height: 18px;
  background-color: var(--rose);
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
  transition: background-color .3s var(--ease);
}

[data-theme="light"] .theme-toggle__glyph { --icon: url("assets/icons/moon.svg"); }
[data-theme="dark"]  .theme-toggle__glyph { --icon: url("assets/icons/sun.svg"); }

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (max-width: 767px) {
  .stage { padding: 32px 16px; }
  .card  { gap: 26px; max-width: 100%; }
  .social { width: 50px; height: 50px; }
  .socials { gap: 12px; }
  .theme-toggle { top: 14px; right: 14px; }
}

@media (hover: none), (pointer: coarse) {
  .card { transform: none; }
  .social::after, .handle::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .blob, .ring, .avatar__halo, .avatar__frame::after { animation: none !important; }
  .card { transform: none !important; }
  .social:hover, .theme-toggle:hover { transform: none; }
}
