/* =========================================================
   LUMALIA — global.css
   ========================================================= */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

img, picture, svg, video {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; }

/* ---------- 2. Polices ---------- */
:root {
  --font-title: "Space Grotesk", system-ui, sans-serif;
  --font-subtitle: "Poppins", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-label: "Geist", "Inter", system-ui, sans-serif;
}

/* ---------- 3. Thème clair ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-elevated: #ffffff;

  --text: #0b0d12;
  --text-soft: #5a6072;
  --text-muted: #8b91a3;

  --border: #e6e8ee;
  --border-strong: #d4d8e2;

  --accent: #7c5cff;
  --accent-hover: #6a48f5;
  --accent-soft: rgba(124, 92, 255, 0.1);
  --accent-text: #ffffff;

  --success: #22c55e;
  --danger: #ef4444;

  --shadow-sm: 0 1px 2px rgba(11, 13, 18, 0.04);
  --shadow-md: 0 4px 16px rgba(11, 13, 18, 0.06);
  --shadow-lg: 0 12px 40px rgba(11, 13, 18, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --t-fast: 0.15s ease;
  --t-base: 0.25s ease;
  --t-slow: 0.4s ease;

  --container: 1200px;
  --navbar-height: 68px;
}

/* ---------- 4. Thème sombre ---------- */
[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-soft: #12141b;
  --bg-elevated: #161922;

  --text: #f4f5f8;
  --text-soft: #a3a9bd;
  --text-muted: #6f7488;

  --border: #1f2230;
  --border-strong: #2b2f40;

  --accent: #8f73ff;
  --accent-hover: #a08aff;
  --accent-soft: rgba(143, 115, 255, 0.15);
  --accent-text: #ffffff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ---------- 5. Base ---------- */
body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  transition: background-color var(--t-base), color var(--t-base);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.75rem); }
h3 { font-family: var(--font-subtitle); font-size: 1.4rem; font-weight: 600; }
h4 { font-family: var(--font-subtitle); font-size: 1.1rem; font-weight: 600; }

p { color: var(--text-soft); }

.label {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- 6. Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section { padding: 5rem 0; }

/* ---------- 7. Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--t-base);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ---------- 8. Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-height);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background var(--t-base), border-color var(--t-base);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1.5rem;
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  flex-shrink: 0;
}

.navbar__logo-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

/* Conteneur des liens : distance régulière entre chaque item */
.navbar__links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
}

/* Chaque item prend la même largeur de padding */
.navbar__item {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.navbar__link {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}
.navbar__link:hover {
  color: var(--text);
  background: var(--bg-soft);
}
.navbar__link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.navbar__icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all var(--t-fast);
}
.navbar__icon-btn:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
}

.lang-switch { position: relative; }
.lang-switch__btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 38px;
  padding: 0 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}
.lang-switch__btn:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
}
.lang-switch__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 130px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.35rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all var(--t-fast);
  z-index: 110;
}
.lang-switch.open .lang-switch__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lang-switch__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-label);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  transition: background var(--t-fast);
}
.lang-switch__item:hover { background: var(--bg-soft); }
.lang-switch__item.active { color: var(--accent); font-weight: 600; }

.navbar__burger {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text);
  place-items: center;
}
.navbar__burger span {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  position: relative;
  transition: background var(--t-fast);
}
.navbar__burger span::before,
.navbar__burger span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--t-fast);
}
.navbar__burger span::before { top: -5px; }
.navbar__burger span::after  { top: 5px; }

/* ---------- 9. Dropdown (Serveurs) ---------- */
/* Le lien parent a une petite flèche */
.navbar__link--parent {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.navbar__link--parent::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.6;
  transition: transform var(--t-fast);
}

/* Le panneau : positionné SOUS le lien, avec un pont invisible
   pour que le hover ne se casse pas entre les deux */
.navbar__dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  /* pont invisible : 12px de padding-top transparent */
  padding-top: 12px;
  min-width: 240px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-fast), visibility var(--t-fast);
  z-index: 120;
  pointer-events: none;
}

/* Ouverture au survol OU focus (clavier) */
.navbar__item:hover > .navbar__dropdown,
.navbar__item:focus-within > .navbar__dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Rotation de la flèche quand ouvert */
.navbar__item:hover > .navbar__link--parent::after,
.navbar__item:focus-within > .navbar__link--parent::after {
  transform: rotate(180deg);
}

/* Le panneau visuel (celui qui a fond / bordure / ombre) */
.navbar__dropdown-inner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
}

