/* ==========================================================================
   Uniqleak — feuille de style unique
   Couches : reset → tokens → base → layout → components → pages → utilities
   ========================================================================== */
@layer reset, tokens, base, layout, components, pages, utilities;

/* ---------------------------------------------------------------- reset */
@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  * {
    margin: 0;
  }
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body {
    min-height: 100dvh;
  }
  img,
  svg,
  video {
    display: block;
    max-width: 100%;
  }
  input,
  button,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }
  button {
    cursor: pointer;
  }
  ul,
  ol {
    padding: 0;
    list-style: none;
  }
  [hidden] {
    display: none !important;
  }
}

/* --------------------------------------------------------------- tokens */
@layer tokens {
  :root {
    color-scheme: dark;

    /* Palette — sombre, premium, accent « volt » */
    --bg: #0a0a0e;
    --bg-raised: #101017;
    --surface: #15151e;
    --surface-2: #1c1c28;
    --line: #272735;
    --line-strong: #3a3a4e;
    --text: #f4f4f8;
    --text-muted: #b4b4c4;
    --text-faint: #8c8ca0;

    /* Violet du logo Uniqleak : --accent pour le texte et les contours (lisible sur fond sombre),
       --brand pour les aplats saturés portant du texte blanc (contraste 5,7:1). */
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-ink: #0d0618;
    --brand: #7c3aed;
    --brand-hover: #6d28d9;

    --fivem: #4cc9f0;
    --redm: #ff8a5b;
    --ok: #5ee6a0;
    --warn: #ffc247;
    --danger: #ff6b7a;
    --info: #4cc9f0;

    /* Typographie (polices système : aucune requête externe) */
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Bahnschrift", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

    --fs-xs: 0.8125rem;
    --fs-sm: 0.9375rem;
    --fs-base: 1rem;
    --fs-md: 1.125rem;
    --fs-lg: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
    --fs-xl: clamp(1.6rem, 1.3rem + 1.2vw, 2.25rem);
    --fs-2xl: clamp(2rem, 1.5rem + 2.4vw, 3.25rem);
    --fs-hero: clamp(2.6rem, 1.4rem + 5.6vw, 5.25rem);

    /* Espacement, rayons, ombres */
    --s-1: 0.25rem;
    --s-2: 0.5rem;
    --s-3: 0.75rem;
    --s-4: 1rem;
    --s-5: 1.5rem;
    --s-6: 2rem;
    --s-7: 3rem;
    --s-8: 4.5rem;
    --r-sm: 0.4rem;
    --r-md: 0.65rem;
    --r-lg: 1rem;
    --gutter: clamp(1rem, 4vw, 2rem);
    --shadow-lg: 0 18px 40px -18px rgb(0 0 0 / 0.8);
    --header-h: 4rem;
  }
}

/* ----------------------------------------------------------------- base */
@layer base {
  html {
    scroll-padding-top: calc(var(--header-h) + 1rem);
  }
  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--font-display);
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-wrap: balance;
  }
  h1,
  h2 {
    text-transform: uppercase;
    font-weight: 800;
  }
  h3,
  h4 {
    font-weight: 700;
  }
  p {
    text-wrap: pretty;
  }

  a {
    color: var(--accent);
    text-underline-offset: 0.2em;
  }
  a:hover {
    color: var(--accent-hover);
  }

  :focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--r-sm);
  }

  ::selection {
    background: var(--accent);
    color: var(--accent-ink);
  }

  main:focus {
    outline: none;
  }

  code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 0.1em 0.4em;
  }
}

