/* ============================================
   OSRS Tracker — Player Profile
   Adapted from profile-prototype.html
   ============================================ */

/* ============================================
   Profile Layout
   ============================================ */

.profile {
  max-width: 640px;
  margin: 0 auto;
  padding: 0;
}

/* ============================================
   Banner — atmospheric, cinematic fade
   ============================================ */

.profile-banner {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

@media (min-width: 640px) {
  .profile-banner {
    height: 240px;
  }
}

.profile-banner__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-banner__fallback {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(168, 85, 247, 0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(59, 130, 246, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 40%),
    linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}


/* Bottom fade — banner melts into page */
.profile-banner::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to top, var(--bg-secondary) 0%, transparent 100%);
  pointer-events: none;
}

/* Subtle noise texture */
.profile-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  pointer-events: none;
  z-index: 1;
}

/* Back button overlay on banner */
.profile-banner__back {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 50%;
  color: white;
  text-decoration: none;
  transition: background 0.15s;
}

.profile-banner__back:hover {
  background: rgba(0, 0, 0, 0.65);
}

.profile-banner__back .material-icons {
  font-size: 1.25rem;
}

/* ============================================
   Header — identity zone
   ============================================ */

.profile-header {
  padding: 0;
  position: relative;
  margin-top: -52px;
  z-index: 10;
  animation: profile-fade-up 0.5s ease-out both;
  animation-delay: 0.1s;
}

.profile-header__top {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 0 16px;
}

/* ============================================
   Avatar with glowing ring
   ============================================ */

.profile-avatar {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar__ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(
    from 0deg,
    var(--accent-primary),
    color-mix(in srgb, var(--accent-primary) 60%, #a855f7),
    var(--accent-primary)
  );
  box-shadow:
    0 0 20px -4px color-mix(in srgb, var(--accent-primary) 40%, transparent),
    0 0 40px -8px color-mix(in srgb, var(--accent-primary) 20%, transparent);
  animation: profile-ring-glow 4s ease-in-out infinite;
}

@keyframes profile-ring-glow {
  0%, 100% {
    box-shadow:
      0 0 20px -4px color-mix(in srgb, var(--accent-primary) 40%, transparent),
      0 0 40px -8px color-mix(in srgb, var(--accent-primary) 20%, transparent);
  }
  50% {
    box-shadow:
      0 0 28px -2px color-mix(in srgb, var(--accent-primary) 50%, transparent),
      0 0 56px -6px color-mix(in srgb, var(--accent-primary) 28%, transparent);
  }
}

.profile-avatar__img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid var(--bg-secondary);
  background: var(--bg-elevated);
}

.profile-avatar__letter {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 32px;
  color: #fff;
  border: 3px solid var(--bg-secondary);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

/* ============================================
   Name + RSN
   ============================================ */

.profile-header__info {
  flex: 1;
  min-width: 0;
  padding-bottom: 6px;
}

.profile-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.2;
  margin: 0;
}

.profile-rsn {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-top: 2px;
}

/* ============================================
   Bio
   ============================================ */

.profile-bio {
  margin-top: 14px;
  padding: 0 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 480px;
}

/* ============================================
   Action Buttons
   ============================================ */

.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding: 0 16px;
}

.profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 20px;
  border-radius: 19px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  color: inherit;
}

.profile-btn:hover {
  text-decoration: none;
}

.profile-btn:active {
  transform: scale(0.96);
}

.profile-btn .material-icons {
  font-size: 18px;
}

/* Primary — Follow */
.profile-btn--primary {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 12px -3px color-mix(in srgb, var(--accent-primary) 40%, transparent);
}

.profile-btn--primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 20px -4px color-mix(in srgb, var(--accent-primary) 50%, transparent);
  color: #fff;
}

/* Secondary — Edit Profile, Message, Share */
.profile-btn--secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.profile-btn--secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Following state */
.profile-btn--following {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.profile-btn--following:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ============================================
   Stats Bar — segmented stat boxes
   ============================================ */

.profile-stats {
  display: flex;
  gap: 2px;
  margin-top: 20px;
  overflow: hidden;
  animation: profile-fade-up 0.5s ease-out both;
  animation-delay: 0.2s;
}

@media (min-width: 640px) {
  .profile-stats {
    border-radius: 12px;
  }
}

.profile-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  background: var(--bg-elevated);
  position: relative;
  cursor: default;
  transition: background 0.15s;
}

.profile-stat:hover {
  background: var(--bg-hover);
}

.profile-stat::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--stat-color, var(--accent-primary));
  opacity: 0.5;
}

.profile-stat__number {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.profile-stat__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
}

/* ============================================
   Activity Highlights — visual mini-cards
   ============================================ */

.profile-highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
  animation: profile-fade-up 0.5s ease-out both;
  animation-delay: 0.3s;
}

.profile-highlight {
  background: var(--bg-elevated);
  border-radius: 0;
  padding: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 640px) {
  .profile-highlight {
    border-radius: 12px;
  }
}

/* Colored ambient glow in background */
.profile-highlight::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--hl-color, var(--accent-primary));
  opacity: 0.06;
  filter: blur(20px);
  pointer-events: none;
}

.profile-highlight__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--hl-color, var(--accent-primary)) 12%, transparent);
  color: var(--hl-color, var(--accent-primary));
}

.profile-highlight__icon .material-icons {
  font-size: 20px;
}

.profile-highlight__value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}

.profile-highlight__label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ============================================
   Section Divider
   ============================================ */

.profile-divider {
  margin-top: 24px;
  padding: 0;
  animation: profile-fade-up 0.5s ease-out both;
  animation-delay: 0.35s;
}

.profile-divider__label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 8px;
}

.profile-divider__text {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
}

.profile-divider__rule {
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* ============================================
   Profile Feed Container
   ============================================ */

.profile-feed {
  padding: 8px 0 0;
  animation: profile-fade-up 0.5s ease-out both;
  animation-delay: 0.4s;
}

/* ============================================
   Profile Empty State
   ============================================ */

.profile-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-tertiary);
}

.profile-empty__icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.3;
}

.profile-empty__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.profile-empty__text {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

/* ============================================
   Entrance Animation
   ============================================ */

@keyframes profile-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-header,
  .profile-stats,
  .profile-highlights,
  .profile-divider,
  .profile-feed {
    animation: none;
  }

  .profile-avatar__ring {
    animation: none;
  }
}
