:root {
  --bg: #0b0c14;
  --surface: #131526;
  --surface-2: #1a1d33;
  --line: rgba(255, 255, 255, .08);
  --text: #ecebf7;
  --muted: #8d8caa;
  --ok: #4ade80;
  --ko: #f87171;
  --display: "Syne", "Trebuchet MS", system-ui, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Fond : lueurs lentes ---------- */
.aurora {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
}
.aurora::before, .aurora::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(110px); opacity: .5;
}
.aurora::before {
  width: 55vw; height: 55vw; left: -15vw; top: -25vw;
  background: radial-gradient(circle, #5b3df5 0%, transparent 65%);
  animation: drift-a 28s ease-in-out infinite alternate;
}
.aurora::after {
  width: 50vw; height: 50vw; right: -18vw; top: 18vh;
  background: radial-gradient(circle, #0fb5a5 0%, transparent 65%);
  opacity: .32;
  animation: drift-b 34s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(12vw, 8vh) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-10vw, -6vh) scale(1.1); } }

/* ---------- En-tête ---------- */
.top {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 96px) clamp(20px, 4vw, 48px) 24px;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.4rem, 12vw, 8.5rem);
  line-height: .9;
  letter-spacing: -.045em;
  background: linear-gradient(100deg, #fff 10%, #b9a8ff 55%, #5fe3d3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
}

.sub {
  margin: 18px 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.1rem;
}

.tools {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
}

.search {
  position: relative;
  flex: 0 1 320px;
  min-width: 220px;
}
.search input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  transition: border-color .2s, background .2s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus-visible {
  border-color: #8b7bff;
  background: rgba(139, 123, 255, .08);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, .25);
}
.search kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font: 500 .75rem var(--body);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  pointer-events: none;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  font: 500 .9rem var(--body);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: color .2s, background .2s, border-color .2s;
}
.filters button:hover { color: var(--text); border-color: rgba(255, 255, 255, .22); }
.filters button[aria-pressed="true"] {
  color: #0b0c14;
  background: #d8d0ff;
  border-color: #d8d0ff;
}
.filters button:focus-visible, .card:focus-visible {
  outline: 2px solid #8b7bff; outline-offset: 3px;
}

.count { margin: 0 0 0 auto; color: var(--muted); font-size: .9rem; }

/* ---------- Signature ---------- */
.sig {
  display: flex;
  align-items: baseline;
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px) clamp(32px, 6vw, 56px);
}
.by {
  font: 500 .85rem var(--body);
  letter-spacing: .12em;
  color: var(--muted);
  white-space: nowrap;
}
.handle {
  position: relative;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.2rem, 3.4vw, 1.7rem);
  letter-spacing: .02em;
  white-space: nowrap;
  cursor: default;
  background: linear-gradient(100deg,
    #ff5fa2 0%, #ffd45f 20%, #5fffc4 40%, #5fb4ff 60%, #b07bff 80%, #ff5fa2 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: foil 7s linear infinite;
  filter: drop-shadow(0 0 14px rgba(176, 123, 255, .45));
}
@keyframes foil { to { background-position: -300% 0; } }

/* Glitch au survol : deux copies décalées, rose et cyan */
.handle::before, .handle::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  background: none;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.handle::before { color: #ff2d95; -webkit-text-fill-color: #ff2d95; }
.handle::after  { color: #19e3ff; -webkit-text-fill-color: #19e3ff; }
.handle:hover::before { opacity: .9; animation: glitch-a .35s steps(2, end) infinite; }
.handle:hover::after  { opacity: .9; animation: glitch-b .35s steps(2, end) infinite; }
@keyframes glitch-a {
  0%   { transform: translate(-3px, 1px);  clip-path: inset(0 0 55% 0); }
  50%  { transform: translate(2px, -1px);  clip-path: inset(40% 0 10% 0); }
  100% { transform: translate(-2px, 0);    clip-path: inset(70% 0 0 0); }
}
@keyframes glitch-b {
  0%   { transform: translate(3px, -1px);  clip-path: inset(60% 0 0 0); }
  50%  { transform: translate(-2px, 1px);  clip-path: inset(10% 0 50% 0); }
  100% { transform: translate(2px, 0);     clip-path: inset(0 0 70% 0); }
}

/* Filet avec une lumière qui le parcourt */
.line {
  position: relative;
  flex: 1;
  height: 1px;
  align-self: center;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .28));
}
.line::after {
  content: "";
  position: absolute; top: 0; left: -80px;
  width: 80px; height: 1px;
  background: linear-gradient(90deg, transparent, #b9a8ff, #5fe3d3, transparent);
  box-shadow: 0 0 10px #8b7bff;
  animation: sweep 5.5s ease-in-out infinite;
}
@keyframes sweep { to { left: 100%; } }

/* ---------- Grille ---------- */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 48px) 64px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 30px 26px;
  perspective: 1400px;
}