/* --------------------------------------------------------------- layout */
@layer layout {
  .container {
    width: 100%;
    max-width: 75rem;
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .section {
    padding-block: clamp(2.5rem, 6vw, 4.5rem);
  }
  .section--tight {
    padding-block: clamp(1.5rem, 4vw, 2.5rem);
  }
  .section--raised {
    background: var(--bg-raised);
    border-block: 1px solid var(--line);
  }

  .section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: var(--s-3) var(--s-5);
    margin-bottom: var(--s-6);
  }
  .section__title {
    font-size: var(--fs-xl);
  }

  .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: var(--s-3);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .eyebrow::before {
    content: "";
    width: 1.75rem;
    height: 2px;
    background: currentColor;
  }

  .grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: var(--s-5);
  }
  .grid-cards > .state {
    grid-column: 1 / -1;
  }

  .page-head {
    position: relative;
    isolation: isolate;
    padding-block: clamp(2rem, 5vw, 3.5rem) var(--s-5);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, var(--bg-raised), var(--bg));
  }
  .page-head::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(50% 120% at 90% 0%, rgb(167 139 250 / 0.09), transparent 70%);
  }
  .page-head h1 {
    font-size: var(--fs-2xl);
  }
  .lead {
    max-width: 42rem;
    margin-top: var(--s-3);
    font-size: var(--fs-md);
    color: var(--text-muted);
  }
}

