Introduction

Surface modification is an excellent method to provide interfaces with a tailored functionality while preserving the bulk properties of the substrate. Functional coatings are used across a broad range of disciplines from biomedicine to nanotechnology with countless applications including: biomolecular sensing, mechanical actuation, fire protection, anticorrosion, and antifouling. Despite rapid progress in the field, the formation of well-defined, responsive, nanostructured layers remains a challenging task. Within the domain of soft-matter functionalization, monolayered or multilayered coatings can be obtained by spin coating, drop casting, dip coating, or spraying1,2,3,4,5,6,7,8,9,10. The different methods have been extensively employed to modify the surface of a very diverse range of substrates, with only few restrictions on the chemical composition of the thin films. In contrast to protocols requiring subsequent synthetic steps and complex experimental set-up, the classical layer-by-layer technique remains one of the most versatile methods to prepare multifunctional, layered coatings. First employed for the successive adsorption of oppositely charged polyelectrolytes onto solid, planar surfaces, the method has rapidly been extended to the incorporation of colloidal particles into thin films. Such films may also be formed on soft and non-planar objects11,12,13,14,15,16.

A common aim for research in this field is the preparation of hierarchical, compartmentalized films with a reversible response to external stimuli and the ability to load active agents, stored in specific reservoirs. To achieve this, intense work has been conducted on the preparation of composite coatings where polymeric materials are combined with low-molecular-weight block copolymer or surfactant assemblies, i.e., micelles, vesicles, or bilayers15,16,17,18,19,20. The stratified structure of alternating lipid or surfactant and polyelectrolyte layers has shown highly promising results in the fields of bio-catalysis and bio-sensing and is generally prepared by sequential adsorption of the different components21,22,23. However, for the incorporation of micelles, intact vesicles, or amphiphilic bilayers into multilayered films, additional steps aimed at stabilizing intermediate structures are required16,17,19. This results in complex preparation protocols, which are not easily controlled and reproduced.

In contrast to the active deposition methods commonly employed so far, in this work, we exploit the spontaneous self-assembly of polymers and surfactants in bulk aqueous solution into complex structures to prepare responsive, nanostructured coatings via a simple, single-step spin-coating deposition procedure. To prepare thin films of alternating polymer/surfactant layers, mixtures of biopolycation chitosan and oppositely charged oligo ethylene oxide (EO) alkyl ether carboxylic acids (AECs) of general formula CiEOjCH2COOH are chosen (Ci is the usual nomenclature for fatty acids and j is the average number of EO units). These mixtures are very versatile as they co-assemble into a large variety of structures depending on the solution acidity, the surfactant-to-polymer molar mixing ratio Z, and the number of EO units of the surfactant24,25,26.

The approach presented in this work aims at the direct transfer of the spontaneously formed aggregates from the aqueous solution onto a solid substrate via a simple spin-coating procedure. The aim is to exploit the high degree of structural control, conferred by the solution self-assembly process, for the functionalization of solid substrates.

Results

Self-assembly in aqueous solutions

AECs with a lauric (C12) or oleic (C18:1) aliphatic chain and an average of 5 EO units form vesicles in a narrow pH range of 4–4.5, close to the pKa value of the fatty acid27,28,29. The representative chemical formula of the surfactant and a schematic representation of the self-assembled vesicles in aqueous solution are given in Fig. 1a. In mixtures with the oppositely charged biopolymer chitosan (Fig. 1b), well-defined onion-like vesicles are formed24, represented schematically in Fig. 1c. The formation of onion-like assemblies is commonly observed in mixtures of vesicle-forming surfactants and oppositely charged macromolecules30,31,32. The structure of the spontaneously formed assemblies in aqueous solutions can be resolved in high detail using small-angle neutron scattering (SANS) and dynamic light scattering (DLS). Representative scattering patterns arising from aqueous solutions of chitosan, C18:1EO5CH2COOH, and of their mixture are shown in Fig. 1d. The SANS data from the polysaccharide is described with a generalized Gaussian coil model33 and indicates that the acetic acid/acetate buffer is a poor solvent for chitosan. In the surfactant solution, we can identify the presence of large, polydisperse vesicles, with the core formed by the aliphatic chains and the shell by the hydrated EO units and carboxylic acid/carboxylate moieties. The scattering pattern arising from the chitosan/AEC mixture exhibit a clear Guinier region at low-q (Rg ~ 40 nm), indicating the well-defined size of the aggregates, and a pronounced correlation peak at q ~ 0.9 nm−1, substantiating the internal periodic structure of the aggregate. The scattering pattern was successfully modeled with a periodic sequence of concentric shells and a polydisperse core radius. Further details on the model and analytical expressions used for the description of the SANS data are provided in the Supplementary Note 3. To analyze the data in absolute units, the molecular volumes and the scattering length densities (SLD) of the components were obtained according to Supplementary note 1 and Supplementary Figure 3. The SANS pattern reveals the formation of multilayered vesicles, formed by an average of three repeating chitosan/surfactant layers of 7.9 nm thickness, and an average vesicle outer radius of ~30 nm. Multiangle DLS experiments show a diffusive behavior for the system with a hydrodynamic radius of Rh ~ 70 nm (see Supplementary Figures 6 and 7). This is in good agreement with the expected value calculated from the structural parameters obtained from the analysis of the SANS data (see Supplementary Table 2). The apparent discrepancy between the vesicle sizes obtained from the SANS and DLS lies in the polydispersity of the sample, as demonstrated in Supplementary Notes 3 and 4. The size of the vesicles, the layer thickness, and the number of the layers can be controlled via the mixing conditions, i.e., the surfactant-to-polymer mixing ratio, the pH, or the length of the hydrophobic chain of the AEC (see Supplementary Fig. 5, Supplementary Table 2, Supplementary Note 3 and ref. 24). In the following, we exploit this spontaneous, controllable assembly behavior for the preparation of thin films with similar internal layered structures.

