/* What depends on the visitor's screen. The canvas draws one page, 1440 px wide with fixed heights: this file,
   written by hand and never touched by scripts/build_landing.py, fits it to the window. `fit()` in landing.js
   adds `fit` and `story` on <html> above 1100 px wide and supplies the sizes CSS cannot work out. Below that,
   and without JavaScript, the boards' own layouts stand. */

/* The QR window opens by class, not by focus: Safari does not focus a button on click, and a focused window
   could not be closed with its cross. landing.js moves it under .lp, out of the hero's scaled stage. */
.demo-wrap:focus-within .qr-modal { display: none; }
.qr-modal.open { display: flex; z-index: 100; animation: qrIn 0.2s ease-out; }
.qr-modal .qr-box { max-width: calc(100vw - 48px); max-height: calc(100vh - 48px); }
.qr-close { cursor: pointer; }

/* The top bar, a copy made by landing.js of the hero's: clear over the hero, with a background once scrolled. */
.bar { position: fixed; left: 0; right: 0; top: 0; z-index: 60; transition: background-color 0.2s ease, box-shadow 0.2s ease; }
.bar > .wrap { transition: padding 0.2s ease; }
.bar.on { background-color: rgba(255, 255, 255, 0.94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 1px 0 rgba(30, 68, 38, 0.08); }
.bar.on > .wrap { padding-top: 11px !important; padding-bottom: 11px !important; }
.bar.on .nav { background: transparent !important; border-color: transparent !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }

/* The hero is the screen, whatever its height: the stage is scaled to it. */
.fit .pf-fluid { display: none; }
.fit .pf-desk { display: block; height: 100vh !important; min-height: 520px; }
.fit .pf-desk > div:first-child { top: var(--hero-y) !important; transform: scale(var(--hero)); transform-origin: 50% 0; }
.fit .pf-desk > div:first-child > div:first-child { overflow: visible !important; }

/* Le constat and Comment ça marche hold the screen: each scroll plays their next step (landing.js, steps()). */
.story .pin { position: relative; height: calc(100vh * var(--pin)); }
.story .pin > section { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.story .c2 { --cy: 50vh; --fs: var(--c2-fs); }

/* Comment ça marche keeps the board's title: the bento only gets smaller, in its own proportions, and centred. */
.story .c3 { padding-top: var(--c3-pad); padding-bottom: 0; }
.story .c3-grid { margin-top: 18px; transform: scale(var(--c3)); transform-origin: 50% 0; }

/* The title, then the phone, then one card per scroll. No card waits on the page: each arrives with a long, soft
   ease-out, and stays lit. What moves inside it is played by landing.js (cards()), at its real speed. */
.story .c3-c { opacity: 0; transform: translateY(32px) scale(0.97); animation: none; transition: opacity 0.75s ease-out, transform 1.3s cubic-bezier(0.16, 1, 0.3, 1); }
.story .c3-c.up { opacity: 1; transform: none; }
.story .c3-plate, .story .c3-txt { opacity: 1; animation: none; }

/* The footer fits under the top bar: the flowers run off its bottom, the mill and the sky stay. */
.fit .ft { height: min(calc(290px + 25cqw), calc(100vh - 72px)); min-height: 540px; }

/* The dashboard window keeps its full layout (sidebar, figures, "Cette semaine" and its chart) at every width above the
   phone. The board shows it from 1241 px of page width: below that, landing.css folds it by a container query on the
   page (max-width: 1240px). So the window is drawn at its desk size inside a 1300 px container, which no fold
   reaches (the same trick as phone.css), then reduced with `scale`, a property of its own, so the reveal's `transform`
   keeps working. The ratio is plain CSS: tan(atan2(a, b)) is a / b without units. The window is 1040 px; it keeps
   the board's margins to the page (104 px a side, 76 px under 1001 px). */
@media (min-width: 641px) {
  @supports (scale: min(1, tan(atan2(100px, 100px)))) {
    #tableau { overflow-x: clip; }
    #tableau .da-wn {
      --s: min(1, tan(atan2(100cqw - 208px, 1040px)));
      width: 1300px; max-width: none; container-type: inline-size;
      scale: var(--s); transform-origin: 0 0;
      margin-left: calc((100% - 1040px * var(--s)) / 2); margin-right: 0;
      margin-bottom: calc((var(--s) - 1) * 552px);
    }
    #tableau .da-wn .dk-win { width: 1040px; }
    /* The toast hangs off the window's corner, not the 1300 px box's. */
    #tableau .da-wn .pc-toast { right: 228px; }
    @container (max-width: 1000px) { #tableau .da-wn { --s: min(1, tan(atan2(100cqw - 152px, 1040px))); } }
  }
}

/* The first time a section comes into view, its titles and blocks rise gently (landing.js, reveal()). */
.rv { opacity: 0; transform: translateY(18px); transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) var(--rv, 0ms), transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) var(--rv, 0ms); }
.rv.in { opacity: 1; transform: none; }
.c3-mid.rv { transform: translateY(30px); }
.c3-mid.rv.in { transform: none; }

