/* =====================================================================
   UNI Immobilier — the home page's hero, Christmas edition
   =====================================================================
   Layers around the existing hero. Its HTML, texts, links and search stay as they are.
   From the bottom up (z-index):
     0   the film (the hero's own <video class="background-video">, given the Christmas film by js/xmas-hero.js);
         under it, the poster as the hero's background (the LCP image, shown at once)
     1   the site's dark veil (section.entry::after, fitted to the hero below)
     2   the snow (a canvas, js/xmas-hero.js)
     3   .xmas-falling-gifts
     10  the hero's content (.container-full), and inside it:
         inside the search card: -2 .xmas-gifts-pile (behind the card's panel, on its top edge, on the left)
                                 12 .xmas-santa (peeking over the card's top edge, on its right side)
         13 « Voir nos biens », dressed as the cottage, with its chimney gifts
         14 the social links and the Google badge
   (The brief numbers the snow 1 and the falling gifts 2; the site's veil already holds 1, so they move up one.)
   Sizes are set per breakpoint with the variables below, for today's texts: nothing shifts. Only when words or a header
   button would be covered (longer texts, a phone held sideways) does js/xmas-hero.js make Santa smaller.
   ===================================================================== */
:root {
  --xmas-pile-w: 220px;            /* the gift pile's width */
  /* the gift pile stands behind the card's white panel, which hides the ragged underside of its snow: the card's
     top edge crosses the picture (171 rows high at 440 wide) at this row, just under the front gift's base,
     so the gifts look set in snow lying on the card */
  --xmas-pile-cut: 128;
  /* Santa peeks over the card's top edge, like over a wall: his head, shoulders and left arm above it, his glove
     hanging over it. Everything of him below the edge is cut out of his film, so
     nothing covers the field or its buttons. His film is cropped to that part (864x624 px of the 1080p source, at 736x532):
     --xmas-santa-w is the width his whole 16:9 frame would have; the crop is .45 of it. In the crop, the edge he
     leans on is at y .7667, and its right end (where his shoulder stops) at x .4445; that point is put on the card's
     top edge, --xmas-santa-in from the card's right end, so all of him stays above the card's straight top edge. */
  --xmas-santa-w: 640px;
  --xmas-santa-in: calc(var(--xmas-santa-w) * .2343 + 18px);
  --xmas-cottage-w: 190px;          /* (the brief's 260x190; made a little smaller twice at the client's request) */
  --xmas-cottage-h: calc(var(--xmas-cottage-w) * 190 / 260);       /* the brief's proportions: 139 px */
  --xmas-cottage-pic-h: calc(var(--xmas-cottage-w) * 336 / 509);   /* the cottage picture's height (509x336, fits the width) */
}
/* tablet: the pile at .6; Santa smaller so he stays on screen */
@media (max-width: 1279px) { :root { --xmas-pile-w: 132px; --xmas-santa-w: 560px; } }
@media (max-width: 1099px) { :root { --xmas-santa-w: 500px; } }

/* ---------- the film and its poster */
main[data-barba-namespace=home] section.entry {
  background: #0b1222 url(../assets/xmas/hero-bg-poster.jpg) center / cover no-repeat;
  background-image: image-set(url(../assets/xmas/hero-bg-poster.webp) type("image/webp"), url(../assets/xmas/hero-bg-poster.jpg) type("image/jpeg"));
}
@media (max-width: 767px) {
  main[data-barba-namespace=home] section.entry {
    background-image: url(../assets/xmas/hero-bg-poster-m.jpg);
    background-image: image-set(url(../assets/xmas/hero-bg-poster-m.webp) type("image/webp"), url(../assets/xmas/hero-bg-poster-m.jpg) type("image/jpeg"));
  }
}
/* the film fills exactly the hero's box, like its poster (the site makes it 5 px larger on every side: then it is
   framed a little bigger than the poster, so the scene grew when it started, and its bottom 5 px spilled below the
   hero) */
main[data-barba-namespace=home] section.entry .background-video {
  z-index: 0; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;
}
/* the site's dark veil is 5 px larger than the hero too (calc(100% + 5px)): with the film now ending at the hero's
   edge, its extra 5 px over the white page showed as a grey band under the hero. It fits the hero exactly */
main[data-barba-namespace=home] section.entry::after { width: 100%; height: 100%; }
/* the hero fills the whole screen (the client's request, 2026-12-01). The site has it 100svh on phones and tablets,
   but only 90vh from 992 px wide, where the next section showed under it */
