/*
 * site.css: loaded after main.css, ONLY for reviewed deviations from the reference design.
 *
 * main.css is a byte-identical copy of plan/redesign/reference/assets/css/main.css
 * (bin/check-reference-assets.sh fails when it differs), so a design update is a plain copy.
 * Anything Sulu needs on top goes here, one comment per rule saying what it is for and who
 * approved it. Keep this file empty when there is nothing to override; the layout then skips it.
 */

/*
 * reCAPTCHA v3 (decision 2026-11: kept, loaded on the first interaction with a form). Google allows its badge to be hidden only
 * while the notice stays visible inside the form; the notice is a `.field__hint` paragraph written by
 * templates/includes/forms/_parts.html.twig (printed only while reCAPTCHA is on). The footer is dark, so the newsletter notice
 * takes the footer's light text colour; links inherit the text colour and are underlined.
 */
.grecaptcha-badge { visibility: hidden; }
.recaptcha-notice a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.newsletter .recaptcha-notice { margin-top: 12px; color: rgb(255 255 255 / .7); }

/*
 * Search page (templates/search/search.html.twig): the search field reuses the footer newsletter row (`.newsletter__row`);
 * type="search" brings native appearance (smaller box, cancel button) that main.css never meets on a text input, so it is
 * reset to look exactly like the newsletter input. The form itself is capped at the newsletter's width.
 */
.search-form { max-width: 620px; }
.search-form input[type="search"] { -webkit-appearance: none; appearance: none; }
.search-form input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/*
 * Static error pages and maintenance page (templates/error/_static_page.html.twig, public/maintenance.php): their footer has only
 * the logo (the footer snippet with the claim text needs the database), so it sits at the start instead of the right edge.
 */
.finale--footer .footer__brand > :only-child { margin-right: auto; }

/*
 * ==========================================================================
 * Responsive fixes beyond the reference (decision 2026-11: fixed here, not in main.css; documented in
 * docs/design-system.md, "Responsive fixes beyond the reference"). Found by tests/visual/responsive.mjs.
 * Common idea: the reference sets many headings to `white-space: nowrap` and sizes some of them from the character count
 * (`--len`), which is only an estimate. Where the line fits nothing changes (`normal` wraps only when a line does not fit);
 * where it does not fit, the heading wraps instead of spilling out of its box or being clipped. Each rule is limited to the
 * widths where the reference breaks, so the compared widths (375/768/1024/1280/1440/1920) change as little as possible.
 * ==========================================================================
 */

/* Blog/article headings: `--len`-based sizes (.5em per character) are too small for wide words/bold glyphs, 2-40 px overflow
   at 640-1024 px (h1#article-title, h2 in ~47 articles; two nl release articles even scroll 2 px sideways). Wrap when needed. */
.article-hero__title, .prose h2 { white-space: normal; }

/* Hero titles with designed nowrap lines (capability/landing `engine-hero__title`, blog `blog-hero__title`, home `hero__title`,
   book-a-demo `demo__title`): in 640-699 px (blog/capability/landing) and 320-640 px (nl/de home and demo, whose words are
   longer than en) a line is wider than the hero and is clipped. main.css already lets the first three wrap below 640 px;
   this extends it up to 699 px and adds the other two. */
@media (max-width: 699.98px) {
  .engine-hero__title span, .blog-hero__title span, .hero__title span, .demo__title span, .voucher-hero__title span { white-space: normal; }
}

/* `.engine-h2` is nowrap at every width: #screens-title (1600-2560 px) and #talk-rules-title (1180-1720 px) sit in a column
   narrower than their line and spill into the neighbouring column. */
#screens-title, #talk-rules-title { white-space: normal; }

/* Home "why" block: the title (up to 999 px, nl/de) and the card title (900 px) are nowrap but longer than their column. */
@media (max-width: 999.98px) {
  .why__title, .why__card-title { white-space: normal; }
}

/* Home search demo at 320 px (nl/de): the typed query and the result lines are nowrap and 2-9 px wider than the card. The query
   shrinks a little (it must stay on the field's one line); the result lines are already stacked in this container-query
   layout and may wrap. */
@media (max-width: 359.98px) {
  .why__query { font-size: .8125rem; }
}
@container why-demo (max-width: 270px) {
  .why__results li { white-space: normal; }
}

/* Home hero mock-up at 320-414 px (en/en_gb/de): the nowrap push title is wider than the card and is only cut off by the
   ellipsis; it may wrap to a second line instead. The nl intent title (320 px) is 6 px too wide at 28 px. */
