/**
 * Linktree Clone - Styles principaux
 * Architecture: Mobile-first, BEM naming, CSS custom properties
 */

/* ============================================
   VARIABLES CSS (Personnalisables)
   ============================================ */
:root {
  /* Couleurs */
  --color-primary: #8b5cf6;
  --color-secondary: #ec4899;
  --color-bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --color-bg-solid: #0f0f23;
  --color-card-bg: rgba(255, 255, 255, 0.1);
  --color-card-bg-hover: rgba(255, 255, 255, 0.2);
  --color-text: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.8);
  --color-border: rgba(255, 255, 255, 0.15);
  --color-shadow: rgba(0, 0, 0, 0.3);

  /* Typographie */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-base: 16px;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Espacement */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Formes */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  /* Ombres */
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.3);
  --shadow-button: 0 4px 15px rgba(0, 0, 0, 0.2);
  --shadow-avatar: 0 4px 20px rgba(139, 92, 246, 0.4);

  /* Effets */
  --backdrop-blur: 16px;
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Layout */
  --container-max-width: 680px;
  --container-padding: var(--space-4);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-weight: var(--font-weight-normal);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg-solid);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Focus visible pour accessibilité */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   ARRIÈRE-PLAN
   ============================================ */
.background {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--color-bg-gradient);
  background-attachment: fixed;
}

.background::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: var(--space-10) var(--container-padding) var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  gap: var(--space-8);
}

/* ============================================
   PROFIL
   ============================================ */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  animation: fadeInDown 0.6s ease-out;
}

.profile__avatar-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-5);
}

.profile__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-avatar);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.profile__avatar-wrapper:hover .profile__avatar {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(139, 92, 246, 0.6);
}

.profile__avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.6;
  animation: pulseRing 3s ease-in-out infinite;
}

.profile__name {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.profile__handle {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.profile__bio {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 480px;
  padding: 0 var(--space-4);
}

/* ============================================
   LIENS
   ============================================ */
.links {
  width: 100%;
  max-width: 600px;
}

.links__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.links__item {
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
  animation-delay: calc(var(--item-index, 0) * 80ms + 0.3s);
}

.link-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.link-card:hover,
.link-card:focus-visible {
  background: var(--color-card-bg-hover);
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
}

.link-card:hover::before,
.link-card:focus-visible::before {
  opacity: 1;
}

.link-card:active {
  transform: translateY(0) scale(0.99);
  transition-duration: var(--transition-fast);
}

.link-card--featured {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.2));
  border-color: rgba(139, 92, 246, 0.3);
}

.link-card--featured:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(236, 72, 153, 0.3));
  border-color: rgba(139, 92, 246, 0.5);
}

.link-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  transition: background var(--transition-base), transform var(--transition-base);
}

.link-card:hover .link-card__icon {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1) rotate(-3deg);
}

.link-card__title {
  flex: 1;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  text-align: left;
  z-index: 1;
}

.link-card__arrow {
  display: flex;
  align-items: center;
  color: var(--color-text-secondary);
  opacity: 0.6;
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.link-card:hover .link-card__arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

/* ============================================
   RÉSEAUX SOCIAUX
   ============================================ */
.socials {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  animation: fadeIn 0.8s ease-out 0.8s both;
}

.socials__list {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
  justify-content: center;
}

.socials__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  color: var(--color-text);
  transition: all var(--transition-base);
}

.socials__link:hover,
.socials__link:focus-visible {
  background: var(--color-card-bg-hover);
  transform: translateY(-3px) scale(1.1);
  box-shadow: var(--shadow-button);
  border-color: rgba(255, 255, 255, 0.3);
}

.socials__link:active {
  transform: translateY(-1px) scale(1.05);
}

.footer__brand {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseRing {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.05);
  }
}

/* ============================================
   RIPPLE EFFECT (JS ajoute la classe)
   ============================================ */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: rippleEffect 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (min-width: 640px) {
  :root {
    --container-padding: var(--space-6);
  }

  .container {
    padding-top: var(--space-12);
    gap: var(--space-10);
  }

  .profile__avatar-wrapper {
    width: 140px;
    height: 140px;
  }

  .profile__name {
    font-size: 2.25rem;
  }

  .profile__bio {
    font-size: var(--font-size-md);
    padding: 0;
  }

  .link-card {
    padding: var(--space-5) var(--space-6);
    gap: var(--space-5);
  }

  .link-card__title {
    font-size: var(--font-size-lg);
  }

  .socials__link {
    width: 52px;
    height: 52px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  :root {
    --container-padding: var(--space-8);
  }

  .container {
    padding-top: 4rem;
  }

  .profile__avatar-wrapper {
    width: 150px;
    height: 150px;
  }

  .profile__name {
    font-size: 2.5rem;
  }

  .links__list {
    gap: var(--space-5);
  }

  .link-card {
    border-radius: var(--radius-xl);
  }
}

/* Réduction des animations (accessibilité) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Mode sombre forcé (déjà sombre par défaut, mais pour override OS) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-card-bg: rgba(255, 255, 255, 0.08);
    --color-card-bg-hover: rgba(255, 255, 255, 0.15);
  }
}

/* Mobile très petit */
@media (max-width: 360px) {
  :root {
    --font-size-base: 15px;
  }

  .profile__avatar-wrapper {
    width: 100px;
    height: 100px;
  }

  .link-card {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .link-card__icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .socials__link {
    width: 44px;
    height: 44px;
  }
}