@media (min-width: 992px) {
  main[data-barba-namespace=home] section.entry { height: 100vh; height: 100svh; }
}
/* (the snow's canvas sets its own z-index 2, js/xmas-hero.js) */
main[data-barba-namespace=home] section.entry .container-full { z-index: 10; }

/* iPhone in low-power mode refuses to start films by itself and draws a play button over them: not on a background */
main[data-barba-namespace=home] section.entry .background-video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }

/* ---------- gifts falling across the hero, under the words */
.xmas-falling-gifts { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.xmas-falling-gifts img { position: absolute; left: 0; top: 0; height: auto; opacity: 0; will-change: transform; }

/* ---------- the search card is the anchor of the pile and of Santa. Both are inside the card itself (.nlp-card),
   so they tilt and grow with it when the mouse moves over it (the site's .uni-tilt); the card is its own layer
   (position relative, z-index 1), its white panel being its ::after at z-index -1 */
.xmas-gifts-pile {
  position: absolute; z-index: -2; pointer-events: none;           /* behind the card's panel */
  left: 20px;                       /* on the straight part of the card's top edge, clear of its 16 px rounded corner */
  width: var(--xmas-pile-w); aspect-ratio: 440 / 171; height: auto;
  top: calc(var(--xmas-pile-w) * var(--xmas-pile-cut) / -440);
  filter: brightness(.94) saturate(.9);                              /* a touch less bright: the scene is a night */
}
/* phones: the pile stays on the card (the client's request, 2026-12-03), a size that follows the screen, left of Santa */
@media (max-width: 479.98px) {
  :root { --xmas-pile-w: clamp(112px, 33vw, 140px); }
  .xmas-gifts-pile { left: 16px; }
}
@media (max-width: 479.98px) and (max-height: 589.98px) { :root { --xmas-pile-w: 100px; } }   /* short screens: clear of the title's second line */

.xmas-santa {
  position: absolute; z-index: 12; pointer-events: none;
  width: calc(var(--xmas-santa-w) * .45); aspect-ratio: 736 / 532;
  left: calc(100% - var(--xmas-santa-in) - var(--xmas-santa-w) * .45 * .4445);
  top: calc(var(--xmas-santa-w) * .45 * 532 / 736 * -.7667);
  transform-origin: 50% 77%;
}
.xmas-santa video, .xmas-santa img { display: block; width: 100%; height: 100%; object-fit: fill; }
.xmas-santa.is-tucked { z-index: -2; }     /* a search being sent: his glove behind the card's panel, off its title */
/* Under 992 px the card takes the whole width and the title sits right above it: Santa peeks over the card's right
   end, his glove just right of « Que recherchez-vous ? » (2026-12-01; until then he was not shown there). Made
   bigger on phones at the client's request (2026-12-01). To give him room, the title and its second line (Neuf,
   Ancien, Financement…) are lifted by --xmas-title-lift, which moves nothing else: 32 px; 16 px on phones under 620
   px tall and tablets under 700 px; none on phones under 553 px and tablets under 610 px, so the title stays clear
   of the logo. On phones the tip of his hat may also run off the screen's right edge (the hero clips it), as if he
   leaned in from outside; his face always stays in view. His size and his inset from the card's right end are fitted
   to that room using his outline over all 200 frames of his film: 6 px clear of the title, every word of its second
   line, the card's logo, « Que recherchez-vous ? » and the field; checked from 320 to 991 px wide, tall and short
   screens, upright and sideways. */
main[data-barba-namespace=home] section.entry h1,
main[data-barba-namespace=home] section.entry .rotator { position: relative; top: calc(-1 * var(--xmas-title-lift, 0px)); }
@media (max-width: 991.98px) {
  :root { --xmas-title-lift: 32px; --xmas-santa-w: 600px; --xmas-santa-in: calc(12.5vw + 43.5px); }
}
/* the lift on shorter screens (the title keeps at least ~24 px under the logo); with no lift, Santa a little smaller */
@media (max-width: 991.98px) and (max-height: 699.98px) { :root { --xmas-title-lift: 16px; } }
@media (max-width: 991.98px) and (max-height: 609.98px) { :root { --xmas-title-lift: 0px; --xmas-santa-w: 560px; --xmas-santa-in: 120px; } }
@media (max-width: 767.98px) {
  :root { --xmas-title-lift: 32px; --xmas-santa-w: 560px; --xmas-santa-in: calc(var(--xmas-santa-w) * .16 - 12.85px); }
}
@media (max-width: 767.98px) and (max-height: 619.98px) { :root { --xmas-title-lift: 16px; --xmas-santa-w: min(560px, 140vw - 150px); } }
@media (max-width: 767.98px) and (max-height: 552.98px) { :root { --xmas-title-lift: 0px; --xmas-santa-w: min(560px, min(166.7vw - 293px, 86.4vw - 4.9px)); } }
@media (max-width: 479.98px) {
  :root { --xmas-santa-w: calc(108.5vw + 31.5px); --xmas-santa-in: calc(var(--xmas-santa-w) * .175 - 20.58px); }
}
@media (max-width: 479.98px) and (max-height: 619.98px) { :root { --xmas-santa-w: min(108.5vw + 31.5px, 140vw - 150px); } }
@media (max-width: 479.98px) and (max-height: 552.98px) { :root { --xmas-santa-w: min(108.5vw + 31.5px, min(166.7vw - 293px, 86.4vw - 4.9px)); } }
@media (max-width: 429.98px) {
  :root { --xmas-santa-w: max(150px, 305vw - 791px); --xmas-santa-in: calc(var(--xmas-santa-w) * .09 + 24vw - 80.7px); }
}
@media (max-width: 429.98px) and (max-height: 619.98px) { :root { --xmas-santa-w: min(max(150px, 305vw - 791px), 140vw - 150px); } }
@media (max-width: 429.98px) and (max-height: 552.98px) { :root { --xmas-santa-w: min(max(150px, 305vw - 791px), min(166.7vw - 293px, 86.4vw - 4.9px)); } }

/* Computers from 1280 px wide: in the brand font « Financement » is wider than in the mock-up (which showed a stand-in
   font) and Santa's sleeve touched its last letter. The title and its second line are lifted by 24 px, which moves
   nothing else; Santa keeps his size and place. On very short windows there is no room under the header: there he
   takes his tablet size instead */
@media (min-width: 1280px) and (min-height: 600px) { :root { --xmas-title-lift: 24px; } }
@media (min-width: 1280px) and (max-height: 599.98px) { :root { --xmas-santa-w: 560px; } }

/* ---------- « Voir nos biens » dressed as the cottage: the same link, words and icon. With a promotion banner
   (section.xmas-promo, homeV2.twig) there is no room for both on computers, so on every screen the button stays the usual one */
main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover {
  width: var(--xmas-cottage-w); height: var(--xmas-cottage-h); min-height: 0;
  padding: 0 0 calc(var(--xmas-cottage-h) * .135) calc(var(--xmas-cottage-w) * .08);   /* the words on the brick front wall */
  align-items: flex-end; justify-content: center; gap: 6px;
  background: url(../assets/xmas/cottage.png) center bottom / contain no-repeat;
  background-image: image-set(url(../assets/xmas/cottage.webp) type("image/webp"), url(../assets/xmas/cottage.png) type("image/png"));
  border-radius: 0; box-shadow: none; overflow: visible; z-index: 13;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), filter .35s ease;
}
@media (min-width: 993px) {
  main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover { bottom: 0; top: auto; }
  main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover:hover { transform: translateX(-50%) translateY(-4px); }
}
@media (max-width: 992px) {
  main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover { position: relative; left: auto; }   /* (the site's left: 50% would apply) */
  main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover:hover { transform: translateY(-4px); }
}
/* phones: the cottage sits a little lower (the client's request, 2026-12-03); less on short screens, where the social
   links and the Google badge are close under it, and not at all on very short ones (a phone held sideways) */
