/* ==========================================================================
   filashkov.com — shared shell
   Design language: deep violet-black canvas, one continuous rainbow field
   that is painted in *viewport space*, so every gradient-filled element
   (letters, icons, gauges, countries) is a window onto the same spectrum.
   ========================================================================== */

:root {
  /* canvas */
  --bg: #07040c;
  --bg-lift: #0d0716;
  --ink: #f6f3fa;
  --muted: rgba(246, 243, 250, 0.55);
  --faint: rgba(246, 243, 250, 0.32);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --glass: rgba(255, 255, 255, 0.028);

  /* live values driven from JS */
  --hue: 0;
  --px: 50vw;
  --py: 40vh;
  --energy: 0; /* 0..1 — how hard the user is pushing the spectrum */

  /* motion */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);

  /* layout */
  --shell: min(1040px, 92vw);
  --radius: 18px;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  touch-action: none;
}

::selection {
  background: hsl(calc(var(--hue) * 1deg) 80% 55% / 0.28);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Ambient background: aurora + pointer light + grain + vignette
   -------------------------------------------------------------------------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -10%, var(--bg-lift) 0%, var(--bg) 62%);
}

/* Everything colour-shifting lives inside one hue-rotated layer: the blurred
   blobs below are painted once and only re-tinted, which keeps the per-frame
   cost on the compositor instead of the paint thread. */
.bg__field {
  position: absolute;
  inset: 0;
  filter: hue-rotate(calc(var(--hue) * 1deg));
}

.bg__aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
  mix-blend-mode: screen;
}

.bg__aurora--a {
  width: min(68vmax, 1200px);
  height: min(68vmax, 1200px);
  left: -14vmax;
  top: -22vmax;
  background: radial-gradient(
    circle at 50% 50%,
    hsl(0, 90%, 55%, 0.32) 0%,
    hsl(0, 90%, 55%, 0) 68%
  );
  animation: drift-a 34s var(--ease-soft) infinite alternate;
}

.bg__aurora--b {
  width: min(58vmax, 1050px);
  height: min(58vmax, 1050px);
  right: -16vmax;
  bottom: -20vmax;
  background: radial-gradient(
    circle at 50% 50%,
    hsl(72, 90%, 55%, 0.26) 0%,
    hsl(72, 90%, 55%, 0) 68%
  );
  animation: drift-b 42s var(--ease-soft) infinite alternate;
}

/* soft light that trails the cursor — the spectrum "listens" to the pointer.
   Moved with a transform only, so it never repaints. */
.bg__pointer {
  position: absolute;
  top: 0;
  left: 0;
  width: min(62vmax, 1100px);
  height: min(62vmax, 1100px);
  margin: min(-31vmax, -550px) 0 0 min(-31vmax, -550px);
  background: radial-gradient(
    circle at 50% 50%,
    hsl(40, 95%, 60%, 0.16) 0%,
    transparent 62%
  );
  transform: translate3d(var(--px), var(--py), 0);
  opacity: calc(0.5 + var(--energy) * 0.5);
  will-change: transform, opacity;
}

.bg__grain {
  position: absolute;
  inset: -20%; /* the drift below only moves it a few percent */
  opacity: 0.32;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  animation: grain 5s steps(5) infinite;
}

.bg__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(110% 80% at 50% 45%, transparent 42%, rgba(0, 0, 0, 0.62) 100%);
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(14vmax, 10vmax, 0) scale(1.14); }
}

@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.08); }
  to   { transform: translate3d(-12vmax, -8vmax, 0) scale(0.94); }
}

@keyframes grain {
  0%   { transform: translate3d(0, 0, 0); }
  20%  { transform: translate3d(-3%, -4%, 0); }
  40%  { transform: translate3d(-6%, 3%, 0); }
  60%  { transform: translate3d(3%, -3%, 0); }
  80%  { transform: translate3d(5%, 4%, 0); }
  100% { transform: translate3d(-2%, 2%, 0); }
}

/* --------------------------------------------------------------------------
   Spectrum text: anything with [data-grad] is painted by site.js
   -------------------------------------------------------------------------- */