/* ---------- Carte façon TCG ---------- */
.card {
  --h: 250;
  --px: 50%; --py: 50%;
  --mx: 50%; --my: 50%;
  --rx: 0deg; --ry: 0deg; --s: 1;

  position: relative;
  display: flex;
  padding: 9px;
  color: inherit;
  text-decoration: none;
  border-radius: 16px;
  background: linear-gradient(135deg,
    hsl(var(--h) 75% 70%),
    hsl(calc(var(--h) + 25) 60% 32%) 42%,
    hsl(var(--h) 80% 74%) 68%,
    hsl(calc(var(--h) + 25) 60% 30%));
  box-shadow:
    0 20px 36px -20px hsl(var(--h) 90% 35% / .9),
    inset 0 1px 0 rgba(255, 255, 255, .35);
  transform: rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--s));
  transition: transform .2s ease-out, box-shadow .3s;
  animation: deal .6s cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: calc(var(--i) * 60ms);
}
.card:hover, .card:focus-visible {
  --s: 1.04;
  box-shadow:
    0 30px 50px -18px hsl(var(--h) 95% 45% / .95),
    inset 0 1px 0 rgba(255, 255, 255, .45);
}

@keyframes deal {
  from { opacity: 0; transform: translateY(40px) rotate(-4deg) scale(.94); }
}

.frame {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px;
  border-radius: 9px;
  background: linear-gradient(180deg, hsl(var(--h) 32% 15%), hsl(var(--h) 38% 8%));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6);
}

/* Bandeau du nom */
.plate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: hsl(var(--h) 55% 11%);
  background: linear-gradient(180deg, hsl(var(--h) 45% 94%), hsl(var(--h) 32% 76%));
  box-shadow: inset 0 1px 0 #fff, 0 2px 5px rgba(0, 0, 0, .5);
}
.plate h2 {
  margin: 0;
  min-width: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gem {
  flex: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, hsl(var(--h) 90% 62%) 40%, hsl(var(--h) 80% 28%) 100%);
  box-shadow: 0 0 0 2px hsl(var(--h) 50% 20%), 0 0 8px hsl(var(--h) 100% 60% / .7);
}

/* Fenêtre d'illustration */
.art {
  position: relative;
  flex: none;
  aspect-ratio: var(--ar, 1);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 4px;
  border: 2px solid hsl(var(--h) 45% 74%);
  box-shadow: inset 0 0 26px rgba(0, 0, 0, .65);
  background:
    radial-gradient(120% 140% at 15% 0%, hsl(var(--h) 85% 55% / .65), transparent 60%),
    radial-gradient(90% 120% at 100% 100%, hsl(calc(var(--h) + 50) 85% 50% / .5), transparent 65%),
    hsl(var(--h) 40% 14%);
}
.art::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 75%);
}

.glyph {
  position: relative; z-index: 1;
  font-size: 4.6rem;
  line-height: 1;
  filter: drop-shadow(0 10px 20px hsl(var(--h) 90% 35% / .85));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
/* La fenêtre prend le ratio de l'image (entre 1 et 1,8), l'image la remplit
   donc exactement, sans coupe. Hors de cette plage, elle reste entière devant
   une version floutée d'elle-même. */
.art-bg { display: none; }
.logo {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: fill;
}
.art:has(.logo.contain) .art-bg {
  display: block;
  position: absolute; inset: -14%;
  background-size: cover;
  background-position: center;
  filter: blur(18px) saturate(1.5) brightness(.55);
}
.logo.contain {
  padding: 14px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .55));
}

.card:hover .glyph, .card:focus-visible .glyph {
  transform: translateY(-4px) scale(1.1) rotate(-4deg);
}

