/* =========================================
   PREMIUM MOBILE-FIRST LINK BIO v5
   Clean, Modern, Elegant
   ========================================= */

:root {
  /* DARK MODE - Elegant Dark */
  --bg-color: #0a0a0f;
  --bg-secondary: #12121a;

  --text-primary: #ffffff;
  --text-secondary: #71717a;

  /* Accent - Vibrant Blue */
  --accent-primary: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

  /* Cards */
  --card-bg: #18181b;
  --card-border: #27272a;
  --card-hover: #1f1f23;

  /* Radius */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --font-family: 'Inter', 'Nunito', -apple-system, sans-serif;
}

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

.visually-hidden,
.hidden {
  display: none !important;
}

/* BODY */
body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 0 0 env(safe-area-inset-bottom, 40px);
}

/* AMBIENT GLOW */
.ambient {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body.light-mode .ambient {
  background: radial-gradient(ellipse, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
}

/* CONTAINER */
.main-container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 20px;
  position: relative;
  z-index: 1;
}

/* HEADER / THEME TOGGLE */
#top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 32px;
}

#theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

#theme-toggle:active {
  transform: scale(0.95);
}

#theme-toggle img {
  width: 18px;
  height: 18px;
}

/* PROFILE SECTION */
.head-section {
  text-align: center;
  margin-bottom: 32px;
}

.blob-center {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.blob-wrapper {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  padding: 3px;
  background: var(--accent-gradient);
}

.blob-image {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--bg-color);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.lead {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 280px;
  margin: 0 auto;
}

/* ACTION BUTTONS */
.button-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.number-btn {
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border: none;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.number-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.mail-btn,
.share-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s;
}

.mail-btn:active,
.share-btn:active {
  background: var(--card-hover);
}

.icon:not(.icon-large) {
  width: 18px;
  height: 18px;
}

.number-btn .icon {
  filter: brightness(0) invert(1);
}

.mail-btn .icon,
.share-btn .icon {
  filter: var(--icon-filter, invert(1));
}

body.light-mode .mail-btn .icon,
body.light-mode .share-btn .icon {
  --icon-filter: invert(0);
}

/* LINKS GRID */
.social-links ul {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* LINK CARDS */
.link-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  position: relative;
  transition: background 0.15s, transform 0.15s;
  overflow: hidden;
}

.link-item:active {
  transform: scale(0.98);
  background: var(--card-hover);
}

/* Wide Card */
.grid-wide {
  grid-column: span 2;
}

/* Square Card */
.grid-square {
  grid-column: span 1;
  aspect-ratio: 1 / 1;
}

/* Link Wrapper */
.link-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.grid-wide .link-wrapper {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.grid-square .link-wrapper {
  justify-content: flex-end;
}

/* Link Anchor */
.link-wrapper a {
  display: flex;
  flex-direction: inherit;
  align-items: inherit;
  gap: inherit;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

/* ICON - BRAND COLORED WITH PULSE */
.icon-large {
  width: 48px;
  height: 48px;
  padding: 12px;
  border-radius: var(--radius-sm);

  /* Transparent background - icon color is the star */
  background: transparent;

  /* Remove filter - let icon show as-is (white SVG) but we'll colorize it */
  /* Since SVGs are white, we need to use a trick: remove filter and use background */
  filter: none;

  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: contain;

  /* Add colored drop shadow for glow effect using accent color */
  filter: drop-shadow(0 0 8px var(--accent)) drop-shadow(0 0 16px var(--accent));

  /* Pulsing animation */
  animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {

  0%,
  100% {
    filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 12px var(--accent));
    transform: scale(1);
  }

  50% {
    filter: drop-shadow(0 0 12px var(--accent)) drop-shadow(0 0 24px var(--accent));
    transform: scale(1.05);
  }
}

.grid-wide .icon-large {
  margin-bottom: 0;
  flex-shrink: 0;
}

.grid-square .icon-large {
  position: absolute;
  top: 16px;
  left: 16px;
  margin-bottom: 0;
}

/* Text Content */
.link-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.link-content small {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
  display: block;
}

.grid-square .link-content {
  margin-top: auto;
}

/* DOTS BUTTON - ALWAYS VISIBLE */
.dots-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s, transform 0.2s;
}

.dots-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.dots-btn:active {
  transform: scale(0.95);
}

.dots-btn img {
  width: 18px;
  height: 18px;
  opacity: 0.9;
  filter: invert(1);
  /* Always white in dark mode */
}

body.light-mode .dots-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .dots-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

body.light-mode .dots-btn img {
  filter: invert(0);
  /* Black in light mode */
}

/* POPUP */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  /* Mobile sheet style */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.share-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.share-popup {
  background: var(--bg-secondary);
  width: 100%;
  max-width: 420px;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 20px));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.share-overlay.active .share-popup {
  transform: translateY(0);
}

.popup-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.popup-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.qr-container {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.share-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.share-actions button {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.share-actions button:hover {
  transform: translateY(-4px);
}

.share-actions button:active {
  transform: scale(0.95);
}

.share-actions button img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
}

.share-actions button span {
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

#shareBtn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

#shareBtn:hover {
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

#copyBtn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

#copyBtn:hover {
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.5);
}

#downloadBtn {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

#downloadBtn:hover {
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.close-btn img {
  width: 12px;
  filter: var(--icon-filter, invert(1));
}

body.light-mode .close-btn img {
  --icon-filter: invert(0);
}

/* TOASTIFY */
.toastify {
  background: var(--card-bg) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-family) !important;
}

/* RESPONSIVE - Already Mobile First, tweak for larger */
@media (min-width: 480px) {
  .main-container {
    padding-top: 48px;
  }

  .share-popup {
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
  }

  .share-overlay {
    align-items: center;
  }
}