:root {
  --bg: #0a0b1e;
  --fg: #e8e4f3;
  --muted: #9b8fb8;
  --brand: #c77dff;
  --brand-2: #7b2cbf;
  --card: #1a1b35;
  --line: #2d2e4a;
  --accent: #f72585;
  --accent-2: #4cc9f0;
  --glow: rgba(199, 125, 255, 0.4);
  --maxw: 1400px;
  --radius: 24px;
  --shadow: 0 15px 50px rgba(123, 44, 191, 0.15);
}

/* Theme Dark (par défaut) */
:root[data-theme="dark"] {
  --bg: #0a0b1e;
  --fg: #e8e4f3;
  --muted: #9b8fb8;
  --brand: #c77dff;
  --brand-2: #7b2cbf;
  --card: #1a1b35;
  --line: #2d2e4a;
  --accent: #f72585;
  --accent-2: #4cc9f0;
  --glow: rgba(199, 125, 255, 0.4);
}

/* Theme Light */
:root[data-theme="light"] {
  --bg: #fff5fb;
  --fg: #4a3666;
  --muted: #8b7aa3;
  --brand: #ff8fc7;
  --brand-2: #b88ce8;
  --card: #ffffff;
  --line: #f0d9f5;
  --accent: #ffb8d9;
  --accent-2: #9ec8ff;
  --glow: rgba(255, 143, 199, 0.25);
}

*::selection {
  background: var(--brand) !important;
  color: #fff;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f8f6fc;
    --fg: #1a1b35;
    --muted: #6b5d8a;
    --card: #fff;
    --line: #e5dff7;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Georgia", "Palatino", "Book Antiqua", serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  background-image: radial-gradient(
      circle at 20% 80%,
      rgba(199, 125, 255, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(76, 201, 240, 0.06) 0%,
      transparent 50%
    );
  background-attachment: fixed;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  overflow-x: hidden; /* Empêcher le scroll horizontal */
}

/* Canvas de particules en arrière-plan */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Canvas de pluie kawaii par-dessus */
#rainCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.8;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: 0.3s;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  padding: 0 24px;
  margin: 0 auto;
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  font-weight: 600;
  font-family: system-ui, -apple-system, sans-serif;
  transition: 0.3s all;
  position: relative;
  overflow: hidden;
  z-index: 10;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), var(--brand-2));
  opacity: 0;
  transition: 0.3s;
}

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

.btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px var(--glow);
  color: white;
}

.btn span {
  position: relative;
  z-index: 1;
}

.btn.ghost {
  background: transparent;
  border-color: var(--brand);
  color: var(--brand);
}

.btn.ghost:hover {
  background: var(--brand);
  color: #fff;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  z-index: 10;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--x, 50%) var(--y, 50%),
    var(--glow),
    transparent 60%
  );
  opacity: 0;
  transition: 0.3s;
}

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

.section {
  padding: 100px 0;
  position: relative;
  z-index: 1;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 16px;
  font-weight: 400;
  letter-spacing: -0.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 300;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 300;
}

h3 {
  font-size: 1.4rem;
  color: var(--muted);
  font-weight: 400;
}

p {
  margin: 0 0 14px;
  color: var(--fg);
  font-size: 1.1rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.muted {
  color: var(--muted);
}

header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--line);
}

nav.wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 300;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
}

.brand .logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(
    from 180deg at 50% 50%,
    var(--brand),
    var(--accent),
    var(--accent-2),
    var(--brand)
  );
  animation: rotate 8s linear infinite;
  box-shadow: 0 0 20px var(--glow);
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.navlinks {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  font-family: system-ui, -apple-system, sans-serif;
}

.navlinks a {
  font-size: 0.95rem;
  opacity: 0.8;
  transition: 0.3s;
}

.navlinks a:hover {
  opacity: 1;
  color: var(--brand);
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.3s;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
}

.theme-toggle:hover {
  border-color: var(--brand);
  background: color-mix(in oklab, var(--brand) 10%, var(--card));
  transform: scale(1.05);
}

.theme-toggle-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.theme-toggle-text {
  font-size: 0.9rem;
}

/* Split text animation */
.split-text {
  display: inline-block;
}

