/* ==========================================
   Will Speer — Tropical Splash Screen
   Mobile-first, Linktree-inspired design
   ========================================== */

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

:root {
  --bg-start: #0c2340;
  --bg-mid: #1a5276;
  --bg-end: #17806d;
  --card-bg: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-hover-bg: rgba(255, 255, 255, 0.15);
  --card-hover-border: rgba(255, 255, 255, 0.3);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-muted: rgba(255, 255, 255, 0.4);
  --accent: #f4d58d;
  --accent-secondary: #48c9b0;
  --accent-glow: rgba(244, 213, 141, 0.35);
  --avatar-gradient-start: #f08080;
  --avatar-gradient-end: #f4d58d;
  --tropical-coral: #f08080;
  --tropical-teal: #48c9b0;
  --tropical-gold: #f4d58d;
  --tropical-pink: #e8946a;
  --tropical-green: #76d7c4;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Animated tropical gradient background ---- */
.background {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(
    160deg,
    #0c2340 0%,
    #1a5276 25%,
    #17806d 50%,
    #1b6b7a 75%,
    #0c2340 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

/* Decorative tropical overlay — palm leaf silhouettes via CSS */
.background::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(
    ellipse at top right,
    rgba(26, 82, 118, 0.35) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.background::after {
  content: '';
  position: absolute;
  bottom: -5%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(
    ellipse at bottom left,
    rgba(244, 213, 141, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  33% { background-position: 50% 100%; }
  66% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---- Floating tropical particles ---- */
.tropical-deco {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.tropical-deco .leaf {
  position: absolute;
  font-size: 2rem;
  opacity: 0.12;
  animation: floatLeaf 20s linear infinite;
}

.tropical-deco .leaf:nth-child(1) {
  left: 10%;
  animation-delay: 0s;
  animation-duration: 22s;
}

.tropical-deco .leaf:nth-child(2) {
  left: 30%;
  animation-delay: -5s;
  animation-duration: 18s;
  font-size: 1.5rem;
}

.tropical-deco .leaf:nth-child(3) {
  left: 60%;
  animation-delay: -10s;
  animation-duration: 25s;
}

.tropical-deco .leaf:nth-child(4) {
  left: 80%;
  animation-delay: -3s;
  animation-duration: 20s;
  font-size: 1.8rem;
}

.tropical-deco .leaf:nth-child(5) {
  left: 50%;
  animation-delay: -15s;
  animation-duration: 24s;
  font-size: 2.5rem;
}

.tropical-deco .leaf:nth-child(6) {
  left: 20%;
  animation-delay: -8s;
  animation-duration: 19s;
  font-size: 1.6rem;
}

.tropical-deco .leaf:nth-child(7) {
  left: 70%;
  animation-delay: -2s;
  animation-duration: 23s;
  font-size: 2.2rem;
}

.tropical-deco .leaf:nth-child(8) {
  left: 40%;
  animation-delay: -12s;
  animation-duration: 17s;
  font-size: 1.4rem;
}

.tropical-deco .leaf:nth-child(9) {
  left: 90%;
  animation-delay: -6s;
  animation-duration: 21s;
  font-size: 1.9rem;
}

.tropical-deco .leaf:nth-child(10) {
  left: 5%;
  animation-delay: -18s;
  animation-duration: 26s;
  font-size: 2.3rem;
}

@keyframes floatLeaf {
  0% {
    transform: translateY(110vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.12;
  }
  90% {
    opacity: 0.12;
  }
  100% {
    transform: translateY(-10vh) rotate(360deg);
    opacity: 0;
  }
}

/* ---- Warm sunset glow on top ---- */
.sunset-glow {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 300px;
  background: radial-gradient(
    ellipse at 50% 0%,
    rgba(244, 213, 141, 0.15) 0%,
    rgba(240, 128, 128, 0.08) 40%,
    transparent 70%
  );
  z-index: -1;
  pointer-events: none;
  animation: sunsetPulse 8s ease-in-out infinite;
}

@keyframes sunsetPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ---- Main container ---- */
.container {
  width: 100%;
  max-width: 480px;
  padding: 2.75rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100dvh;
}

/* ---- Profile section ---- */
.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.25rem;
  opacity: 0;
  flex-shrink: 0;
  animation: sunRiseSection 2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8946a, var(--tropical-gold), var(--tropical-coral), #f4d58d);
  background-size: 300% 300%;
  animation: sunCycle 8s ease-in-out 2s infinite both;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  box-shadow:
    0 0 30px rgba(244, 213, 141, 0.4),
    0 0 60px rgba(244, 213, 141, 0.15);
  position: relative;
}

/* ---- Sun rays ---- */
.avatar::before {
  content: '';
  position: absolute;
  width: 160%;
  height: 160%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(244, 213, 141, 0.1) 0deg 6deg,
    transparent 6deg 24deg
  );
  animation: sunRaysRotate 30s linear infinite, sunRaysPulse 8s ease-in-out infinite;
  z-index: -1;
}

/* ---- Sun cycle: arc path + color shift + glow ---- */
@keyframes sunCycle {
  0%, 100% {
    transform: translate(-45px, 8px);
    background-position: 0% 50%;
    box-shadow:
      0 0 30px rgba(244, 213, 141, 0.4),
      0 0 60px rgba(244, 213, 141, 0.15);
  }
  25% {
    transform: translate(0, -18px);
    background-position: 33% 25%;
    box-shadow:
      0 0 50px rgba(244, 213, 141, 0.6),
      0 0 100px rgba(244, 213, 141, 0.25);
  }
  50% {
    transform: translate(45px, 8px);
    background-position: 66% 50%;
    box-shadow:
      0 0 35px rgba(240, 128, 128, 0.4),
      0 0 70px rgba(240, 128, 128, 0.15);
  }
  75% {
    transform: translate(0, -18px);
    background-position: 100% 75%;
    box-shadow:
      0 0 50px rgba(244, 213, 141, 0.6),
      0 0 100px rgba(244, 213, 141, 0.25);
  }
}

@keyframes sunRaysRotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes sunRaysPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ---- Dark inner circle (warm tone) ---- */
.avatar::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(25, 18, 5, 0.45) 0%, rgba(13, 10, 2, 0.65) 100%);
}

.avatar-initials {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  z-index: 1;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.name {
  font-size: 1.82rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
  background: linear-gradient(135deg, #ffffff 0%, var(--tropical-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ---- Wave divider ---- */
.wave-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--tropical-pink), var(--tropical-gold), var(--tropical-teal));
  border-radius: 2px;
  margin: 0.35rem 0 0;
  opacity: 0.7;
}

/* ---- Links section ---- */
.links-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  justify-content: center;
}

/* ---- Individual link button ---- */
.link-button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;

  /* Staggered entrance animation */
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.5s ease forwards;
  animation-delay: calc(var(--delay) * 0.1s + 1.6s);
}

/* Tropical shimmer on hover */
.link-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(244, 213, 141, 0.06),
    rgba(72, 201, 176, 0.06),
    transparent
  );
  transition: left 0.5s ease;
}

.link-button:hover::before {
  left: 100%;
}

.link-button:hover,
.link-button:focus-visible {
  background: var(--card-hover-bg);
  border-color: var(--card-hover-border);
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.25),
    0 0 0 1px var(--card-hover-border),
    0 0 20px rgba(244, 213, 141, 0.08);
}

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

