/* ==========================================================================
   Penumbra Works: global

   Loads on every front-end page, unconditionally. Two jobs:

     1. Define the palette tokens. Everything else in the plugin reads
        them, so this file has to be present before any other pw
        stylesheet, enforced by declaring 'pw-global' as a dependency
        on the others rather than by hoping load order works out.

     2. Paint the site background: base colour, grid, noise, and the
        drifting accent spheres.

   Also carries the site-wide chrome that used to live in Betheme's
   Custom CSS field: scrollbar, Contact Form 7, footer newsletter.
   Delete it from there once this is installed; two copies will drift.
   ========================================================================== */


/* --------------------------------------------------------------------------
   Tokens

   The six-colour palette plus the accent at reduced alpha. Don't add new
   colour values here, if something needs to be lighter or darker, it
   wants an existing token at a different alpha, not a seventh colour.
   -------------------------------------------------------------------------- */

:root {
    --pw-bg:         #101010;  /* page background, image wells */
    --pw-surface:    #202020;  /* cards, inputs, panels */
    --pw-surface-hi: #303030;  /* hovered / selected surface */
    --pw-line:       #303030;  /* borders */
    --pw-accent:     #f63049;  /* accent fill, active state */
    --pw-text:       #f7f7f7;  /* headings, important text */
    --pw-text-dim:   #bbbbbb;  /* body, secondary, meta, hover borders */

    /* the accent at reduced alpha, same colour, not a new one */
    --pw-glow:       rgba(246, 48, 73, .25);
    --pw-ring:       rgba(246, 48, 73, .35);
    --pw-accent-90:  rgba(246, 48, 73, .9);

    /* accent as raw channels, for rgba() in new rules.
       rgba() can't take a hex custom property, so this is the way to
       build a translucent accent without hardcoding the hex again. */
    --pw-accent-rgb: 246, 48, 73;

    /* header and footer surface. --pw-bg keeps them the base colour but
       opaque, so the accent wash stops at their edges. --pw-surface lifts
       them a step off the page instead. */
    --pw-chrome-bg: var(--pw-bg);

    /* background tuning.
       --pw-noise-opacity drives dark grain, not light haze: raising it
       makes the page darker and grainier, not brighter. */
    --pw-grid-size:      3rem;
    --pw-grid-opacity:   .035;
    --pw-noise-opacity:  .5;
    --pw-wash-strength:  1;

    /* written by global.js, cursor offset, in percent */
    --pw-mx: 0%;
    --pw-my: 0%;
}


/* --------------------------------------------------------------------------
   Background

   Four fixed layers behind the page:

     html::before  (-3)  base colour + grid
     html::after   (-2)  noise
     body::before  (-1)  accent spheres, group A
     body::after   (-1)  accent spheres, group B

   Body must stay transparent. An opaque body paints over all four,
   it's a descendant box with its own background, so its colour lands
   above html's negative-z pseudo-elements regardless of z-index.

   'html body' rather than plain 'body' so this beats Betheme's own
   body background rule on specificity instead of with !important.

   Everything animated moves via transform and translate only, so it
   stays on the compositor and off the layout and paint paths.
   -------------------------------------------------------------------------- */