/* ----------------------------------------------------------- components */
@layer components {
  /* ---- Lien d'évitement ---- */
  .skip-link {
    position: absolute;
    inset-block-start: 0.5rem;
    inset-inline-start: 0.5rem;
    z-index: 100;
    padding: 0.7rem 1rem;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    border-radius: var(--r-md);
    transform: translateY(-200%);
  }
  .skip-link:focus {
    transform: none;
    color: var(--accent-ink);
  }

  /* ---- En-tête et navigation ---- */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgb(10 10 14 / 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }
  .site-header__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    min-height: var(--header-h);
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text);
    text-decoration: none;
  }
  .brand:hover {
    color: var(--text);
  }
  .brand__mark {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.55rem;
    background: var(--accent);
    color: var(--accent-ink);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    transform: rotate(-4deg);
    transition: transform 0.2s;
  }
  .brand:hover .brand__mark {
    transform: rotate(0deg);
  }
  .brand__logo {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 18px -4px rgb(124 58 237 / 0.7);
  }
  .brand__name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.5rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-weight: 600;
  }
  .nav-toggle:hover {
    border-color: var(--accent);
  }
  .nav-toggle__icon {
    display: grid;
  }
  .nav-toggle__icon > * {
    grid-area: 1 / 1;
  }
  .nav-toggle[aria-expanded="false"] .icon:last-child,
  .nav-toggle[aria-expanded="true"] .icon:first-child {
    visibility: hidden;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline: 0;
    padding: var(--s-3) var(--gutter) var(--s-5);
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
  }
  .site-nav[data-open="true"] {
    display: block;
  }
  .site-nav__list {
    display: grid;
    gap: var(--s-1);
  }
  .site-nav__link {
    display: block;
    padding: 0.75rem 0.9rem;
    border-radius: var(--r-md);
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
  }
  .site-nav__link:hover {
    background: var(--surface);
    color: var(--text);
  }
  .site-nav__link[aria-current="page"] {
    color: var(--text);
    background: var(--surface);
    box-shadow: inset 3px 0 0 var(--accent);
  }

  @media (min-width: 48rem) {
    .nav-toggle {
      display: none;
    }
    .site-nav,
    .site-nav[data-open] {
      display: block;
      position: static;
      padding: 0;
      background: none;
      border: 0;
    }
    .site-nav__list {
      display: flex;
      gap: var(--s-1);
    }
    .site-nav__link {
      padding: 0.55rem 0.9rem;
      position: relative;
    }
    .site-nav__link[aria-current="page"] {
      background: none;
      box-shadow: none;
    }
    .site-nav__link[aria-current="page"]::after {
      content: "";
      position: absolute;
      inset-inline: 0.9rem;
      bottom: 0.15rem;
      height: 2px;
      background: var(--accent);
    }
  }

  /* ---- Boutons ---- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    padding: 0.65rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition:
      background-color 0.15s,
      border-color 0.15s,
      color 0.15s,
      transform 0.15s,
      box-shadow 0.15s;
  }
  .btn--lg {
    min-height: 3.25rem;
    padding-inline: 1.6rem;
    font-size: var(--fs-base);
  }
  .btn--block {
    width: 100%;
  }
  .btn--primary {
    background: var(--brand);
    color: #fff;
  }
  .btn--primary:hover {
    background: var(--brand-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 26px -10px rgb(124 58 237 / 0.75);
  }
  .btn--primary:active {
    transform: translateY(0);
    box-shadow: none;
  }
  .btn--ghost {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--text);
  }
  .btn--ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft, rgb(167 139 250 / 0.07));
  }
  .btn--arrow::after,
  .link-arrow::after {
    content: "";
    width: 1.1em;
    height: 1.1em;
    flex: none;
    background: currentColor;
    -webkit-mask: var(--arrow) center / contain no-repeat;
    mask: var(--arrow) center / contain no-repeat;
    transition: transform 0.15s;
  }
  .btn--arrow:hover::after,
  .link-arrow:hover::after {
    transform: translateX(3px);
  }
  .btn[aria-disabled="true"],
  .btn[aria-disabled="true"]:hover,
  .btn:disabled {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--text-faint);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }
  .btn[aria-busy="true"] {
    cursor: progress;
  }

  .link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
    text-decoration: none;
  }
  .link-arrow:hover {
    text-decoration: underline;
  }

  :root {
    --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
    --search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM21 21l-4.3-4.3'/%3E%3C/svg%3E");
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b4b4c4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }

  /* ---- Badges ---- */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgb(10 10 14 / 0.82);
    color: var(--text);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.4;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .badge--fivem {
    color: var(--fivem);
    border-color: color-mix(in srgb, var(--fivem) 55%, transparent);
  }
  .badge--redm {
    color: var(--redm);
    border-color: color-mix(in srgb, var(--redm) 55%, transparent);
  }
  .badge--demo,
  .badge--draft {
    color: var(--warn);
    border-color: color-mix(in srgb, var(--warn) 60%, transparent);
    border-style: dashed;
  }
  .badge--free {
    color: var(--ok);
    border-color: color-mix(in srgb, var(--ok) 55%, transparent);
  }
  .badge--paid {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  }
  .badge--muted {
    color: var(--text-muted);
  }

  /* ---- Visuel d'une ressource (image ou repli) ---- */
  .cover {
    width: 100%;
    height: 100%;
    background: var(--surface-2);
  }
  .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .cover-fallback {
    display: grid;
    place-content: center;
    gap: 0.25rem;
    width: 100%;
    height: 100%;
    text-align: center;
    color: var(--text-faint);
    background:
      repeating-linear-gradient(135deg, transparent 0 14px, rgb(255 255 255 / 0.025) 14px 28px),
      radial-gradient(80% 90% at 50% 0%, var(--cover-glow, rgb(167 139 250 / 0.12)), transparent 70%),
      var(--surface-2);
  }
  .cover[data-game="fivem"] {
    --cover-glow: rgb(76 201 240 / 0.2);
  }
  .cover[data-game="redm"] {
    --cover-glow: rgb(255 138 91 / 0.2);
  }
  .cover-fallback__game {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .cover-fallback__note {
    font-size: var(--fs-xs);
    letter-spacing: 0.04em;
  }

  /* ---- Cartes de ressource ---- */
  .card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    transition:
      transform 0.2s,
      border-color 0.2s,
      box-shadow 0.2s;
  }
  .card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-lg);
  }
  .card[data-game="fivem"]:hover {
    border-color: color-mix(in srgb, var(--fivem) 50%, var(--line));
  }
  .card[data-game="redm"]:hover {
    border-color: color-mix(in srgb, var(--redm) 50%, var(--line));
  }
  .card__media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--surface-2);
  }
  .card__media .cover img {
    transition: transform 0.45s;
  }
  .card:hover .card__media .cover img {
    transform: scale(1.04);
  }
  .card__badges {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    right: 0.65rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--s-3);
    padding: var(--s-4) var(--s-4) var(--s-5);
  }
  .card__category {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
  }
  .card__title {
    font-size: var(--fs-lg);
  }
  .card__link {
    color: var(--text);
    text-decoration: none;
  }
  .card__link::after {
    content: "";
    position: absolute;
    inset: 0;
  }
  .card__link:hover {
    color: var(--accent);
  }
  .card__link:focus-visible {
    outline: none;
  }
  .card__link:focus-visible::after {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
    border-radius: var(--r-lg);
  }
  .card__desc {
    color: var(--text-muted);
    font-size: var(--fs-sm);
  }
  .card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1rem;
    margin-top: auto;
    padding-top: var(--s-3);
    border-top: 1px solid var(--line);
    font-size: var(--fs-xs);
    color: var(--text-faint);
  }

  /* ---- Squelettes de chargement ---- */
  .skeleton {
    display: block;
    background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
    background-size: 200% 100%;
  }
  @media (prefers-reduced-motion: no-preference) {
    .skeleton {
      animation: shimmer 1.4s linear infinite;
    }
  }
  .skeleton--line {
    height: 0.9rem;
    border-radius: var(--r-sm);
  }
  .skeleton--short {
    width: 40%;
  }
  .card--skeleton:hover {
    transform: none;
    box-shadow: none;
  }
  @keyframes shimmer {
    to {
      background-position: -200% 0;
    }
  }

  /* ---- États (vide, erreur, info) ---- */
  .state {
    display: grid;
    justify-items: center;
    gap: var(--s-3);
    max-width: 36rem;
    margin-inline: auto;
    padding: var(--s-7) var(--s-5);
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
    background: var(--bg-raised);
  }
  .state__icon {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--accent);
  }
  .state--error {
    border-color: color-mix(in srgb, var(--danger) 55%, transparent);
  }
  .state--error .state__icon {
    color: var(--danger);
  }
  .state__title {
    font-size: var(--fs-lg);
  }
  .state__text {
    color: var(--text-muted);
  }
  .state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s-3);
    margin-top: var(--s-2);
  }

  /* ---- Avis ---- */
  .notice {
    --tone: var(--info);
    display: flex;
    gap: var(--s-3);
    padding: var(--s-4);
    border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent);
    border-radius: var(--r-md);
    background: color-mix(in srgb, var(--tone) 9%, var(--bg-raised));
    font-size: var(--fs-sm);
  }
  .notice--warn {
    --tone: var(--warn);
  }
  .notice--error {
    --tone: var(--danger);
  }
  .notice--success {
    --tone: var(--ok);
  }
  .notice__icon {
    flex: none;
    margin-top: 0.1rem;
    color: var(--tone);
  }
  .notice__body {
    display: grid;
    gap: var(--s-2);
    min-width: 0;
  }
  .notice__title {
    font-weight: 700;
    color: var(--text);
  }
  .notice__body ul {
    padding-inline-start: 1.1rem;
    list-style: disc;
  }

  /* ---- Panneaux ---- */
  .panel {
    padding: var(--s-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
  }
  .panel__title {
    margin-bottom: var(--s-4);
    font-size: var(--fs-md);
  }

  /* ---- Formulaires ---- */
  .field {
    display: grid;
    gap: 0.4rem;
  }
  .field__label,
  .fieldset__legend {
    font-size: var(--fs-sm);
    font-weight: 600;
  }
  .req {
    color: var(--accent);
  }
  .field__hint {
    font-size: var(--fs-xs);
    color: var(--text-faint);
  }
  .field__error {
    display: flex;
    gap: 0.4rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--danger);
  }
  .field__error::before {
    content: "⚠";
    flex: none;
  }

  .input,
  .select,
  .textarea {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    transition:
      border-color 0.15s,
      background-color 0.15s;
  }
  .input::placeholder,
  .textarea::placeholder {
    color: var(--text-faint);
  }
  .input:hover,
  .select:hover,
  .textarea:hover {
    border-color: var(--text-faint);
  }
  .input:focus-visible,
  .select:focus-visible,
  .textarea:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
  }
  .input[aria-invalid="true"],
  .select[aria-invalid="true"],
  .textarea[aria-invalid="true"] {
    border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 7%, var(--bg-raised));
  }
  .textarea {
    min-height: 9rem;
    resize: vertical;
  }
  .select {
    appearance: none;
    padding-inline-end: 2.5rem;
    background-image: var(--chevron);
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1.1rem;
  }

  .search {
    position: relative;
  }
  .search::before {
    content: "";
    position: absolute;
    inset-inline-start: 0.9rem;
    top: 50%;
    width: 1.1rem;
    height: 1.1rem;
    translate: 0 -50%;
    background: var(--text-faint);
    -webkit-mask: var(--search) center / contain no-repeat;
    mask: var(--search) center / contain no-repeat;
    pointer-events: none;
  }
  .search .input {
    padding-inline-start: 2.6rem;
  }

  .check {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    font-size: var(--fs-sm);
  }
  .check input {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
    accent-color: var(--accent);
  }
  .check input[aria-invalid="true"] {
    outline: 2px solid var(--danger);
    outline-offset: 2px;
  }

  fieldset {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  /* Sélecteur segmenté (boutons radio accessibles) */
  .segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    background: var(--bg-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
  }
  .segmented input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
  }
  .segmented label {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.3rem 1rem;
    border-radius: calc(var(--r-md) - 3px);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 700;
    cursor: pointer;
    transition:
      background-color 0.15s,
      color 0.15s;
  }
  .segmented label:hover {
    color: var(--text);
    background: var(--surface-2);
  }
  .segmented input:checked + label {
    background: var(--accent);
    color: var(--accent-ink);
  }
  .segmented input:focus-visible + label {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }

  .error-summary {
    padding: var(--s-4) var(--s-5);
    border: 1px solid var(--danger);
    border-radius: var(--r-md);
    background: color-mix(in srgb, var(--danger) 9%, var(--bg-raised));
  }
  .error-summary h2,
  .error-summary h3 {
    margin-bottom: var(--s-2);
    font-size: var(--fs-md);
    text-transform: none;
    color: var(--danger);
  }
  .error-summary ul {
    padding-inline-start: 1.1rem;
    list-style: disc;
  }
  .error-summary a {
    color: var(--text);
  }

  .hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  /* ---- Puces de catégorie ---- */
  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
  }
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.25rem;
    padding: 0.25rem 0.85rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
    transition:
      border-color 0.15s,
      background-color 0.15s;
  }
  .chip:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgb(167 139 250 / 0.08);
  }
  .chip__count {
    font-size: var(--fs-xs);
    color: var(--text-faint);
  }

  /* ---- Pied de page ---- */
  .site-footer {
    margin-top: var(--s-8);
    padding-block: var(--s-7) var(--s-5);
    background: var(--bg-raised);
    border-top: 1px solid var(--line);
  }
  .footer-grid {
    display: grid;
    gap: var(--s-6);
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  }
  .footer-col--brand {
    display: grid;
    align-content: start;
    gap: var(--s-3);
    grid-column: 1 / -1;
  }
  @media (min-width: 64rem) {
    .footer-col--brand {
      grid-column: auto;
    }
    .footer-grid {
      grid-template-columns: 1.5fr repeat(auto-fit, minmax(11rem, 1fr));
    }
  }
  .footer-tagline {
    max-width: 22rem;
    color: var(--text-muted);
    font-size: var(--fs-sm);
  }
  .footer-title {
    margin-bottom: var(--s-3);
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--text-faint);
  }
  .footer-list {
    display: grid;
    gap: var(--s-2);
  }
  .footer-list a {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    text-decoration: none;
  }
  .footer-list a:hover {
    color: var(--accent);
    text-decoration: underline;
  }
  .footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--s-2) var(--s-5);
    margin-top: var(--s-6);
    padding-top: var(--s-4);
    border-top: 1px solid var(--line);
    font-size: var(--fs-xs);
    color: var(--text-faint);
  }
}

