/* CTA preset buttons + mobile sticky contact bar. .srd-btn is a
   general-purpose class, not limited to the CTA builder's own output — add
   it (plus srd-btn--filled or srd-btn--outline) to any <a> or <button>
   anywhere on the site to pick up the same design. This file is enqueued
   unconditionally for exactly that reason.
   1080px/1081px in media queries are breakpoint tokens (substituted at load
   time when the Mobile Breakpoint setting differs).

   .srd-slide__btn (a slider button class from the separate srd-toolkit
   plugin) is deliberately NOT touched here — it keeps its own plugin's
   color/style controls, never Button Design. It's still excluded from the
   Link Hover Animation background trick in
   inc/features/general/assets/link-anim.css though, since that's a
   different concern (protecting srd-toolkit's own styling from being
   clobbered by a site-wide selector, not applying our design to it).

   Button design cascade (highest priority first): a per-button inline style
   (set on that one <a>, see srdss_cta_button_style_attr() — targets
   --srd-cta-*, never set at :root, only inline) > SRD Site Suite -> General ->
   Button Design (--srd-btn-*) > the hardcoded default in this file. Every
   var() below spells that out as a fallback chain: var(--srd-cta-X,
   var(--srd-btn-X, default)).

   WhatsApp/Call/Email keep their own brand color by design: their filled
   rules read a TYPE-scoped variable (--srd-cta-whatsapp-bg etc.) that is
   never wired to --srd-cta-bg/--srd-btn-bg at all, so Button Design's
   background settings never touch them — only a per-button override (which
   targets that same type-scoped variable) can change one. */

.srd-btn {
    /* Native <button> reset — a hand-placed <button class="srd-btn ...">
       must look identical to the same classes on an <a>; these five undo
       the browser's own button chrome so nothing but the rules below (and
       the design settings they read) ever shows through. */
    appearance: none;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;

    display: inline-flex;
    align-items: center;

    /* The label is centred, and it takes BOTH of these because they centre
       different things.

       justify-content places the flex items — the icon and the label — in a
       button wider than they are. text-align places the LINES inside the
       label once it wraps: a wrapped label fills the width, so the item has
       nowhere left to be centred to and justify-content has nothing to say.
       A full-width button with a two-line label was left-aligned with only
       the first, and a one-line label in the same button is left-aligned with
       only the second.

       Neither does anything to an ordinary inline-flex button, which
       shrink-wraps to its content and has no spare width for either property
       to place anything in. They cost nothing until a button is stretched —
       the drawer, the mobile bar, a site's own width: 100% — which is exactly
       when a left-aligned label starts looking like a bug. */
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: var(--srd-cta-pad-y, var(--srd-btn-pad-y, 9px)) var(--srd-cta-pad-x, var(--srd-btn-pad-x, 18px));
    border-radius: var(--srd-cta-radius, var(--srd-btn-radius, 6px));
    font-weight: var(--srd-cta-font-weight, var(--srd-btn-font-weight, 600));
    font-size: var(--srd-cta-font-size, var(--srd-btn-font-size, 15px));
    text-transform: var(--srd-cta-text-transform, var(--srd-btn-text-transform, none));
    letter-spacing: var(--srd-cta-letter-spacing, var(--srd-btn-letter-spacing, normal));
    line-height: 1.2;
    text-decoration: none;
    /* Button Hover Duration. The 0.2s fallback is what every button did
       before the setting existed, so a blank setting changes nothing. */
    transition: background-color var(--srd-btn-hover-duration, 0.2s) ease,
                color var(--srd-btn-hover-duration, 0.2s) ease,
                border-color var(--srd-btn-hover-duration, 0.2s) ease;
}