html {
    background-color: var(--pw-bg, #101010);
}

html body {
    background-color: transparent;
    position: relative;
    z-index: 0;
}

/* layer 1, base colour and grid.
   Oversized by 2% because the cursor offset shifts it; at inset 0 a
   strip of ungridded background would show at the trailing edge. */
html::before {
    content: "";
    position: fixed;
    inset: -2%;
    z-index: -3;
    pointer-events: none;
    background-color: var(--pw-bg, #101010);
    background-image:
        linear-gradient(rgba(247, 247, 247, var(--pw-grid-opacity)) .0625rem, transparent .0625rem),
        linear-gradient(90deg, rgba(247, 247, 247, var(--pw-grid-opacity)) .0625rem, transparent .0625rem);
    background-size:
        var(--pw-grid-size) var(--pw-grid-size),
        var(--pw-grid-size) var(--pw-grid-size);
    /* a tenth of the sphere travel, this small amount of parallax on
       the grid is what reads as depth. A static grid over moving blobs
       reads as a screen effect instead. */
    translate: calc(var(--pw-mx) * -.3) calc(var(--pw-my) * -.3);
}

/* layer 2, grain.

   feTurbulence generates values centred on mid-grey in every channel,
   so a plain turbulence rect over a near-black page can only ever add
   light. At the old opacity it lifted #101010 to roughly #131313, a
   19% luminance rise, uniform across the whole site, which read as the
   page not being properly dark.

   The feColorMatrix fixes that: it zeroes RGB and routes the red
   channel of the turbulence into alpha, leaving black modulated by
   noise. The grain now darkens instead of lightening, which is also
   closer to how film grain behaves in shadow.

   --pw-noise-opacity means the opposite of what it used to, so the
   numbers are different: .35 is subtle, .60 matches the grain strength
   of the old setup while sitting five levels darker, .85 is heavy. */
html::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: var(--pw-noise-opacity);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  1 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 12.5rem 12.5rem;
}

/* layer 3, accent spheres, group A.
   Moves against the cursor. */
html body::before {
    content: "";
    position: fixed;
    inset: -25%;
    z-index: -1;
    pointer-events: none;
    opacity: var(--pw-wash-strength);
    background-image:
        radial-gradient(30% 30% at 78% 18%, rgba(var(--pw-accent-rgb), .30), transparent 70%),
        radial-gradient(26% 26% at 12% 55%, rgba(var(--pw-accent-rgb), .20), transparent 70%);
    filter: blur(3rem);
    animation: pw-drift-a 34s ease-in-out infinite alternate;
    translate: calc(var(--pw-mx) * -1) calc(var(--pw-my) * -1);
    will-change: transform;
}

/* layer 3, accent spheres, group B.
   Moves with the cursor, and further. Opposing directions at different
   magnitudes is what separates the two into distinct planes; matched
   motion just reads as one sheet sliding around. */
html body::after {
    content: "";
    position: fixed;
    inset: -25%;
    z-index: -1;
    pointer-events: none;
    opacity: var(--pw-wash-strength);
    background-image:
        radial-gradient(34% 34% at 55% 92%, rgba(var(--pw-accent-rgb), .24), transparent 70%);
    filter: blur(3.5rem);
    animation: pw-drift-b 47s ease-in-out infinite alternate;
    translate: calc(var(--pw-mx) * 1.8) calc(var(--pw-my) * 1.8);
    will-change: transform;
}

/* Deliberately long and deliberately mismatched. The two periods never
   line up, so the composition doesn't visibly repeat. Under about 20s
   this starts reading as a screensaver behind the text. */
@keyframes pw-drift-a {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(6%, -4%, 0) scale(1.15); }
    100% { transform: translate3d(-5%, 5%, 0) scale(1.05); }
}

@keyframes pw-drift-b {
    0%   { transform: translate3d(0, 0, 0) scale(1.1); }
    50%  { transform: translate3d(-7%, -6%, 0) scale(1); }
    100% { transform: translate3d(4%, 3%, 0) scale(1.2); }
}


/* --------------------------------------------------------------------------
   Surfaces

   Two things have to be true for the background to work:

     1. The theme's full-page wrappers must not paint over it.
     2. Anything deliberately given a colour, a section, a column, the
        header, the footer, must still win.

   Only the two outer wrappers are forced transparent. Earlier this list
   also covered .section, .section_wrapper, .mcb-section, .mcb-wrap and
   .mcb-column, which was over-reach: those have no background in Betheme
   unless you give them one, so the rule did nothing except fight the
   colours set in BeBuilder. Section, wrap and column backgrounds now
   pass through untouched.

   'html body' prefix because Betheme's generated theme CSS is printed
   inline in the head, after plugin stylesheets. At equal specificity it
   wins on order alone and the background never appears. That's the only
   reason these selectors are verbose, don't simplify them.
   -------------------------------------------------------------------------- */

html body #Wrapper,
html body #Content {
    background-color: transparent;
}


/* --------------------------------------------------------------------------
   Chrome: header and footer

   Solid surfaces, so the accent wash stops at their edges. That edge is
   what separates them from the content area; without it the header
   floats in the same field as the page and the whole thing reads as one
   undifferentiated surface.

   Set --pw-chrome-bg to --pw-surface instead if you want them lifted a
   step off the base colour rather than flush with it.

   Betheme's transparent-header layouts are excluded. If you switch a
   page to a transparent or semi-transparent header, it stays that way
   and the background shows through as intended.

   Verify these IDs against your Betheme version, they're stable across
   recent releases but they are theme-specific, not WordPress core.
   -------------------------------------------------------------------------- */

