/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg: #06060b;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-hover: rgba(255, 255, 255, 0.2);
  --text: #fafafa;
  --text-muted: #9ca3af;
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --cyan: #22d3ee;
  --rose: #f472b6;
  --radius-card: 32px;
  --radius-link: 16px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Syne", var(--font);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Reset & base ────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* ── Three.js canvas background ─────────────────────────────── */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  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-repeat: repeat;
  background-size: 180px 180px;
}

/* ── Layout ─────────────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 2.5rem 1.25rem;
}

/* ── Profile card ───────────────────────────────────────────── */
.profile-card {
  position: relative;
  width: min(460px, 100%);
  padding: 2.5rem 2rem 1.75rem;
  border-radius: var(--radius-card);
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.02) 45%,
    rgba(139, 92, 246, 0.04) 100%
  );
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 32px 64px -16px rgba(0, 0, 0, 0.65),
    0 0 120px -30px var(--accent-glow);
  animation: card-in 1s var(--ease) both;
  overflow: hidden;
}

.card-glow {
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 50%;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
}

/* ── Profile header ─────────────────────────────────────────── */
.profile-header {
  position: relative;
  text-align: center;
  margin-bottom: 2rem;
}

.avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
}

.avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--accent),
    var(--cyan),
    var(--rose),
    var(--accent)
  );
  animation: ring-spin 8s linear infinite;
  opacity: 0.9;
}

.avatar-ring::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--bg);
}

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

.avatar {
  position: relative;
  display: block;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(6, 6, 11, 0.9);
  box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.5);
}

.name {
  margin: 0 0 0.875rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6vw, 2.125rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 20%, #c4b5fd 60%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  margin: 0;
  display: flex;
  justify-content: center;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 100px;
  letter-spacing: 0.01em;
}

/* ── Links ──────────────────────────────────────────────────── */
.links-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.links-section {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 0.25rem;
}

.links-section__title {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.9375rem 1.125rem;
  border-radius: var(--radius-link);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition:
    background 0.3s var(--ease),
    border-color 0.3s var(--ease),
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
  animation: link-in 0.7s var(--ease) both;
}

.link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.06) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease);
}

.link:nth-child(1) { animation-delay: 0.15s; }
.link:nth-child(2) { animation-delay: 0.22s; }
.link:nth-child(3) { animation-delay: 0.29s; }
.link:nth-child(4) { animation-delay: 0.36s; }
.link:nth-child(5) { animation-delay: 0.43s; }
.link:nth-child(6) { animation-delay: 0.5s; }

@keyframes link-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

.link:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow:
    0 12px 32px -12px rgba(0, 0, 0, 0.5),
    0 0 24px -8px rgba(139, 92, 246, 0.2);
}

.link:hover::before {
  transform: translateX(100%);
}

.link:active {
  transform: translateY(-1px);
  transition-duration: 0.1s;
}

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

.link__icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  transition: color 0.3s var(--ease), background 0.3s var(--ease), transform 0.3s var(--ease);
}

.link__icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.link:hover .link__icon {
  color: var(--accent);
  background: rgba(139, 92, 246, 0.18);
  transform: scale(1.05);
}

.link__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  text-align: left;
}

.link__label {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.link__hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.link__arrow {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--text-muted);
  opacity: 0;
  transform: translate(-6px, 6px);
  transition:
    opacity 0.3s var(--ease),
    transform 0.3s var(--ease),
    color 0.3s var(--ease);
}

.link__arrow svg {
  width: 1rem;
  height: 1rem;
}

.link:hover .link__arrow {
  opacity: 1;
  transform: translate(0, 0);
  color: var(--cyan);
}

/* ── Footer ─────────────────────────────────────────────────── */
.profile-footer {
  margin-top: 1.75rem;
  padding-top: 1.375rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.profile-footer p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.footer-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s var(--ease);
}

.footer-link:hover {
  color: var(--cyan);
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .page {
    align-items: flex-start;
    min-height: 100dvh;
    min-height: 100svh;
    padding: max(1rem, env(safe-area-inset-top)) 1rem 1.5rem;
  }

  .profile-card {
    padding: 1.5rem 1.25rem 1.25rem;
    border-radius: 24px;
  }

  .profile-header {
    margin-bottom: 1.125rem;
  }

  .avatar-wrap {
    margin-bottom: 0.875rem;
  }

  .avatar {
    width: 96px;
    height: 96px;
  }

  .name {
    margin-bottom: 0.625rem;
    font-size: 1.625rem;
  }

  .profile-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
  }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .link:hover {
    transform: none;
  }

  .avatar-ring {
    animation: none;
  }
}