Fig. 1
figure 1

Description of the materials used and their solution self- and co-assembly behavior. a Representative chemical formula of an alkyl ether carboxylic acid (AEC), with i = 18:1 or 12, at a pH value close to the pKa, and a representation of the bilayer and vesicle structure, formed in aqueous solution. b Chemical formula of chitosan with a degree of polymerization N and degree of deacetylation DA; c Schematic representation of the multilayered vesicles found in aqueous mixtures of polymer and AECs. d Small-angle neutron scattering patterns arising from a 0.6 wt% chitosan solution, 0.5 wt% C18:1EO5CH2COOH solution, and their 1:1 mixture (0.3 wt% chitosan and 0.25 wt% fatty acid). Full lines represent curves calculated using models describing the bilayer vesicle, the multilayer vesicle, and the linear polysaccharide depicted in ac. The mathematical description of the corresponding models is given in the Supplementary Note 3. Curves are scaled for improved readability. Error bars represent standard deviations of neutron counts

Multilayered thin films

When an aqueous solution, containing the spontaneously assembled chitosan/AEC multilayered vesicles, is spin-coated onto a silicon substrate, a macroscopically homogeneous film is formed (see Fig. 2). The film is highly sensitive to variations in relative humidity (RH), as clearly demonstrated by the change in color of the layer when gently blowing on the surface (see Supplementary Movie 1), leading to a humidity increase from approximately 30% to 60% RH.

Fig. 2
figure 2

Photographs of representative samples investigated in this work. a Photograph of the aqueous solution with a composition of 0.3 wt% chitosan and 0.3 wt% C18:1EO5CH2COOH (mixing ratio, Z = [surfactant]/[chitosan units] = 0.3) at pH = 4.3, b of the silicon block coated with the same solution spin-coated at 500 RPM for 180 s at ambient humidity of approximately 30% RH and c at approximately 60% RH

Thin films were prepared from complexes formed by either C12EO5CH2COOH or C18:1EO5CH2COOH and chitosan. These chain lengths were chosen as they determine the thickness of the layers in the multilayered vesicles: 6.3 nm for the C12-based surfactant and 7.9 nm for the C18:1-based complexes. In addition to the chain length variation, the effect of spin-coating conditions, i.e., rotation speed, Ω, and the total concentration of polymer and surfactant, ctot, on the optical film thickness, dtot, was systematically investigated by ellipsometry. The relationship between the spin-coating parameters and the film thickness was found to be \(d_{{\mathrm{tot}}} \propto c_{{\mathrm{tot}}} \cdot {\mathrm{\Omega}} ^{ - 0.6}\)(see Supplementary Figure 8), as predicted for simple polymeric systems34 (see Supplementary Note 5). It is noteworthy that the same spin-coating procedure performed with a pure surfactant solution (0.3 wt%) leads to the formation of macroscopically highly heterogeneous films, while spin-coating the pure chitosan (0.3 wt%) solution results in a film with a dry thickness of <2 nm (details in Supplementary Note 6, Supplementary Figures 10 and 11, and Supplementary Table 3). In summary, by simply varying the spin-coating conditions, thin films with thickness varying from a few tens to hundreds of nanometers can be prepared.

In order to evaluate the internal structure of the thin films, neutron reflectometry (NR) experiments were performed under a controlled atmosphere of heavy water (D2O). The objective of the swelling study with D2O was twofold: first, it allowed the internal structure of the film to be probed, by providing an enhanced contrast between hydrated, hydrophilic regions—chitosan and surfactant head groups—and the hydrophobic regions—surfactant alkyl chains. Second, it offered significant insights into swelling behavior of the thin film, which is of paramount importance for many applications, e.g., chemical sensing, uptake/release, and mechanical actuation, as the physico-chemical properties of the coating are expected to be strongly dependent on its water content.

A representative set of NR curves, recorded for the chitosan/C18:1EO5CH2COOH coating at increasing RH, is shown in Fig. 3. The film was prepared by spin-coating a mixture containing 0.3 wt% chitosan and 0.3 wt% C18:1EO5CH2COOH (Z = 0.3) at pH 4.3 at 500 RPM for 180 s. Further NR curves are shown in Supplementary Fig. 12. The reflectivity data exhibit a characteristic evolution with increasing humidity. First, the apparent critical edge shifts toward higher q values at increasing RH, indicating an increase of the average SLD of the coating as it takes up D2O (SLD of 6.33 × 10−4 nm−2). Second, with the exception of the curve at 0% RH, i.e., under an atmosphere of N2, the first minimum moves to lower q values while the oscillation frequency of the Kiessig fringes increases, characteristic of increasing layer thickness. Finally, a broad Bragg peak appears at q ~ 1 nm-1 and moves toward smaller q values with increasing RH, which is a clear indication of the swelling of a multilayered system with structural periodicity.

Fig. 3
figure 3

Characterization of the thin films by neutron reflectometry (NR). a NR patterns measured at controlled D2O humidity of a chitosan/C18:1EO5CH2COOH thin film. x axis is shown on a logarithmic scale and curves are scaled to enhance readability. Solid lines represent calculated reflectivity curves. b Scattering length density (SLD) profiles used to calculate the NR curves. c Volume fraction profiles, ϕi(z), used to calculate SLD(z). d Graphical description of the model underpinning the NR data analysis including the representation of the layered model used to describe the NR curves and the corresponding volume fraction and SLD profiles

