/* ============================================================
   LINKTREE — MERIDIAN
   Editorial typographic design. Cormorant + DM Sans.
   Full-width fill hover. No card boxing.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,600;1,300;1,600&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --transition: 0.2s ease;
  --transition-theme: 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  --card-px: 40px;
}

/* ── Themes ──────────────────────────────────────────────── */

[data-theme="dark"] {
  --accent:        #6366f1;
  --accent-text:   #f8f8ff;
  --bg:            #080808;
  --bg-mesh:
    radial-gradient(ellipse 900px 700px at 20%  -5%, rgba(99,102,241,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 600px 900px at 80% 105%, rgba(139,92,246,0.16) 0%, transparent 60%);
  --text-primary:  #f0ebe0;
  --text-secondary:#4a4a5a;
  --rule:          rgba(255,255,255,0.07);
  --rule-strong:   rgba(255,255,255,0.14);
  --card-bg:       rgba(255,255,255,0.02);
  --cat-color:     var(--accent);
  --badge-bg:      rgba(99,102,241,0.15);
  --badge-text:    #a5b4fc;
  --avatar-border: var(--accent);
  --avatar-glow:   rgba(99,102,241,0.2);
  --link-fill:     var(--accent);
}

[data-theme="light"] {
  --accent:        #4f46e5;
  --accent-text:   #ffffff;
  --bg:            #f7f5f0;
  --bg-mesh:
    radial-gradient(ellipse 800px 600px at 20%  0%,  rgba(99,102,241,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 600px 800px at 80% 100%, rgba(139,92,246,0.06) 0%, transparent 60%);
  --text-primary:  #1a1814;
  --text-secondary:#999080;
  --rule:          rgba(0,0,0,0.08);
  --rule-strong:   rgba(0,0,0,0.16);
  --card-bg:       rgba(255,255,255,0.6);
  --cat-color:     var(--accent);
  --badge-bg:      rgba(79,70,229,0.10);
  --badge-text:    #4338ca;
  --avatar-border: var(--accent);
  --avatar-glow:   rgba(79,70,229,0.15);
  --link-fill:     var(--accent);
}

[data-theme="midnight"] {
  --accent:        #38bdf8;
  --accent-text:   #0a0f1e;
  --bg:            #060c18;
  --bg-mesh:
    radial-gradient(ellipse 1000px 800px at 10%  -5%, rgba(56,189,248,0.20) 0%, transparent 60%),
    radial-gradient(ellipse 700px 900px at 90% 110%, rgba(99,102,241,0.14) 0%, transparent 60%);
  --text-primary:  #ddf0ff;
  --text-secondary:#2a4560;
  --rule:          rgba(56,189,248,0.09);
  --rule-strong:   rgba(56,189,248,0.18);
  --card-bg:       rgba(56,189,248,0.02);
  --cat-color:     var(--accent);
  --badge-bg:      rgba(56,189,248,0.14);
  --badge-text:    #7dd3fc;
  --avatar-border: var(--accent);
  --avatar-glow:   rgba(56,189,248,0.22);
  --link-fill:     var(--accent);
}

[data-theme="sunset"] {
  --accent:        #f97316;
  --accent-text:   #100802;
  --bg:            #0c0600;
  --bg-mesh:
    radial-gradient(ellipse 900px 700px at 15% -10%, rgba(249,115,22,0.26) 0%, transparent 60%),
    radial-gradient(ellipse 700px 900px at 85% 110%, rgba(234,88,12,0.18) 0%, transparent 60%);
  --text-primary:  #fff0e0;
  --text-secondary:#5a3818;
  --rule:          rgba(249,115,22,0.10);
  --rule-strong:   rgba(249,115,22,0.22);
  --card-bg:       rgba(249,115,22,0.02);
  --cat-color:     var(--accent);
  --badge-bg:      rgba(249,115,22,0.16);
  --badge-text:    #fdba74;
  --avatar-border: var(--accent);
  --avatar-glow:   rgba(249,115,22,0.24);
  --link-fill:     var(--accent);
}

[data-theme="forest"] {
  --accent:        #22c55e;
  --accent-text:   #030d06;
  --bg:            #030a04;
  --bg-mesh:
    radial-gradient(ellipse 800px 700px at 10%  0%,  rgba(34,197,94,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 600px 800px at 90% 110%, rgba(16,185,129,0.15) 0%, transparent 60%);
  --text-primary:  #e8ffe8;
  --text-secondary:#1e4020;
  --rule:          rgba(34,197,94,0.09);
  --rule-strong:   rgba(34,197,94,0.20);
  --card-bg:       rgba(34,197,94,0.02);
  --cat-color:     var(--accent);
  --badge-bg:      rgba(34,197,94,0.14);
  --badge-text:    #86efac;
  --avatar-border: var(--accent);
  --avatar-glow:   rgba(34,197,94,0.22);
  --link-fill:     var(--accent);
}

[data-theme="neon"] {
  --accent:        #e879f9;
  --accent-text:   #08000f;
  --bg:            #000000;
  --bg-mesh:
    radial-gradient(ellipse 700px 600px at 15%  5%,  rgba(232,121,249,0.20) 0%, transparent 60%),
    radial-gradient(ellipse 600px 700px at 85%  95%, rgba(139,92,246,0.16) 0%, transparent 60%);
  --text-primary:  #ffe8ff;
  --text-secondary:#4a1060;
  --rule:          rgba(232,121,249,0.10);
  --rule-strong:   rgba(232,121,249,0.22);
  --card-bg:       rgba(232,121,249,0.02);
  --cat-color:     var(--accent);
  --badge-bg:      rgba(232,121,249,0.16);
  --badge-text:    #f0abfc;
  --avatar-border: var(--accent);
  --avatar-glow:   rgba(232,121,249,0.28);
  --link-fill:     var(--accent);
}
[data-theme="neon"] .name {
  text-shadow: 0 0 40px rgba(232,121,249,0.20);
}
[data-theme="neon"] .link-item:hover {
  text-shadow: none;
}

[data-theme="rose"] {
  --accent:        #f43f5e;
  --accent-text:   #1a0008;
  --bg:            #fdf0f3;
  --bg-mesh:
    radial-gradient(ellipse 700px 500px at 20%  0%,  rgba(244,63,94,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 500px 700px at 80% 100%, rgba(251,113,133,0.08) 0%, transparent 60%);
  --text-primary:  #1a0410;
  --text-secondary:#c08090;
  --rule:          rgba(244,63,94,0.09);
  --rule-strong:   rgba(244,63,94,0.20);
  --card-bg:       rgba(255,255,255,0.55);
  --cat-color:     var(--accent);
  --badge-bg:      rgba(244,63,94,0.09);
  --badge-text:    #e11d48;
  --avatar-border: var(--accent);
  --avatar-glow:   rgba(244,63,94,0.18);
  --link-fill:     var(--accent);
}

[data-theme="ocean"] {
  --accent:        #06b6d4;
  --accent-text:   #010e14;
  --bg:            #010c12;
  --bg-mesh:
    radial-gradient(ellipse 900px 700px at  5%  -5%, rgba(6,182,212,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 600px 900px at 95% 105%, rgba(14,165,233,0.16) 0%, transparent 60%);
  --text-primary:  #daf8ff;
  --text-secondary:#14506a;
  --rule:          rgba(6,182,212,0.09);
  --rule-strong:   rgba(6,182,212,0.20);
  --card-bg:       rgba(6,182,212,0.02);
  --cat-color:     var(--accent);
  --badge-bg:      rgba(6,182,212,0.14);
  --badge-text:    #67e8f9;
  --avatar-border: var(--accent);
  --avatar-glow:   rgba(6,182,212,0.24);
  --link-fill:     var(--accent);
}

/* ── Base ────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-mesh);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 0 80px;
  transition: background-color var(--transition-theme), color var(--transition-theme);
}

/* ── Page ────────────────────────────────────────────────── */
.page {
  width: 100%;
  max-width: 560px;
  padding: 0 16px;
}

/* The "card" is now a minimal container — barely visible */
.card {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  border-radius: 0 0 8px 8px;
  padding: 48px var(--card-px) 36px;
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: border-color var(--transition-theme), background var(--transition-theme);
  overflow: hidden; /* clip the link fills */
}

/* ── Theme Picker ────────────────────────────────────────── */
.theme-picker {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.theme-picker-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--rule-strong);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: border-color var(--transition), transform var(--transition);
}
.theme-picker-toggle:hover {
  border-color: var(--accent);
  transform: rotate(15deg);
}

.theme-swatches {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.theme-swatches.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.swatch {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.swatch:hover { background: var(--rule); }
.swatch.active { background: var(--rule); }

.swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.swatch-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
}
.swatch.active .swatch-label { color: var(--text-primary); font-weight: 600; }

/* ── Profile ─────────────────────────────────────────────── */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: 32px;
  gap: 0;
}

.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 1.5px solid var(--avatar-border);
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  font-style: italic;
  color: var(--avatar-border);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 0 0 5px var(--avatar-glow), 0 0 30px var(--avatar-glow);
  transition: border-color var(--transition-theme), box-shadow var(--transition-theme);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Decorative rule above name */
.profile-rule {
  width: 48px;
  height: 1px;
  background: var(--rule-strong);
  margin: 0 auto 18px;
}

.name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 2.9rem;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.0;
  color: var(--text-primary);
  margin-bottom: 10px;
  transition: color var(--transition-theme);
}

.title {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 12px;
  transition: color var(--transition-theme);
}

.bio {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.7;
}

/* ── Links Section ───────────────────────────────────────── */
.links {
  display: flex;
  flex-direction: column;
}

.category-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.60rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cat-color);
  padding: 28px 0 10px;
}
.category-heading::before {
  content: '';
  width: 20px;
  height: 1.5px;
  background: var(--cat-color);
  flex-shrink: 0;
}
/* First category heading needs less top padding */
.links > .category-heading:first-child { padding-top: 4px; }

/* ── Link Item ───────────────────────────────────────────── */
.link-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 0;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  position: relative;
  /* fills bleed through negative margin */
  margin-left: calc(-1 * var(--card-px));
  margin-right: calc(-1 * var(--card-px));
  padding-left: var(--card-px);
  padding-right: var(--card-px);
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: color 0.25s ease;
}
/* last item gets bottom border */
.link-item:last-child {
  border-bottom: 1px solid var(--rule);
}

