:root {
  --bg: #0c0e14;
  --bg-card: rgba(18, 21, 28, 0.72);
  --bg-elevated: rgba(26, 30, 40, 0.8);
  --bg-media: #111318;
  --text: #f0f2f5;
  --text-muted: #9aa3b2;
  --paladium: #ff6f00;
  --paladium-light: #ffbf39;
  --paladium-dim: #cc5800;
  --faction-blue: #3b9eff;
  --faction-red: #e83b3b;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --glass: blur(16px) saturate(1.2);
  --transition: 200ms ease-out;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Atmospheric background */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, #0a0c12 0%, #0e1018 45%, #0b0d13 100%);
}

.site-bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: orb-drift 18s ease-in-out infinite alternate;
}

.site-bg__orb--blue {
  width: 55vw;
  height: 55vw;
  max-width: 620px;
  max-height: 620px;
  top: -12%;
  left: -8%;
  background: radial-gradient(circle, rgba(59, 158, 255, 0.35) 0%, transparent 70%);
}

.site-bg__orb--red {
  width: 50vw;
  height: 50vw;
  max-width: 560px;
  max-height: 560px;
  top: 8%;
  right: -10%;
  background: radial-gradient(circle, rgba(232, 59, 59, 0.28) 0%, transparent 70%);
  animation-delay: -6s;
}

.site-bg__orb--gold {
  width: 45vw;
  height: 45vw;
  max-width: 500px;
  max-height: 500px;
  bottom: -15%;
  left: 30%;
  background: radial-gradient(circle, rgba(255, 111, 0, 0.18) 0%, transparent 70%);
  animation-delay: -12s;
}

.site-bg__noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

@keyframes orb-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(3%, 2%) scale(1.06); }
}

body > :not(.site-bg):not(.fx-layer):not(dialog) {
  position: relative;
  z-index: 1;
}

h1, h2, .logo {
  font-family: 'Righteous', cursive;
}

/* Explosion FX */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

#explosionCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.explosion-flash {
  position: absolute;
  width: 120vmax;
  height: 120vmax;
  margin-left: -60vmax;
  margin-top: -60vmax;
  background: radial-gradient(
    circle,
    rgba(255, 240, 180, 0.95) 0%,
    rgba(255, 160, 50, 0.55) 12%,
    rgba(80, 40, 20, 0.25) 30%,
    transparent 55%
  );
  opacity: 0;
  transform: scale(0.15);
  pointer-events: none;
}

.explosion-flash.active {
  animation: mc-flash 0.4s ease-out forwards;
}

@keyframes mc-flash {
  0% { opacity: 1; transform: scale(0.15); }
  15% { opacity: 1; transform: scale(0.55); }
  100% { opacity: 0; transform: scale(1.4); }
}

body.exploding {
  animation: mc-shake 0.55s ease-out;
}

body.micro-shake {
  animation: mc-micro-shake 0.2s ease-out;
}

@keyframes mc-micro-shake {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2px, -2px); }
}

.click-float {
  position: fixed;
  font-family: 'Righteous', cursive;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--paladium-light);
  pointer-events: none;
  z-index: 10001;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  animation: click-float-up 0.9s ease-out forwards;
  white-space: nowrap;
}

.click-float--red { color: var(--faction-red); }
.click-float--blue { color: var(--faction-blue); }
.click-float--green { color: #4ade80; }

@keyframes click-float-up {
  0% { opacity: 1; transform: translateY(0) scale(0.85); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-36px) scale(1.05); }
}

@keyframes mc-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-12px, 6px); }
  20% { transform: translate(10px, -8px); }
  30% { transform: translate(-8px, -6px); }
  40% { transform: translate(12px, 4px); }
  50% { transform: translate(-6px, 8px); }
  60% { transform: translate(8px, -4px); }
  70% { transform: translate(-4px, 2px); }
  80% { transform: translate(4px, -2px); }
}

/* Navbar */
.navbar {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 100;
  max-width: 90rem;
  margin: 0 auto;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  transition: opacity var(--transition);
}

.logo:hover { opacity: 0.85; }

.logo-img {
  image-rendering: pixelated;
  border-radius: 6px;
}

.accent-red { color: var(--faction-red); }

.nav-tags {
  display: flex;
  gap: 0.5rem;
}

