/* ══════════════════════════════════════════════════════════
   Theme: Stars
   ══════════════════════════════════════════════════════════

   A dark parallax starfield theme adapted from the LinkStack "Galaxy" theme
   by JulianPrieber & LinkStack Team, used on elena.social.

   ── LICENSE & ATTRIBUTION ──────────────────────────────────

   This theme is a derivative work. Original sources and their licenses:

   • Galaxy theme for LinkStack
     Author: JulianPrieber & LinkStack Team
     Source: https://github.com/linkstackorg/galaxy
     License: GPLv3 — https://www.gnu.org/licenses/gpl-3.0.html

   • Skeleton CSS (used as a base by Galaxy)
     Author: Dave Gamache
     Source: https://github.com/dhg/Skeleton
     License: MIT — https://opensource.org/licenses/MIT

   • Linktree clone (layout patterns used by Galaxy)
     Author: johnggli
     Source: https://github.com/johnggli/linktree
     License: MIT — https://github.com/johnggli/linktree/blob/master/LICENSE.md

   Because the Galaxy theme is GPLv3-licensed, this derivative file is also
   distributed under the terms of the GNU General Public License v3.0.
   You may redistribute and/or modify it under those terms.
   A copy of the GPLv3 is available at https://www.gnu.org/licenses/gpl-3.0.html

   Adaptations for FediProfile's markup (`.card`, `.link-card`, `.profile-avatar`,
   etc.) by the FediProfile project.

   ══════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* Galaxy palette — radial gradient from deep navy to near-black */
  --bgColor: #223344;
  --bgColor2: #090a0f;
  --accentColor: #FFF;

  /* FediProfile semantic tokens mapped to Galaxy palette */
  --bg: #090a0f;
  --ink: #FFFFFF;
  --accent: #FFFFFF;
  --accent-hover: #c8d8ff;
  --card: rgba(14, 18, 32, 0.65);
  --card-hover: rgba(20, 26, 44, 0.8);
  --border: rgba(255, 255, 255, 0.15);
  --shadow: rgba(0, 0, 0, 0.5);
  --link-hover: rgba(255, 255, 255, 0.06);
  --star-glow: rgba(180, 200, 255, 0.6);

  /* Galaxy animation delay token */
  --delay: 0.3s;
}

/* ── Galaxy radial-gradient background ─────────────────── */
body {
  background: radial-gradient(ellipse at bottom, var(--bgColor) 0%, var(--bgColor2) 100%);
  background-repeat: no-repeat;
  background-size: cover;
  overflow-x: hidden;
  position: relative;
  font-family: 'Karla', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Galaxy-style page entrance: fade + slide up */
  opacity: 0;
  animation: bodyFadeIn 1s ease-out var(--delay) forwards;
}

