/* Table des projets (accueil) : un tapis de découpe, des tirages posés dessus.
   Sans JavaScript, la liste s'affiche en grille ; le script pose les cartes en vrac. */

.table-projets { --carte: 180px; }
.table-projets .rangements { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 0 0 14px; }
.table-projets .rangements[hidden] { display: none; }
.table-projets .rangements small { font-size: 14px; font-weight: 600; margin-right: 6px; }
.table-projets .rangements button { border: 2px solid var(--bleu); background: var(--blanc); color: var(--bleu); padding: 4px 12px; font: 800 20px/1.1 var(--affiche); text-transform: uppercase; cursor: pointer; }
.table-projets .rangements button:hover, .table-projets .rangements button:focus-visible { background: var(--brume); }
.table-projets .rangements button[aria-pressed="true"] { background: var(--fluo); }
/* « Mélanger » est une action, pas un classement : il se tient à part, et ne reste pas allumé. */
.table-projets .rangements .melanger { margin-left: 14px; }
.table-projets .rangements .melanger[aria-pressed="true"] { background: var(--blanc); }
.table-projets .rangements .melanger:hover, .table-projets .rangements .melanger:focus-visible { background: var(--fluo); }

.table-projets .table {
	position: relative; overflow: hidden; padding: 16px;
	background-color: var(--brume);
	background-image: linear-gradient(rgba(45,46,130,.10) 1px, transparent 1px), linear-gradient(90deg, rgba(45,46,130,.10) 1px, transparent 1px), linear-gradient(rgba(45,46,130,.22) 1px, transparent 1px), linear-gradient(90deg, rgba(45,46,130,.22) 1px, transparent 1px);
	background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
}
.table-projets .table-cartes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--carte), 1fr)); gap: 14px; }
.table-projets .carte { margin: 0; background: var(--blanc); padding: 7px 7px 9px; box-shadow: 0 1px 0 rgba(45,46,130,.25); }
.table-projets .carte a { display: block; text-decoration: none; color: var(--bleu); -webkit-user-drag: none; }
.table-projets .carte img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.table-projets .carte small { display: inline-block; margin-top: 7px; font: 900 14px/1 var(--affiche); background: var(--fluo); padding: 2px 5px 0; }
.table-projets .carte span { display: block; margin-top: 4px; font: 900 17px/1 var(--affiche); text-transform: uppercase; text-decoration: underline transparent; text-decoration-thickness: .6em; text-underline-offset: -.46em; text-decoration-skip-ink: none; }
.table-projets .carte:hover span, .table-projets .carte a:focus-visible span, .table-projets .carte.choisie span { text-decoration-color: var(--fluo); }
.table-projets .carte a:focus-visible { outline: 3px solid var(--bleu); outline-offset: 4px; }

/* Avec le script : la table */
.table-projets.vivante .table { padding: 0; height: 700px; }
.table-projets.vivante .table-cartes { display: block; }
.table-projets.vivante .carte { position: absolute; left: 0; top: 0; width: var(--carte); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.table-projets.vivante .carte.prise { cursor: grabbing; }
.table-projets.vivante .carte.choisie { outline: 3px solid var(--bleu); }
.table-projets.vivante .table.range .carte { transition: transform .35s ease; }
.table-projets .etiquette-tas { position: absolute; z-index: 950; margin: 0; padding: 2px 4px 0; background: var(--brume); font: 900 22px/1 var(--affiche); text-transform: uppercase; pointer-events: none; }
.table-projets .etiquette-tas em { font-style: normal; font-size: 14px; font-weight: 700; margin-left: 6px; opacity: .7; }
.table-projets .aide { position: absolute; left: 14px; bottom: 12px; z-index: 900; margin: 0; font-size: 13.5px; font-weight: 600; background: var(--blanc); padding: 3px 9px; pointer-events: none; }
.table-projets .aide[hidden] { display: none; }

/* La fiche ouverte */
.table-projets .fiche-table { position: absolute; right: 16px; bottom: 16px; width: min(560px, calc(100% - 32px)); z-index: 1000; display: grid; grid-template-columns: 150px 1fr; gap: 14px 18px; background: var(--blanc); border: 2px solid var(--bleu); padding: 14px; align-items: start; }
.table-projets .fiche-table > img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.table-projets .fiche-table .annee { display: inline-block; font: 900 20px/1 var(--affiche); background: var(--fluo); padding: 3px 7px 1px; }
.table-projets .fiche-table strong { display: block; font: 900 28px/.95 var(--affiche); text-transform: uppercase; margin: 8px 0; }
.table-projets .fiche-table p { margin: 0 0 8px !important; font-size: 15.5px; line-height: 1.5; }
.table-projets .fiche-table .sf { font-size: 13.5px; }
.table-projets .fiche-table .lien { font-weight: 700; }
.table-projets .fiche-table .fermer { position: absolute; top: 6px; right: 8px; border: 0; background: none; color: var(--bleu); font: 900 26px/1 var(--affiche); cursor: pointer; padding: 4px 6px; }
.table-projets .fiche-table .fermer:hover, .table-projets .fiche-table .fermer:focus-visible { background: var(--fluo); }

/* Au doigt, la page défile normalement : on garde le doigt posé un instant sur une photo pour l'attraper. */
@media (pointer: coarse) {
	.table-projets.vivante .carte { touch-action: auto; -webkit-touch-callout: none; }
	.table-projets.vivante .carte.prise { outline: 3px solid var(--fluo); }
	.table-projets .aide .souris { display: none; }
}
@media not (pointer: coarse) { .table-projets .aide .doigt { display: none; } }
@media (max-width: 760px) {
	.table-projets { --carte: 112px; }
	.table-projets.vivante .table { height: 520px; }
	.table-projets .carte { padding: 5px 5px 6px; }
	.table-projets .carte span { font-size: 13px; }
	.table-projets .carte small { font-size: 12px; }
	.table-projets .etiquette-tas { font-size: 16px; }
	.table-projets .rangements button { font-size: 16px; padding: 3px 9px; }
	.table-projets .fiche-table { left: 8px; right: 8px; bottom: 8px; width: auto; grid-template-columns: 84px 1fr; gap: 10px 12px; padding: 10px; }
	.table-projets .fiche-table strong { font-size: 22px; margin: 6px 0; }
	.table-projets .fiche-table p { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .table-projets.vivante .table.range .carte { transition: none; } }