html body #Header_wrapper,
html body #Top_bar,
html body #Top_bar.is-sticky,
html body #Subheader,
html body #Action_bar,
html body #Footer {
    background-color: var(--pw-chrome-bg);
}

/* Transparent-header layouts opt out. */
html body.header-transparent #Header_wrapper,
html body.header-transparent #Top_bar:not(.is-sticky),
html body.header-semi-transparent #Header_wrapper,
html body.header-semi-transparent #Top_bar:not(.is-sticky) {
    background-color: transparent;
}

/* Hairlines to define the edges. Same .0625rem structural weight as the
   rest of the site. Remove either if Betheme already draws one. */
html body #Header_wrapper {
    border-bottom: .0625rem solid var(--pw-line);
}

html body #Footer {
    border-top: .0625rem solid var(--pw-line);
}

/* The mobile menu drops over the page, it needs to be opaque or the
   drifting spheres show through the links. */
html body #Top_bar #menu,
html body .mfn-header-menu-overlay {
    background-color: var(--pw-chrome-bg);
}


/* --------------------------------------------------------------------------
   Surface utilities

   Type one of these into a BeBuilder element's custom-class field to
   override what's above on a single section, wrap or column.

   These carry !important on purpose. They're explicit, opt-in, and typed
   by hand for a specific element, so they have to beat whatever BeBuilder
   emits for that element, which is the one case where !important is the
   right tool rather than a shortcut.
   -------------------------------------------------------------------------- */

.pw-transparent {
    background-color: transparent !important;
}

.pw-solid {
    background-color: var(--pw-bg) !important;
}

.pw-surface {
    background-color: var(--pw-surface) !important;
}

/* Frosted panel: reads as glass over the moving background. Useful for
   a section that needs to sit above the wash without going fully opaque. */
.pw-frost {
    background-color: rgba(16, 16, 16, .72) !important;
    backdrop-filter: blur(.75rem);
    -webkit-backdrop-filter: blur(.75rem);
}

/* Off in the BeBuilder front-end editor, editing through a moving grid
   gets old fast. The class is set on <body>, so reaching the html
   pseudo-elements needs :has().

   Verify the class name against your Betheme version: open the builder
   and inspect <body>. If it differs, change it in all four selectors. */
html:has(body.mfn-builder-active)::before,
html:has(body.mfn-builder-active)::after,
html body.mfn-builder-active::before,
html body.mfn-builder-active::after {
    display: none;
}

@media print {
    html::before,
    html::after,
    html body::before,
    html body::after {
        display: none;
    }
}


/* --------------------------------------------------------------------------
   Scrollbar
   -------------------------------------------------------------------------- */

html {
    scrollbar-width: auto;
    scrollbar-color: var(--pw-surface-hi) var(--pw-bg);
    scrollbar-gutter: stable;
}

::-webkit-scrollbar {
    width: 1rem;
    height: 1rem;
}

::-webkit-scrollbar-track {
    background: var(--pw-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--pw-surface-hi);
    border: .25rem solid var(--pw-bg);
    background-clip: content-box;
    border-radius: .3125rem;
}

::-webkit-scrollbar-thumb:hover {
    border-width: .1875rem;
}

::-webkit-scrollbar-corner {
    background: var(--pw-bg);
}


/* --------------------------------------------------------------------------
   Contact Form 7, autofill

   Kill the browser's yellow fill. The huge inset shadow is the only way
   to override it; -webkit-text-fill-color is the only way to change the
   text colour on top of it.
   -------------------------------------------------------------------------- */

