@charset "UTF-8";

/**
 * styles-medias.css
 * Author: hybrid.
 */



/* ================================================================================================== */
/* ============================================= CONFIG ============================================= */
/* ================================================================================================== */


.thumbnail {
	--thumbnail-background-color: var(--accent-color, --dominant-color);
}

/* ============================== SIZES ============================== */

@media (max-width: 1000px) {
	figure.size-short { --img-height: 5rem; }
}
@media (min-width: 1000px) {
	figure.size-short { --img-height: 8rem; }
}



/* ====================================================================================================== */
/* ============================================= ANIMATIONS ============================================= */
/* ====================================================================================================== */



/* ================================================================================================= */
/* ============================================= THEME ============================================= */
/* ================================================================================================= */


/* ============================== THUMBNAILS ============================== */

/* =============== DEFAULT =============== */

.thumbnails {
	margin: 0;
	aspect-ratio: 16/9;
}
.thumbnails > .thumbnail {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	aspect-ratio: inherit;
	pointer-events: none;
}


/* =============== ANIMATED =============== */

/*
Principe :
- 1 image  → .images > .thumbnail (aucune animation)
- N images → .images > .thumbnails.animated
- Hors survol : première image visible, les autres cachées
- Au survol : cycle démarre image par image
- Sortie de survol : retour instantané à la première image
- ease-out sur fade in + ease-in sur fade out → somme perçue ≥ 1 → zéro dip to black

--display-duration : durée d'affichage plein par image
--fade-duration    : durée du fondu entrant/sortant entre les images 2+
*/

/* Désactiver toute transition sur img — conflit avec l'animation */
/*.thumbnails.animated img {
	transition: none;
}*/

/* Conteneur */
.thumbnails.animated {
	--thumbnail-count: 2;
	--display-duration: .75s;
	--fade-duration: .375s;
}

/* Hors survol : première image visible, les autres cachées */
.thumbnails.animated > .thumbnail          { opacity: 0; }
.thumbnails.animated > .thumbnail:first-child { opacity: 1; }


/* =============== ANIMATION =============== */

/*
Durée totale = n*(D+F) → slot identique pour chaque image y compris la première au retour de cycle.
backwards → opacity:0 pendant les delays (images 2+).
nth-child(1) → delay:0, keyframe démarre à opacity:1 → visible immédiatement au premier survol.
*/