The quantitative data analysis of the NR patterns was performed by modeling the interfacial distribution (volume fractions) of all the chemical species present. The volume fraction profiles, ϕi(z), are used to compute the interfacial SLD profile, which is, in turn, used to generate the corresponding reflectivity curve, R(q), via the Parratt recursive algorithm35. Computing the SLD profile from the volume fractions, and not vice versa, is an effective way to include molecular constraints and to extract physically meaningful parameters from the fitting procedure36,37,38. The film is modeled as a sequence of alternating polymer and surfactant layers, defined by their thickness, roughness, and total number of layers. In the following, a layer is defined as a one-component region of the film, chitosan, surfactant hydrophobic chains, or surfactant hydrophilic head group. As in the model of multilayer vesicles, one repeating unit is formed by a sequence of four layers composed of surfactant head group, surfactant tail, surfactant head group, and chitosan. The whole film contains N repeating units in addition to an initial chitosan layer. Intermixing between the components is allowed. The incoherent sum of the NR curves from layers formed by N and N + 1 repeating units allows the NR profile of thin film formed by a non-integer average number of repeating units to be calculated. For each humidity, the water content in the hydrophilic layers is allowed to vary. With these assumptions, the volume fraction profiles ϕi(z) are described by a set of parameters common to the whole swelling series (number of layers, total amount of chitosan and surfactant, and substrate roughness) and by a set of humidity-specific parameters (water content of the hydrophilic layers, void content of the film in dry conditions, roughness of the layer, and intermixing of the components). These parameters were varied until the best agreement of the simulated NR curve with the experimental ones was achieved and are reported in Supplementary Tables 4 and 5. A graphical representation of the model is given in Fig. 3d and full details are given in the “Methods” section.

The model was used to describe the NR patterns shown in Fig. 3a. In particular, the SLD profiles (Fig. 3b) were obtained from the volume fraction profiles in Fig. 3c. This highly constrained model is able to reproduce the most relevant features of the experimental reflectivity data: the shift in the critical edge; the position, width, and intensity of the Bragg peak; and the position of the Kiessig fringes. All of these features validate the underlying structural model. However, some predicted fringes are more pronounced than they appear in the experimental data. This discrepancy likely arises from sample inhomogeneities over the illuminated area of 2.5 × 3.0 cm2, a factor not taken into account by the model. The structural model is further supported by a qualitative analysis of the off-specular reflectometry signal (see Supplementary Note 10 and Supplementary Figures 15-17), which confirms the presence of Bragg sheets. Moreover, the observed linear relation between the diffuse scattering and the film SLD indicates that no strong structural changes, e.g., layer-to-vesicle transition or lateral phase separation, take place during the swelling process.

The volume fraction profiles deduced from the NR experiments (Fig. 3c) clearly show that the spin-coating process of polysaccharide/oleic acid-based surfactant, self-assembled, multilayered vesicles produces thin, multilayered films. The internal periodicity results in the consistent alternation of hydrophilic (chitosan and surfactant head group) and hydrophobic (surfactant tail) layers, with the swelling water enriching only the hydrophilic region. The size of the repeating unit is 4–7 nm, depending on the RH value (see Supplementary Table 5), thus reaching the limits of nano-patterning in thin films by spontaneous phase separation required for new-generation nano-lithography39,40,41. With the aim of achieving even smaller domain sizes, additional thin films were prepared from mixtures of chitosan and the lauric acid-based surfactant C12EO5CH2COOH, see Supplementary Note 7. The reflectivity curves are shown in Supplementary Fig. 12 and reveal a similar swelling behavior, with the film being formed by fewer and thinner repeat units. Interestingly, in both cases the thickness of the repeat unit at the highest probed humidity of 65% RH (6.5 and 7.4 nm for the C12 and C18:1-based AECs, respectively) exactly equals the repeating distance found in the multilayered vesicles, providing further evidence of the direct link between assemblies in aqueous solution and surface structure. The analysis also reveals that the composition of the thin films is close to that of the multilayered vesicles (see Supplementary Table 7).

It is worth noting that all NR curves recorded at 0% RH, i.e., under N2 atmosphere, could only be described by assuming a large fraction (approximately 50 vol%) of voids in the layer. The high air content results in the, seemingly paradoxical, case of thin films being thicker in dry conditions than in humid air, when water is absorbed inside the layer. In order to validate the results from the NR analysis with the complex multilayer model, the low-q part of the data, where the small-scale, internal structural features of the film can be neglected, was described with a homogeneous film model (see Supplementary Note 8). In the analysis, only the total amount of surfactant, polymer, air, and D2O was allowed to vary (see Supplementary Note 9, and Supplementary Figures 13 and 14). Aside from small variations, the analysis leads to layers with the same thickness and composition as found by the multilayer model, as summarized in Supplementary Table 6. The presence of voids in polyelectrolyte multilayer thin films has previously been reported in the literature, although only to a maximum void content of 20 vol%42,43,44. We hypothesize that the large fraction of voids arises due to a dry, rigid structure with numerous defects and that water acts as plasticizer, triggering the transition to a softer and more compact structure.

Film morphology and crystalline structure