@media (max-width: 479.98px) {
  .mock__push-title span { white-space: normal; }
}
@media (max-width: 359.98px) {
  .mock__intent-title { font-size: 24px; }
}

/* Home security tabs at 620-699 px: three tab titles in three columns are wider than a column (nl); let them wrap. */
@media (max-width: 699.98px) {
  .security__tab { white-space: normal; }
}

/* Prices, extra plan name at 320 px (de): "nowrap" name wider than the card. */
@media (max-width: 479.98px) {
  .plan__name { white-space: normal; overflow-wrap: anywhere; }
}

/* Voucher page (en_gb): perk titles at 320 and 640 px, and the current progress step at 640 and 1180 px, are nowrap and wider
   than their grid cell. */
.voucher-perk b, .voucher-progress__steps li { white-space: normal; }

/*
 * Interaction fixes beyond the reference (decision 2026-11, product owner): main.css's generic `.btn:hover` turns every button
 * white (white background, white border, navy text). On the white voucher card the wizard's "Next"/submit button
 * (`.btn.btn--fill.voucher-next`) therefore vanishes on hover; the reference has the same flaw. On hover and keyboard focus these
 * buttons take the dark treatment of main.css's `.btn--dark:hover` (navy background and border, white text); the transition
 * of `.btn` is kept. The scan of all pages (nl/en/de/en_gb at 1280 and 375, hovered `.btn` background against the nearest opaque
 * ancestor, contrast below 1.5) found the same flaw on the "Book a demo" buttons of the price cards (`.plan .btn--fill`, white card):
 * same treatment.
 */
.voucher-next:hover, .voucher-next:focus-visible,
.plan .btn--fill:hover, .plan .btn--fill:focus-visible { border-color: var(--navy); background: var(--navy); color: var(--white); }

/*
 * Home engines ring, titles as questions (approved by Mathias on 2026-11-12, specified by Tom Dacquin; content in the
 * `{engine}_ring_title` fields, split in templates/includes/sections/home_engines.html.twig): the question word sits large in
 * the engine's colour on its own line, the rest of the question in white below it. `.hub-engine__title` keeps the reference's
 * `white-space: nowrap`, so each part stays on one line; between 1000 and 1200 px the rest is smaller so the long de questions
 * fit beside the ring. Where the column is narrow (below 345 px, 640-740 px in two columns, around 1200 px) the longest question
 * (de Content, "sollten Kunden sich für Sie entscheiden?", ~18.8 px of width per px of font size) still spilled out of it, so
 * the rest is also capped at 5.2% of the column width (`cqi`, the link is the container): at the other widths the cap is larger
 * than the font size and changes nothing.
 */