/* Full-width fill — slides in from left on hover */
.link-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--link-fill);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

/* All children above fill */
.link-icon, .link-label, .link-badge, .link-arrow {
  position: relative;
  z-index: 1;
}

.link-item:hover::before { transform: scaleX(1); }
.link-item:hover {
  color: var(--accent-text);
}
.link-item:hover .link-arrow {
  color: var(--accent-text);
  transform: translateX(4px);
}
.link-item:active::before {
  transition-duration: 0.1s;
}

/* Featured item — slightly elevated */
.link-item.featured {
  border-top: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.link-item.featured:last-child {
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.link-icon {
  font-size: 1.05rem;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--rule);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.link-item:hover .link-icon {
  background: rgba(0,0,0,0.08);
  border-color: transparent;
}

.link-label { flex: 1; }

.link-badge {
  font-size: 0.60rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--badge-bg);
  color: var(--badge-text);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  flex-shrink: 0;
  transition: background 0.25s ease, color 0.25s ease;
}
.link-item:hover .link-badge {
  background: rgba(0,0,0,0.12);
  color: var(--accent-text);
}

.link-arrow {
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--text-secondary);
  transition: color 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  line-height: 1;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--text-secondary);
  padding-top: 32px;
  letter-spacing: 0.04em;
}
.footer-link {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition);
}
.footer-link:hover { opacity: 0.7; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.profile  { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both; }
.links    { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both; }
.footer   { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both; }

.link-item:nth-child(1)  { animation-delay: 0.10s; }
.link-item:nth-child(2)  { animation-delay: 0.14s; }
.link-item:nth-child(3)  { animation-delay: 0.18s; }
.link-item:nth-child(4)  { animation-delay: 0.22s; }
.link-item:nth-child(5)  { animation-delay: 0.26s; }
.link-item:nth-child(6)  { animation-delay: 0.30s; }
.link-item:nth-child(7)  { animation-delay: 0.34s; }
.link-item:nth-child(8)  { animation-delay: 0.38s; }
.link-item:nth-child(9)  { animation-delay: 0.42s; }
.link-item:nth-child(10) { animation-delay: 0.46s; }

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, .link-item::before, .link-item, .profile, .links, .footer, .card {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 520px) {
  :root { --card-px: 22px; }
  body { padding: 32px 0 64px; }
  .page { padding: 0 10px; }
  .card { padding: 36px var(--card-px) 28px; }
  .name { font-size: 2.3rem; }
}
