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

:root {
  --page-background: #1b1430;
  --card-background: #271d52;
  --instagram-background: linear-gradient(150deg, #2f2170, #241a4a);
  --discord-background: linear-gradient(150deg, #472f9e, #241a4a);
  --icon-background: #472f9e;
  --text: #f0ecfb;
  --muted-text: #c9bbf0;
  --subtle-text: #ab9ade;
  --accent: #afa9ec;
  --button: #6247c6;
  --border: rgba(184, 165, 232, 0.18);
  --soft-border: rgba(184, 165, 232, 0.14);
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background: var(--page-background);
  color: var(--text);
  font-family: "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}

img {
  -webkit-user-drag: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.site {
  display: flex;
  width: 100%;
  min-height: 100dvh;
  flex-direction: column;
  background: var(--page-background);
}

.hero {
  position: relative;
  height: min(680px, 74vh);
  min-height: 440px;
  flex-shrink: 0;
  overflow: hidden;
}

.hero-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  animation: hero-reveal 1.1s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 10, 26, 0.72) 0%,
    rgba(15, 10, 26, 0) 28%,
    rgba(27, 20, 48, 0) 50%,
    rgba(27, 20, 48, 0.94) 82%,
    var(--page-background) 100%
  );
}

.topbar {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  animation: fade-down 0.7s 0.12s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.kicker {
  margin: 0;
}

.language {
  display: flex;
  align-items: center;
  gap: 7px;
}

.language-separator {
  opacity: 0.35;
}

.language button {
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.language button:hover {
  opacity: 0.85;
}

.language button[aria-pressed="true"] {
  opacity: 1;
}

.heading {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-heading {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 32px;
  left: 0;
  padding: 0 24px;
  animation: fade-up 0.8s 0.22s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.desktop-heading {
  display: none;
}

.wordmark {
  margin: 0;
  color: var(--text);
  font-family: "Bodoni Moda", serif;
  font-size: clamp(72px, 22vw, 96px);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: 0.12em;
}

.tagline {
  margin: 0;
  color: var(--muted-text);
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.06em;
}

.link-list {
  display: flex;
  padding: 24px 20px;
  flex-direction: column;
  gap: 12px;
}

/* Rendu tardif de l'API : la cascade d'entrée est déjà passée, rejouer les
   animations ferait clignoter des cartes déjà visibles. */
.link-list.instant .card,
.link-list.instant .join-button {
  animation: none;
}

.card {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  color: var(--text);
  transition:
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 0.35s;
}

.card::before {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    var(--glow-size, 340px) circle at var(--pointer-x, 50%) var(--pointer-y, -60%),
    rgba(240, 236, 251, 0.14),
    transparent 62%
  );
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.card:hover {
  border-color: rgba(184, 165, 232, 0.4);
  transform: scale(1.02);
}

.card:hover::before {
  opacity: 1;
}

.instagram-card {
  display: flex;
  padding: 22px;
  flex-direction: column;
  gap: 16px;
  border-radius: 20px;
  background: var(--instagram-background);
  animation: card-in 0.65s var(--enter-delay, 0.3s) cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.instagram-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.instagram-name {
  font-size: 19px;
  font-weight: 600;
}

.instagram-description {
  margin-top: 3px;
  color: var(--muted-text);
  font-size: 13px;
}

.external-arrow {
  color: var(--muted-text);
  font-family: var(--mono);
  font-size: 12px;
}

.instagram-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.instagram-photo {
  overflow: hidden;
  border-radius: 10px;
  aspect-ratio: 4 / 5;
  background: var(--card-background);
}

.instagram-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discord-card {
  display: flex;
  padding: 20px 22px;
  flex-direction: column;
  gap: 16px;
  border-radius: 20px;
  background: var(--discord-background);
  animation: card-in 0.65s var(--enter-delay, 0.39s) cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.discord-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon {
  display: flex;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--icon-background);
  color: var(--text);
}

.discord-card .icon {
  border: 1px solid rgba(240, 236, 251, 0.14);
}

.discord-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.discord-title {
  font-size: 18px;
  font-weight: 600;
}

.discord-description,
.presence {
  color: var(--muted-text);
  font-size: 13px;
}

.presence {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #917ee3;
  box-shadow: 0 0 10px #917ee3;
}

.join-button {
  align-self: stretch;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--button);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  animation: button-pop 0.6s var(--enter-delay, 0.72s) cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.social-card {
  display: flex;
  padding: 14px 16px;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--soft-border);
  border-radius: 16px;
  background: var(--card-background);
  animation: card-in 0.65s var(--enter-delay, 0.48s) cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

/* Cascade d'entrée du HTML statique (avant le rendu de /api/public-site/links).
   Elle est positionnelle, donc valable uniquement dans ce wrapper : une fois les
   cartes rendues par script.js, `.social-links` n'existe plus et la cascade est
   portée par `--enter-delay` posé en inline sur chaque carte. Ne jamais revenir
   à un `animation-delay` non scopé : nth-child comptait alors les cartes
   Instagram et Discord et laissait les derniers liens sans délai. */
.social-links .social-card:nth-child(2) {
  --enter-delay: 0.57s;
}

.social-links .social-card:nth-child(3) {
  --enter-delay: 0.66s;
}

.social-links .social-card:nth-child(4) {
  --enter-delay: 0.75s;
}

.social-card .icon {
  width: 40px;
  height: 40px;
}

.social-label {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: baseline;
  gap: 8px;
}

.social-name {
  font-size: 14.5px;
  font-weight: 600;
}

.social-handle {
  color: var(--subtle-text);
  font-size: 12px;
}

.social-arrow {
  color: var(--subtle-text);
  font-family: var(--mono);
  font-size: 13px;
}

.footer {
  display: flex;
  padding: 8px 24px 28px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #8f7ec2;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  animation: fade-up 0.65s 0.82s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.footer span:last-child {
  text-align: right;
}

@media (min-width: 900px) {
  html,
  body {
    height: auto;
    overflow-x: clip;
  }

  .site {
    min-height: 100dvh;
    align-items: flex-start;
    flex-direction: row;
  }

  .hero {
    position: sticky;
    top: 0;
    width: 40%;
    height: 100dvh;
    min-height: 0;
  }

  .hero-image {
    object-position: center 15%;
  }

  .hero-shade {
    background:
      linear-gradient(90deg, rgba(27, 20, 48, 0) 72%, var(--page-background) 100%),
      linear-gradient(
        180deg,
        rgba(15, 10, 26, 0.55) 0%,
        rgba(15, 10, 26, 0) 20%,
        rgba(27, 20, 48, 0) 72%,
        rgba(27, 20, 48, 0.75) 100%
      );
  }

  .topbar {
    top: 28px;
    right: 32px;
    left: 32px;
    font-size: 11.5px;
    letter-spacing: 0.16em;
  }

  .mobile-heading {
    display: none;
  }

  .content {
    display: flex;
    min-width: 0;
    min-height: 100dvh;
    padding: 64px 72px 40px;
    flex: 1;
    flex-direction: column;
    gap: 28px;
  }

  .desktop-heading {
    display: flex;
    animation: fade-up 0.8s 0.16s cubic-bezier(0.2, 0.75, 0.2, 1) both;
  }

  .desktop-heading .wordmark {
    font-size: 108px;
    line-height: 0.88;
  }

  .desktop-heading .tagline {
    font-size: 17px;
    letter-spacing: 0.07em;
  }

  .link-list {
    padding: 0;
    gap: 12px;
  }

  .footer {
    padding: 8px 0 0;
  }

  .instagram-card {
    padding: 26px;
    gap: 18px;
    border-radius: 22px;
  }

  .instagram-name {
    font-size: 22px;
  }

  .instagram-description {
    font-size: 14px;
  }

  .instagram-grid {
    gap: 10px;
  }

  .instagram-photo {
    border-radius: 12px;
  }

  .card:hover {
    transform: scale(1.015);
  }

  .discord-card {
    padding: 24px 26px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 22px;
  }

  .discord-card .icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .discord-title {
    font-size: 19px;
  }

  .discord-description {
    font-size: 13.5px;
  }

  .join-button {
    align-self: auto;
    flex-shrink: 0;
  }

  .social-card {
    padding: 16px 18px;
    gap: 16px;
  }

  .social-card .icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .social-name {
    font-size: 15px;
  }

  .social-handle {
    font-size: 12.5px;
  }

  .social-arrow {
    font-size: 14px;
  }
}

@keyframes hero-reveal {
  from {
    opacity: 0;
    transform: scale(1.035);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    translate: 0 16px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes fade-down {
  from {
    opacity: 0;
    translate: 0 -12px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    translate: 0 18px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes button-pop {
  from {
    opacity: 0;
    scale: 0.9;
  }

  70% {
    opacity: 1;
    scale: 1.035;
  }

  to {
    opacity: 1;
    scale: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-image,
  .topbar,
  .mobile-heading,
  .desktop-heading,
  .instagram-card,
  .discord-card,
  .join-button,
  .social-card,
  .footer {
    animation: none;
  }

  .card,
  .card::before,
  .language button {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}