@keyframes bodyFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Stars layer 1 — tiny (1px) stars, slow twinkle ───── */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(1px 1px at  4%  7%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 11% 21%, #dde4ff 50%, transparent 100%),
    radial-gradient(1px 1px at 19% 44%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 27% 66%, #c8d4ff 50%, transparent 100%),
    radial-gradient(1px 1px at 34% 14%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 41% 87%, #e8ecff 50%, transparent 100%),
    radial-gradient(1px 1px at 49% 34%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 57% 71%, #dde4ff 50%, transparent 100%),
    radial-gradient(1px 1px at 64% 51%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 71%  9%, #c8d4ff 50%, transparent 100%),
    radial-gradient(1px 1px at 79% 91%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 87% 37%, #e8ecff 50%, transparent 100%),
    radial-gradient(1px 1px at 94% 59%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 17% 54%, #dde4ff 50%, transparent 100%),
    radial-gradient(1px 1px at 44% 94%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 67% 81%, #c8d4ff 50%, transparent 100%),
    radial-gradient(1px 1px at 84% 24%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at  2% 41%, #e8ecff 50%, transparent 100%),
    radial-gradient(1px 1px at 52% 76%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 73% 47%, #dde4ff 50%, transparent 100%),
    radial-gradient(1px 1px at 38% 63%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at  8% 88%, #c8d4ff 50%, transparent 100%),
    radial-gradient(1px 1px at 91% 16%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 23% 32%, #e8ecff 50%, transparent 100%),
    radial-gradient(1px 1px at 60%  4%, #fff 50%, transparent 100%);
  opacity: 0.8;
  animation: twinkle1 6s ease-in-out infinite alternate;
}

/* ── Stars layer 2 — larger (2-2.5 px) stars ──────────── */
body::after {
  background:
    radial-gradient(2px 2px at  9% 14%, var(--star-glow) 40%, transparent 100%),
    radial-gradient(2.5px 2.5px at 24% 49%, #fff 40%, transparent 100%),
    radial-gradient(2px 2px at 39% 79%, var(--star-glow) 40%, transparent 100%),
    radial-gradient(2.5px 2.5px at 54% 24%, #fff 40%, transparent 100%),
    radial-gradient(2px 2px at 69% 64%, var(--star-glow) 40%, transparent 100%),
    radial-gradient(2.5px 2.5px at 84% 39%, #fff 40%, transparent 100%),
    radial-gradient(2px 2px at 14% 89%, var(--star-glow) 40%, transparent 100%),
    radial-gradient(2.5px 2.5px at 47% 54%, #fff 40%, transparent 100%),
    radial-gradient(2px 2px at 76% 18%, var(--star-glow) 40%, transparent 100%),
    radial-gradient(1.5px 1.5px at 32%  6%, #fff 40%, transparent 100%),
    radial-gradient(2px 2px at 58% 92%, var(--star-glow) 40%, transparent 100%),
    radial-gradient(1.5px 1.5px at 90% 72%, #fff 40%, transparent 100%);
  opacity: 0.65;
  animation: twinkle2 8s ease-in-out infinite alternate;
}

/* ── Twinkle keyframes ─────────────────────────────────── */
@keyframes twinkle1 {
  0%   { opacity: 0.6; }
  50%  { opacity: 0.9; }
  100% { opacity: 0.7; }
}

@keyframes twinkle2 {
  0%   { opacity: 0.5; }
  50%  { opacity: 0.8; }
  100% { opacity: 0.55; }
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
    opacity: 1;
  }
  body::before,
  body::after {
    animation: none;
    opacity: 0.7;
  }
  .card {
    animation: none !important;
  }
  .link-card {
    animation: none !important;
  }
  .link-card::after {
    animation: none !important;
  }
}

/* ── Card — no panel, content floats on the starfield ──── */
.card {
  position: relative;
  z-index: 1;
  max-width: 600px;            /* Galaxy uses 600 px */
  width: 100%;
  padding: 50px 0 0;           /* Galaxy spacing top */
  margin: 0 auto;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  text-align: center;
  animation: cardFadeIn 800ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--delay);
}

/* ── Heading — clean white, Galaxy style ───────────────── */
h1 {
  font-size: 2.6rem;
  font-weight: 400;            /* Galaxy uses 400 */
  text-align: center;
  letter-spacing: 0;
  color: #fff;
  text-shadow: 0 0 30px rgba(180, 200, 255, 0.15);
}

.subtitle {
  color: #8b95b0;
  text-align: center;
  font-size: 1rem;
}

/* ── Category headers — Galaxy style: bold, centered ───── */
h2 {
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-transform: none;         /* Galaxy doesn't uppercase */
  letter-spacing: 0;
  font-size: 1.25rem;           /* Larger like Galaxy */
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 20px;
}

h2::before,
h2::after {
  content: '';
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* ── Link cards — Galaxy button style ──────────────────── */
/*
   Galaxy buttons: transparent bg, white 2px border, white text,
   fill white on hover with inverted text. Rounded 10px.
   We adapt this to FediProfile's .link-card layout.
*/
.link-card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 8px 24px;
  background: transparent;
  border: 3px solid var(--accentColor);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: all 280ms cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  /* Galaxy popUp entrance — staggered via CSS var */
  animation: popUp 1s both;
  animation-delay: calc(var(--delay) / 10);
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .link-card:hover {
    background: var(--accentColor);
    color: var(--bgColor);
    border-color: var(--accentColor);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.10);
  }
  .link-card:hover .link-content strong {
    color: var(--bgColor);
  }
  .link-card:hover .link-content p {
    color: var(--bgColor);
  }
  .link-card:hover .link-icon {
    filter: invert(100%) grayscale(100%);
    -webkit-filter: invert(100%) grayscale(100%);
  }
}

.link-card:active {
  background: var(--accentColor);
  color: var(--bgColor);
}

/* Galaxy popUp keyframe */
@keyframes popUp {
  from {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 0.3);
  }
  50% {
    opacity: 1;
  }
}

/* Subtle shimmer sweep across link cards */
.link-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    115deg,
    transparent 40%,
    rgba(180, 200, 255, 0.04) 45%,
    rgba(180, 200, 255, 0.06) 50%,
    rgba(180, 200, 255, 0.04) 55%,
    transparent 60%
  );
  animation: shimmer 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0%, 100% { transform: translateX(-100%) rotate(10deg); }
  50%      { transform: translateX(100%) rotate(10deg); }
}

/* ── Icons — small inline next to text, Galaxy style ───── */
.link-icon {
  width: 20px;
  height: 20px;
  border-radius: 0;
  object-fit: contain;
  flex-shrink: 0;
  vertical-align: middle;
  filter: grayscale(100%) invert(1);
  -webkit-filter: grayscale(100%) invert(1);
  transition: filter 280ms ease;
}

/* Override base theme flex:1 so icon+text center as a group */
.link-content {
  flex: 0 1 auto;
  text-align: center;
}

.profile-container, #profile-container {
  padding-top: 20px;
}

.link-content strong {
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  transition: color 280ms ease;
}

.link-content p {
  color: #8b95b0;
  transition: color 280ms ease;
  font-size: 0.85rem;
}

/* ── Boost badge ───────────────────────────────────────── */
.boost-badge {
  background: none;
  color: var(--accentColor);
  opacity: 0.5;
  padding: 0;
  box-shadow: none;
}
.boost-badge:hover {
  opacity: 0.8;
}

/* ── Info section — centered like Galaxy ────────────────── */
.info-section {
  border-top: 1px solid var(--border);
  text-align: center;
}

.info-section summary {
  color: #8b95b0;
  transition: color 200ms;
}

.info-section summary:hover {
  color: var(--accent);
}

.info-section ul {
  color: #8b95b0;
}

.info-section code {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}

/* ── Share button — Galaxy style, pinned top-right ─────── */
.share-btn {
  position: fixed;
  top: 30px;
  right: 0px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 20px;
  border: 2px solid var(--accentColor);
  border-radius: 10px;
  background: transparent;
  color: var(--accentColor);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.share-btn:hover {
  background: var(--accentColor);
  color: var(--bgColor);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.12);
}

.share-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Card entrance animation ───────────────────────────── */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Profile avatar — round with glow, Galaxy style ────── */
.profile-avatar {
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(180, 200, 255, 0.15),
              0 0 48px rgba(180, 200, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* ── Custom scrollbar — Galaxy style ───────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: #171a1d #31363b;
}

*::-webkit-scrollbar {
  width: 8px;
}

*::-webkit-scrollbar-track {
  background: #31363b;
}

*::-webkit-scrollbar-thumb {
  background-color: #171a1d;
  border-radius: 30px;
  border: 3px none #ffffff;
}

/* ── Fedi handle / footer text — centered ──────────────── */
.fedi-handle,
.fedi-note {
  text-align: center;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .card {
    padding: 24px 10px 0;
  }
  h1 {
    font-size: 2.1rem;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 20px 10px 0;
  }
  h1 {
    font-size: 1.8rem;
  }
  .link-card {
    padding: 14px 16px;
    gap: 10px;
  }
  .link-icon {
    width: 18px;
    height: 18px;
  }
}