.tag {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (min-width: 640px) {
  .tag { display: flex; }
}

.tag-faction {
  background: rgba(59, 158, 255, 0.12);
  color: var(--faction-blue);
  border: 1px solid rgba(59, 158, 255, 0.3);
}

.tag-dynamite {
  background: rgba(255, 111, 0, 0.12);
  color: var(--paladium-light);
  border: 1px solid rgba(255, 111, 0, 0.35);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 90rem;
  margin: 0 auto;
  padding: 7rem 1rem 3rem;
  align-items: center;
}

@media (min-width: 768px) {
  .hero {
    grid-template-columns: 1.1fr 0.9fr;
    padding: 8rem 2rem 4rem;
  }
}

.hero-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: rgba(255, 111, 0, 0.1);
  border: 1px solid rgba(255, 111, 0, 0.35);
  border-radius: 6px;
  color: var(--paladium-light);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.highlight {
  background: linear-gradient(135deg, var(--faction-blue), var(--faction-red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 30rem;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: 'Righteous', cursive;
  font-size: 1.6rem;
  color: var(--paladium-light);
}

.stat-num.stat-orange { color: var(--paladium); }

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-explode {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1.4rem;
  background: linear-gradient(135deg, var(--paladium), var(--paladium-dim));
  color: var(--text);
  border: 1px solid rgba(255, 191, 57, 0.3);
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
  box-shadow: 0 4px 16px rgba(255, 111, 0, 0.3);
}

.btn-dyna-icon {
  image-rendering: pixelated;
}

.btn-explode:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 111, 0, 0.45);
  filter: brightness(1.08);
}

.btn-explode:focus-visible {
  outline: 2px solid var(--paladium-light);
  outline-offset: 3px;
}

/* Dynamite showcase */
.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.dyna-showcase {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem 2rem;
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(59, 158, 255, 0.06),
    0 0 40px rgba(232, 59, 59, 0.04);
}

.dyna-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: float-dyna 3s ease-in-out infinite;
}

.dyna-item img {
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.dyna-item figcaption {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.dyna-ninja { animation-delay: 0.4s; }
.dyna-big { animation-delay: 0.8s; }

.fuse-spark {
  position: absolute;
  top: 1rem;
  right: calc(50% - 5rem);
  width: 6px;
  height: 6px;
  background: var(--paladium-light);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--paladium), 0 0 20px var(--paladium-light);
  animation: spark-pulse 0.7s ease-in-out infinite alternate;
}

@keyframes float-dyna {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes spark-pulse {
  0% { opacity: 0.5; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.15); }
}

/* Main */
.main {
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

@media (min-width: 768px) {
  .main { padding: 0 2rem 5rem; }
}

.gallery-header {
  margin-bottom: 1.75rem;
}

.gallery-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.gallery-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.filter-btn {
  padding: 0.5rem 1.1rem;
  background: var(--bg-elevated);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.filter-btn:hover {
  background: rgba(40, 45, 58, 0.9);
  color: var(--text);
}

.filter-btn.active {
  background: rgba(255, 111, 0, 0.12);
  border-color: var(--paladium);
  color: var(--paladium-light);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--paladium-light);
  outline-offset: 2px;
}

/* Gallery — bento grid */
.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .gallery {
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 124px;
    grid-auto-flow: dense;
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 132px;
    gap: 1.45rem;
  }
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  opacity: 0;
  transform: translateY(16px);
}

@media (min-width: 640px) {
  .card--hero  { grid-column: span 3; grid-row: span 5; }
  .card--xl    { grid-column: span 3; grid-row: span 3; }
  .card--lg    { grid-column: span 3; grid-row: span 3; }
  .card--wide  { grid-column: span 6; grid-row: span 3; }
  .card--md    { grid-column: span 3; grid-row: span 2; }
  .card--tall  { grid-column: span 2; grid-row: span 5; }
  .card--sm    { grid-column: span 2; grid-row: span 2; }
}

@media (min-width: 1024px) {
  /* Hero portrait (affiche verticale) + xl à droite = vrai bento */
  .card--hero  { grid-column: span 4; grid-row: span 5; }
  .card--xl    { grid-column: span 8;  grid-row: span 3; }
  .card--lg    { grid-column: span 6;  grid-row: span 3; }
  .card--wide  { grid-column: span 8;  grid-row: span 3; }
  .card--md    { grid-column: span 4;  grid-row: span 2; }
  .card--tall  { grid-column: span 3;  grid-row: span 5; }
  .card--sm    { grid-column: span 3;  grid-row: span 2; }
}

/* Grandes cartes : média plein écran + texte en overlay */
@media (min-width: 640px) {
  .card--hero,
  .card--xl,
  .card--lg,
  .card--wide {
    position: relative;
    display: block;
  }

  .card--hero .card-media,
  .card--xl .card-media,
  .card--lg .card-media,
  .card--wide .card-media {
    position: absolute;
    inset: 0;
    min-height: 0;
  }

  .card--hero .card-body,
  .card--xl .card-body,
  .card--lg .card-body,
  .card--wide .card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    border: none;
    background: linear-gradient(to top, rgba(8, 10, 14, 0.96) 0%, rgba(8, 10, 14, 0.7) 50%, transparent 100%);
    padding: 2.25rem 1rem 0.9rem;
  }

  .card--hero .card-body {
    padding: 1.25rem 0.85rem 0.65rem;
    background: linear-gradient(to top, rgba(8, 10, 14, 0.9) 0%, transparent 85%);
  }

  .card--hero .card-desc,
  .card--hero .card-type {
    display: none;
  }

  .card--hero .card-health,
  .card--xl .card-health,
  .card--lg .card-health,
  .card--wide .card-health {
    display: none;
  }
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.45s ease-out, transform 0.45s ease-out, border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--paladium);
  box-shadow: 0 6px 24px rgba(255, 111, 0, 0.1);
  transform: translateY(-3px);
}

