/* ═══════════════════════════════════════════════════════════════
   LINKTREE PERSONAL — style.css
   Dark-first design system · Inter · Glassmorphism · Animations
═══════════════════════════════════════════════════════════════ */

/* ─── 1. CSS Custom Properties (Design Tokens) ─────────────── */
:root {
  /* Dark theme (default) */
  --bg:             #080810;
  --bg-card:        rgba(18, 18, 30, 0.85);
  --bg-btn:         rgba(255, 255, 255, 0.05);
  --bg-btn-hover:   rgba(255, 255, 255, 0.10);
  --bg-badge:       rgba(255, 255, 255, 0.04);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --accent-1:       #6366f1;
  --accent-2:       #8b5cf6;
  --accent-3:       #06b6d4;
  --accent-glow:    rgba(99, 102, 241, 0.35);

  --border:         rgba(255, 255, 255, 0.08);
  --border-hover:   rgba(255, 255, 255, 0.16);

  --shadow-card:    0 32px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  --shadow-btn:     0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow:    0 0 30px var(--accent-glow);

  --radius-card:    24px;
  --radius-btn:     14px;
  --radius-badge:   16px;
  --radius-avatar:  50%;

  --font:           'Inter', system-ui, -apple-system, sans-serif;
  --transition:     all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg:             #f0f2ff;
  --bg-card:        rgba(255, 255, 255, 0.92);
  --bg-btn:         rgba(0, 0, 0, 0.04);
  --bg-btn-hover:   rgba(0, 0, 0, 0.08);
  --bg-badge:       rgba(99, 102, 241, 0.06);

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --accent-glow:    rgba(99, 102, 241, 0.20);

  --border:         rgba(0, 0, 0, 0.08);
  --border-hover:   rgba(99, 102, 241, 0.30);

  --shadow-card:    0 20px 60px rgba(99, 102, 241, 0.12), 0 0 0 1px var(--border);
  --shadow-btn:     0 4px 16px rgba(0, 0, 0, 0.10);
}

/* ─── 2. Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
  position: relative;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ─── 3. Animated Background Blobs ─────────────────────────── */
.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: floatBlob 12s ease-in-out infinite alternate;
}

[data-theme="light"] .blob { opacity: 0.10; }

.blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6366f1, #4f46e5);
  top: -150px;
  left: -150px;
  animation-duration: 14s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #8b5cf6, #7c3aed);
  bottom: -100px;
  right: -100px;
  animation-duration: 10s;
  animation-delay: -4s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #06b6d4, #0891b2);
  top: 50%;
  left: 60%;
  animation-duration: 16s;
  animation-delay: -8s;
}

@keyframes floatBlob {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(30px, -40px) scale(1.08); }
  100% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ─── 4. Theme Toggle ───────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.theme-toggle:hover {
  color: var(--accent-1);
  border-color: var(--accent-1);
  transform: rotate(20deg) scale(1.05);
  box-shadow: var(--shadow-glow);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: var(--transition);
}

[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ─── 5. Main Card ──────────────────────────────────────────── */
.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2.5rem 2rem 2rem;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-card);
  animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── 6. Profile Header ─────────────────────────────────────── */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

/* Avatar */
.avatar-wrapper {
  position: relative;
  width: 108px;
  height: 108px;
  margin-bottom: 0.5rem;
}

.avatar-wrapper::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  animation: spinGradient 5s linear infinite;
  z-index: 0;
}

.avatar-wrapper::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  filter: blur(10px);
  opacity: 0.5;
  z-index: -1;
  animation: spinGradient 5s linear infinite;
}

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

.avatar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  display: block;
}

/* Profile Text */
.profile-name {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.profile-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-bio {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 360px;
  font-weight: 400;
}

.profile-location {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
}

/* ─── 7. Badges Section ─────────────────────────────────────── */
.badges-section {
  margin-bottom: 1.5rem;
}

.badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  justify-content: center;
}

.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  background: var(--bg-badge);
  border: 1px solid var(--border);
  border-radius: var(--radius-badge);
  cursor: default;
  transition: var(--transition);
  min-width: 120px;
  flex: 1;
  max-width: 160px;
}

.badge-card:hover {
  border-color: var(--accent-1);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

.badge-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 10px;
  transition: var(--transition-slow);
}

.badge-card:hover .badge-img {
  transform: rotate(-6deg) scale(1.1);
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}

.badge-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── 8. Divider ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 1.25rem 0;
}

/* ─── 9. Links Section ──────────────────────────────────────── */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Link Button */
.link-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0.9rem 1.1rem;
  background: var(--bg-btn);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-btn);
  text-align: left;
}

/* Shimmer on hover */
.link-btn::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.5s ease;
}

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

.link-btn:hover {
  background: var(--bg-btn-hover);
  border-color: var(--border-hover);
  transform: translateX(5px);
  box-shadow: var(--shadow-btn), -4px 0 0 0 var(--btn-accent-color, var(--accent-1));
}

.link-btn:active {
  transform: translateX(5px) scale(0.99);
}

/* Loading state */
.link-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.link-btn.loading .btn-icon { animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Icon */
.btn-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-accent-color, var(--accent-1));
  background: linear-gradient(135deg, var(--btn-accent-color, var(--accent-1)), color-mix(in srgb, var(--btn-accent-color, var(--accent-1)) 70%, #fff));
  color: #fff;
  transition: var(--transition);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.link-btn:hover .btn-icon {
  transform: scale(1.1) rotate(-4deg);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

/* Text */
.btn-text {
  flex: 1;
  min-width: 0;
}

.btn-label {
  font-size: 0.95rem;
  font-weight: 600;
  display: block;
  line-height: 1.2;
}

.btn-description {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Arrow */
.btn-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: var(--transition);
  opacity: 0.6;
}

.btn-arrow svg { width: 16px; height: 16px; }

.link-btn:hover .btn-arrow {
  color: var(--text-secondary);
  transform: translateX(3px);
  opacity: 1;
}

/* ─── 10. Footer ────────────────────────────────────────────── */
.card-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-footer span { color: #f472b6; }

/* ─── 11. Toast Notification ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 999;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ─── 12. Skeleton Loading ──────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, rgba(255,255,255,0.08) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── 13. Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: 1rem 0.75rem; }

  .card {
    padding: 2rem 1.25rem 1.5rem;
    border-radius: 20px;
  }

  .profile-name { font-size: 1.4rem; }
  .avatar-wrapper { width: 90px; height: 90px; }

  .badge-card { min-width: 100px; max-width: 140px; }
  .badge-img { width: 52px; height: 52px; }

  .link-btn { padding: 0.8rem 0.9rem; }
  .btn-icon { width: 34px; height: 34px; }

  .theme-toggle {
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 640px) {
  .card { padding: 3rem 2.5rem 2.5rem; }
}

/* ─── 14. Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.15ms !important;
  }
}