@media (max-width: 767.98px) and (min-height: 590px) {
  main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover { top: 12px; }
}
@media (max-width: 767.98px) and (min-height: 620px) {
  main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover { top: 24px; }
}
@media (max-width: 767.98px) and (min-height: 700px) {
  main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover { top: 40px; }
}
main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover span {
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); position: relative; z-index: 2;
  /* longer words typed in WordPress go on two lines inside the cottage */
  white-space: normal; max-width: calc(var(--xmas-cottage-w) * .86); text-align: center;
}
/* no house icon on the cottage (the client's request): only the words. The icon stays in the HTML, hidden */
main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover svg.maison { display: none; }
main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover:hover { filter: drop-shadow(0 0 14px rgba(255, 196, 110, .55)); }

/* the lit window: a warm glow over it, flickering slowly; brighter on hover */
.xmas-window {
  position: absolute; pointer-events: none; z-index: 1;
  /* the window in the cottage picture (fractions of the picture, which fills the box's width, bottom-aligned) */
  left: calc(var(--xmas-cottage-w) * .245); width: calc(var(--xmas-cottage-w) * .115);
  bottom: calc(var(--xmas-cottage-pic-h) * (1 - .52)); height: calc(var(--xmas-cottage-pic-h) * .2);
  border-radius: 3px; background: radial-gradient(closest-side, rgba(255, 214, 140, .55), rgba(255, 190, 90, 0));
  mix-blend-mode: screen; animation: xmas-flicker 3s ease-in-out infinite;
}
a.btn-pills.discover:hover .xmas-window { box-shadow: 0 0 24px 10px rgba(255, 196, 110, .45); }
@keyframes xmas-flicker { 0%, 100% { opacity: 1; } 50% { opacity: .85; } }