The hypothesis of crystalline-to-amorphous transition causing the anomalous behavior in dry conditions was examined by atomic force microscopy (AFM) and X-ray diffraction in grazing incidence geometry (GI-XRD) experiments under controlled humidity conditions. AFM surface height scans performed on an area of 400, 25, and 1 μm2 are given in Fig. 4, and the corresponding phase traces are provided in Supplementary Fig. 18. The results show the formation of a polycrystalline film at 0% RH, with flat, crystalline domains with a typical size of ~200 nm, and an almost parallel orientation to the silicon substrate. Platelets, as shown in Fig. 4, have also been reported in other chitosan-based composites and chitosan single crystals45,46,47. In contrast, a homogeneous, softer film is formed at 40% RH. The surface roughness, evaluated as the standard deviation of the height profile on the 20 × 20 μm2 scans, is approximately 7 nm for both humidity conditions, in good agreement with the decay of the SLD profile from the NR analysis.

Fig. 4
figure 4

Morphology of the chitosan/C18:1EO5CH2COOH coatings as seen by atomic force microscopy (AFM) and X-ray diffraction in grazing incidence geometry (GI-XRD). On the left, AFM scans performed on different areas: 20 × 20 μm2 (a, d), 5 × 5 μm2 (b, e), 1 × 1 μm2 (c, f), dry conditions (ac), and at 40% relative humidity of water (df). Squares indicate the magnified areas shown to the right of each frame. The GI-XRD patterns recorded with a grazing incidence angle of 0.2° at different humidity values are shown in g. The shaded area represents the standard deviation resulting from at least five measurements. Inset shows high-q data on a logarithmic scale

This crystalline-to-amorphous transition is clearly supported by the GI-XRD patterns recorded at different humidity conditions (see Fig. 4). Under dry conditions, three clear peaks are found at q* values of 2.14, 4.52, and 6.66 nm−1, corresponding to lattice spacings of 2.93, 1.39, and 0.94 nm, respectively. Some residual crystallinity is found at 25% RH, as evidenced by the large shoulder at low q and by the correlation peak at q* = 4.41 nm−1\(\hat =\) 1.42 nm. The signal at approximately 6.5 nm−1 weakens with increasing humidity, while a residual, very weak and broad signal at approximately 14 nm−1 persists at all humidity conditions. Chitosan exhibits a complex crystallization behavior and different crystalline structures are obtained depending on the crystallization conditions, i.e., the temperature of preparation, the nature of the counterion, the presence of water in the crystal, and the time since preparation of the crystal47,48,49,50,51,52. The signals at approximately 6.5 nm−1 and approximately 14 nm−1 can be directly ascribed to the chitosan chains48,53. Moreover, the GI-XRD data exclude the formation of sodium acetate crystallites, whose diffraction signals are found between 6.2 and 25 nm−1 54.

In summary, the XRD and AFM results show that the adsorption of water in the polysaccharide/surfactant induces conformational changes of the chitosan chains, with the presence of crystalline domains at low humidity and a fully amorphous film at high humidity values. Dynamic mechanical analysis on chitosan films have shown a gradual decrease in the storage modulus with increasing humidity55, corroborating the hypothesis of water acting as plasticizer in the film, thereby triggering the transition from a semi-crystalline film at low humidity to an amorphous film at high humidity. Finally, the AFM scans confirm the full conversion of the vesicles into a homogeneous film.

Sample ageing and repeatability of film preparation

A final aspect probed in this work is the evolution of the thin films with time. Nine identical samples were prepared by spin-coating the same chitosan/C18:1EO5CH2COOH solution (Z = 0.3 and at pH 4.3) at 500 RPM for 180 s. The films were stored in closed chambers in contact with silica gel (dry conditions), with a saturated potassium acetate solution (23% RH), and with a saturated sodium chloride solution (75% RH). The evolution of the ellipsometric film thickness and refractive index of the films was followed for 35 days and is shown in Fig. 5. No change in the film thickness and refractive index is found for samples stored in dry conditions and at 23% RH. In contrast, a clear decrease of thickness and increasing inhomogeneity, as evidenced by the large error bars, is found for the samples stored at 75% RH. The latter also exhibits small heterogeneities visible by naked eye. Accordingly, optical images of the thin films stored under different conditions were taken with different level of magnification and are shown in Fig. 6. The images clearly demonstrate that the films stored in dry conditions and at high humidity exhibit phase separation, while no sign of demixing is found in the films stored at 23% RH. In particular, the morphology of the phase-separated aggregates strongly varies with humidity. After 35 days of storage at high humidity, large (approximately 100 μm), star-like aggregates with few branches are formed. In contrast, after long storage in dry conditions, smaller (10–20 μm) fractal-like aggregates are found. The AFM height traces, which allow for a stronger magnification, further confirm the presence of fractal-like phase separation for samples stored in dry conditions, the formation of large, rigid star-like objects at 75% RH, and the presence of a homogeneous film when the sample is stored at 23% RH.

Fig. 5
figure 5

Time-dependent evolution of the ellipsometric thickness and refractive index for chitosan/C18:1EO5CH2COOH thin films. a The evolution of samples stored under different conditions as a function of sample age. b The ellipsometric thickness as a function of the day of preparation of the coating from two solutions of different age; the broken lines represent the average thickness and the shaded areas the standard deviations. For each condition, three samples were prepared and investigated; error bars represent standard deviation between different points on the same sample

Fig. 6
figure 6