.navbar__dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast);
  color: var(--text);
}
.navbar__dropdown-item:hover {
  background: var(--bg-soft);
}
.navbar__dropdown-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.navbar__dropdown-item__logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}
.navbar__dropdown-item__logo--crystal { background: linear-gradient(135deg, #7c5cff, #b39bff); }
.navbar__dropdown-item__logo--azur    { background: linear-gradient(135deg, #0ea5e9, #67e8f9); }
.navbar__dropdown-item__logo--green   { background: linear-gradient(135deg, #22c55e, #4ade80); }

.navbar__dropdown-item__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.navbar__dropdown-item__text strong {
  font-family: var(--font-subtitle);
  font-weight: 600;
  font-size: 0.9rem;
}
.navbar__dropdown-item__text span {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-label);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- 10. Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-top: 5rem;
  background: var(--bg);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}
.footer__brand { max-width: 280px; }
.footer__brand p { font-size: 0.9rem; margin-top: 0.5rem; }
.footer__cols {
  display: flex;
  gap: 4rem;
  flex-wrap: wrap;
}
.footer__col h5 {
  font-family: var(--font-label);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
  font-weight: 600;
}
.footer__col a {
  display: block;
  font-size: 0.9rem;
  color: var(--text-soft);
  padding: 0.3rem 0;
  transition: color var(--t-fast);
}
.footer__col a:hover { color: var(--accent); }

.footer__bottom {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- 11. Fond animé ---------- */
#luma-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  display: block;
  transition: opacity var(--t-slow);
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}
.bg-blobs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  transition: opacity var(--t-slow);
}
[data-theme="dark"] .bg-blobs span { opacity: 0.25; }

.bg-blobs span:nth-child(1) {
  width: 480px;
  height: 480px;
  background: #b39bff;
  top: -120px;
  left: -120px;
  animation: blobFloat1 22s ease-in-out infinite;
}
.bg-blobs span:nth-child(2) {
  width: 420px;
  height: 420px;
  background: #8ad4ff;
  bottom: -140px;
  right: -100px;
  animation: blobFloat2 26s ease-in-out infinite;
}

@keyframes blobFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(60px, 40px) scale(1.1); }
}
@keyframes blobFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-50px, -40px) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-blobs span { animation: none; }
}

/* ---------- 12. Responsive ---------- */
@media (max-width: 900px) {
  .navbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg);
  }

  .navbar__links {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    z-index: 99;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.5rem 1.5rem;
    gap: 0.25rem;
    transform: translateY(-120%);
    transition: transform var(--t-base), visibility var(--t-base);
    visibility: hidden;
    justify-content: flex-start;
    max-height: calc(100vh - var(--navbar-height) - 2rem);
    overflow-y: auto;
    flex: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
  .navbar__links.open {
    transform: translateY(0);
    visibility: visible;
  }
  .navbar__link {
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
  }
  .navbar__burger {
    display: grid;
    z-index: 101;
  }
  .navbar__cta { display: none; }
  .footer__cols { gap: 2.5rem; }

  /* Dropdown en version mobile : accordéon */
  .navbar__item {
    width: 100%;
    display: block;
  }
  .navbar__link--parent {
    justify-content: space-between;
    width: 100%;
  }
  .navbar__item.open .navbar__link--parent::after {
    transform: rotate(180deg);
  }
  .navbar__dropdown {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    padding-top: 0;
    min-width: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--t-base);
    pointer-events: auto;
  }
  .navbar__item.open .navbar__dropdown {
    max-height: 500px;
  }
  .navbar__dropdown-inner {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.25rem 0 0.5rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .section { padding: 3.5rem 0; }
}

/* ---------- Bouton utilisateur (connecté) ---------- */
.navbar__user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--t-fast);
}
.navbar__user-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

.navbar__user-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b39bff);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.navbar__user-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .navbar__user-name {
    display: none;
  }
}

/* =========================================================
   BBcode — rendu des messages formatés
   ========================================================= */

.bb-code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  overflow-x: auto;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

.bb-quote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.bb-quote cite {
  display: block;
  font-family: var(--font-label);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
  font-style: normal;
}
.bb-quote p {
  margin: 0;
  color: var(--text);
}

.bb-spoiler {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin: 0.75rem 0;
  background: var(--bg-soft);
}
.bb-spoiler summary {
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.85rem;
  color: var(--text-soft);
  user-select: none;
}
.bb-spoiler[open] summary {
  margin-bottom: 0.5rem;
}

.bb-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 0.5rem 0;
}

.bb-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bb-link:hover {
  color: var(--accent-hover);
}

.bb-center { text-align: center; }
.bb-right  { text-align: right; }
.bb-left   { text-align: left; }

.bb-list {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}
.bb-list li {
  margin-bottom: 0.25rem;
  color: var(--text-soft);
}
.bb-list:not([class*="ol"]) {
  list-style: disc;
}
ol.bb-list {
  list-style: decimal;
}

/* ---------- BBcode : séparateur + vidéo ---------- */
.bb-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.bb-video {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  margin: 0.75rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.bb-video iframe {
  width: 100%;
  height: 100%;
  display: block;
}

/* ⚠️ Forcer le modal editor news à être caché */
#news-editor-modal:not(.open) {
  display: none !important;
}