.split-text .char,
.split-text .space {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.split-text.animate .char,
.split-text.animate .space {
  opacity: 1;
  transform: translateY(0);
}

/* Magic text gradient */
.magic-text {
  font-weight: 500;
  display: inline-block;
}

.magic-text .char {
  background: linear-gradient(
    90deg,
    var(--brand),
    var(--accent),
    var(--accent-2),
    var(--brand)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbow 3s linear infinite;
}

@keyframes rainbow {
  to {
    background-position: 200% center;
  }
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  text-align: center;
  align-items: center;
  min-height: 70vh;
}

.hero h1 {
  margin-bottom: 24px;
}

.hero p {
  max-width: 650px;
  margin: 0 auto 32px;
  font-size: 1.2rem;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Kawaii decorative stars */
.kawaii-star {
  position: absolute;
  font-size: 24px;
  opacity: 0.6;
  pointer-events: none;
  animation: float 4s ease-in-out infinite;
  z-index: 1;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(5deg);
  }
  50% {
    transform: translateY(0) rotate(0deg);
  }
  75% {
    transform: translateY(-15px) rotate(-5deg);
  }
}

@keyframes heartFloat {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) scale(1.5);
    opacity: 0;
  }
}

/* Portfolio magique */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}

.filters button {
  cursor: pointer;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent !important;
  color: var(--muted);
  font-family: system-ui, -apple-system, sans-serif;
  transition: all 0.3s ease;
  font-weight: 500;
}

.filters button::before {
  display: none !important;
}

.filters button[aria-selected="true"],
.filters button:hover {
  border-color: var(--brand);
  color: #fff !important;
  background: var(--brand) !important;
  font-weight: 600;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(199, 125, 255, 0.3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.tile {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #000;
  aspect-ratio: 3/4;
  cursor: zoom-in;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Images protégées en background (type Instagram) */
.tile .protected-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.92;
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform: scale(1);
  filter: saturate(1.1);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform, opacity, filter;
}

/* Overlay de protection transparent */
.tile .protection-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
  cursor: zoom-in;
  transition: background 0.3s ease;
}

.tile .protection-overlay:active {
  background: rgba(199, 125, 255, 0.05);
}

.tile:hover {
  transform: translateY(-12px) scale(1.03);
  animation: rainbowShadow 3s ease-in-out infinite;
}

.tile:hover .protected-image {
  transform: scale(1.05);
  opacity: 1;
  filter: saturate(1.15) brightness(1.03);
}

/* Animation shadow arc-en-ciel au hover */
@keyframes rainbowShadow {
  0% {
    box-shadow: 0 20px 60px rgba(255, 0, 128, 0.4);
  }
  10% {
    box-shadow: 0 20px 60px rgba(255, 64, 0, 0.45);
  }
  20% {
    box-shadow: 0 20px 60px rgba(255, 128, 0, 0.5);
  }
  30% {
    box-shadow: 0 20px 60px rgba(255, 191, 0, 0.55);
  }
  40% {
    box-shadow: 0 20px 60px rgba(191, 255, 0, 0.6);
  }
  50% {
    box-shadow: 0 20px 60px rgba(0, 255, 128, 0.6);
  }
  60% {
    box-shadow: 0 20px 60px rgba(0, 191, 255, 0.55);
  }
  70% {
    box-shadow: 0 20px 60px rgba(0, 64, 255, 0.5);
  }
  80% {
    box-shadow: 0 20px 60px rgba(128, 0, 255, 0.45);
  }
  90% {
    box-shadow: 0 20px 60px rgba(191, 0, 255, 0.4);
  }
  100% {
    box-shadow: 0 20px 60px rgba(255, 0, 128, 0.4);
  }
}

/* Compatibilité avec anciennes images <img> si présentes */
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  transition: 0.5s;
  filter: saturate(1.1);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

.tile:hover img {
  transform: scale(1.08);
  opacity: 1;
}

.badge {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.85rem;
  font-family: system-ui, -apple-system, sans-serif;
  z-index: 2;
  pointer-events: auto;
}

.caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.85));
  color: #fff;
  font-size: 1.1rem;
  z-index: 2;
  pointer-events: none;
}

/* Contact enchanteur */
.contact-wrapper {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 10;
}

.contact-wrapper h2 {
  margin-bottom: 12px;
}

.contact-wrapper p {
  margin-bottom: 32px;
}

form {
  display: grid;
  gap: 16px;
  position: relative;
  z-index: 10;
}

input,
textarea {
  width: 100%;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
  transition: 0.3s;
  position: relative;
  z-index: 10;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--glow);
}

