/*
 * Home page, conversion blocks (task 2026-11-11): the help block before the closing call to action and the
 * sticky "Start free" button for phones. Everything is prefixed sb-hc-. Loaded only by
 * views/pages/home.php; no other page reads this file.
 */

/* ---- Support block -------------------------------------------------------------------------
   Sits between the FAQ (bg-background-2, almost white) and the dark closing call to action, so it
   takes a soft brand tint with a glow from the top edge: lighter than the CTA below, clearly not
   the FAQ's grey. The cards are the white .sb-allin-card of the "What you launch" block. */
.sb-hc-support {
  position: relative;
  background:
    radial-gradient(70% 90% at 50% 0%, rgba(115, 103, 240, 0.13), rgba(115, 103, 240, 0) 72%),
    var(--color-background-3);
  border-top: 1px solid var(--color-stroke-1);
}

/* Lines in the heading, the subtitle and the card titles break evenly; descriptions never end on a
   single word. */
.sb-hc-support h2,
.sb-hc-support h2 + p,
.sb-hc-card__title { text-wrap: balance; }
.sb-hc-support p { text-wrap: pretty; }
.sb-hc-card p { text-wrap: balance; } /* 2-3 lines of a card text come out even, not 2 + 1 word */

/* The card button is a pill sized to its text, at the bottom of the card; a long label in DE, FR,
   PT or ES wraps inside it. */
.sb-hc-card .sb-launch-link { align-self: flex-start; max-width: 100%; padding-inline: 16px; gap: 6px; }

/* Narrow phones (below 640px): the three buttons are the same width, so a label that needs two lines
   in one language and one line in another does not make the cards' buttons look different.
   From 640px each is a pill sized to its text, as on a desktop. */
@media (max-width: 639.98px) {
  .sb-hc-card .sb-launch-link { display: flex; width: 100%; justify-content: center; text-align: center; }
}

/* The AI item (second in the first feature list) is the longest line of that list: no orphan word. */
.sb-hc-bullets li:nth-child(2) > span:last-child { text-wrap: pretty; }

/* A word with a hyphen never breaks at the hyphen (the views wrap such words; the text itself keeps the
   ordinary hyphen, so search and copy give U+002D). */
.sb-hc-nb { white-space: nowrap; }

/* Three columns (1024px and up): the cards share four grid rows (icon, title, text, button), so in a row
   every title has the same height, the texts start on one line and the buttons sit on one line, whatever
   the length of the titles in a language. One column: the cards stay as they were. */
@media (min-width: 1024px) {
  .sb-hc-support__grid { row-gap: 0; grid-template-rows: auto auto auto auto; }
  .sb-hc-cell { display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; }
  .sb-hc-card { display: grid; grid-row: 1 / -1; grid-template-rows: subgrid; row-gap: 16px; }
  .sb-hc-card__body { display: contents; }
  .sb-hc-card__cta { align-self: end; }
}

/* A 320px screen: tighter card padding gives the button label the room for one line. */
@media (max-width: 359.98px) {
  .sb-hc-card { padding: 24px; }
  .sb-hc-card .sb-launch-link { padding-inline: 10px; gap: 4px; }
}

/* ---- Sticky "Start free" for phones ---------------------------------------------------------
   Not on screen from 640px up, where the header already shows the same button. On a phone it is one centred line ABOVE the two corner widgets, so
   it cannot touch either whatever the width or the language: the HelpCrunch launcher (live 70x70,
   20px from the right and bottom edge, top at 90px from the bottom) and the Cookiebot badge that
   stays after consent (48x48, 10px from the left and bottom edge). bottom 102px = launcher top 90
   + 12px gap; the safe area lifts it off the home indicator. The white ring parts it from the
   purple card buttons. Hidden = visibility:hidden, so a hidden button takes no taps and no focus. */
.sb-hc-sticky { display: none; }

@media (max-width: 639.98px) {
  .sb-hc-sticky {
    display: flex;
    position: fixed;
    z-index: 45; /* under the header (50) and the menu (9999); Cookiebot and HelpCrunch sit far above */
    left: 16px;
    right: 16px;
    margin-inline: auto; /* centred without transform: the transform belongs to the fade-in */
    width: fit-content;
    min-width: 220px;
    max-width: calc(100% - 32px);
    bottom: calc(102px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    padding-block: 0;
    padding-inline: 24px;
    white-space: nowrap;
    font-size: 15px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 10px 28px rgba(57, 45, 168, 0.3), 0 2px 6px rgba(20, 14, 58, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, 16px, 0);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
    -webkit-tap-highlight-color: transparent;
  }

  .sb-hc-sticky.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }

  .sb-hc-sticky > span { padding: 0; white-space: nowrap; }
}

/* A phone held sideways has no room above the chat: no button there. */
@media (max-height: 480px) {
  .sb-hc-sticky { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sb-hc-sticky,
  .sb-hc-sticky.is-visible { transition: none; transform: none; }
}