Morphological investigation of identically prepared thin films stored under different humidity conditions. The films were prepared by spin-coating the same chitosan/C18:1EO5CH2COOH solution (Z = 0.3 and at pH 4.3) at 500 RPM for 180 s. The images show: optical microscopic images (al) of samples stored for 1 day (af) and for 35 days (gl) in dry conditions (a, d, g, j), at 23% relative humidity (RH) (b, e, h, k), and at 75% RH (c, f, i, l); atomic force microscopic (AFM) height traces (mo) of samples stored for 35 days in dry conditions (m), at 23% RH (n), and 75% RH (o). Note the different magnifications in the optical images and the different height scales in the AFM images

Finally, the repeatability and the effect of the age of the multilayered vesicle solution on the film thickness were probed. In Fig. 5, the dependence of the ellipsometric thickness of the thin films is plotted as a function of the day of preparation for two different solutions with different age. The data reveal a random variability of the thickness with time of approximately 7%. We ascribe the variability to fluctuations in the humidity of the laboratory during the film preparation (see Supplementary Fig. 9), which is a parameter affecting the spin-coating deposition from aqueous solutions56,57. The variability of the thickness of samples prepared on the same day from the same solution is 4%, while a systematic deviation between the thicknesses from the two solutions of 5% was found.

Discussion

The combination of the structural information from NR and morphological features from AFM results in the following unified picture: thin polysaccharide/lipid films, with an ordered multilayer structure, can be prepared in a single and rapid step, by spin-coating a solution of spontaneously co-assembled multilayer vesicles onto a solid surface. The hydrophilic regions of the film, namely, the chitosan chains and the fatty acid PEGylated head groups, selectively and reversibly absorb water as a function of the RH, resulting in a remarkable color change of the film, thereby allowing for optical sensing of humidity and the design of humidity-triggered optical filters. Moreover, in dry conditions, the film switches to a polycrystalline morphology, with partially ordered platelets formed by crystalline chitosan/lipid domains. A schematic representation of the process is given in Fig. 7. A slow phase separation in the film is observed over a time scale of several weeks, which is strongly dependent on the humidity conditions at which the films are stored.

Fig. 7
figure 7

Schematic representation of the spontaneous co-assembly of ethoxylated fatty acid and chitosan into multilayered vesicles and the response behavior of the corresponding multilayered film

In summary, we report the formation of well-defined polyelectrolyte/lipid coatings, whose mesoscopic structure is the result of a spontaneous co-assembly process of chitosan and oppositely charged ethoxylated fatty acids into multilamellar vesicles in bulk aqueous solution. The preparation is rapid, low-cost, reproducible, and highly versatile, as it allows films to be prepared with a controlled total thickness, number of layers, and periodicity. In particular, the thickness of the repeating unit is dictated by the length of the fatty acid, while the total film thickness is determined during the spin-coating process via the total concentration and the spin speed. NR reveals a clear segregation between the hydrophilic and hydrophobic regions, with a strong swelling response of the hydrophilic regions to changes in RH. The preparation procedure is, at this moment, restricted to relatively small, rigid, and flat substrates, due to the intrinsic limitations of the spin-coating deposition procedure. It is worth conducting further studies, with the aim of exploring the potential of these responsive, compartmentalized membranes as functional coatings for food preservation, hierarchical nanoreactors, and transport membranes and to extend the deposition process to different substrates.

The method presented in this work is not restricted to polymer/surfactant mixtures, and we expect that similar multilayered coatings can be prepared applying an analogous rapid, single-step procedure to a large variety of spontaneously assembled, hybrid, layered systems in bulk solution, such as: catanionic58,59, surfactant/polyoxometalates60, fullerene/polyoxometalates61, and DNA/lipid multilayer62,63 vesicles.

Methods

Materials

Chitosan was obtained from TCI Europe. It is characterized by a viscosity-average molecular weight of 100 kDa and a degree of acetylation of 0.15 determined by 1H-nuclear magnetic resonance (NMR) and purified before use as described previously25. Two oligo ethylene oxide alkylether carboxylic acids were obtained from Kao Chemicals and are available under the trade names AKYPO RO 50 VG and AKYPO RLM 45 CA. The surfactants are of technical grade and were used without purification. They were, however, characterized by 1H-NMR spectroscopy27, revealing that the hydrophobic part of RO 50 VG is a 3:1 mixture of C18:1 and C16:0 aliphatic chains, while that of RLM 45 CA is a 2:1 mixtures of C12 and C14 chains. The degree of ethoxylation is 4.7 and 4.6 for RO 50 VG and RLM 45 CA, respectively. The degree of carboxymethylation is for both surfactants ca. 0.9. RO 50 VG is referred to with the representative formula of C18:1EO5CH2COOH and RLM 45 CA with C12EO5CH2COOH. The 1H-NMR spectra were recorded on a Brucker Avance II spectrometer operating at 400 MHz and are provided in Supplementary Figs. 1 and 2.

Bulk solution preparation

Solutions were prepared in an acetic acid buffer with a total concentration of acetate/acetic acid (Roth, 99%) of 200 mM. pH was adjusted using a concentrated sodium hydroxide solution. Solutions were prepared at a constant chitosan concentration of 0.3 wt% and at a mixing ratio of Z = 0.3, defined as the ratio between the moles of surfactants and the moles of deacetylated chitosan units (using an effective Mw of 196.8 g mol−1). Unless otherwise stated, solutions were prepared in D2O.

Substrate cleaning

The substrates consisting of silicon mono-crystalline blocks cleaved along the (111) direction (5 × 5 × 1 cm3), were cleaned in an ultrasonic bath in an ethanol/acetone 1:1 mixture, extensively washed with Milli-Q water (specific resistivity 18.2 MΩ cm), and dried under nitrogen flow. Surface activation was performed by ozone etching (BioForce Nanosciences UV/ozone ProcleanerTM Plus) for 10 min. The thickness of the silicon oxide layer was checked prior to the reflectivity experiments with optical ellipsometry.