/* WHY !important ON background AND color, AND NOWHERE ELSE IN THIS FILE.

   A theme's link rules routinely carry an ID. The one this was found against
   is `#main-content a, footer a { background: linear-gradient(...) }` — the
   same gradient-underline trick link-anim.css uses, applied to every anchor
   in the content area. An ID beats any number of classes, so .srd-btn--filled
   at (0,1,0) cannot reach (1,0,1) and never will: a filled button inside that
   wrapper was painted by the theme's underline, and Button Background Color
   saved correctly and did nothing. (`footer a` is (0,0,2) and already lost,
   which is why the same button looked right in the footer and wrong in the
   content — the tell that this is specificity and not the setting.)

   It is the bug the suite already fixed on its own side by keeping .srd-btn
   out of every link-anim selector. A theme's stylesheet cannot be edited, so
   the button has to hold its own paint instead.

   !important rather than a specificity bump (.srd-btn--filled:not(#_), which
   would reach (1,1,0)) because a bump is a guess at how many IDs the opponent
   used — it beats one and loses to two, and which it meets is a property of a
   theme nobody here can see. There is nothing to guess with !important.

   Scoped to the two paint properties deliberately. Padding, radius, borders,
   typography and the icon stay ordinary: nothing was overriding those, and
   every !important is one more thing a site cannot override without one of
   its own. .srd-btn--text is left out for the same reason it reads `color:
   inherit` — it is a link that reads as a button, and taking its surroundings
   is the design, not a failure of it.

   The var() chains are untouched, so a per-button inline override still beats
   the setting and the setting still beats the default. The declaration got
   heavier; the cascade inside it did not move. */