.wpcf7 input:-webkit-autofill,
.wpcf7 input:-webkit-autofill:hover,
.wpcf7 input:-webkit-autofill:focus,
.wpcf7 input:-webkit-autofill:active,
.wpcf7 textarea:-webkit-autofill,
.wpcf7 textarea:-webkit-autofill:hover,
.wpcf7 textarea:-webkit-autofill:focus,
.wpcf7 select:-webkit-autofill,
.wpcf7 select:-webkit-autofill:hover,
.wpcf7 select:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 62.5rem #0d0d0d inset !important;
    box-shadow: 0 0 0 62.5rem #0d0d0d inset !important;
    -webkit-text-fill-color: var(--pw-text, #f7f7f7) !important;
    caret-color: var(--pw-text, #f7f7f7);
    /* stops the brief yellow flash on fill in some Chrome versions */
    transition: background-color 9999s ease-in-out 0s;
}


/* --------------------------------------------------------------------------
   Contact Form 7, consent row

   Checkbox beside the text, not above it.
   -------------------------------------------------------------------------- */

.wpcf7 .pw-consent,
.wpcf7 label:has(.wpcf7-acceptance) {
    display: flex !important;
    align-items: flex-start;
    justify-content: flex-start;
    gap: .625rem;
    font-size: .85rem;
    line-height: 1.5;
    margin: .5rem 0;
    text-align: left;
}

/* CF7's outermost field wrapper. Without this it stays a full-width
   flex item and shoves the text across the row. */
.wpcf7 .pw-consent .wpcf7-form-control-wrap {
    flex: 0 0 auto !important;
    width: auto !important;
    display: inline-flex !important;
    margin: 0 !important;
}

.wpcf7 .pw-consent-text {
    flex: 1 1 auto;
    min-width: 0;
}

.wpcf7 .wpcf7-acceptance,
.wpcf7 .wpcf7-acceptance .wpcf7-list-item,
.wpcf7 .wpcf7-acceptance .wpcf7-list-item-label {
    display: inline !important;
    margin: 0 !important;
}

.wpcf7 .wpcf7-acceptance {
    flex: 0 0 auto;
}

.wpcf7 .wpcf7-acceptance input[type="checkbox"] {
    margin: .2rem 0 0 !important;
}


/* --------------------------------------------------------------------------
   Contact Form 7, validation and state
   -------------------------------------------------------------------------- */

.wpcf7 .wpcf7-not-valid-tip {
    display: block !important;
    position: static !important;
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin-top: .375rem;
    color: #ff6b6b !important;
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.4;
}

.wpcf7 .wpcf7-not-valid-tip::before,
.wpcf7 .wpcf7-not-valid-tip::after {
    display: none !important;
}

/* form-level message under the button, flush with it */
.wpcf7 .wpcf7-response-output {
    margin: 1rem 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    text-align: left;
}

/* CF7 disables submit until required consent is ticked. Keep the
   behaviour, drop the dimmed look. */
.wpcf7 input[type="submit"]:disabled,
.wpcf7 .wpcf7-submit:disabled {
    opacity: 1 !important;
    cursor: pointer;
}

/* honeypot, injected by the wpcf7_form_elements filter in the main
   plugin file. Positioned off-canvas rather than display:none, which
   some bots check for. */
.wpcf7 .pw-hp {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: .0625rem;
    height: .0625rem;
    overflow: hidden;
}

.wpcf7 .pw-form-notice-sub {
    display: inline-block;
    margin-top: .375rem;
    font-size: .6875rem;
    opacity: .8;
}


/* --------------------------------------------------------------------------
   Contact Form 7, submit row

   CF7 prints a spinner straight after the button. It is hidden with
   visibility, not display, so it keeps about 4.5rem of the row and
   drags anything centred in that row off centre. Positioned absolutely
   it stays beside the button without taking any width. Behind
   @supports because the anchor is found with :has(); without it the
   spinner keeps CF7's own inline placement.

   Below 48rem the button runs the full width of the card, the same as
   the fields above it, and the spinner sits inside its right edge.

   Scoped to rows that are direct children of the form, which is where
   CF7's autop puts the submit. The footer newsletter nests its button
   inside .pw-news-row, so it keeps its own inline layout.
   -------------------------------------------------------------------------- */

@supports selector(:has(*)) {

    html body .wpcf7 form > p:has(> .wpcf7-submit) {
        position: relative;
    }

    html body .wpcf7 form > p > .wpcf7-spinner {
        position: absolute;
        top: 50%;
        margin: -.75rem 0 0 .75rem;
    }

    @media (max-width: 48rem) {

        html body .wpcf7 form > p > .wpcf7-spinner {
            right: .75rem;
            margin: -.75rem 0 0;
        }
    }
}

@media (max-width: 48rem) {

    html body .wpcf7 form > p > .wpcf7-submit {
        display: block;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}


/* --------------------------------------------------------------------------
   Service tags

   Chips on the commission form. Unrelated to the service cards, which
   index their capabilities as an accent-dash list rather than chips.
   -------------------------------------------------------------------------- */

.pw-service-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin: 1rem 0 0;
}

.pw-service-tag {
    display: inline-block;
    background: var(--pw-surface, #202020);
    border: .1rem solid var(--pw-accent, #f63049);
    border-radius: 2rem;
    color: var(--pw-text, #f7f7f7);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .5rem 1.125rem;
    line-height: 1;
    white-space: nowrap;
}


/* --------------------------------------------------------------------------
   Footer newsletter

   CF7's autop wraps the controls in a <p> inside .pw-news-row, so the
   flex container has to be that paragraph, not the div.
   -------------------------------------------------------------------------- */

.pw-news-row > p {
    display: flex;
    align-items: stretch;
    gap: .375rem;
    margin: 0;
}

.pw-news-row .wpcf7-form-control-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
    margin: 0 !important;
}

.pw-news-row input[type="email"] {
    width: 100%;
    box-sizing: border-box;
    padding: .5rem .625rem;
    font-size: .8125rem;
    line-height: 1.4;
}

.pw-news-row input[type="submit"] {
    flex: 0 0 auto;
    width: auto;
    box-sizing: border-box;
    padding: .5rem .875rem;
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.4;
    border: .1rem solid var(--pw-accent, #f63049);
    border-radius: .375rem;
    background-color: transparent;
    color: var(--pw-text, #f7f7f7);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s;
}

.pw-news-row input[type="submit"]:hover {
    background-color: var(--pw-accent, #f63049);
}

.pw-news-row .wpcf7-spinner {
    display: none;
}

.pw-news-notice {
    font-size: .6875rem;
    line-height: 1.5;
    color: var(--pw-text-dim, #bbbbbb);
    margin: .5rem 0 0;
}

.pw-news-notice a {
    color: var(--pw-accent, #f63049);
}


/* --------------------------------------------------------------------------
   Page head

   Centred title and lede at the top of a BeBuilder page: blog, docs,
   support and the rest. Each page used to carry its own copy in a Code
   element <style> block. This is the one copy now, so delete those
   blocks; two copies will drift.

   pw-blog-head is the original name and stays as an alias so existing
   pages keep working untouched. New pages use pw-page-head.

   The title floor used to be 3rem, which made "Documentation" wider
   than a phone column, and the overflow guard further down then broke
   it mid-word rather than let it push the page sideways. The floor is
   2.25rem now, and the fluid term carries a rem offset so desktop sizes
   land where they did before.

   html body on the title and lede because Betheme's generated heading
   and paragraph rules print inline in the head, after this file. The
   Code element blocks only won because they printed later still.
   -------------------------------------------------------------------------- */

.pw-page-head,
.pw-blog-head {
    padding: 3.5rem 0 2.5rem;
    margin-bottom: 2rem;
    border-bottom: .0625rem solid var(--pw-line, #303030);
    text-align: center;
}

html body .pw-page-head__title,
html body .pw-blog-head__title {
    margin: 0 auto;
    max-width: 20ch;
    font-size: clamp(2.25rem, 1rem + 3.6vw, 4rem);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -.02em;
    color: var(--pw-text, #f7f7f7);
    text-wrap: balance;
}

html body .pw-page-head__lede,
html body .pw-blog-head__lede {
    margin: 1.5rem auto 0;
    max-width: 46ch;
    text-wrap: pretty;
}

@media (max-width: 64rem) {

    .pw-page-head,
    .pw-blog-head {
        padding: 1.5rem 0 2rem;
    }

    html body .pw-page-head__title,
    html body .pw-blog-head__title {
        max-width: none;
    }
}

@media (max-width: 37.5rem) {

    .pw-page-head,
    .pw-blog-head {
        padding: 1rem 0 1.5rem;
        margin-bottom: 1.5rem;
    }

    html body .pw-page-head__lede,
    html body .pw-blog-head__lede {
        margin-top: 1rem;
    }
}


/* --------------------------------------------------------------------------
   Motion and responsive
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    html body::before,
    html body::after {
        animation: none;
    }

    /* global.js bails on reduced motion, so --pw-mx and --pw-my stay at
       0%, but zero the translate anyway in case the variables were
       already set when the preference changed mid-session. */
    html::before,
    html body::before,
    html body::after {
        translate: none;
    }
}

/* --------------------------------------------------------------------------
   Form controls on touch

   iOS Safari zooms the viewport whenever a focused control has a font
   smaller than 16px, and then leaves it zoomed. Every field on this
   site is under that: the newsletter row is .8125rem, the contact form
   inherits Betheme's own sizing. The fix is to meet the threshold on
   coarse pointers only, so the desktop type scale is untouched.

   1rem rather than 16px because the root size is what the threshold is
   measured against, and this way a visitor who has raised their default
   font is not dragged back down to it.
   -------------------------------------------------------------------------- */

@media (pointer: coarse) {

    html body .wpcf7 input[type="text"],
    html body .wpcf7 input[type="email"],
    html body .wpcf7 input[type="tel"],
    html body .wpcf7 input[type="url"],
    html body .wpcf7 input[type="number"],
    html body .wpcf7 input[type="search"],
    html body .wpcf7 input[type="date"],
    html body .wpcf7 select,
    html body .wpcf7 textarea,
    html body [class^="pw-"] input,
    html body [class^="pw-"] select,
    html body [class^="pw-"] textarea {
        font-size: 1rem;
    }

    /* A checkbox rendered at its intrinsic size is roughly 13px and
       sits inside a consent sentence, which makes it the hardest
       target on the page to hit. */
    html body .wpcf7 input[type="checkbox"],
    html body .wpcf7 input[type="radio"] {
        width: 1.25rem;
        height: 1.25rem;
    }
}


/* --------------------------------------------------------------------------
   Form controls, sizing

   Betheme sizes fields from its own stylesheet and does not always set
   box-sizing, so a field with padding and width: 100% resolves wider
   than its container and pushes the card sideways. Scoped to forms
   inside plugin components so nothing here reaches a theme layout.
   -------------------------------------------------------------------------- */

html body .wpcf7 input,
html body .wpcf7 select,
html body .wpcf7 textarea,
html body [class^="pw-"] input,
html body [class^="pw-"] select,
html body [class^="pw-"] textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* A textarea is horizontally resizable by default, which on a phone
   lets the visitor drag the form wider than the screen. */
html body .wpcf7 textarea,
html body [class^="pw-"] textarea {
    resize: vertical;
}


/* --------------------------------------------------------------------------
   Overflow guards

   These sit outside any breakpoint because an element that overflows
   its column does so at every width, it is just that a wide viewport
   has the slack to hide it. Scoped to plugin components rather than
   applied globally, so nothing here can fight Betheme's own layout.
   -------------------------------------------------------------------------- */

html body [class^="pw-"],
html body [class*=" pw-"] {
    /* a long unbroken string, a filename in a manifest, a URL in an
       excerpt, an SKU, is otherwise unbreakable and sets a minimum
       width the grid track has to honour */
    overflow-wrap: break-word;
}

html body [class^="pw-"] img,
html body [class*=" pw-"] img,
html body [class^="pw-"] video,
html body [class*=" pw-"] video,
html body [class^="pw-"] iframe,
html body [class*=" pw-"] iframe {
    max-width: 100%;
}

/* An oversized table is the one case where clipping is worse than a
   scrollbar, so it gets its own scroll context rather than pushing the
   page sideways. */
html body [class^="pw-"] table,
html body [class*=" pw-"] table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

/* Grid and flex items refuse to shrink below their content's minimum
   size unless told to. This is the single most common cause of a
   layout that looks fine on desktop and pushes a horizontal scrollbar
   onto a tablet. */
html body .pw-product-body > *,
html body .pw-services > *,
html body .pw-store-grid > *,
html body .pw-folio-grid > *,
html body .pw-quotes > *,
html body .pw-files > *,
html body .pw-close > * {
    min-width: 0;
}


@media (max-width: 48rem) {
    :root {
        --pw-grid-size: 2rem;
    }

    /* Noise is invisible on a high-DPI phone screen and still costs a
       full-viewport composite. Drop it. */
    html::after {
        display: none;
    }
}

@media (max-width: 37.5rem) {

    /* Chips are already a wrapping flex row, but at full size four of
       them stack into four lines and push the form down the screen. */
    .pw-service-tags {
        gap: .375rem;
    }

    .pw-service-tag {
        padding: .4375rem .875rem;
        font-size: .75rem;
    }

    .pw-news-row > p {
        flex-wrap: wrap;
    }

    .pw-news-row input[type="text"],
    .pw-news-row input[type="email"] {
        width: 100%;
        min-width: 0;
    }

    .pw-news-row input[type="submit"] {
        width: 100%;
    }
}

/* Touch targets. 44px is the floor both platforms publish, and several
   of these controls were sized for a cursor. */
@media (pointer: coarse) {

    html body [class^="pw-"] a[class*="-cta"],
    html body [class^="pw-"] button,
    html body [class*=" pw-"] button {
        min-height: 2.75rem;
    }
}