/* the chimney: the gifts start from its mouth; light smoke rises from it */
.xmas-chimney {
  position: absolute; width: 0; height: 0; pointer-events: none;   /* a marker: js/xmas-hero.js reads its place */
  left: calc(var(--xmas-cottage-w) * .735);
  bottom: calc(var(--xmas-cottage-pic-h) * (1 - .035));
}
/* what comes out of the chimney: a layer of the content just above the search card (z 2 > the card's 1);
   js/xmas-hero.js puts .xmas-chimney-mouth on the chimney's mouth. Most gifts stay in the space under the card;
   about a third pass a little over its lower part (the chips row), never up to the field */
.xmas-chimney-out { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.xmas-chimney-mouth { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.xmas-chimney-mouth img { position: absolute; left: -17px; top: -17px; width: 34px; height: auto; opacity: 0; will-change: transform; }
.xmas-smoke {
  position: absolute; left: -11px; top: -24px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; filter: blur(6px); opacity: 0; animation: xmas-smoke 4.2s ease-out infinite;
}
.xmas-smoke:nth-child(2) { animation-delay: 1.4s; }
.xmas-smoke:nth-child(3) { animation-delay: 2.8s; }
@keyframes xmas-smoke {
  0% { transform: translate(0, 0) scale(.6); opacity: 0; }
  12% { opacity: .35; }
  100% { transform: translate(18px, -90px) scale(2.2); opacity: 0; }
}

/* short computer windows (from 993 px wide the cottage sits at the bottom, under the search card): it is made smaller
   to fit the room there, about half the window's height less 153 px, so it never covers the card */
@media (min-width: 993px) and (max-height: 589.98px) {
  :root { --xmas-cottage-w: clamp(104px, 68.4vh - 211px, 190px); }
  main[data-barba-namespace=home] section.entry:not(.xmas-promo) .bottom a.btn-pills.discover span { font-size: calc(var(--xmas-cottage-w) * .095); line-height: 1.15; }
}

/* a message under the search field (« Décrivez d'abord votre recherche »): while it shows, the card comes above the
   chimney's gifts and smoke (z 2) */
main[data-barba-namespace=home] section.entry .nlp-card:has(.uni-field-error) { z-index: 3; }

/* the social links and the Google badge stay on top */
main[data-barba-namespace=home] section.entry .bottom ul.reseaux,
main[data-barba-namespace=home] section.entry .bottom .google-new-rendu { position: relative; z-index: 14; }
@media (max-width: 992px) {
  main[data-barba-namespace=home] section.entry .bottom ul.reseaux,
  main[data-barba-namespace=home] section.entry .bottom .google-new-rendu { position: absolute; }
}

/* ---------- the header logo's Santa hat (assets/xmas/logo-hat)
   The logo's <svg> sits in span.logo-hat-wrap (templates/partials/newheader.twig). The wrap reserves room above and to the left
   of the logo (padding), taken back by an equal negative margin, so the logo and its link keep their place and size,
   and the hat is inside the wrap's box (never cut by an overflow: hidden around it).
   The hat sits on the top of the « u »'s left stroke, tilted -20 deg about its bottom centre, its pompom hanging
   outside the logo on the left. Its left/top below put the middle of the brim's lower edge on the stroke; they are
   worked out from the asset's measures (the brim's lower edge at 61 % across and 81 % down the picture, the brim 25 %
   of its height) and the logo's (the stroke: x 0.39-9.49, top 2.5, in its 114 x 52 viewBox), and checked on the
   page. Sizes are in logo heights (--logo-hat-logo-h).
   The brief asked for 55-65 % of the logo's height, and 45 % under 70 px wide, with the brim over the stroke's top by
   15 % of its height. At the client's request (2026-12-01) the hat is bigger: 85 % everywhere. */
.site-header .logo {
  /* from 992 px wide the logo is 50 px high and only 13 px from the top of the screen: the 42.5 px hat sits deeper,
     its brim over the stroke's top by 1.3 times its height (8 px high: as in the source picture, where the brim hides
     the top of the « u »), so its crown stays 1.9 px inside the screen */
  --logo-hat-logo-h: 50px;
  --logo-hat-size: .85;             /* hat width / logo height */
  --logo-hat-x: -.377;              /* the hat's box: left and top from the logo's top-left corner, in logo heights */
  --logo-hat-y: -.2348;
  --logo-hat-tilt: -20deg;
  --logo-hat-pad-top: calc(var(--logo-hat-logo-h) * .45);
  --logo-hat-pad-left: calc(var(--logo-hat-logo-h) * .42);
}
/* under 992 px the logo is 26 px high (57 px wide). The hat is a little bigger there (the client's request): as wide
   as the logo is high, 26 px, its brim over the stroke by 15 % of its height (the brief), 2.3 px clear of the top
   of the screen and 7.8 px of its left edge */
@media (max-width: 991.98px) {
  .site-header .logo {
    --logo-hat-logo-h: 26px; --logo-hat-size: 1; --logo-hat-x: -.4604; --logo-hat-y: -.5012;
    --logo-hat-pad-top: calc(var(--logo-hat-logo-h) * .5);
    --logo-hat-pad-left: calc(var(--logo-hat-logo-h) * .48);
  }
}
.site-header .logo .logo-hat-wrap {
  position: relative; display: block;
  padding: var(--logo-hat-pad-top) 0 0 var(--logo-hat-pad-left);
  margin: calc(var(--logo-hat-pad-top) * -1) 0 0 calc(var(--logo-hat-pad-left) * -1);
}
.site-header .logo .logo-hat {
  position: absolute; z-index: 1; pointer-events: none; max-width: none;
  left: calc(var(--logo-hat-pad-left) + var(--logo-hat-x) * var(--logo-hat-logo-h));
  top: calc(var(--logo-hat-pad-top) + var(--logo-hat-y) * var(--logo-hat-logo-h));
  width: calc(var(--logo-hat-size) * var(--logo-hat-logo-h)); height: auto;
  transform: rotate(var(--logo-hat-tilt)); transform-origin: bottom center;
  /* it drops in once, on first paint: from 12 px above, with a little bounce (ease-out-back) */
  animation: logo-hat-drop .5s cubic-bezier(.34, 1.56, .64, 1) .1s backwards;
}
/* on the logo's hover it wiggles once to the pompom's side. (The drop stays in the list, so it does not play again
   when the hover ends.) */
.site-header .logo a:hover .logo-hat {
  animation: logo-hat-drop .5s cubic-bezier(.34, 1.56, .64, 1) .1s backwards, logo-hat-wiggle .6s ease-in-out;
}
@keyframes logo-hat-drop {
  from { transform: translateY(-12px) rotate(-28deg); }
  to { transform: translateY(0) rotate(var(--logo-hat-tilt)); }
}
@keyframes logo-hat-wiggle {
  0%, 100% { transform: rotate(var(--logo-hat-tilt)); }
  50% { transform: rotate(calc(var(--logo-hat-tilt) - 4deg)); }
}

/* the hero off screen or the tab hidden (js/xmas-hero.js): the smoke and the window's flicker wait too */
.xmas-paused .xmas-smoke, .xmas-paused .xmas-window { animation-play-state: paused; }

/* Santa's nod when the « ho ho ho » plays */
@keyframes xmas-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.xmas-santa.is-pulsing { animation: xmas-pulse .3s ease-in-out; }

/* reduced motion: the poster only; no film, no falling or chimney gifts, no smoke or flicker */
@media (prefers-reduced-motion: reduce) {
  .xmas-window { animation: none; }                          /* (the script makes no smoke and no nod then) */
  .site-header .logo .logo-hat, .site-header .logo a:hover .logo-hat { animation: none; }   /* the hat stays still */
}