/* ---------------------------------------------------------------- pages */
@layer pages {
  /* ---- Accueil : hero ---- */
  .hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding-block: clamp(3rem, 8vw, 6.5rem) clamp(3rem, 6vw, 5rem);
    border-bottom: 1px solid var(--line);
  }
  .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
      radial-gradient(55% 70% at 85% 0%, rgb(124 58 237 / 0.3), transparent 70%),
      radial-gradient(45% 60% at 0% 100%, rgb(124 58 237 / 0.14), transparent 70%);
  }
  .hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
      linear-gradient(var(--line) 1px, transparent 1px),
      linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 3rem 3rem;
    opacity: 0.4;
    -webkit-mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000, transparent 75%);
    mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000, transparent 75%);
  }
  .hero__grid {
    display: grid;
    gap: var(--s-7);
    align-items: center;
  }
  @media (min-width: 64rem) {
    .hero__grid {
      grid-template-columns: 1.25fr 0.75fr;
    }
  }
  .hero__title {
    font-size: var(--fs-hero);
    line-height: 0.95;
  }
  .hero__title em {
    font-style: normal;
    color: var(--accent);
  }
  .hero__lead {
    max-width: 38rem;
    margin-top: var(--s-5);
    font-size: var(--fs-md);
    color: var(--text-muted);
  }
  .hero__cta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    margin-top: var(--s-6);
  }
  .hero__logo {
    display: none;
    justify-self: center;
    width: min(100%, 26rem);
    overflow: hidden;
    border-radius: 50%;
    box-shadow:
      0 0 0 1px rgb(167 139 250 / 0.25),
      0 0 90px -10px rgb(124 58 237 / 0.6);
  }
  .hero__logo img {
    width: 100%;
    height: auto;
  }
  @media (min-width: 64rem) {
    .hero__logo {
      display: block;
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
      animation-delay: var(--d, 0ms);
    }
    @keyframes rise {
      from {
        opacity: 0;
        transform: translateY(14px);
      }
    }
  }

  /* ---- Accès rapide aux jeux ---- */
  .game-grid {
    display: grid;
    gap: var(--s-5);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  }
  .game-panel {
    --tone: var(--fivem);
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    padding: var(--s-5);
    background:
      radial-gradient(80% 100% at 100% 0%, color-mix(in srgb, var(--tone) 14%, transparent), transparent 70%),
      var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--tone);
    border-radius: var(--r-lg);
  }
  .game-panel--redm {
    --tone: var(--redm);
  }
  .game-panel__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-3);
  }
  .game-panel__title {
    font-size: var(--fs-xl);
    color: var(--tone);
  }
  .game-panel__count {
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }
  .game-panel p {
    color: var(--text-muted);
  }
  .game-panel .btn {
    align-self: start;
    margin-top: auto;
  }

  .features {
    display: grid;
    gap: var(--s-5);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  }
  .feature {
    display: grid;
    align-content: start;
    gap: var(--s-3);
  }
  .feature__icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--accent);
  }
  .feature h3 {
    font-size: var(--fs-md);
  }
  .feature p {
    color: var(--text-muted);
    font-size: var(--fs-sm);
  }

  .cta-band {
    display: grid;
    gap: var(--s-4);
    justify-items: start;
    padding: clamp(1.5rem, 5vw, 3rem);
    background:
      radial-gradient(70% 120% at 100% 0%, rgb(167 139 250 / 0.16), transparent 70%),
      var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
  }
  .cta-band h2 {
    font-size: var(--fs-xl);
  }
  .cta-band p {
    max-width: 34rem;
    color: var(--text-muted);
  }

  /* ---- Catalogue ---- */
  .toolbar {
    display: grid;
    gap: var(--s-4);
    padding: var(--s-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
  }
  .toolbar__row {
    display: grid;
    gap: var(--s-4);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    align-items: end;
  }
  .results-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-block: var(--s-5);
  }
  .results-count {
    font-weight: 600;
    color: var(--text-muted);
  }
  .load-more {
    display: grid;
    justify-items: center;
    gap: var(--s-2);
    margin-top: var(--s-6);
    color: var(--text-faint);
    font-size: var(--fs-sm);
  }

  /* ---- Fiche ressource ---- */
  .breadcrumb {
    padding-block: var(--s-4);
    font-size: var(--fs-sm);
    color: var(--text-faint);
  }
  .breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .breadcrumb li:not(:last-child)::after {
    content: "/";
    margin-inline-start: 0.4rem;
    color: var(--line-strong);
  }
  .breadcrumb a {
    color: var(--text-muted);
  }
  .breadcrumb [aria-current="page"] {
    color: var(--text);
  }

  .detail {
    display: grid;
    gap: var(--s-5);
    grid-template-areas:
      "head"
      "download"
      "main"
      "info";
  }
  @media (min-width: 64rem) {
    .detail {
      grid-template-columns: minmax(0, 1fr) 21rem;
      grid-template-rows: auto auto auto 1fr;
      column-gap: var(--s-7);
      grid-template-areas:
        "head head"
        "main download"
        "main info"
        "main .";
    }
  }
  .detail__head {
    grid-area: head;
  }
  .detail__main {
    grid-area: main;
    display: grid;
    gap: var(--s-7);
    align-content: start;
    min-width: 0;
  }
  .detail__download {
    grid-area: download;
  }
  .detail__info {
    grid-area: info;
    display: grid;
    gap: var(--s-5);
    align-content: start;
  }
  .detail__title {
    margin-block: var(--s-3);
    font-size: var(--fs-2xl);
  }
  .detail__badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
  }
  .detail__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2) var(--s-5);
    margin-top: var(--s-4);
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }
  .detail__meta strong {
    color: var(--text);
  }

  .block > h2 {
    margin-bottom: var(--s-4);
    font-size: var(--fs-lg);
  }
  .prose {
    display: grid;
    gap: var(--s-3);
    max-width: 44rem;
    color: var(--text-muted);
  }

  .gallery {
    display: grid;
    gap: var(--s-3);
  }
  .gallery__stage {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface-2);
  }
  .gallery__stage .cover img {
    object-fit: contain;
  }
  .gallery__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
  }
  .gallery__thumb {
    width: 5.5rem;
    aspect-ratio: 16 / 9;
    padding: 0;
    overflow: hidden;
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-sm);
  }
  .gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .gallery__thumb:hover {
    border-color: var(--text-faint);
  }
  .gallery__thumb[aria-pressed="true"] {
    border-color: var(--accent);
  }
  .gallery__video {
    width: 100%;
    border-radius: var(--r-lg);
    background: #000;
  }

  .dep-list {
    display: grid;
    gap: var(--s-3);
  }
  .dep {
    display: grid;
    gap: 0.3rem;
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
  }
  .dep__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2) var(--s-3);
  }
  .dep__name {
    font-family: var(--font-mono);
    font-weight: 700;
  }
  .dep__note {
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }

  .steps {
    display: grid;
    gap: var(--s-4);
    counter-reset: step;
  }
  .steps li {
    position: relative;
    padding-inline-start: 3rem;
    counter-increment: step;
    color: var(--text-muted);
  }
  .steps li::before {
    content: counter(step);
    position: absolute;
    inset-inline-start: 0;
    top: -0.1rem;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 800;
    font-size: var(--fs-sm);
  }

  .changelog {
    display: grid;
    gap: var(--s-5);
  }
  .changelog__entry {
    padding-inline-start: var(--s-4);
    border-inline-start: 2px solid var(--line-strong);
  }
  .changelog__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--s-3);
    margin-bottom: var(--s-2);
  }
  .changelog__version {
    font-size: var(--fs-md);
  }
  .changelog__date {
    font-size: var(--fs-sm);
    color: var(--text-faint);
  }
  .changelog ul {
    padding-inline-start: 1.1rem;
    list-style: disc;
    color: var(--text-muted);
  }

  .facts {
    display: grid;
    gap: var(--s-3);
    font-size: var(--fs-sm);
  }
  .facts div {
    display: flex;
    justify-content: space-between;
    gap: var(--s-4);
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--line);
  }
  .facts div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }
  .facts dt {
    color: var(--text-faint);
  }
  .facts dd {
    text-align: end;
    font-weight: 600;
  }

  .download__note {
    margin-top: var(--s-3);
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }
  .download__price {
    margin-bottom: var(--s-3);
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--accent);
  }
  .download .notice {
    margin-top: var(--s-4);
  }

  .credit-list {
    display: grid;
    gap: var(--s-2);
    font-size: var(--fs-sm);
  }
  .credit-list span {
    color: var(--text-faint);
  }
  .subtle-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--fs-sm);
    font-weight: 600;
  }

  /* ---- Contact ---- */
  .contact-grid {
    display: grid;
    gap: var(--s-6);
    align-items: start;
  }
  @media (min-width: 64rem) {
    .contact-grid {
      grid-template-columns: 0.8fr 1.2fr;
    }
  }
  .contact-side {
    display: grid;
    gap: var(--s-5);
  }
  .contact-methods {
    display: grid;
    gap: var(--s-3);
  }
  .method {
    display: grid;
    gap: 0.25rem;
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
  }
  .method__label {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
  }
  .method__value {
    font-weight: 700;
    overflow-wrap: anywhere;
  }
  .method__hint {
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }
  .method--empty {
    border-style: dashed;
    border-color: var(--line-strong);
    background: transparent;
  }
  .method--empty .method__value {
    color: var(--warn);
  }
  .form {
    display: grid;
    gap: var(--s-5);
  }
  .form__row {
    display: grid;
    gap: var(--s-5);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  }
  .form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-4);
  }
  .form__note {
    font-size: var(--fs-xs);
    color: var(--text-faint);
  }
  .steps-plain {
    display: grid;
    gap: var(--s-2);
    padding-inline-start: 1.25rem;
    list-style: decimal;
    color: var(--text-muted);
    font-size: var(--fs-sm);
  }

  /* ---- Légal ---- */
  .legal-layout {
    display: grid;
    gap: var(--s-6);
    align-items: start;
  }
  @media (min-width: 64rem) {
    .legal-layout {
      grid-template-columns: 15rem minmax(0, 1fr);
    }
  }
  .toc {
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
  }
  @media (min-width: 64rem) {
    .toc {
      position: sticky;
      top: calc(var(--header-h) + 1rem);
    }
  }
  .toc h2 {
    margin-bottom: var(--s-3);
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    letter-spacing: 0.14em;
    color: var(--text-faint);
  }
  .toc ul {
    display: grid;
    gap: var(--s-1);
  }
  .toc a {
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
  }
  .toc a:hover {
    background: var(--surface-2);
    color: var(--text);
  }
  .legal-content {
    display: grid;
    gap: var(--s-7);
    min-width: 0;
  }
  .legal-section {
    display: grid;
    gap: var(--s-4);
    padding: var(--s-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
  }
  .legal-section > h2 {
    font-size: var(--fs-lg);
  }
  .legal-section h3 {
    font-size: var(--fs-md);
  }
  .legal-section ul {
    padding-inline-start: 1.1rem;
    list-style: disc;
    color: var(--text-muted);
  }
  .legal-section p {
    color: var(--text-muted);
  }
  .legal-updated {
    font-size: var(--fs-xs);
    color: var(--text-faint);
  }
  .imprint {
    display: grid;
    gap: var(--s-3);
  }
  .imprint div {
    display: grid;
    gap: 0.15rem;
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--line);
  }
  @media (min-width: 40rem) {
    .imprint div {
      grid-template-columns: 14rem 1fr;
      gap: var(--s-4);
    }
  }
  .imprint dt {
    font-size: var(--fs-sm);
    color: var(--text-faint);
  }
  .imprint dd {
    font-weight: 600;
    overflow-wrap: anywhere;
  }
  .placeholder {
    display: inline-block;
    padding: 0.05rem 0.55rem;
    border: 1px dashed color-mix(in srgb, var(--warn) 60%, transparent);
    border-radius: 999px;
    color: var(--warn);
    font-size: var(--fs-sm);
    font-weight: 600;
  }
}

/* ------------------------------------------------------------ utilities */
@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .text-muted {
    color: var(--text-muted);
  }
  .stack {
    display: grid;
    gap: var(--s-4);
  }
}

/* Mouvements réduits : aucune animation ni transition superflue */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