Coating preparation

The chitosan–surfactant mixtures were spin-coated on freshly cleaned silicon blocks, using an SÜSS MicroTec Delta 6 spin-coater. Approximately 2 mL of solution were deposited onto the blocks to cover the entire substrate surface. Where not otherwise stated, the spin-coating process was performed with a rotation speed of 500 RPM for 3 min. The coated samples were kept under saturated D2O atmosphere before NR experiments.

Small-angle neutron scattering

SANS curves were recorded on D11 at the Institut Laue-Langevin (ILL) in Grenoble, France64. Three different configurations were used, with a wavelength of λ = 0.6 nm; sample-to-detector distances (SD) of 1.5, 8, and 34 m; and collimation lengths of 8, 8, and 34 m, respectively, covering a q-range of 0.02–4 nm−1, where

$$q = 4\pi {\mathrm{sin}}(\theta {\mathrm{/}}2){\mathrm{/}}\lambda$$
(1)

is the magnitude of the scattering vector and θ is the scattering angle. The differential cross-sections (absolute scaling) were obtained by comparison with the scattering from a water sample with 1 mm path length. The data were described in absolute units using the SLD values and molecular volumes reported in Supplementary Table 1. The SANS pattern arising from the chitosan solution was previously published25 and recorded on D11 using three configurations with sample-to-detector distances (SD) of 1.2, 8, and 34 m and collimations of 4, 8, and 34 m, respectively, and wavelength of λ = 0.6 nm.

Light scattering

Static and dynamic light scattering experiments were simultaneously performed at 25 °C on a compact ALV/CGS-3 instrument, equipped with a He–Ne laser with a wavelength of 632.8 nm. The absolute intensity was obtained using toluene a standard, where a Rayleigh ratio of 1.34 × 10−5cm−1 was used65. Experiments were performed at variable scattering angles between 21° and 145°, thus covering a q-range of 4.8 × 10−3–2.3 × 10−2 nm−1. The field autocorrelation function was computed by the ALV 5000/E multiple-τ correlator and was described as66:

$$g^{(1)}(q,\tau ) = {\mathrm{exp}}( - \Gamma (q)\tau )\left( {1 + \frac{{\mu _2(q)}}{2}\tau ^2} \right)$$
(2)

with Γ being the mean decay rate, τ the delay time, and μ2 is related to the second moment of the distribution of decay rates. The diffusion coefficient Dh was obtained from the relation Γ(q) = Dhq2. The hydrodynamic radius is finally calculated using the well-known Stokes–Einstein relation:

$$R_{\mathrm{h}} = \frac{{k_{\mathrm{B}}T}}{{6\pi \eta _1D_{\mathrm{h}}}}$$
(3)

where kB, T, and η1 are the Boltzmann constant, the absolute temperature, and the viscosity of the solvent, respectively. The data were also analyzed using the constrained inverse Laplace transformation CONTIN67, provided with the ALV data analysis software.

Optical ellipsometry

Single-wavelength (632 nm) multiple-angle ellipsometry was used to determine the total film thickness. Experiments were performed on a Picometer Light ellipsometer (Beaglehole Instruments, New Zealand) with incident angles between 50° and 80° with step increment of 2°. The reported thicknesses are the average from three randomly chosen points on the surface.

Neutron reflectivity

