/* ==========================================================================
   Accueil — hero, sections éditoriales, bandeau communauté
   ========================================================================== */

/* ----------------------------------------------------------------- hero */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

/* La photo de nuit : la lune sert de source de lumière pour le bouton. */
.hero-sky {
  position: absolute;
  /* Calque élargi vers la droite : la lune se décale hors du titre. */
  inset: 0 -24% 0 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(7, 11, 22, 0.94) 0%, rgba(7, 11, 22, 0.6) 52%, rgba(7, 11, 22, 0.18) 100%),
    linear-gradient(180deg, rgba(7, 11, 22, 0.35) 0%, rgba(7, 11, 22, 0) 25%, rgba(7, 11, 22, 0) 58%, var(--night) 100%),
    var(--settings-background) 62% 38% / cover no-repeat,
    var(--night);
  animation: moonrise 2.4s var(--ease) both;
}

/* Grain léger pour casser l'aplat de la photo */
.hero-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes moonrise {
  from { opacity: 0; transform: scale(1.08); }
  to   { opacity: 1; transform: scale(1); }
}

.hero-body {
  margin: auto;
  padding: calc(var(--nav-h) + 48px) 0 112px;
}

.hero-eyebrow .live-dot.is-static {
  background: var(--violet-hi);
}
.hero-eyebrow .live-dot.is-static::after {
  display: none;
}

.hero-eyebrow {
  animation: rise 0.9s 0.25s var(--ease) both;
}

.hero-title {
  max-width: 13ch;
  margin: 0 !important;
  color: var(--moon);
  font: 800 clamp(2.5rem, 7vw, 5.5rem)/0.98 var(--display) !important;
  letter-spacing: -0.045em;
  text-wrap: balance;
  animation: rise 0.9s 0.35s var(--ease) both;
}

.hero-lede {
  max-width: 46ch;
  margin: 28px 0 0;
  animation: rise 0.9s 0.45s var(--ease) both;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: 44px;
  animation: rise 0.9s 0.55s var(--ease) both;
}

.hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--mist) !important;
  font-weight: 500;
  transition: color 0.15s;
}
.hero-secondary:hover {
  color: var(--moon) !important;
}
.hero-secondary .bi-arrow-right {
  transition: transform 0.2s var(--ease);
}
.hero-secondary:hover .bi-arrow-right {
  transform: translateX(3px);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 16px 0 0;
  color: var(--mist);
  font-size: 0.9375rem;
  animation: rise 0.9s 0.65s var(--ease) both;
}
.hero-meta:empty {
  display: none;
}
.hero-players b {
  color: var(--moon);
  font-weight: 600;
}
.hero-players + span::before {
  content: "·";
  margin-right: 18px;
  color: var(--line);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* -------------------------------------------------------- mise en page */

.home-main {
  display: flex;
  flex-direction: column;
}

.home-section > section {
  padding: 56px 0;
}
.home-section:first-child > section {
  padding-top: 32px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 32px;
}
.section-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--mist) !important;
  font-weight: 500;
  transition: color 0.15s;
}
.section-link:hover {
  color: var(--moon) !important;
}

.reveal {
  transition-delay: var(--delay, 0ms);
}

/* ------------------------------------------------------------ features */

.features-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 64px;
  margin: 0;
}

.feature {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 18px;
  padding: 26px 0 30px;
  border-top: 1px solid var(--line);
}

.feature-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--violet-hi);
  font-size: 1.125rem;
}

.feature dt {
  color: var(--moon);
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.35;
}

.feature dd {
  max-width: 48ch;
  margin: 6px 0 0;
  color: var(--mist);
}

/* --------------------------------------------------------------- steps */

.home-section > .steps {
  margin: 40px 0;
}

section.steps {
  position: relative;
  padding: 72px clamp(20px, 5vw, 64px) 64px !important;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(139, 92, 255, 0.16), transparent 60%),
    var(--deep);
}

.steps .anchor {
  position: absolute;
  top: 0;
}

.steps-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps-list li {
  counter-increment: step;
}

.steps-list li::before {
  content: counter(step);
  display: block;
  margin-bottom: 14px;
  color: var(--violet-hi);
  font: 800 3rem/1 var(--display);
}

.steps-list h3 {
  margin: 0;
  font-weight: 600;
  font-size: 1.1875rem;
  overflow-wrap: anywhere;
}

.steps-list p {
  margin: 8px 0 0;
  color: var(--mist);
}

.ip-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: rgba(7, 11, 22, 0.5);
  color: var(--moon);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.ip-chip:hover {
  border-color: var(--violet-edge);
  background: var(--violet-wash);
}
.ip-chip code {
  color: var(--moon);
  font: 600 0.9375rem/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
}
.ip-chip-action {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--mist);
}
.ip-chip .copy-state {
  display: none;
}
.ip-chip.is-copied {
  border-color: rgba(61, 220, 151, 0.55);
}
.ip-chip.is-copied .copy-idle {
  display: none;
}
.ip-chip.is-copied .copy-state {
  display: inline;
  color: var(--ok);
}

