/* =========================================================
   Team Guérande — style.css
   Design system global (variables, reset, layout, menu)
   ========================================================= */

/* -------- Variables -------- */
:root {
  /* Thème sombre (par défaut) */
  --bg-from: #0a0a0f;
  --bg-to: #1a1a24;
  --surface: #14141c;
  --surface-2: rgba(255, 255, 255, 0.04);
  --text: #f5f5f7;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --glass-bg: rgba(20, 20, 28, 0.6);
  --glass-bg-solid: rgba(20, 20, 28, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-strong: rgba(255, 255, 255, 0.14);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --noise-opacity: 0.04;
  --logo-overwatch-opacity: 0.9;

  /* Couleurs fixes (identiques dans les deux thèmes) */
  --accent: #f6ad1a;
  --accent-soft: rgba(246, 173, 26, 0.15);
  --accent-hover: rgba(246, 173, 26, 0.25);

  /* Géométrie */
  --radius-pill: 999px;
  --radius-card: 24px;
  --radius-menu: 18px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1200px;
}

/* Thème clair (Apple) */
[data-theme="light"] {
  --bg-from: #f5f5f7;
  --bg-to: #e8e8ed;
  --surface: #ffffff;
  --surface-2: rgba(0, 0, 0, 0.03);
  --text: #1d1d1f;
  --text-muted: #515154;
  --text-dim: #86868b;
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-bg-solid: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-strong: rgba(0, 0, 0, 0.14);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --noise-opacity: 0.025;
  --logo-overwatch-opacity: 1;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-from) 0%, var(--bg-to) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Bruit SVG très léger pour le fond */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul {
  list-style: none;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* -------- Layout principal -------- */
main,
.section {
  position: relative;
  z-index: 1;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* -------- Menu liquid glass -------- */
nav.menu {
  position: sticky;
  top: 1rem;
  z-index: 100;
  margin: 1rem auto;
  width: fit-content;
  max-width: 720px;
  padding: 0.4rem;

  display: flex;
  align-items: center;
  gap: 0.25rem;

  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-menu);

  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);

  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

  /* Fallback navigateurs sans backdrop-filter */
  @supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    background: var(--glass-bg-solid);
  }
}

nav.menu ul {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

/* Indicateur de statut en ligne (à droite du menu) */
nav.menu .menu-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.25rem;
  padding: 0 0.4rem 0 0.2rem;
  border-left: 1px solid var(--glass-border);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

nav.menu .menu-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: pulse-online 2s infinite;
}

nav.menu .menu-status.is-offline .dot {
  background: #f6ad1a;
  box-shadow: 0 0 0 0 rgba(246, 173, 26, 0.7);
  animation: pulse-offline 2.5s infinite;
}

@keyframes pulse-online {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

@keyframes pulse-offline {
  0%   { box-shadow: 0 0 0 0 rgba(246, 173, 26, 0.6); }
  70%  { box-shadow: 0 0 0 6px rgba(246, 173, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(246, 173, 26, 0); }
}

/* Toggle de thème sombre / clair */
nav.menu .theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 0.15rem;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

nav.menu .theme-toggle:hover {
  background: var(--surface-2);
  color: var(--accent);
  transform: rotate(15deg);
}

nav.menu .theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

nav.menu .theme-toggle .icon-sun  { display: none; }
nav.menu .theme-toggle .icon-moon { display: block; }

[data-theme="light"] nav.menu .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] nav.menu .theme-toggle .icon-moon { display: none; }

/* Transition douce du thème */
body, .character-card, .character-portrait, nav.menu, .fun-gif, .roster {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

nav.menu li {
  position: relative;
}

nav.menu a {
  display: block;
  padding: 0.6rem 1.1rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  border-radius: var(--radius-pill);
  transition: background var(--transition), color var(--transition);
}

nav.menu a:hover,
nav.menu a:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  outline: none;
}

nav.menu > ul > li > a {
  color: var(--text);
}

/* -------- Hero / bannière (page d'accueil) -------- */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1rem 1.5rem 3rem;
}

.hero .logo-tg {
  max-width: 360px;
  margin: 0 auto 0;
  filter: drop-shadow(0 10px 30px rgba(246, 173, 26, 0.15));
}

.hero .logo-overwatch {
  max-width: 240px;
  margin: 0 auto;
  opacity: var(--logo-overwatch-opacity);
}

.hero p.tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: 0.75rem;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* -------- Grille roster (page d'accueil) -------- */
.roster {
  position: relative;
  z-index: 1;
  padding: 1rem 1.5rem 6rem;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Animations au scroll */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal--delay-1.is-visible { transition-delay: 0.08s; }
.reveal--delay-2.is-visible { transition-delay: 0.16s; }
.reveal--delay-3.is-visible { transition-delay: 0.24s; }
.reveal--delay-4.is-visible { transition-delay: 0.32s; }
.reveal--delay-5.is-visible { transition-delay: 0.40s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

.character-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.character-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, var(--accent-soft) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.character-card:hover {
  transform: translateY(-6px);
  border-color: var(--glass-border-strong);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-soft);
}

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

.character-card .avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  position: relative;
  z-index: 1;
}

.character-card .avatar img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.character-card .name {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.character-card .teaser {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* -------- Footer -------- */
footer.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--glass-border);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 2rem;
}

footer.site-footer .links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

footer.site-footer .links a {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  transition: color var(--transition);
}

footer.site-footer .links a:hover {
  color: var(--accent);
}

/* -------- Responsive -------- */
@media (max-width: 900px) {
  .roster-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  nav.menu {
    margin: 0.75rem auto;
    padding: 0.35rem;
    max-width: calc(100vw - 1.5rem);
  }

  nav.menu ul {
    gap: 0;
  }

  nav.menu a {
    padding: 0.5rem 0.7rem;
    font-size: 0.7rem;
  }

  .hero {
    padding: 0.5rem 1rem 2rem;
  }

  .hero .logo-tg {
    max-width: 240px;
  }

  .hero .logo-overwatch {
    max-width: 160px;
  }

  .roster-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .character-card {
    padding: 1.5rem 1rem;
  }

  .character-card .avatar {
    width: 110px;
    height: 110px;
  }
}

@media (max-width: 420px) {
  nav.menu a {
    padding: 0.45rem 0.55rem;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
  }
}