*:hover > .thumbnails.animated[style*="--thumbnail-count: 2"] .thumbnail {
	animation: thumbnailsCycle2 calc(2 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 3"] .thumbnail {
	animation: thumbnailsCycle3 calc(3 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 4"] .thumbnail {
	animation: thumbnailsCycle4 calc(4 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 5"] .thumbnail {
	animation: thumbnailsCycle5 calc(5 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 6"] .thumbnail {
	animation: thumbnailsCycle6 calc(6 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 7"] .thumbnail {
	animation: thumbnailsCycle7 calc(7 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 8"] .thumbnail {
	animation: thumbnailsCycle8 calc(8 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 9"] .thumbnail {
	animation: thumbnailsCycle9 calc(9 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 10"] .thumbnail {
	animation: thumbnailsCycle10 calc(10 * (var(--display-duration) + var(--fade-duration))) linear infinite backwards;
}


/* =============== DELAYS =============== */

/*
nth-child(1) → 0ms : démarre immédiatement
nth-child(n) → (n-1) * (D+F) : attend son tour
backwards maintient opacity:0 pendant ces delays
*/

.thumbnails.animated .thumbnail:nth-child(1)  { animation-delay: 0ms !important; }
.thumbnails.animated .thumbnail:nth-child(2)  { animation-delay: calc(1 * (var(--display-duration) + var(--fade-duration))) !important; }
.thumbnails.animated .thumbnail:nth-child(3)  { animation-delay: calc(2 * (var(--display-duration) + var(--fade-duration))) !important; }
.thumbnails.animated .thumbnail:nth-child(4)  { animation-delay: calc(3 * (var(--display-duration) + var(--fade-duration))) !important; }
.thumbnails.animated .thumbnail:nth-child(5)  { animation-delay: calc(4 * (var(--display-duration) + var(--fade-duration))) !important; }
.thumbnails.animated .thumbnail:nth-child(6)  { animation-delay: calc(5 * (var(--display-duration) + var(--fade-duration))) !important; }
.thumbnails.animated .thumbnail:nth-child(7)  { animation-delay: calc(6 * (var(--display-duration) + var(--fade-duration))) !important; }
.thumbnails.animated .thumbnail:nth-child(8)  { animation-delay: calc(7 * (var(--display-duration) + var(--fade-duration))) !important; }
.thumbnails.animated .thumbnail:nth-child(9)  { animation-delay: calc(8 * (var(--display-duration) + var(--fade-duration))) !important; }
.thumbnails.animated .thumbnail:nth-child(10) { animation-delay: calc(9 * (var(--display-duration) + var(--fade-duration))) !important; }


/* =============== KEYFRAMES =============== */

/*
nth-child(1) utilise thumbnailsCycle*-first : démarre à opacity:1, pas de fade in au démarrage.
nth-child(2+) utilisent thumbnailsCycle* : fade in au début.
animation-timing-function par segment :
- fade in  : ease-out → image monte vite, reste longtemps proche de 1
- fade out : ease-in  → image descend lentement, reste longtemps proche de 1
→ somme perçue des deux images en transition ≥ 1 → zéro dip to black

Formules (D=display, F=fade, n=count) :
total      = n*(D+F)
fade%      = F/(n*(D+F)) * 100
slot%      = 1/n * 100
slot+fade% = (D+2*F)/(n*(D+F)) * 100

n=2  : fade=14.29% slot=50%    slot+fade=64.29%
n=3  : fade=9.52%  slot=33.33% slot+fade=42.86%
n=4  : fade=7.14%  slot=25%    slot+fade=32.14%
n=5  : fade=5.71%  slot=20%    slot+fade=25.71%
n=6  : fade=4.76%  slot=16.67% slot+fade=21.43%
n=7  : fade=4.08%  slot=14.29% slot+fade=18.37%
n=8  : fade=3.57%  slot=12.5%  slot+fade=16.07%
n=9  : fade=3.17%  slot=11.11% slot+fade=14.29%
n=10 : fade=2.86%  slot=10%    slot+fade=12.86%
*/

/* nth-child(1) — démarre à opacity:1, pas de fade in */
@keyframes thumbnailsCycle2-first {
	0%     { opacity: 1; }
	50%    { opacity: 1; animation-timing-function: ease-in; }
	64.29% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle3-first {
	0%     { opacity: 1; }
	33.33% { opacity: 1; animation-timing-function: ease-in; }
	42.86% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle4-first {
	0%     { opacity: 1; }
	25%    { opacity: 1; animation-timing-function: ease-in; }
	32.14% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle5-first {
	0%     { opacity: 1; }
	20%    { opacity: 1; animation-timing-function: ease-in; }
	25.71% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle6-first {
	0%     { opacity: 1; }
	16.67% { opacity: 1; animation-timing-function: ease-in; }
	21.43% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle7-first {
	0%     { opacity: 1; }
	14.29% { opacity: 1; animation-timing-function: ease-in; }
	18.37% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle8-first {
	0%     { opacity: 1; }
	12.5%  { opacity: 1; animation-timing-function: ease-in; }
	16.07% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle9-first {
	0%     { opacity: 1; }
	11.11% { opacity: 1; animation-timing-function: ease-in; }
	14.29% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle10-first {
	0%     { opacity: 1; }
	10%    { opacity: 1; animation-timing-function: ease-in; }
	12.86% { opacity: 0; }
	100%   { opacity: 0; }
}

/* nth-child(2+) — fade in ease-out, fade out ease-in */
@keyframes thumbnailsCycle2 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	14.29% { opacity: 1; }
	50%    { opacity: 1; animation-timing-function: ease-in; }
	64.29% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle3 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	9.52%  { opacity: 1; }
	33.33% { opacity: 1; animation-timing-function: ease-in; }
	42.86% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle4 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	7.14%  { opacity: 1; }
	25%    { opacity: 1; animation-timing-function: ease-in; }
	32.14% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle5 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	5.71%  { opacity: 1; }
	20%    { opacity: 1; animation-timing-function: ease-in; }
	25.71% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle6 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	4.76%  { opacity: 1; }
	16.67% { opacity: 1; animation-timing-function: ease-in; }
	21.43% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle7 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	4.08%  { opacity: 1; }
	14.29% { opacity: 1; animation-timing-function: ease-in; }
	18.37% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle8 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	3.57%  { opacity: 1; }
	12.5%  { opacity: 1; animation-timing-function: ease-in; }
	16.07% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle9 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	3.17%  { opacity: 1; }
	11.11% { opacity: 1; animation-timing-function: ease-in; }
	14.29% { opacity: 0; }
	100%   { opacity: 0; }
}
@keyframes thumbnailsCycle10 {
	0%     { opacity: 0; animation-timing-function: ease-out; }
	2.86%  { opacity: 1; }
	10%    { opacity: 1; animation-timing-function: ease-in; }
	12.86% { opacity: 0; }
	100%   { opacity: 0; }
}


/* nth-child(1) utilise les keyframes *-first */
*:hover > .thumbnails.animated[style*="--thumbnail-count: 2"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle2-first;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 3"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle3-first;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 4"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle4-first;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 5"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle5-first;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 6"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle6-first;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 7"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle7-first;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 8"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle8-first;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 9"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle9-first;
}
*:hover > .thumbnails.animated[style*="--thumbnail-count: 10"] .thumbnail:nth-child(1) {
	animation-name: thumbnailsCycle10-first;
}




/* ============================== SECTION IMAGE ============================== */

.section-image {
	--img-fit: cover;
	--img-height: 100%;
	--img-ratio: var(--section-image-ratio);
	width: 100% !important;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	aspect-ratio: var(--section-image-ratio) !important;
	overflow: hidden;
	object-position: center center;
}
.section-image picture {
	width: 100%;
	margin: 0;
	aspect-ratio: var(--section-image-ratio) !important;
}

main .section-image + [class*='-background-color'] {
	margin-top: 0;
}


/* ============================== THUMBNAIL ============================== */

.thumbnail {
	--img-fit: cover;
	--img-height: 100%;
	--img-margin: 0;
	--img-ratio: var(--thumb-ratio);
	position: relative;
	display: block;
	width: 100%;
}

.thumbnail > * {
	max-height: inherit;
}

.thumbnail picture {
	border-radius: var(--thumbnail-border-radius);
}
.thumbnail img {
	border-radius: var(--thumbnail-border-radius);
}


/* =============== MEDIA =============== */

.thumbnail.media {
	--thumbnail-border-radius: 1em;
	max-width: none;
	aspect-ratio: var(--media-ratio);
}


/* =============== AVATAR =============== */

.thumbnail.avatar {
	--img-ratio: var(--avatar-ratio);
	--img-height: 10em;
	--img-width: 10em;
}
.thumbnail.avatar > *,
.thumbnail.avatar img {
	max-height: var(--img-height);
	max-width: var(--img-width);
}


/* ============================== AD ============================== */

figure.ad {
	--img-ratio: var(--ad-ratio);
	--img-height: 100%;
	--img-fit: cover;
}


/* ============================== ILLUSTRATION ============================== */

/* @use in section.banner */

figure.illustration {
	--figcaption-font-size: 1em;
	--figcaption-gap: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: none;
    margin: 0;
}
figure.illustration picture {
    flex-grow: 1;
    overflow: hidden;
    width: 100%;
	display: contents;
}
figure.illustration img {
    height: 100%;
    width: 100%;
    max-width: none;
}
figure.illustration figcaption {
    display: block;
    width: 100%;
    padding: 1em;
    margin: 0 auto;
    line-height: 1;
    max-width: var(--content-max-width);
    background: var(--bright-color);
}



figure.focus {
	/*margin-block: var(--section-gap-x) !important;*/
	margin-block: calc(var(--content-spacing) * 2);
	/*max-width: calc(100% * 2 / 3);*/
}