.steps-note {
  margin: 56px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--mist);
}
.steps-note a {
  color: var(--moon) !important;
  text-decoration: underline !important;
  text-decoration-color: var(--violet-hi) !important;
}

/* ---------------------------------------------------------------- news */

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.news-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--deep);
  transition: border-color 0.2s, transform 0.3s var(--ease);
}
.news-card:hover {
  border-color: var(--line);
  transform: translateY(-3px);
}

.news-card.is-featured {
  grid-column: span 2;
  grid-row: span 2;
}

.news-media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--night);
}
.news-card.is-featured .news-media {
  aspect-ratio: auto;
  flex: 1;
  min-height: 240px;
}
.news-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.news-card:hover .news-media img {
  transform: scale(1.04);
}

.news-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: radial-gradient(80% 80% at 70% 20%, rgba(139, 92, 255, 0.22), transparent 70%), var(--night);
}
.news-placeholder img {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0.7;
}

.news-body {
  padding: 20px 22px 24px;
}
.news-meta {
  display: flex;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--mist);
  font-size: 0.8125rem;
}
.news-title {
  margin: 0;
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.35;
}
.news-card.is-featured .news-title {
  font: 700 clamp(1.25rem, 2.2vw, 1.625rem)/1.2 var(--display);
  letter-spacing: -0.02em;
}
.news-title a {
  color: var(--moon) !important;
}
.news-excerpt {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--mist);
  font-size: 0.9375rem;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Empty state partagé */
.empty-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 22px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.empty-state h2,
.empty-state h3 {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 1.0625rem;
}
.empty-state p {
  margin: 0;
  color: var(--mist);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--violet-wash);
  color: var(--violet-hi);
  font-size: 1.25rem;
}

.posts-search {
  width: min(320px, 100%);
}

/* --------------------------------------------------- bandeau communauté */

.home-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 24px;
  padding: 56px 0 0;
}
.home-band:not(:has(.home-band-item)) {
  display: none;
}
.home-band > .editor-add {
  grid-column: 1 / -1;
}

.home-band-item > section {
  height: 100%;
}

section.band-card,
.home-band-item > section:not(.band-card) {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 32px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--deep);
}

.band-card .eyebrow {
  margin-bottom: 12px;
}

.band-title {
  margin: 0 0 10px;
  font: 700 clamp(1.25rem, 2.2vw, 1.625rem)/1.2 var(--display);
  letter-spacing: -0.025em;
}

.band-text {
  max-width: 42ch;
  margin: 0;
  color: var(--mist);
}

.band-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 24px;
}

/* Discord */
section.discord-card {
  background:
    radial-gradient(90% 80% at 100% 0%, rgba(88, 101, 242, 0.18), transparent 65%),
    var(--deep);
}
.discord-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(7, 11, 22, 0.45);
}
.discord-card .band-title {
  margin-bottom: 24px;
}
.discord-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 14px;
  background: #5865f2;
  color: #fff;
  font-size: 1.375rem;
}
.discord-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.discord-title {
  overflow: hidden;
  color: var(--moon);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.discord-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--mist);
  font-size: 0.875rem;
}
.discord-count .live-dot {
  margin-right: 2px;
}
.discord-join {
  margin-left: auto;
  flex-shrink: 0;
}

/* Profil */
.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  image-rendering: pixelated;
  object-fit: cover;
}
.profile-role {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* -------------------------------------------------- éditeur (admin) */

.hero.editor {
  border-width: 0 !important;
  outline: 2px solid transparent;
  outline-offset: -2px;
}
.hero.editor:hover {
  outline-color: var(--violet);
}
.hero .toolbox {
  top: calc(var(--nav-h) + 12px) !important;
  right: 16px !important;
}

/* ---------------------------------------------------------- responsive */

@media (max-width: 991.98px) {
  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .features-list,
  .steps-list {
    grid-template-columns: 1fr;
  }
  .steps-list {
    gap: 32px;
  }
  .hero-sky {
    inset: 0;
    background:
      linear-gradient(180deg, rgba(7, 11, 22, 0.55) 0%, rgba(7, 11, 22, 0.78) 55%, var(--night) 100%),
      var(--settings-background) 60% 40% / cover no-repeat,
      var(--night);
  }
  .hero {
    min-height: 92svh;
  }
  .hero-body {
    padding-bottom: 72px;
  }
}

@media (max-width: 575.98px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
  .news-card.is-featured {
    grid-column: auto;
    grid-row: auto;
  }
  .news-card.is-featured .news-media {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }
  .btn-launch {
    width: 100%;
  }
  section.band-card,
  .home-band-item > section:not(.band-card) {
    padding: 24px;
  }
  .discord-row {
    flex-wrap: wrap;
  }
  .discord-join {
    width: 100%;
  }
  .home-section > section {
    padding: 40px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-sky,
  .hero-eyebrow,
  .hero-title,
  .hero-lede,
  .hero-cta,
  .hero-meta {
    animation: none;
  }
}
