/*
 * Kontakt-Klapper — fixed mail/phone pills on the right viewport edge.
 *
 * Anima reference (cultina-1920-startseite.css): .mail-klapper (Lipstick,
 * z-index 8) + .phone-klapper (Conifer, z-index 9), both 525×61px pills with
 * 31px radius. At rest only the rounded icon cap (61px) peeks into the
 * viewport; on hover/focus the whole pill slides in.
 *
 * Lives in theme CSS (not a widget): transform-based hover effects are an
 * Elementor Pro feature, and the flap must work on every page regardless of
 * page-level Elementor content. The markup is built with native Elementor
 * containers inside the [Global] Header template; editors only have to put
 * the CSS classes below on the right containers (documented in the handbook,
 * chapter "Header & Footer").
 *
 * Markup contract:
 *   <a class="cultina-flap cultina-flap--mail"  href="mailto:…"> [icon] [label] </a>
 *   <a class="cultina-flap cultina-flap--phone" href="tel:…">    [icon] [label] </a>
 *
 * All colors come from the design tokens (= Elementor Kit globals).
 */

/* Exact XD geometry (measured from the Startseite render):
   - mail pill:  top 248px, lipstick bg, white label "INFO@VIVENO.DE"
   - phone pill: top 326px, conifer bg, mine-shaft label "+49 (0) 52 41 877-0"
   - both 295px wide × 61px high, flush to the right viewport edge,
     left corners rounded (31px), right edge square (sits off-screen).
   - position:fixed, topmost z-layer (above the sticky header + all content).

   Doubled class for specificity: Elementor's container CSS (.e-con
   { position: relative; --width … }) loads after this file and would
   otherwise win and put the flaps back into the document flow. */