.hub-engine a { container-type: inline-size; }
.hub-engine__q {
  display: block;
  color: var(--accent);
  font-size: clamp(2rem, 1.5rem + 1.1vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -.01em;
}
.hub-engine__rest {
  display: block;
  font-size: min(clamp(1rem, .82rem + .42vw, 1.3125rem), 5.2cqi);
  line-height: 1.4;
}
@media (min-width: 1000px) and (max-width: 1199.98px) { .hub-engine__rest { font-size: min(.875rem, 5.2cqi); } }
@media (max-width: 639.98px) { .hub-engine__rest { font-size: min(.9375rem, 5.2cqi); } }

/*
 * Home engine cards (templates/includes/sections/home_engines.html.twig): an engine without a film (Expansion) shows its mock-up
 * instead; it gets the white frame and shadow that main.css gives only to `.pillar__film`, so all four cards look alike.
 */
.pillar__media--mock { border: 3px solid var(--white); box-shadow: 0 20px 50px rgb(0 0 40 / .4); }

/*
 * Home hero (templates/pages/homepage.html.twig): a black layer at 30% over the curtain video, behind the copy. It shares the
 * video's z-index (-2) and comes after it in the markup, so it covers the video (and the hero background) while the dot textures
 * (-1) and the text stay on top.
 */
.hero__shade { position: absolute; inset: 0; z-index: -2; background: rgb(0 0 0 / .3); border-radius: inherit; pointer-events: none; }

/*
 * Homepage scroll snap (html.home-snap, set by templates/pages/homepage.html.twig). Mandatory, with scroll-snap-stop: always: every
 * scroll goes straight to the next (or previous) section and a fast swipe cannot skip one. A panel taller than the screen can still be
 * scrolled through freely (the browser allows any position inside a snap area larger than the screen). Each panel snaps one inset
 * below the top of the screen, where the engine cards pin too; the hero snaps to the very top and the finale (closing + footer) to
 * the bottom, so the footer stays reachable. The cards themselves are sticky, so main.js (sulu: 10) puts one invisible .pillar-snap
 * mark per card in .engines at the scroll position where that card pins.
 */
html.home-snap { scroll-snap-type: y mandatory; }
.home-snap :is(.hero, .hub__panel, .why__panel, .security__panel, .sectors__panel, .home-blog__panel, .closing__panel) { scroll-snap-align: start; scroll-snap-stop: always; scroll-margin-top: var(--inset); }
.home-snap .finale { scroll-snap-align: end; scroll-margin-bottom: var(--inset); }
.home-snap .engines { position: relative; }
.pillar-snap { position: absolute; left: 0; width: 1px; height: 1px; scroll-snap-align: start; scroll-snap-stop: always; pointer-events: none; }

/*
 * Home sectors (templates/includes/sections/home_sectors.html.twig), two columns from 1100px: the block fills one screen, the photo
 * as high as the screen minus one inset above and below (no 4:3 ratio, no 640px cap), the text vertically centred beside it. The
 * space to the sections around it is one inset, as between the other sections (padding-bottom only, like .security and .home-blog),
 * and the side space is the section's inset only (the panel's own padding would double it);
 * it snaps one inset below the top of the screen like the other panels. Below 1100px the columns stack and the reference layout stays.
 */
@media (min-width: 1100px) {
  .sectors { padding: 0 var(--inset) var(--inset); }
  .sectors__panel { min-height: calc(100svh - 2 * var(--inset)); padding: 0; align-items: center; }
  .sectors__media { height: calc(100svh - 2 * var(--inset)); aspect-ratio: auto; max-height: none; }
}

/*
 * Footer logo (templates/includes/chrome/footer.html.twig, error/_static_page.html.twig): about a quarter larger than the reference (clamp(110px, 8vw, 160px)), on every page.
 */
.footer__logo img { width: clamp(138px, 10vw, 200px); }

/*
 * Home security (templates/includes/sections/home_security.html.twig), from 860px, where the panel is one screen high: with the
 * mandatory scroll snap a panel taller than the screen can be scrolled through freely, and at 1440x800 the reference panel is
 * about 120px too tall. The white space (panel padding, the gaps above the slides, the controls and the button) now also scales
 * with the screen height, capped at the reference values, so the panel fits from about 780px high; the cards are untouched.
 */
@media (min-width: 860px) {
  .home-snap .security__panel { padding-block: min(clamp(48px, 5vw, 96px), max(24px, 4svh)); }
  .home-snap .security__slides { margin-top: min(clamp(28px, 3vw, 56px), max(16px, 2.5svh)); }
  .home-snap .security__controls { margin-top: min(clamp(24px, 2.2vw, 40px), max(12px, 2svh)); }
  .home-snap .security .btn { margin-top: min(clamp(28px, 3.4vw, 64px), max(16px, 3svh)); }
}

/*
 * Home engines ring (templates/includes/sections/home_engines.html.twig), desktop: the ring and the nodes around it at 75% of the
 * reference size, for more white space in the panel. Only the --ring-w that main.css sets from 1000px is scaled; the copy beside
 * the nodes follows it.
 */
@media (min-width: 1000px) {
  .hub { --ring-w: calc(clamp(300px, min(33vw, 100svh - 370px), 620px) * .75); }
}

/*
 * Engine cards on the home (templates/includes/sections/home_engines.html.twig): a quarter of the space above the bullets
 * (reference clamp(16px, min(3vw, 4svh), 56px)).
 */
.pillar__bullets { padding-top: clamp(4px, min(.75vw, 1svh), 14px); }

/*
 * Home blog (templates/includes/sections/home_blog.html.twig), from 860px: like .security above, the panel must fit one screen or
 * the mandatory scroll snap lets it scroll freely (at 1440x800 it was 52px too tall, at 1280x720 100px). The white space (panel
 * padding, the gap above the cards and above each card title) scales with the screen height, capped at the reference values;
 * photos and text keep their size. Like the security panel, it is one screen high (minus the inset above and below) with its
 * content centred vertically.
 */
@media (min-width: 860px) {
  .home-snap .home-blog__panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100svh - 2 * var(--inset));
    padding-top: min(clamp(56px, 5.6vw, 108px), max(32px, 5svh));
    padding-bottom: min(clamp(56px, 5vw, 90px), max(32px, 4.5svh));
  }
  .home-snap .home-blog__list { margin-top: min(clamp(32px, 4vw, 80px), max(24px, 4svh)); }
  .home-snap .home-blog__card h3 { margin-top: min(40px, max(20px, 3svh)); }
}