.srd-btn--filled {
    background: var(--srd-cta-bg, var(--srd-btn-bg, #1d2327)) !important;
    color: var(--srd-cta-text, var(--srd-btn-text, #ffffff)) !important;
    border: var(--srd-cta-border-width, var(--srd-btn-border-width, 0px)) var(--srd-cta-border-style, var(--srd-btn-border-style, solid)) var(--srd-cta-border-color, var(--srd-btn-border-color, transparent));
}

.srd-btn--filled:hover {
    background: var(--srd-cta-hover-bg, var(--srd-btn-hover-bg, color-mix(in srgb, var(--srd-cta-bg, var(--srd-btn-bg, #1d2327)) 85%, black))) !important;
    color: var(--srd-cta-hover-text, var(--srd-btn-hover-text, var(--srd-cta-text, var(--srd-btn-text, #ffffff)))) !important;
}

/* An outline button does NOT read --srd-btn-bg, deliberately — same shape as
   .srd-btn--text not reading --srd-btn-text below. Button Background Color is
   usually a strong colour with a white label on a filled button; an outline
   button's label is its border colour, so taking that fill would put navy text
   on navy on any site using both styles. It has its own setting instead, and a
   per-button Background override (--srd-cta-bg) lands too. */
.srd-btn--outline {
    background: var(--srd-cta-bg, var(--srd-btn-outline-bg, transparent)) !important;
    border: var(--srd-cta-border-width, var(--srd-btn-border-width, 2px)) var(--srd-cta-border-style, var(--srd-btn-border-style, solid)) var(--srd-cta-border-color, var(--srd-btn-border-color, currentColor));
    color: var(--srd-cta-border-color, var(--srd-btn-border-color, inherit)) !important;
}

.srd-btn--outline:hover {
    background: var(--srd-cta-hover-bg, var(--srd-btn-hover-bg, color-mix(in srgb, currentColor 12%, var(--srd-cta-bg, var(--srd-btn-outline-bg, transparent))))) !important;
    color: var(--srd-cta-hover-text, var(--srd-btn-hover-text, inherit)) !important;
}

/* Text style — a link that reads as a button. Keeps everything typographic
   from .srd-btn (font-size, weight, text-transform, gap, icon size) and
   drops the chrome, so it inherits the surrounding text color.

   This is the ONE button style that takes a hover underline. It has its own
   setting — General -> Button Design -> Button Hover Animation — which is
   separate from the site-wide Link Hover Animation, so links and buttons can
   animate differently (Inherit makes it follow the link setting). The variant
   CSS lives in link-anim.css, where every rule carries a second selector
   scoped by body.srd-btnanim--<name>.

   Filled and outline buttons are never targeted: they have a background the
   underline would paint over, which was a real production bug. Here there is
   no background to protect and the bar IS the underline.

   Padding is 0 rather than inherited so the animation measures its bar
   against text + gap + icon (every variant sizes against the anchor's box,
   see link-anim.css) — an underline that hugs the label, not one floating
   below a padding box. Border Radius / Padding / Background settings do not
   apply here; every other Button Design setting does. */
.srd-btn--text {
    padding: 0;
    background: none;
    border: none;

    /* Reads the per-button variable but NOT the site-wide --srd-btn-text,
       deliberately — same shape as the brand-color rules below. Button Text
       Color is almost always set to white to sit on a dark filled button;
       inheriting that here would render every text button invisible against
       the page. So it inherits the surrounding text color by default, and a
       per-button Text Color override still lands. */
    color: var(--srd-cta-text, inherit);
}

.srd-btn--text:hover {
    /* Same reasoning, and blank is the normal case: the Link Hover Animation
       carries the hover on its own. */
    color: var(--srd-cta-hover-text, inherit);
}

/* The drawer/mobile-bar rules further down stretch buttons to full width,
   which would drag a text button's underline across the whole panel. Keep it
   hugging its own text on every surface. Doubled class (.srd-btn.srd-btn--text)
   so this wins on specificity rather than on source order — those rules are
   below this point in the file. */
@media (max-width: 1080px) {
    .srd-cta .srd-btn.srd-btn--text,
    .srd-mobile-bar .srd-btn.srd-btn--text {
        flex: 0 0 auto;
        width: auto;
        justify-content: flex-start;
    }
}

/* Preset-type brand colors — filled style only (matches outline's existing
   currentColor-based look, unchanged for these types). */
.srd-btn--filled.srd-btn--whatsapp {
    background: var(--srd-cta-whatsapp-bg, #25d366) !important;
    color: var(--srd-cta-whatsapp-text, #ffffff) !important;
}

.srd-btn--filled.srd-btn--whatsapp:hover {
    background: var(--srd-cta-whatsapp-hover-bg, color-mix(in srgb, var(--srd-cta-whatsapp-bg, #25d366) 85%, black)) !important;
    color: var(--srd-cta-whatsapp-hover-text, var(--srd-cta-whatsapp-text, #ffffff)) !important;
}

.srd-btn--filled.srd-btn--call {
    background: var(--srd-cta-call-bg, #2563eb) !important;
    color: var(--srd-cta-call-text, #ffffff) !important;
}

.srd-btn--filled.srd-btn--call:hover {
    background: var(--srd-cta-call-hover-bg, color-mix(in srgb, var(--srd-cta-call-bg, #2563eb) 85%, black)) !important;
    color: var(--srd-cta-call-hover-text, var(--srd-cta-call-text, #ffffff)) !important;
}

.srd-btn--filled.srd-btn--email {
    background: var(--srd-cta-email-bg, #475569) !important;
    color: var(--srd-cta-email-text, #ffffff) !important;
}

.srd-btn--filled.srd-btn--email:hover {
    background: var(--srd-cta-email-hover-bg, color-mix(in srgb, var(--srd-cta-email-bg, #475569) 85%, black)) !important;
    color: var(--srd-cta-email-hover-text, var(--srd-cta-email-text, #ffffff)) !important;
}

.srd-btn svg {
    flex: 0 0 auto;
    width: var(--srd-cta-icon-size, var(--srd-btn-icon-size, 18px));
    height: var(--srd-cta-icon-size, var(--srd-btn-icon-size, 18px));
}

/* A group of buttons: the spacing between them, and where the group sits.

   Carried by [srdss_cta_buttons]'s own wrapper and by the div [srdss_button]
   gets when it is given an align. Both are the same class family, so a
   hand-written container can use it too.

   flex because gap needs it — .srd-cta-buttons had no CSS at all, so two
   buttons side by side were separated by the whitespace between the tags and
   nothing else. One consequence has to be said out loud: a flex container
   places its own children, so the PARENT's text-align no longer moves this
   group. That is what align="center" replaces, and it is why the family
   exists rather than the gap being added on its own.

   Block-level flex, not inline-flex, because the header drawer renders
   through this same wrapper: .srd-cta .srd-btn is width: 100% at mobile, and
   an inline-flex parent shrink-wraps, which would resolve that 100% against
   the widest button instead of the drawer. Block-level + wrap keeps each
   full-width button on its own line, exactly as before.

   The 10px gap is also what now spaces the drawer's stacked buttons — the
   margin-bottom that used to do it is gone, which additionally drops the
   trailing space that sat under the last one. .srd-mobile-bar already used
   gap: 10px, so this is the same number the bar has always used. */
.srd-btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.srd-btn-group--left {
    justify-content: flex-start;
}

.srd-btn-group--center {
    justify-content: center;
}

.srd-btn-group--right {
    justify-content: flex-end;
}

/* The same three placements, carried by the button itself.

   For the one case the wrapper above cannot reach: a builder module that lets
   you add a class to the button but not wrap it in a div of your own. Prefer
   .srd-btn-group when you can add the wrapper — it also spaces a row, which
   this cannot, having no children to space.

   A button has to stop being inline-level to place itself. .srd-btn is
   inline-flex, and an inline box is positioned by its container, not by its
   own margins — auto margins on it do nothing at all. So these switch it to
   block-level flex and shrink it back to its content, which is what gives the
   auto margins something to push against.

   margin-inline rather than margin-left/right so this family and the group's
   justify-content: flex-end agree under RTL, where both mean the end of the
   line rather than the right of the screen.

   STANDALONE BUTTONS ONLY, and the reason is not a style preference: inside
   .srd-btn-group, .srd-mobile-bar or the drawer the button is already a flex
   item, and an auto margin on a flex item absorbs the free space in the line
   instead of centring the box — it would push its siblings around rather than
   place itself. The drawer is safe whatever happens, because .srd-cta
   .srd-btn is (0,2,0) and keeps its width: 100% over these. */
.srd-btn--align-left,
.srd-btn--align-center,
.srd-btn--align-right {
    display: flex;
    width: fit-content;
}

.srd-btn--align-left {
    margin-inline: 0 auto;
}

.srd-btn--align-center {
    margin-inline: auto;
}

.srd-btn--align-right {
    margin-inline: auto 0;
}

/* Phone width: a button takes the line. NOT IN THIS FILE.

   This used to be a literal @media (max-width: 480px) rule here. It is now
   the Full Width Below setting (default 480, so nothing moved). A @media
   condition cannot read a custom property, so srdss_btn_width_css() writes the
   rule with the number in it. It also writes Button Min Width and Button Max
   Width, which are declared only when set.

   Do not put a width rule for .srd-btn back in this file. It would fight the
   setting, and a copy written as 1080px/1081px would also be moved by the
   breakpoint substitution. */

/* Visibility per surface. */
@media (min-width: 1081px) {
    .srd-btn--hide-desktop {
        display: none;
    }
}

@media (max-width: 1080px) {
    .srd-btn--hide-mobile {
        display: none;
    }

    /* Drawer CTAs stack full-width. The spacing between them is the
       group gap now, not a margin — which also means no trailing space
       under the last one. */
    .srd-cta .srd-btn {
        justify-content: center;
        width: 100%;
    }
}

/* Mobile sticky contact bar. */
.srd-mobile-bar {
    display: none;
}

@media (max-width: 1080px) {
    .srd-mobile-bar {
        display: flex;
        gap: 10px;
        position: fixed;
        left: 0;
        right: 0;
        /* Any bar fixed above this one publishes its own height here, so the
           two stack instead of overlapping. Nothing sets it by default. */
        bottom: var(--srd-bottom-bar-offset, 0px);
        z-index: 9990;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        background: var(--srd-mobile-bar-bg, #ffffff);
        box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
    }

    .srd-mobile-bar .srd-btn {
        flex: 1;
        justify-content: center;
    }

    /* Hidden while the drawer is open (drawer overlays it anyway). */
    body.srd-drawer-open .srd-mobile-bar {
        display: none;
    }
}
