/* ==========================================================================
   Modern Linktree Profile - Design System & CSS Stylesheet
   Theme: Premium Dark Crimson & Glassmorphism
   Font: Plus Jakarta Sans
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- Root CSS Variables & Theme System --- */
:root {
  /* Color Palette - Crimson Dark Theme (Default) */
  --bg-primary: #0a0a0d;
  --bg-secondary: #121218;
  --bg-gradient: radial-gradient(circle at 50% 0%, #2a0813 0%, #0a0a0d 70%);

  --accent: #ff2a5f;
  --accent-hover: #ff4d79;
  --accent-glow: rgba(255, 42, 95, 0.4);
  --accent-gradient: linear-gradient(135deg, #ff2a5f 0%, #990026 100%);

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

  /* Glassmorphism System */
  --glass-bg: rgba(22, 22, 30, 0.65);
  --glass-bg-hover: rgba(32, 32, 45, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 42, 95, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(16px);

  /* Layout & Geometry */
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
  --border-radius-full: 9999px;
  --max-width: 680px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light Theme Variables Support */
[data-theme="light"] {
  --bg-primary: #f4f4f7;
  --bg-secondary: #ffffff;
  --bg-gradient: radial-gradient(circle at 50% 0%, #ffeef2 0%, #f4f4f7 70%);

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-bg-hover: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-hover: rgba(255, 42, 95, 0.6);
  --glass-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

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

html {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  background: var(--bg-gradient);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  padding: 0 16px;
}

/* Background Ambient Glow Effects */
.bg-glow-1, .bg-glow-2 {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

.bg-glow-1 {
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: var(--accent);
}

.bg-glow-2 {
  bottom: -150px;
  right: 10%;
  width: 400px;
  height: 400px;
  background: #800020;
}

/* Container */
.app-container {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1;
  padding-bottom: 40px;
}

/* --- Header & Navigation Bar --- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  width: 100%;
}

.brand-logo {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand-logo .dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Glass Buttons */
.btn-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--glass-shadow);
  outline: none;
}

.btn-glass:hover, .btn-glass:focus-visible {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: 0 0 15px var(--accent-glow);
  transform: translateY(-2px);
}

.btn-glass:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-glass svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: transform var(--transition-fast);
}

/* --- Navigation Drawer / Hamburger Sidebar --- */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

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

.sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  background: rgba(15, 15, 22, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  z-index: 101;
  display: flex;
  flex-direction: column;
  padding: 30px 24px;
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5);
}

.sidebar-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.drawer-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
}

.nav-item:hover, .nav-item:focus-visible {
  color: var(--text-primary);
  background: rgba(255, 42, 95, 0.1);
  border-color: rgba(255, 42, 95, 0.3);
  transform: translateX(6px);
}

.nav-item.active {
  color: var(--text-primary);
  background: var(--accent-gradient);
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.drawer-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Section Switcher SPA Transitions --- */
.section-view {
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  width: 100%;
}

.section-view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* --- Profile Section --- */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 32px 0;
  width: 100%;
}

/* Hero Logo Avatar */
.hero-logo-container {
  position: relative;
  margin-bottom: 20px;
}

.hero-logo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 25px var(--accent-glow), inset 0 0 15px rgba(0,0,0,0.5);
  position: relative;
  z-index: 2;
  animation: avatarPulse 4s ease-in-out infinite;
  background-color: var(--bg-secondary);
}

.hero-logo-ring {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 42, 95, 0.4);
  animation: spinRing 25s linear infinite;
  z-index: 1;
}

@keyframes avatarPulse {
  0%, 100% {
    box-shadow: 0 0 25px var(--accent-glow);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 42, 95, 0.7);
    transform: scale(1.02);
  }
}

@keyframes spinRing {
  100% {
    transform: rotate(360deg);
  }
}

.profile-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.profile-name {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.verified-badge svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.profile-username {
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.profile-bio {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

/* --- Link Cards Container --- */
.links-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin-top: 10px;
}

/* Link Card Glassmorphism Item */
.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  box-shadow: var(--glass-shadow);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.link-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transition: left 0.6s ease;
}

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

.link-card:hover, .link-card:focus-visible {
  transform: translateY(-4px) scale(1.01);
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: 0 10px 30px rgba(255, 42, 95, 0.25), 0 0 1px var(--accent);
}

.link-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.link-card-left {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
}

.link-icon-wrapper {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: transform var(--transition-bounce), background-color var(--transition-fast);
}

.link-card:hover .link-icon-wrapper {
  transform: scale(1.12) rotate(-3deg);
  background: rgba(255, 42, 95, 0.15);
  border-color: rgba(255, 42, 95, 0.4);
}

.link-icon-wrapper svg, .link-icon-wrapper img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  fill: currentColor;
}

.link-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.link-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-description {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform var(--transition-bounce), color var(--transition-fast);
  padding-left: 12px;
}

.link-arrow svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.link-card:hover .link-arrow {
  transform: translateX(6px);
  color: var(--accent);
}

/* Disabled Link Card */
.link-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto; /* Allow focus for screen readers */
}

.link-card.disabled:hover {
  transform: none;
  border-color: var(--glass-border);
  box-shadow: var(--glass-shadow);
  background: var(--glass-bg);
}

.link-card.disabled:hover .link-arrow {
  transform: none;
  color: var(--text-muted);
}

.link-card.disabled:hover .link-icon-wrapper {
  transform: none;
}

/* --- Placeholder Cards (Projects & Sponsors) --- */
.placeholder-view {
  text-align: center;
  padding: 40px 20px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--glass-shadow);
  margin-top: 10px;
}

.placeholder-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px auto;
  border-radius: 50%;
  background: rgba(255, 42, 95, 0.1);
  border: 1px solid rgba(255, 42, 95, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.placeholder-icon svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.placeholder-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.placeholder-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto 24px auto;
}

.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
  text-align: left;
}

.project-card, .sponsor-card {
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.project-card:hover, .sponsor-card:hover {
  border-color: rgba(255, 42, 95, 0.4);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.project-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  background: rgba(255, 42, 95, 0.15);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 10px;
}

/* --- Footer --- */
.site-footer {
  margin-top: auto;
  padding-top: 40px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.site-footer a:hover {
  color: var(--accent);
}

/* --- Loading Screen Overlay --- */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.spinner-glow {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid rgba(255, 42, 95, 0.15);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
  box-shadow: 0 0 20px var(--accent-glow);
  margin-bottom: 20px;
}

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

.loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* --- Toast Notifications & Error Message --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  padding: 14px 20px;
  background: rgba(20, 20, 28, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--accent);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--accent-glow);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.toast.toast-error {
  border-color: #ef4444;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(239, 68, 68, 0.4);
}

.error-banner {
  padding: 24px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--border-radius-lg);
  color: #fca5a5;
  text-align: center;
  margin-top: 20px;
}

.error-banner h3 {
  font-size: 1.1rem;
  color: #ffffff;
  margin-bottom: 8px;
}

/* --- Responsive Media Queries --- */
@media (max-width: 600px) {
  .hero-logo {
    width: 90px;
    height: 90px;
  }

  .profile-name {
    font-size: 1.35rem;
  }

  .profile-bio {
    font-size: 0.88rem;
  }

  .link-card {
    padding: 14px 16px;
  }

  .link-icon-wrapper {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .link-icon-wrapper svg {
    width: 20px;
    height: 20px;
  }

  .link-title {
    font-size: 0.92rem;
  }

  .link-description {
    font-size: 0.78rem;
  }
}