textarea {
  min-height: 160px;
  resize: vertical;
}

form button {
  width: 100%;
  cursor: pointer;
  border: none;
  font-size: 1.05rem;
}

/* ========== CHECKBOX RGPD KAWAII ========== */
.consent-checkbox {
  margin: 8px 0;
  padding: 16px;
  background: var(--bg);
  border-radius: 12px;
  border: 2px dashed var(--line);
  transition: all 0.3s ease;
}

.consent-checkbox:hover {
  border-color: var(--brand);
  background: var(--card);
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 6px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
  margin-top: 2px;
}

.checkmark::after {
  content: "✓";
  position: absolute;
  display: none;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 16px;
  color: white;
  font-weight: bold;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.checkbox-label input:checked ~ .checkmark {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-color: var(--brand);
  transform: rotate(0deg) scale(1.1);
  box-shadow: 0 4px 12px var(--glow);
}

.checkbox-label input:checked ~ .checkmark::after {
  display: block;
  transform: translate(-50%, -50%) scale(1);
}

.checkbox-label:hover .checkmark {
  border-color: var(--brand);
  transform: scale(1.05);
}

.consent-text {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  transition: color 0.3s ease;
}

.checkbox-label:hover .consent-text {
  color: var(--fg);
}

.checkbox-label input:checked ~ .consent-text {
  color: var(--fg);
}

/* Animation kawaii quand on coche */
@keyframes checkBounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.checkbox-label input:checked ~ .checkmark {
  animation: checkBounce 0.4s ease;
}

footer {
  border-top: 1px solid var(--line);
  padding: 40px 0;
  text-align: center;
}

/* ========== BOUTON DISCORD ========== */
.discord-link {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline;
  position: relative;
}

.discord-link:hover {
  color: #5865f2; /* Couleur Discord officielle */
  transform: scale(1.05);
}

.discord-link:active {
  transform: scale(0.95);
}

/* Lightbox mystique */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 30, 0.95);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: min(90vw, 1200px);
  max-height: 85vh;
  border-radius: 16px;
  box-shadow: 0 20px 80px rgba(199, 125, 255, 0.4);
}

.lightbox .meta {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  text-align: center;
  font-size: 1.2rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.ctrl {
  position: fixed;
  font-size: 40px;
  color: #fff;
  background: rgba(199, 125, 255, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(199, 125, 255, 0.3);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
}

.ctrl:hover {
  background: var(--brand);
  scale: 1.1;
}

.prev {
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
}

.next {
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
}

.close {
  top: 30px;
  right: 30px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }

  .section {
    padding: 60px 0;
  }

  .navlinks {
    display: none;
  }

  .brand span {
    font-size: 1.1rem;
  }

  .hero {
    min-height: auto;
    padding: 40px 0;
  }

  h1 {
    font-size: 2.2rem;
    padding: 0 10px;
  }

  h2 {
    padding: 0 10px;
  }

  p {
    padding: 0 10px;
  }

  .hero-actions {
    padding: 0 10px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .ctrl {
    width: 50px;
    height: 50px;
    font-size: 32px;
  }

  .prev {
    left: 15px;
  }

  .next {
    right: 15px;
  }

  /* Plus d'espace pour les formulaires sur mobile */
  form {
    padding: 0 10px;
  }

  .card {
    padding: 24px 20px !important;
  }
}

/* Rainbow Cursor Trail Canvas for Desktop */
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  /* Add sparkle effect on hover */
  a:hover,
  .btn:hover,
  .gallery-item:hover {
    position: relative;
  }

  a:hover::after,
  .btn:hover::after,
  .gallery-item:hover::after {
    content: "✨";
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 20px;
    pointer-events: none;
    animation: sparkle 0.6s ease-in-out infinite alternate;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    z-index: 10;
  }

  /* Étoile plus visible sur les boutons avec fond coloré */
  .filters button[aria-selected="true"]::after,
  .filters button:hover::after {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)) brightness(1.3);
    font-size: 22px;
  }

  @keyframes sparkle {
    0% {
      transform: scale(0.5) rotate(0deg);
      opacity: 0.5;
    }
    100% {
      transform: scale(1) rotate(180deg);
      opacity: 1;
    }
  }
}

/* ========== MASQUER LE BADGE RECAPTCHA ========== */
.grecaptcha-badge {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
