/* ===== Tokens ===== */
:root {
  --bg: #030816;
  --text: #ffffff;
  --muted: #8b93b0;
  --muted-2: #6e7594;
  --blue-deep: #1e40af;
  --blue: #2563eb;
  --blue-light: #60a5fa;
  --blue-shine: #dbeafe;
  --chip-bg: rgba(10, 16, 34, 0.75);
  --chip-border: rgba(148, 163, 255, 0.14);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== Animated background ===== */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg);
}

/* WebGL flowing silk — drifts to the left (see script.js) */
#bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  animation: bg-in 3s ease 0.1s forwards;
}
@keyframes bg-in { to { opacity: 1; } }

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(2, 5, 15, 0.7) 100%);
}

/* CSS fallback, only used when WebGL is unavailable */
.blob { display: none; }
.bg.fallback #bg-canvas { display: none; }
.bg.fallback .blob {
  display: block;
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}
.bg.fallback .b1 {
  width: 60vw; height: 40vw; right: -20vw; top: -5vw;
  background: radial-gradient(circle, #1d4ed8, transparent 65%);
  animation: flow-left 24s linear infinite;
}
.bg.fallback .b2 {
  width: 55vw; height: 35vw; right: -30vw; top: 35vh;
  background: radial-gradient(circle, #3b82f6, transparent 65%);
  animation: flow-left 32s linear infinite -12s;
}
.bg.fallback .b3 {
  width: 50vw; height: 30vw; right: -25vw; bottom: -5vw;
  background: radial-gradient(circle, #312e81, transparent 65%);
  animation: flow-left 28s linear infinite -20s;
}
@keyframes flow-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-170vw); }
}

/* ===== Social links (top right) ===== */
.socials {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  height: 58px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(8, 14, 32, 0.6);
  border: 1px solid var(--chip-border);
  backdrop-filter: blur(10px);
}

.socials a {
  display: grid;
  place-items: center;
  width: 54px;
  height: 46px;
  color: #c7cde6;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}
.socials a:hover { color: var(--blue-light); background: rgba(96, 165, 250, 0.1); }
.socials a:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.socials svg { width: 22px; height: 22px; }
.socials .divider { width: 1px; height: 18px; background: rgba(255, 255, 255, 0.12); }

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 90px 20px 60px;
}

/* Avatar */
.avatar {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(12, 20, 46, 0.8);
  box-shadow:
    0 0 0 2px rgba(96, 165, 250, 0.35),
    0 0 40px rgba(37, 99, 235, 0.45);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.avatar-fallback { display: none; width: 56px; height: 56px; color: var(--blue-light); opacity: 0.8; }
.avatar.no-img img { display: none; }
.avatar.no-img .avatar-fallback { display: block; }

/* Title */
.title {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.title .line { display: block; }

.wave {
  display: inline-block;
  margin-right: 0.28em;
  transform-origin: 70% 70%;
  animation: wave 2.6s ease-in-out infinite;
}
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20%, 40% { transform: rotate(-8deg); }
  50% { transform: rotate(10deg); }
}

/* Blue gradient + light shine sweeping left → right with a ~1s pause */
.shine {
  display: inline-block;
  padding-bottom: 0.08em; /* keeps descenders (p) from being clipped */
  color: transparent;
  background-image:
    linear-gradient(105deg,
      transparent 42%,
      rgba(219, 234, 254, 0.95) 50%,
      transparent 58%),
    linear-gradient(90deg, var(--blue-deep), var(--blue) 45%, var(--blue-light));
  background-size: 250% 100%, 100% 100%;
  background-position: 100% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 3.2s linear 2s infinite;
}
/* 0–69% = sweep (~2.2s), 69–100% = pause (~1s) */
@keyframes shine {
  0%   { background-position: 100% 0, 0 0; }
  69%  { background-position: 0% 0, 0 0; }
  100% { background-position: 0% 0, 0 0; }
}

/* Text blocks */
.tagline {
  margin: 34px 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 500;
  color: var(--muted);
}
.about {
  max-width: 580px;
  margin: 26px 0 0;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--muted-2);
}

/* Rotating role */
.role {
  margin: 38px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 28px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #d8dcf0;
}
.tilde { color: var(--muted-2); font-weight: 400; }

.role-text {
  display: inline-block;
  transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
}
.role-text.out { opacity: 0; transform: translateY(-10px); filter: blur(4px); }
.role-text.pre { opacity: 0; transform: translateY(10px); filter: blur(4px); transition: none; }

/* Technologies */
.tech { margin-top: 54px; max-width: 880px; }
.tech h2 {
  margin: 0 0 22px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 16px;
}
.chips li {
  padding: 13px 26px;
  font-size: 0.85rem;
  color: #aab1cf;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.chips li:hover {
  color: #fff;
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.35);
  transform: translateY(-2px);
}

/* ===== Entrance: everything fades in slowly, one after another ===== */
.reveal {
  /* "backwards" = hidden during the delay, then normal styles (hover effects keep working) */
  animation: reveal 1.4s cubic-bezier(0.22, 0.61, 0.36, 1) var(--d, 0s) backwards;
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(22px); filter: blur(10px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .socials { top: 12px; right: 12px; height: 50px; }
  .socials a { width: 46px; height: 40px; }
  .avatar { margin-bottom: 40px; }
  .chips li { padding: 10px 18px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .bg.fallback .blob, .wave, .shine { animation: none; }
  .reveal { animation: none; }
  #bg-canvas { animation: none; opacity: 1; }
  .shine { background-position: 0% 0, 0 0; }
  .role-text { transition: none; }
}