/*
 * Home hero mock-up animation, after the Figma prototype (node 430-1153, taken over 2026-11-17; company names stay anonymous).
 * main.js (sulu: 11) adds .is-on to .mock once, for the intro (cards fade in, the bars grow left to right, then the facts, the top
 * notification, the ranking and the bottom notification), and then runs a 14.6 s cycle without hiding anything: .is-swapped
 * brings the Live card forward for a moment, .is-current moves each notification on to its next message and back to its first
 * at the start of the next cycle, and the bars move at random (an inline --h per bar). html.mock-anim (an inline script on the
 * homepage, only without prefers-reduced-motion) hides the mock-up before the first paint; without it the mock-up is the static
 * reference: the last messages, the Live card over the Intent card. The intro delays sit on the .is-on state only; opacity and
 * filter are delayed, transforms (the swap) are not.
 */
.mock__push-msgs { display: grid; flex: 1; min-width: 0; }
.mock__push-msgs > .mock__push-body { grid-area: 1 / 1; }
.mock__push-body:not(.is-current) { opacity: 0; }

.mock-anim .mock__card,
.mock-anim .mock__push { opacity: 0; transition: opacity .5s var(--ease), transform .45s var(--ease), filter .5s var(--ease); }
.mock-anim .mock__push { filter: blur(8px); }
.mock-anim .mock.is-on .mock__card,
.mock-anim .mock.is-on .mock__push { opacity: 1; filter: none; }
.mock-anim .mock.is-on .mock__card--intent { transition-delay: .1s, 0s, 0s; }
.mock-anim .mock.is-on .mock__push--top { transition-delay: .6s, 0s, .6s; }
.mock-anim .mock.is-on .mock__push--bottom { transition-delay: 1s, 0s, 1s; }

/* The bars grow in one by one, then keep moving: main.js sets a random --h on them while the mock-up is on */
.mock-anim .mock__bars i { transform: scaleY(0); transform-origin: 50% 100%; transition: transform .45s cubic-bezier(.2, .8, .2, 1), height .7s cubic-bezier(.4, 0, .2, 1); }
.mock-anim .mock.is-on .mock__bars i { transform: none; transition-delay: calc(.15s + var(--i, 0) * 45ms), 0s; }
/* main.css lights the full bars with [style*="--o:1"]; once main.js has set --h the browser writes the style back as "--o: 1" */
.mock__bars i[style*="--o: 1"] { box-shadow: 0 0 calc(var(--u) * 26) rgb(0 207 255 / .55); }

.mock-anim .mock__facts,
.mock-anim .mock__rank { opacity: 0; transition: opacity .5s var(--ease); }
.mock-anim .mock.is-on .mock__facts { opacity: 1; transition-delay: .6s; }
.mock-anim .mock.is-on .mock__rank { opacity: 1; transition-delay: .9s; }

/* A notification moving on: the old message blurs out, the new one blurs in */
.mock-anim .mock__push-body { transition: opacity .4s var(--ease), filter .4s var(--ease); }
.mock-anim .mock__push-body:not(.is-current) { filter: blur(6px); }

/* The swap, only where the cards overlap (from 640px; on phones they stack). At rest the Intent card lies over the Live card, as in
   Figma; the Live card comes forward over both the Intent card and the top notification, and only drops back once it is back */
@media (min-width: 640px) {
  .mock-anim .mock__card--live { z-index: 1; transition: opacity .5s var(--ease), transform .45s var(--ease), z-index .45s step-end; }
  .mock-anim .mock__card--intent { z-index: 2; }
  .mock-anim .mock__push { z-index: 3; }
  .mock-anim .mock.is-swapped .mock__card--live { z-index: 4; transform: translate(calc(var(--u) * 23), calc(var(--u) * -11)) scale(1.02); transition: opacity .5s var(--ease), transform .45s var(--ease), z-index 0s; }
  .mock-anim .mock.is-swapped .mock__card--intent { transform: translate(calc(var(--u) * 14), calc(var(--u) * 9)) scale(.99); }
  .mock-anim .mock.is-swapped .mock__push--top { transform: translate(calc(var(--u) * -4), calc(var(--u) * 8)); }
}