.link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  color: var(--accent);
}

/* Give each icon a unique tropical color */
.link-button:nth-child(1) .link-icon { color: var(--tropical-coral); }
.link-button:nth-child(2) .link-icon { color: var(--tropical-teal); }
.link-button:nth-child(3) .link-icon { color: #25d366; }
.link-button:nth-child(4) .link-icon { color: var(--tropical-gold); }
.link-button:nth-child(5) .link-icon { color: var(--tropical-pink); }
.link-button:nth-child(6) .link-icon { color: var(--tropical-teal); }

.link-text {
  flex: 1;
  margin-left: 1rem;
  font-size: 1rem;
  font-weight: 500;
}

.link-arrow {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: transform 0.25s ease, color 0.25s ease;
}

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

/* ---- Ripple effect ---- */
.ripple {
  position: absolute;
  border-radius: 50%;
  width: 200px;
  height: 200px;
  margin-top: -100px;
  margin-left: -100px;
  background: rgba(244, 213, 141, 0.15);
  animation: rippleAnim 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleAnim {
  from {
    transform: scale(0);
    opacity: 1;
  }
  to {
    transform: scale(3);
    opacity: 0;
  }
}

/* ---- QR Code Modal ---- */
.avatar[role="button"] {
  cursor: pointer;
}

.qr-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.qr-overlay.active {
  opacity: 1;
  visibility: visible;
}

.qr-modal {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.qr-overlay.active .qr-modal {
  transform: scale(1);
}

.qr-modal img {
  border-radius: 8px;
}

.qr-label {
  font-size: 0.875rem;
  color: #333;
  font-weight: 500;
}

.qr-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.qr-close:hover {
  color: #333;
}

/* ---- Footer ---- */
.footer {
  margin-top: auto;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---- Keyframes ---- */
@keyframes sunRiseSection {
  0% {
    opacity: 0;
    transform: translateY(60px);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ---- Responsive ---- */
@media (min-width: 640px) {
  .container {
    padding: 2.5rem 2rem 1.5rem;
  }

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

  .avatar-initials {
    font-size: 2.25rem;
  }

  .name {
    font-size: 2.44rem;
  }

  .link-button {
    padding: 1rem 1.5rem;
  }

  .links-section {
    gap: 0.75rem;
  }
}

/* ---- Accessibility: reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .background {
    animation: none;
  }

  .avatar {
    animation: none;
    box-shadow:
      0 0 30px rgba(244, 213, 141, 0.4),
      0 0 60px rgba(244, 213, 141, 0.15);
  }

  .avatar::before {
    animation: none;
    display: none;
  }

  .sunset-glow {
    animation: none;
  }

  .tropical-deco .leaf {
    animation: none;
    display: none;
  }

  .profile-section,
  .link-button {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .link-button:hover {
    transform: none;
  }

  .link-button::before {
    display: none;
  }

  .link-button:hover .link-arrow {
    transform: none;
  }
}
