/* Page Téléchargement : familles, cartes des modèles, fenêtre de téléchargement */
[data-downloads] { --dl-card: #0c1f22; --dl-pic: #e9f3f3; }
[data-downloads] [hidden] { display: none !important; }
/* beaucoup de photos ont un fond blanc : "multiply" lui donne la couleur de la case */
.dl-fams img, .dl-pic img, .dl-dlg-pic img { mix-blend-mode: multiply; filter: contrast(1.08) brightness(1.04); } /* les fonds presque blancs deviennent blancs */

.dl-step { display: flex; align-items: center; gap: .7rem; margin: 2rem 0 1rem; font-size: 1.15rem; font-weight: 700; line-height: 1.3; }
.dl-step:first-child { margin-top: 0; }
.dl-step b { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font: 800 .9rem var(--mono); color: #fff; background: var(--btn-grad); }
.dl-step2 em { font-style: normal; color: var(--orange); }
.dl-step2 i { margin-left: .3rem; font: 600 .8rem var(--mono); font-style: normal; color: var(--muted); white-space: nowrap; }
.dl-step2 { scroll-margin-top: 170px; }

/* 1. familles : petites cases avec photo, collées sous l'en-tête */
.dl-fams {
  position: sticky; top: 64px; z-index: 6; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .45rem;
  padding: .6rem 0; background: linear-gradient(var(--bg) 85%, transparent);
}
.dl-fams a {
  display: flex; flex-direction: column; gap: .35rem; min-width: 0; padding: .45rem; border-radius: 12px; color: var(--text);
  background: var(--dl-card); border: 1px solid var(--border); transition: border-color .2s, transform .2s, box-shadow .2s;
}
.dl-fams a:hover { color: #fff; text-decoration: none; transform: translateY(-2px); border-color: var(--border-strong); }
.dl-fams a[aria-current="true"] { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange), 0 14px 34px -20px var(--orange); }
.dl-fams .dl-fam-pic { position: relative; display: block; height: 52px; overflow: hidden; border-radius: 9px; background: var(--dl-pic); }
.dl-fams img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.dl-fams span { display: flex; align-items: baseline; justify-content: space-between; gap: .3rem; min-width: 0; }
.dl-fams strong { overflow: hidden; font-size: .86rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.dl-fams em { font: 700 .74rem var(--mono); font-style: normal; color: var(--muted); }
.dl-fams a[aria-current="true"] em { color: var(--orange); }
.dl-hint { margin: .6rem 0 0; color: var(--muted); font-size: .88rem; }
.dl-hint .icon { width: 15px; height: 15px; margin-right: .3rem; color: var(--teal); vertical-align: -3px; }
.dl-hint a { font-weight: 600; }

/* 2. recherche et marques */
.dl-tools { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: .8rem; align-items: center; margin-bottom: 1rem; }
.dl-tools .search { max-width: none; }
.dl-makers { display: flex; flex-wrap: wrap; gap: .45rem; }
.dl-makers button {
  flex: none; display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border-radius: 999px; cursor: pointer;
  font: 600 .86rem/1 var(--font); color: var(--text); background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09);
}
.dl-makers button em { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px; font: 700 .7rem/1 var(--mono); font-style: normal; color: var(--muted); background: rgba(255, 255, 255, .06); }
.dl-makers button[aria-pressed="true"] { color: #fff; border-color: var(--orange); background: rgba(251, 176, 59, .12); }
.dl-makers button[aria-pressed="true"] em { color: var(--orange); background: rgba(251, 176, 59, .16); }

/* cartes des modèles : toute la carte ouvre la fenêtre */
.dl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: .8rem; }
.dl-dev {
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; color: var(--text); background: var(--dl-card); border: 1px solid var(--border);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.dl-dev:hover, .dl-dev:focus-visible { color: var(--text); text-decoration: none; border-color: rgba(251, 176, 59, .55); transform: translateY(-2px); box-shadow: 0 16px 36px -22px rgba(251, 176, 59, .8); }
.dl-pic { display: grid; place-items: center; height: 120px; margin: .55rem .55rem 0; border-radius: 11px; background: linear-gradient(160deg, #f4fbfb, #d8ecec); }
.dl-pic img { width: auto; max-width: 85%; height: auto; max-height: 100px; object-fit: contain; transition: transform .3s; }
.dl-pic.is-nopic img, .dl-dlg-pic.is-nopic img { max-height: 56px; opacity: .35; filter: grayscale(1); mix-blend-mode: normal; } /* pas encore de photo */
.dl-dev:hover .dl-pic img { transform: scale(1.04); }
.dl-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; padding: .7rem .85rem .85rem; flex: 1; }
.dl-info small { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; color: var(--muted); font-size: .74rem; }
.dl-info strong { font-size: .95rem; line-height: 1.25; }
.dl-meta { color: var(--muted); font-size: .76rem; }
.dl-lab {
  display: inline-flex; align-items: center; gap: .2rem; padding: .05rem .4rem; border-radius: 999px;
  font: 700 .62rem/1.3 var(--font); color: var(--orange); background: rgba(251, 176, 59, .1); border: 1px solid rgba(251, 176, 59, .35);
}
.dl-lab .icon { width: 10px; height: 10px; }
.dl-oldver { color: var(--orange); font-weight: 600; } /* appareil resté sur une ancienne version */
.dl-curver { color: var(--teal); font-weight: 600; }  /* dernière version */
.dl-empty { color: var(--muted); }

/* la fenêtre : photo et téléchargements, puis l'installation */
.dl-dlg {
  width: min(760px, calc(100% - 24px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border-radius: 20px;
  color: var(--text); background: #0a1d20; border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .95), 0 0 70px -35px rgba(251, 176, 59, .7);
}
.dlg-open, .dlg-open body { overflow: hidden; } /* la page derrière ne défile pas (iOS) */
.dl-dlg { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.dl-dlg::backdrop { background: rgba(2, 8, 9, .78); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dl-dlg[open] { animation: dl-pop .22s ease-out; }
@keyframes dl-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.dl-dlg-x {
  position: absolute; top: .7rem; right: .7rem; z-index: 2; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  color: var(--text); background: rgba(6, 20, 23, .85); border: 1px solid rgba(255, 255, 255, .12);
}
.dl-dlg-x:hover { color: #fff; border-color: var(--orange); }
.dl-dlg-top { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.4rem; padding: 1.4rem; }
.dl-dlg-pic { display: grid; place-items: center; min-height: 190px; border-radius: 14px; background: linear-gradient(160deg, #f4fbfb, #d8ecec); }
.dl-dlg-pic img { max-width: 88%; max-height: 170px; object-fit: contain; }
.dl-dlg-id { display: flex; flex-direction: column; gap: .35rem; min-width: 0; padding-right: 2rem; }
.dl-dlg-id small { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; color: var(--orange); font: 700 .72rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.dl-dlg-id h2 { margin: 0; font-size: 1.45rem; line-height: 1.2; }
.dl-dlg-id .dl-meta { margin: 0 0 .5rem; font-size: .85rem; }
.dl-dlg-id .dl-meta span + span::before { content: " · "; }
.dl-acts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.dl-acts:has(.dl-tor[hidden]) .dl-btn { grid-column: 1 / -1; } /* pas de torrent pour cette image */
.dl-btn, .dl-tor {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .75rem .9rem; border-radius: 12px;
  font-weight: 700; font-size: .95rem; white-space: nowrap; color: #fff; transition: background .2s;
}
.dl-btn { background: var(--btn-grad); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 18px -8px var(--pink); }
.dl-btn:hover, .dl-btn:focus-visible { color: #fff; text-decoration: none; background: var(--btn-grad-hover); }
.dl-tor { background: linear-gradient(90deg, #2563eb, #3b82f6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 18px -8px #3b82f6; }
.dl-tor:hover, .dl-tor:focus-visible { color: #fff; text-decoration: none; background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.dl-btn .icon, .dl-tor .icon { width: 17px; height: 17px; }
.dl-dlg [hidden] { display: none !important; } /* la fenêtre est hors de [data-downloads] */
.dl-dlg-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: .4rem 0 0; font-size: .84rem; }
.dl-dlg-links a { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
.dl-dlg-links a:hover { color: var(--text); }
.dl-dlg-links .icon { width: 14px; height: 14px; }
.dl-dlg-how { padding: 1.1rem 1.4rem 1.4rem; border-top: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .02); }
.dl-dlg-how > strong { display: block; margin-bottom: .7rem; font-size: .95rem; }
.dl-dlg-how ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.dl-dlg-how li { position: relative; padding: .8rem .8rem .8rem 2.9rem; border-radius: 12px; font-size: .85rem; color: var(--muted); background: var(--dl-card); border: 1px solid var(--border); counter-increment: s; }
.dl-dlg-how li::before {
  content: counter(s); position: absolute; left: .8rem; top: .8rem; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  font: 800 .8rem var(--mono); color: var(--orange); background: rgba(251, 176, 59, .12);
}
.dl-dlg-how b { display: block; margin-bottom: .15rem; color: var(--text); }
/* bas de la fenêtre : un mot pour les dons */
.dl-dlg-more { padding: 0 1.4rem 1.4rem; background: rgba(255, 255, 255, .02); }
.dl-thanks { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .3rem .75rem; padding: .85rem .9rem; border-radius: 12px; }
.dl-thanks { background: rgba(232, 20, 111, .06); border: 1px solid rgba(232, 20, 111, .3); }
.dl-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--orange); background: rgba(251, 176, 59, .14); }
.dl-thanks .dl-ico { color: var(--pink); background: rgba(232, 20, 111, .14); }
.dl-ico .icon { width: 16px; height: 16px; }
.dl-thanks strong { display: block; margin-bottom: .15rem; font-size: .88rem; line-height: 1.3; }
.dl-thanks p { margin: 0; color: var(--muted); font-size: .8rem; }
.dl-thanks-btns { grid-column: 2; display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.dl-thanks-btns a {
  display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border-radius: 9px; font-weight: 600; font-size: .8rem;
  color: var(--text); border: 1px solid rgba(232, 20, 111, .4);
}
.dl-thanks-btns a:hover { color: #fff; text-decoration: none; background: rgba(232, 20, 111, .16); }
.dl-thanks-btns .icon { width: 14px; height: 14px; color: var(--pink); }

/* tablettes et téléphones : les familles en grille 4 x 2 */
@media (max-width: 1100px) {
  .dl-fams { position: static; grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; background: none; }
  .dl-fams .dl-fam-pic { height: 46px; }
  .dl-tools { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .dl-dlg-more { padding: 0 1rem 1rem; }
  .dl-dlg-top { grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: 1rem; }
  .dl-dlg-pic { min-height: 150px; }
  .dl-dlg-pic img { max-height: 130px; }
  .dl-dlg-id { padding-right: 0; }
  .dl-dlg-id h2 { font-size: 1.25rem; }
  .dl-dlg-how { padding: 1rem; }
  .dl-dlg-how ol { grid-template-columns: minmax(0, 1fr); }
}
/* téléphones : cases plus petites, cartes deux par deux */
@media (max-width: 560px) {
  .dl-step { font-size: 1.02rem; margin-top: 1.6rem; }
  .dl-fams { gap: .35rem; }
  .dl-fams a { gap: .25rem; padding: .3rem .3rem .4rem; border-radius: 10px; }
  .dl-fams a:hover { transform: none; }
  .dl-fams .dl-fam-pic { height: 36px; border-radius: 7px; }
  .dl-fams span { flex-direction: column; align-items: flex-start; gap: .05rem; padding-inline: .1rem; }
  .dl-fams strong { font-size: .76rem; white-space: normal; }
  .dl-fams em { font-size: .68rem; }
  .dl-makers { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -20px; padding-inline: 20px; }
  .dl-makers::-webkit-scrollbar { display: none; }
  .dl-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .dl-dev:hover { transform: none; }
  .dl-pic { height: 92px; margin: .4rem .4rem 0; }
  .dl-pic img { max-height: 76px; }
  .dl-info { padding: .55rem .6rem .65rem; }
  .dl-info strong { font-size: .88rem; }
}
@media (max-width: 360px) { .dl-btn, .dl-tor { gap: .3rem; padding-inline: .5rem; font-size: .88rem; } }
.dl-all { margin-top: 2rem; }