/* Zone de texte */
.text {
  display: flex;
  align-items: center;
  flex: 1;
  min-height: 5.4em;
  overflow: hidden;
  padding: 9px 11px;
  border-radius: 6px;
  color: hsl(var(--h) 35% 13%);
  background: hsl(var(--h) 30% 90%);
  border: 1px solid hsl(var(--h) 30% 62%);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, .25);
}
.text p { margin: 0; font-size: .86rem; line-height: 1.35; }

.meta {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  font: 500 .7rem var(--body);
  letter-spacing: .04em;
  color: hsl(var(--h) 25% 72%);
}

/* Reflet holographique qui suit la souris */
.foil, .glare {
  position: absolute; inset: 0; z-index: 3;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.foil {
  background: repeating-linear-gradient(115deg,
    #ff5fa2 0%, #ffd45f 12%, #5fffc4 24%, #5fb4ff 36%, #b07bff 48%, #ff5fa2 60%);
  background-size: 300% 300%;
  background-position: var(--px) var(--py);
  mix-blend-mode: color-dodge;
  filter: saturate(1.2);
}
.glare {
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, .55), transparent 45%);
  mix-blend-mode: overlay;
}
.card:hover .foil, .card:focus-visible .foil { opacity: .38; }
.card:hover .glare, .card:focus-visible .glare { opacity: 1; }

.empty {
  margin: 48px 0 0;
  color: var(--muted);
  text-align: center;
}

/* ---------- Tactile ---------- */
html { -webkit-text-size-adjust: 100%; }
a, button { -webkit-tap-highlight-color: transparent; }
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.sig { padding-bottom: calc(clamp(32px, 6vw, 56px) + env(safe-area-inset-bottom, 0px)); }

/* Pas de survol sur téléphone : reflet holo discret en continu, et réaction au toucher */
@media (hover: none) {
  .search kbd { display: none; }
  .foil {
    opacity: .2;
    background-size: 260% 260%;
    animation: foil-drift 7s ease-in-out infinite alternate;
    animation-delay: calc(var(--i) * -900ms);
  }
  .card:active { --s: .97; }
  .card:active .foil { opacity: .4; }
  .card:active .glare { opacity: 1; }
}
@keyframes foil-drift {
  from { background-position: 10% 15%; }
  to   { background-position: 90% 85%; }
}

/* ---------- Téléphone : en-tête compact, cartes en classeur (2 par ligne) ---------- */
@media (max-width: 560px) {
  .top { padding: calc(env(safe-area-inset-top, 0px) + 28px) 20px 6px; }
  .sub { font-size: 1rem; margin-top: 14px; }

  .tools { margin-top: 24px; gap: 12px; }
  .search { flex: 1 1 100%; min-width: 0; }
  .search input { font-size: 16px; padding: 13px 16px; } /* 16px : évite le zoom auto d'iOS */

  /* Filtres sur une ligne qu'on fait défiler au doigt */
  .filters {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -20px;
    padding: 2px 20px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; min-height: 40px; padding: 8px 18px; }
  .count { margin: 0; }

  main { padding: 16px 14px 40px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }

  .card { padding: 6px; border-radius: 12px; }
  .frame { padding: 6px; gap: 6px; border-radius: 7px; }
  .plate { padding: 5px 7px; gap: 5px; border-radius: 6px; }
  .plate h2 { font-size: .82rem; }
  .gem { width: 11px; height: 11px; box-shadow: 0 0 0 1.5px hsl(var(--h) 50% 20%), 0 0 6px hsl(var(--h) 100% 60% / .7); }
  .art { border-width: 1.5px; }
  .glyph { font-size: 3.1rem; }
  .text { padding: 6px 7px; min-height: 4.8em; }
  .text p { font-size: .72rem; line-height: 1.3; }
  .meta { font-size: .6rem; }

  .aurora::before, .aurora::after { filter: blur(70px); }

  .sig { gap: 10px; padding-left: 20px; padding-right: 20px; }
  .by { font-size: .72rem; letter-spacing: .08em; }
  .handle { font-size: 1.1rem; }
}

/* Très petits écrans : une seule colonne pour garder le texte lisible */
@media (max-width: 340px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .card { transform: none; }
}