/* Hover: simple and the same everywhere. A button rises a little, a link takes a yellow underline. */
.btn, .ec-cta, .lp a[href^="/candidature/"] { transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease; }
.lp .ft-cta a { transition: transform 0.18s ease, filter 0.18s ease, background-color 0.18s ease, color 0.18s ease; }
.demo-qr { transition: transform 0.18s ease, color 0.18s ease; }
.vs-b, .qr-close { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.nav a { border-radius: 999px; transition: background-color 0.18s ease; }
#faq button { transition: transform 0.2s ease, color 0.2s ease; }
.lp a[href="#top"] { transition: opacity 0.18s ease; }
.lp input[type="range"] { cursor: pointer; }
@media (hover: hover) {
  .btn:hover, .ec-cta:hover, .lp a[href^="/candidature/"]:hover { transform: translateY(-2px); filter: brightness(1.16); box-shadow: 0 14px 24px -14px rgba(30, 68, 38, 0.7); }
  .btn:active, .ec-cta:active, .lp a[href^="/candidature/"]:active { transform: none; }
  /* On the hero's yellow a yellow underline would vanish: this link keeps its own, thicker. */
  .demo-qr:hover { transform: translateY(-1px); color: #2F6B45 !important; }
  .demo-qr:hover span { text-decoration-thickness: 2.5px !important; }
  .vs-b:hover, .k6-t .vs-b:hover { transform: scale(1.08); box-shadow: 0 0 0 1px rgba(30, 68, 38, 0.24), 0 6px 12px -6px rgba(30, 68, 38, 0.45); }
  .vs-b:active, .k6-t .vs-b:active { transform: scale(0.95); }
  .qr-close:hover { transform: scale(1.1); }
  .nav a:hover { background-color: rgba(30, 68, 38, 0.08); }
  .lp a[href="#top"]:hover { opacity: 0.72; }
  #faq button:hover { transform: translateX(4px); color: #2F6B45 !important; }
  #faq a:hover, .demo-go:hover, .cta-a .cta-l:hover { text-decoration: underline !important; text-decoration-color: #FFDA0F !important; text-decoration-thickness: 2px; text-underline-offset: 4px; }
  /* The footer's button is glass on the sky: under the mouse it fills with white, its text turns green. */
  .ft-cta a:hover { background: #FFFFFF !important; color: #1E4426 !important; }
  .ft a:not([href^="/candidature/"]):hover { color: #FFFFFF !important; text-decoration: underline !important; text-decoration-color: #FFDA0F; text-decoration-thickness: 2px; text-underline-offset: 4px; }
}

/* Le constat on a phone: a text fades, a petal fades, and nothing else moves. landing.js only sets `data-step` on the track.
   The board's choreography (a petal that wilts, tears off and flies while the flower turns) stuttered on an iPhone whatever
   was tried, so the loop of the board is switched off here. */
@media (max-width: 640px) {
  /* No layer is asked for in advance: the flower no longer moves, and a layer is memory. */
  .pin-c2 .c-rot, .pin-c2 .c-rot img { will-change: auto !important; }
  .pin-c2 .c-t0, .pin-c2 .c-t1, .pin-c2 .c-t2, .pin-c2 .c-t3, .pin-c2 .c-t4, .pin-c2 .c-t5 { animation: none !important; transform: none !important; opacity: 0 !important; transition: opacity 0.2s ease; }
  .pin-c2 .c-m1, .pin-c2 .c-m2, .pin-c2 .c-m3, .pin-c2 .c-m4, .pin-c2 .c-m5 { animation: none !important; }
  .pin-c2[data-step="0"] .c-t0, .pin-c2[data-step="1"] .c-t1, .pin-c2[data-step="2"] .c-t2, .pin-c2[data-step="3"] .c-t3, .pin-c2[data-step="4"] .c-t4, .pin-c2[data-step="5"] .c-t5, .pin-c2:not([data-step]) .c-t0 { opacity: 1 !important; transition: opacity 0.35s ease 0.15s; }
  .pin-c2 .c-rot, .pin-c2 .c-fresh1, .pin-c2 .c-fresh2, .pin-c2 .c-fresh3 { animation: none !important; transform: none !important; }
  .pin-c2 .c-fresh1, .pin-c2 .c-fresh2, .pin-c2 .c-fresh3 { opacity: 1; transition: opacity 0.5s ease; }
  .pin-c2 .c-dry1, .pin-c2 .c-fly1, .pin-c2 .c-dry2, .pin-c2 .c-fly2, .pin-c2 .c-dry3, .pin-c2 .c-fly3 { display: none !important; }
  .pin-c2[data-step="1"] .c-fresh1, .pin-c2[data-step="2"] .c-fresh1, .pin-c2[data-step="2"] .c-fresh2, .pin-c2[data-step="3"] .c-fresh1, .pin-c2[data-step="3"] .c-fresh2, .pin-c2[data-step="3"] .c-fresh3, .pin-c2[data-step="4"] .c-fresh1, .pin-c2[data-step="4"] .c-fresh2, .pin-c2[data-step="4"] .c-fresh3 { opacity: 0; }
}