.card-media {
  position: relative;
  flex: 1;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 70%),
    linear-gradient(165deg, #161920 0%, #0f1116 100%);
}

@media (min-width: 640px) {
  .card-media { min-height: 0; }
}

.card-media img,
.card-media video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}

.card--hero .card-media {
  background:
    radial-gradient(ellipse 70% 55% at 50% 35%, rgba(255, 120, 40, 0.12) 0%, transparent 70%),
    linear-gradient(180deg, #1a1410 0%, #0f1116 100%);
}

.card--hero .card-media img {
  object-fit: contain;
  object-position: center top;
  padding: 0.35rem 0.25rem 0;
}

@media (max-width: 639px) {
  .card--hero .card-media {
    min-height: 28rem;
  }

  .card-media img,
  .card-media video {
    height: auto;
    max-height: none;
  }

  .card--hero .card-media img {
    min-height: 26rem;
    object-fit: contain;
    object-position: center top;
  }
}

.card--hero .card-title {
  font-size: 1rem;
  margin-bottom: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}
.card--hero .card-desc,
.card--xl .card-desc,
.card--lg .card-desc {
  font-size: 0.78rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-type {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 3;
}

.card-type.image {
  background: rgba(59, 158, 255, 0.9);
  color: #0a1628;
}

.card-type.gif {
  background: rgba(255, 191, 57, 0.9);
  color: #2a1800;
}

.card-type.video {
  background: rgba(232, 59, 59, 0.9);
  color: #2a0505;
}

.card-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  transition: background var(--transition);
  pointer-events: none;
}

.card:hover .card-play { background: rgba(0, 0, 0, 0.12); }

.card-play svg {
  width: 2.75rem;
  height: 2.75rem;
  color: var(--text);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.card-body {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(12, 14, 18, 0.5);
}

.card-title {
  font-family: 'Righteous', cursive;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.card-health {
  margin-top: 0.65rem;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.card-health-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--faction-red), var(--paladium-light));
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem 3rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2));
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-logo {
  image-rendering: pixelated;
  margin-bottom: 0.75rem;
  opacity: 0.9;
}

/* Lightbox */
.lightbox {
  border: none;
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  background: transparent;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(8, 10, 14, 0.94);
  backdrop-filter: blur(8px);
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 3.5rem 1.25rem 1.5rem;
  box-sizing: border-box;
}

.lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: min(1200px, 96vw);
  max-height: calc(100vh - 8rem);
  flex: 1;
  min-height: 0;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  background: #0a0c10;
}

.lightbox-content video {
  width: 100%;
  min-height: 200px;
}

.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  z-index: 10;
}

.lightbox-close:hover { background: var(--paladium); }

.lightbox-close:focus-visible {
  outline: 2px solid var(--paladium-light);
  outline-offset: 2px;
}

.lightbox-close svg {
  width: 1.1rem;
  height: 1.1rem;
}

.lightbox-caption {
  text-align: center;
  margin-top: 1rem;
  padding: 0 1rem;
  max-width: 48rem;
  font-family: 'Righteous', cursive;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--paladium-light);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html { scroll-behavior: auto; }
  .card { opacity: 1; transform: none; }
  .card:hover { transform: none; }

  .explosion-flash.active { animation: none; opacity: 0.4; }
  body.exploding { animation: none; }
  body.micro-shake { animation: none; }

  .site-bg__orb { animation: none; }
  .click-float { animation: none; opacity: 0; }
}