.cultina-flap.cultina-flap {
    position: fixed;
    right: 0;
    left: auto;
    /* Colours + vertical position are supplied per flap by the Customizer as
       inline CSS variables (class-contact-flaps.php); the fallbacks keep the
       original XD look if a value is ever missing. */
    top: var(--flap-top, 248px);
    display: flex;
    flex-direction: row;
    align-items: center;
    /* Icon→label spacing. Also sets how far in the label sits, so the collapsed
       peek (--flap-peek) can show the icon with margin WITHOUT exposing the
       label text (label starts at padding-left 26 + icon 24 + this gap). */
    gap: 24px;
    width: 295px;
    max-width: 80vw;
    height: 61px;
    min-height: 61px;
    padding: 0 0 0 26px;
    margin: 0;
    border-radius: 31px 0 0 31px;
    background: var(--flap-bg, var(--cultina-color-primary));
    color: var(--flap-color, var(--cultina-color-text-inverse, #fff));
    font-family: var(--cultina-font-family);
    font-size: 18px;
    font-weight: var(--cultina-font-weight-bold, 700);
    text-decoration: none;
    /* Topmost: above header (100), overlay (500), modal (1000), toast (2000). */
    z-index: 9000;
}

.cultina-flap:focus-visible {
    outline: none;
    box-shadow: var(--cultina-focus-ring);
}

/* The flaps are <a> styled as buttons — re-assert their own colour on hover/focus
   so the theme's generic a:hover (a different colour) can never recolour them. */
.cultina-flap.cultina-flap:hover,
.cultina-flap.cultina-flap:focus,
.cultina-flap.cultina-flap:focus-visible {
    color: var(--flap-color, var(--cultina-color-text-inverse, #fff));
}

/* Stable stacking order (the two pills don't overlap at the default tops, but
   keep them distinct in case the positions are moved close together). */
.cultina-flap--1 { z-index: 9001; }
.cultina-flap--2 { z-index: 9002; }

.cultina-flap.cultina-flap {
    max-height: 61px;
    overflow: hidden;
}

/* Theme-rendered markup: <span.cultina-flap__icon> + <span.cultina-flap__label>
   sit directly in the flex pill. The label colour is inherited from the pill
   (--flap-color); the default SVG uses fill:currentColor, so it tracks the same
   colour. An uploaded logo keeps its own colours. */
.cultina-flap__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.cultina-flap__icon svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.cultina-flap__icon img {
    display: block;
    height: 24px;
    width: auto;
    max-width: 48px;
    object-fit: contain;
}

/* Label typography: Ubuntu Bold 18px, single line (Anima:
   ubuntu-bold-white-18px / ubuntu-bold-mine-shaft-18px). No text-transform —
   the label text is stored in its final form ("INFO@VIVENO.DE"). */
.cultina-flap__label {
    font-family: var(--cultina-font-family);
    font-size: 18px;
    font-weight: var(--cultina-font-weight-bold, 700);
    line-height: 1.2;
    white-space: nowrap;
    color: inherit;
}

/* Below the nav breakpoint (≤1024px) the responsive burger menu is active, and
   its overlay already shows the contact info as pills — so the side flaps would
   be redundant. Hide them entirely there; they appear only on desktop (>1024px),
   where there is no menu overlay. */
@media (max-width: 1024px) {
    .cultina-flap.cultina-flap {
        display: none;
    }
}

/* ── Slide-out mode (Customizer → "Kontakt-Klapper: Slide-out-Effekt") ──
   Opt-in via the body class set in ElementorIntegration::body_classes().
   Applies the same icon-cap → full-pill transform as the ≤1024px baseline,
   but at EVERY width. At rest only the icon cap peeks in (width = --flap-peek,
   default 80px); on hover, keyboard focus, or focus inside the pill it slides
   fully in to reveal the label.
   The doubled .cultina-flap.cultina-flap keeps specificity above Elementor's
   container CSS; the leading body class makes this win over the static base. */
body.cultina-flaps-slideout .cultina-flap.cultina-flap {
    transform: translateX(calc(100% - var(--flap-peek, 68px)));
    transition: transform var(--cultina-duration-base, 300ms) var(--cultina-ease-out, ease-out);
}
/* Hover trigger (default): expand on hover / keyboard focus. Suppressed in
   click mode via :not(.cultina-flaps-click). */
body.cultina-flaps-slideout:not(.cultina-flaps-click) .cultina-flap.cultina-flap:hover,
body.cultina-flaps-slideout:not(.cultina-flaps-click) .cultina-flap.cultina-flap:focus-visible,
body.cultina-flaps-slideout:not(.cultina-flaps-click) .cultina-flap.cultina-flap:focus-within,
body.cultina-flaps-slideout:not(.cultina-flaps-click) .cultina-flap.cultina-flap:active {
    transform: translateX(0);
}
/* Click trigger: expand ONLY while JS has toggled .is-open (assets/js/flap.js).
   No :focus-within here on purpose — clicking the pill focuses it, and a
   :focus-within rule would keep it open so a second click could never close it.
   Keyboard users open it with Enter (= click) and close with Escape. */
body.cultina-flaps-click .cultina-flap.cultina-flap.is-open {
    transform: translateX(0);
}

/* Touch devices have no :hover — both slide-out mode and the ≤1024px baseline
   rely on it. The :active rules above already slide the label out on press;
   on coarse pointers we drop the transition so the label appears instantly
   under the finger (a readable preview) before the tap navigates to the
   mailto:/tel: link. */
@media (hover: none) and (pointer: coarse) {
    .cultina-flap.cultina-flap:active {
        transition: none;
    }
}

/* Force-open: the QA helper (?flapsopen=1 → body.cultina-flaps-open) and any
   future "always open" need — reveal the full pill no matter the mode. */
.cultina-flaps-open .cultina-flap.cultina-flap {
    transform: translateX(0) !important;
}

/* Respect reduced-motion: keep the collapse/expand functional but skip the
   slide animation. Placed last so it overrides the transitions set above. */
@media (prefers-reduced-motion: reduce) {
    .cultina-flap.cultina-flap {
        transition: none;
    }
}

/* Screenshot mode (pixel-diff tooling): fixed flaps would land mid-page in a
   full-height headless render — hide them. */
.cultina-screenshot .cultina-flap.cultina-flap {
    display: none;
}

/* When the mobile menu overlay is open (body.cultina-menu-open — set by nav.js
   on burger open, and by the ?menuopen=1 QA flag) the menu shows its own contact
   pills, and the fixed flaps sit in a higher stacking context than the overlay,
   so hide them to avoid them peeking over the open menu. */
.cultina-menu-open .cultina-flap.cultina-flap {
    display: none;
}

/* Screenshot mode: hide the Pojo accessibility toolbar toggle (plugin UI,
   not part of the design renders). */
.cultina-screenshot #pojo-a11y-toolbar,
.cultina-screenshot .pojo-a11y-toolbar-toggle {
    display: none !important;
}