[data-grad] {
  background-image: linear-gradient(
    90deg,
    hsl(0, 82%, 55%),
    hsl(40, 82%, 55%),
    hsl(80, 82%, 55%)
  );
  background-repeat: no-repeat;
  background-position: left center;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* masks (icons) paint the same gradient through their alpha, not through text */
[data-grad].is-mask,
.logo[data-grad] {
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: inherit;
}

/* --------------------------------------------------------------------------
   Wordmark + per-letter reveal
   -------------------------------------------------------------------------- */

.wordmark {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.92;
  text-transform: lowercase;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  user-select: none;
}

.wd {
  display: inline-flex;
  white-space: nowrap;
}

.ch {
  display: inline-block;
  overflow: hidden;
  padding: 0.09em 0 0.16em; /* room for descenders while clipping */
  margin: -0.09em 0 -0.16em;
}

.ch--space { width: 0.3em; }

.ch__i {
  display: inline-block;
  will-change: transform, filter, opacity;
}

/* pre-reveal state */
.reveal-letters .ch__i {
  transform: translate3d(0, 108%, 0) rotate(6deg);
  filter: blur(14px);
  opacity: 0;
}

.reveal-letters.is-in .ch__i {
  transform: translate3d(0, 0, 0) rotate(0deg);
  filter: blur(0);
  opacity: 1;
  transition:
    transform 1150ms var(--ease-expo),
    filter 900ms var(--ease-expo),
    opacity 700ms var(--ease-soft);
  transition-delay: calc(var(--i) * 62ms + var(--delay, 0ms));
}

/* --------------------------------------------------------------------------
   Generic scroll reveal
   -------------------------------------------------------------------------- */

/* An animation, not a transition: once it has played the element is handed
   back to plain CSS, so hover states are never held up by a stagger delay
   that was only ever meant for the entrance. */
[data-reveal] {
  opacity: 0;
}

[data-reveal].is-in {
  animation: reveal-up 900ms var(--ease-expo) both;
  animation-delay: calc(var(--i, 0) * 55ms + var(--delay, 0ms));
}

[data-reveal].is-done {
  animation: none;
  opacity: 1;
  transform: none;
  filter: none;
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translate3d(0, 26px, 0);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

/* --------------------------------------------------------------------------
   Pill link
   -------------------------------------------------------------------------- */

.pill {
  --pill-bg: rgba(255, 255, 255, 0.03);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.72em 1.25em 0.72em 1.05em;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--pill-bg);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  overflow: hidden;
  transition:
    border-color 400ms var(--ease-soft),
    transform 600ms var(--ease-expo),
    background-color 400ms var(--ease-soft);
}

.pill::after {
  /* sheen that sweeps on hover */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    hsl(calc(var(--hue) * 1deg) 90% 70% / 0.16) 48%,
    transparent 76%
  );
  transform: translateX(-120%);
  transition: transform 900ms var(--ease-expo);
}

.pill:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.055);
  transform: translateY(-2px);
}

.pill:hover::after { transform: translateX(120%); }

.pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(calc(var(--hue) * 1deg) 90% 60%);
  box-shadow: 0 0 14px 2px hsl(calc(var(--hue) * 1deg) 90% 60% / 0.7);
  flex: 0 0 auto;
}

.pill__arrow {
  opacity: 0.5;
  transition: transform 600ms var(--ease-expo), opacity 400ms var(--ease-soft);
}

.pill:hover .pill__arrow {
  transform: translateX(4px);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Social row
   -------------------------------------------------------------------------- */

.social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
}

.social__item { display: inline-flex; }

.logo {
  position: relative;
  width: 24px;
  height: 24px;
  background-repeat: no-repeat;
  background-position: left center;
  display: block;
  opacity: 0.72;
  will-change: transform;
  transition: opacity 400ms var(--ease-soft), transform 500ms var(--ease-expo);
}

.logo:hover { opacity: 1; }

.logo::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translate(-50%, 6px);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ease-soft), transform 500ms var(--ease-expo);
}

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

.email    { -webkit-mask: url('https://cdn.simpleicons.org/gmail?color=ffffff') no-repeat center/contain; mask: url('https://cdn.simpleicons.org/gmail?color=ffffff') no-repeat center/contain; }
.telegram { -webkit-mask: url('https://cdn.simpleicons.org/telegram?color=ffffff') no-repeat center/contain; mask: url('https://cdn.simpleicons.org/telegram?color=ffffff') no-repeat center/contain; }
.github   { -webkit-mask: url('https://cdn.simpleicons.org/github?color=ffffff') no-repeat center/contain; mask: url('https://cdn.simpleicons.org/github?color=ffffff') no-repeat center/contain; }
.scholar  { -webkit-mask: url('https://cdn.simpleicons.org/googlescholar?color=ffffff') no-repeat center/contain; mask: url('https://cdn.simpleicons.org/googlescholar?color=ffffff') no-repeat center/contain; }

/* --------------------------------------------------------------------------
   Small print
   -------------------------------------------------------------------------- */

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--faint);
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .bg__aurora,
  .bg__grain { animation: none !important; }

  .reveal-letters .ch__i,
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
    animation: none !important;
  }
}

:focus-visible {
  outline: 2px solid hsl(calc(var(--hue) * 1deg) 90% 62%);
  outline-offset: 4px;
  border-radius: 6px;
}