NR measurements were performed on the D17 reflectometer at the Institut Laue-Langevin (ILL, Grenoble, France)68 (https://doi.org/ILL-DATA.9?12?455/ILL-DATA.9-12-455). The measurements were performed in time-of-flight (ToF) mode with instrumental resolution of ΔQ/Q between 3% and 6% and wavelengths ranging from 2 to 22 Å. The footprint length (in the beam direction) and width (in the perpendicular direction) were L = 2.5 cm and W = 3 cm, respectively.

The samples were placed inside a humidity chamber69. The chamber and the sample were kept at constant temperature of a 25 °C via a thermostatic bath, while the temperature of four, small reservoirs inside the chamber filled with D2O was controlled via piezo-elements to reach the desired humidity value following the psychrometric charts. The humidity level was monitored by a commercial humidity sensor (Honeywell Inc., USA) placed inside the cell in close proximity to the sample. NR experiments in dry conditions were performed by flooding the sample chamber with dry nitrogen. After temperature stabilization, the sample was allowed to equilibrate to the new humidity levels for at least 15 min before starting the acquisition of the reflectivity curves. Further details on data reduction can be found in the Supplementary Note 2.

Neutron reflectivity data analysis

The SLD profile, ρ(z), used for the calculation of the reflectivity curves, was obtained via a three-step procedure, schematically represented in Fig. 3d. In the first step, each coating is described by a sequence of discrete layers, characterized by their content in chitosan, hydrophobic surfactant chains, surfactant head groups, and D2O. The thickness and content of the layers are defined by a set of parameters common to all curves and by a set of parameters that are humidity dependent and defined hereafter as P(h). The sequence of layers is equal for all investigated systems and built-up as follows: the first, semi-infinite layer is made of pure silicon, followed by a thin layer of silicone oxide. The thickness of the silicon oxide layer was determined by optical ellipsometry. The interface between the silicon oxide layer and the coating was set at z = 0 nm.

The organic layer was built-up as a sequence of layers composed of mainly surfactant head group, surfactant alkyl chain, surfactant head group, and chitosan layers. This sequence of layers is repeated Floor(N) and Ceil(N) times. Floor(x) and Ceil(x) are the floor and ceiling functions, which return the greatest integer less than or equal to x and the least integer greater than or equal to x, respectively. Mixing between surfactant tails and head group is quantified by the fit parameter \(\Xi (h)\). The amounts of surfactant head group and tails in the respective layers, given in volume per surface area, were calculated as:

$$d_a^0 = d_a^a(h) + 2d_a^h(h)$$
(4)
$$d_h^0 = d_h^h(h) + \frac{{d_h^a(h)}}{2}$$
(5)
$$\Xi (h) = \frac{{d_a^h(h)}}{{d_a^h(h) + d_h^h(h)}} = \frac{{d_h^a(h)}}{{d_h^a(h) + d_a^a(h)}}$$
(6)

with \(d_a^0\) and \(d_h^0\) being the amount of surfactant head group and tail per repeating unit. \(d_a^a(h)\) and \(d_a^h(h)\) are the amounts of surfactant tails in the layers composed of mainly alkyl chains and head groups, respectively. Similarly, \(d_h^a\) and \(d_h^h\) are the amounts of surfactant head groups in the layers composed of mainly alkyl chains and head groups, respectively. The total amount of surfactant head groups and tails in the film is given by \(2Nd_h^0\) and \(Nd_a^0\), respectively. The amounts are constraint via the molecular volumes of the hydrophilic vh and hydrophobic va surfactant parts as \(d_h^0 = d_a^0 \cdot v_a/(2v_h)\). Equations 46 can be solved leading to the amount of surfactant head groups and tails in the respective layers:

$$d_a^a(h) = \frac{{d_a^0(\Xi (h)^2 - 2\Xi (h) + 1) + d_h^0(2\Xi (h)^2 - 2\Xi (h))}}{{1 - 2\Xi (h)}}$$
(7)
$$d_h^h(h) = \frac{{d_a^0(\Xi (h)^2 - \Xi (h)) + d_h^0(2\Xi (h)^2 - 4\Xi (h) + 2)}}{{2 - 4\Xi (h)}}$$
(8)
$$d_h^a(h) = \frac{{2d_h^0\Xi (h)^2 + d_a^0(\Xi (h)^2 - \Xi (h))}}{{2\Xi (h) - 1}}$$
(9)
$$d_a^h(h) = \frac{{d_a^0\Xi (h)^2 + d_h^0(2\Xi (h)^2 - 2\Xi (h))}}{{4\Xi (h) - 2}}$$
(10)

\(\Xi (h)\) is allowed to vary between 0 and \(d_h^0/(d_h^0 + 0.5d_a^0)\) and is a humidity-dependent parameter. The surfactant was not allowed to diffuse into the chitosan layer. In contrast, penetration of chitosan into the surfactant layers is allowed, and the parameter φ(h) defines the ratio between the volumes of chitosan and surfactant in the “surfactant layer” as:

$$\phi (h) = \frac{{d_{ch}^h(h)}}{{d_a^h(h) + d_h^h(h)}} = \frac{{d_{ch}^a(h)}}{{d_a^a(h) + d_h^a(h)}}$$
(11)

with \(d_{ch}^h(h)\) and \(d_{ch}^a(h)\) being the amounts of chitosan in the layers composed of mainly alkyl chains and head groups, respectively. The amount of chitosan in the chitosan layer \(d_{ch}^{ch}\) was then calculated as:

$$d_{ch}^{ch}(h) = d_{ch}^0 - \phi (h)(d_a^0 + 2d_h^0)$$
(12)

with \(d_{ch}^0\) being the amount of chitosan per repeating sequence. φ(h) is humidity dependent and varies with the distance from the substrate as:

$$\phi (j,h) = \frac{{{\mathrm{erf}}\left[ {(j - j_0(h))g_0(h)} \right] + 1}}{2}$$
(13)

erf is the error function, j is the number of the repeating unit starting at 1 and ending at Floor(N) or Ceil(N), and j0(h) and g0(h) are the fitted humidity-dependent parameters that describe φ(h). The choice of the error function to describe the intermixing between chitosan and surfactant, i.e., the extent of segregation within the system, is arbitrary and is motivated by the property of the error function to describe both relatively constant φ values (when g0(h) is close to zero), increasing and decreasing values according to the sign of g0(h) and strongly j-dependent values when g0(h) is large. j0(h) defines the position of the inflection point of the function. The maximum value of φ(j,h) is limited to \(\phi (j,h)\, < \, d_{ch}^0{\mathrm{/}}(d_a^0 + 2d_h^0)\). An additional chitosan layer is inserted between the multilayer and the silicon oxide.

The water content of each layer is calculated under the assumption that chitosan and the surfactant adsorb water to the same extent and is computed as:

$$d_w^i = (d_{ch}^i + d_h^i)\frac{{\varphi (h)}}{{1 - \varphi (h)}}$$
(14)

with ϕ(h) being the volume fraction of water in the film relative to the surfactant head group and chitosan content.

Finally, the sum of the amounts of the different components, D2O, chitosan, surfactant head group, and surfactant tails, in each layer resulted in the total layer thickness. The volume fraction of the ith component is readily calculated as the ratio of its amount and the layer thickness. In addition to thickness and composition, each layer is characterized by its roughness. In particular, the roughnesses of the silicon/silicon oxide and silicon oxide/coating interfaces, σSi and \(\sigma _{{\mathrm{SiO}}_2}\), are constant within each series.

The water content of the layer is set to 0 when the system is put under dry, nitrogen atmosphere. For this particular case, the presence of voids in the system is accounted for. In particular, the following strategy was followed: the total number of repeating units forming the film was recalculated as N/(1 − ϕvoid) and the volume fractions of the components multiplied by the factor (1 − ϕvoid).

The second step consists of converting the discrete sequence of layers with defined thickness and composition and roughness of their interfaces into continuous volume fraction profiles for each component. For the kth components, it reads:

$$\varphi ^k(z) = \varphi _0^k + \mathop {\sum}\limits_{i = 1}^n \frac{{\varphi _i^k - \varphi _{i - 1}^k}}{2}\left[ {1 + {\mathrm{erf}}\left( {\frac{{z - z_i}}{{\sqrt 2 \sigma _i}}} \right)} \right]$$
(15)

with \(\varphi _0^k\) being the volume fraction of kth component in the first layer, i.e., the silicon block where all volume fractions, except that of silicon, are zero. zi is the distance of the ith interface from the silicon oxide/coating interface set at z = 0, and n is the total number of layers in the film.

The third step consists of calculating of the SLD profile ρ(z) from the volume fraction profiles, as the volume weight average of the SLD of the single components:

$$\rho (z) = \mathop {\sum}\limits_k \varphi ^k(z){\mathrm{SLD}}_k.$$
(16)

The SLD values of the kth component (SLDk) and the molecular volumes used for the calculations are given in Supplementary Table 1. Owing to technical reasons, the humidity cell has to be briefly opened before the measurement under N2 atmosphere can be performed, which exposes the sample to ambient air. In order to take into account a possible exchange of the labile protons of chitosan, the SLD of chitosan for the 0% RH dataset is a fitted parameter, which is allowed to vary between the two extreme values provided in Supplementary Table 1. For the experiments under D2O atmosphere, a value of 4.64 × 10−2 nm−2 was used. Finally, the SLD profile SLD(z) was discretized into thin and sharp slabs of 1 Å thickness, and the reflectivity curve was calculated by applying Fresnel’s reflection laws at each slab interface using the iterative procedure proposed by Parratt35. No effects in the reflectivity curves were seen when the thickness of the slabs is further reduced.

The last step is to perform the incoherent average of the reflectivity patterns calculated for the Ceil(N) and Floor(N) coatings. The weighted average was performed as:

$$R(q,N) = \left[ {{\mathrm{Ceil}}(N) - N} \right]R(q,{\mathrm{Floor}}(N)) + \left[ {N - {\mathrm{Floor}}(N)} \right]R(q,{\mathrm{Ceil}}(N))$$
(17)

The analysis was performed using python script language making use of the LMfit fitting routine based on the SciPy package. Data fitting with the simpler, homogeneous layer model was performed using the Levenberg–Marquardt minimization routine, while when the more complex, multilayered model was employed, the quasi-Newton limited-memory Broyden–Fletcher–Goldfarb–Shanno minimization algorithm was used.

Atomic force microscopy

AFM measurements were performed on a Cypher S Scanning Probe microscope (Asylum Research, USA). The instrument was operated in intermittent contact mode (AC-mode) in air under controlled RH. The humidity was set by flooding the AFM measurement chamber with an atmosphere of desired humidity, set by appropriate mixing of dry and water-saturated air. To reach dry conditions, the experimental chamber was flooded with dry air. Several hours were needed to reach dry conditions. Microcantilevers AC240TS-R3 from Asylum Research (Oxford Instruments) were used, with dimensions of (240 × 40 × 2.3) μm3, spring constant 2 N/m, and a resonant frequency of 70 kHz in air. A tetrahedral silicon tip was mounted on the cantilever, which has a radius of 7(±2) nm. The oscillation amplitude was set to 3.3 V (175 nm) and the integral gain was varied between 30 and 100 depending on surface asperities to optimize the surface scan quality. The size of the scan box was varied from (20 × 20) μm2 to (1 × 1) μm2, with a scan rate varying between 1.5 and 4 Hz. Image treatment and analysis were performed using the Gwyddion open-source software70, version 2.50. The data were corrected for sample tilting by subtracting a linear fit and the height was rescaled with respect to the average sample height. The roughness was calculated as the root mean square, rrms

$$r_{{\mathrm{rms}}} = \sqrt {\frac{1}{n}\mathop {\sum}\limits_{n = 1}^n (h_i - \overline h )^2}$$
(18)

with \(\overline h\) being the average film height.

X-ray diffraction

XRD experiments were performed with an Empyrean diffractometer from PANanalytical (Brevannes, France) in grazing incidence geometry, with an incident angle of 0.2°. The data were corrected for the signal arising from a bare silicon wafer placed in the same sample holder. The monochromatic X-ray source was a Cu anode emitting Kα radiation (wavelength λ = 1.54 Å). On the incoming beam side, a divergence slit 1/8°, focusing mirror for Cu source and anti-scatter slit of 1/4° were used. Between mirror and anti-scatter slit, a mask of 2 mm and a Soller slit of 0.02° was used to reduce the horizontal beam divergence. On the detector site, the diffracted beam optics consisted of a collimation slit of 0.18°, a Soller slit of 0.04°, and a PIXcel3D scintillator detector. The experiments were performed using the sample cell as described in Supplementary Fig. 4.

Binocular lenses

The morphological investigation of the ageing samples was performed using an Olympus-type SZ61 Stereo Microscope equipped with a 5.1 Megapixel ToupCam UCMOS05100KPA sensor. Experiments were performed under ambient conditions.