/* Merati engraving options - deliberately low-specificity and token-light so the
   Bijoux theme's own typography and colours come through. */

/* The theme lays the add-to-cart form out as a nowrap flex row, so a full-width
   engraving block gets squeezed in beside the quantity and button. Allowing the row to
   wrap lets it take its own line. Products without engraving are unaffected: their
   items already fit on one line, and wrap only kicks in on overflow.

   Note the bare selector: this Elementor template renders the widget without
   WooCommerce's usual ".woocommerce div.product" wrapper, so anything scoped to that
   never matches here.

   !important is deliberate. Elementor injects per-widget CSS inline and late, and it
   sets nowrap on this form; matching its generated selector would mean guessing at an
   element id that changes whenever the template is rebuilt. One property, one form. */
form.cart {
    flex-wrap: wrap !important;
}

.merati-engraving {
    margin: 1.5em 0;
    padding: 1.25em 0 0;
    border-top: 1px solid rgba(0, 0, 0, .12);
    width: 100%;
    /* On simple products this block lands next to the quantity and Add to Cart, which
       Elementor lays out as a flex row - without a full-width basis it gets squeezed
       into a narrow column. Variable products render it above that row already. */
    flex: 1 1 100%;
    max-width: 100%;
}

.merati-engraving__legend {
    margin: 0 0 .75em;
    font-size: .85em;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .75;
}

.merati-engraving__modes {
    display: flex;
    flex-wrap: wrap;
    gap: .5em 1.5em;
    margin-bottom: 1em;
}

.merati-engraving__mode {
    display: inline-flex;
    align-items: center;
    gap: .5em;
    cursor: pointer;
    margin: 0;
}

.merati-engraving__mode input {
    margin: 0;
}

.merati-engraving__panel[hidden] {
    display: none;
}

.merati-engraving__set-name {
    margin: .5em 0 .5em;
    font-size: .8em;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: .6;
}

.merati-engraving__designs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: .6em;
    list-style: none;
    margin: 0 0 1.25em;
    padding: 0;
}

.merati-engraving__designs li {
    margin: 0;
}

.merati-engraving__designs label {
    display: block;
    cursor: pointer;
    margin: 0;
}

/* Keep the radio reachable by keyboard and screen readers rather than display:none. */
.merati-engraving__designs input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.merati-engraving__design {
    display: block;
    padding: .4em;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 3px;
    text-align: center;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.merati-engraving__design img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    margin: 0 auto .35em;
}

.merati-engraving__noimg {
    display: block;
    aspect-ratio: 1 / 1;
    margin-bottom: .35em;
    background: rgba(0, 0, 0, .05);
}

.merati-engraving__design-name {
    display: block;
    font-size: .78em;
    line-height: 1.3;
}

.merati-engraving__designs input:checked + .merati-engraving__design {
    border-color: currentColor;
    box-shadow: inset 0 0 0 1px currentColor;
}

.merati-engraving__designs input:focus-visible + .merati-engraving__design {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.merati-engraving__field {
    margin: 0 0 1em;
}

.merati-engraving__field label {
    display: block;
    margin-bottom: .35em;
    font-size: .85em;
}

.merati-engraving__field textarea {
    width: 100%;
    padding: .6em .75em;
    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: 3px;
    font: inherit;
    resize: vertical;
}

.merati-engraving__field input[type="file"] {
    width: 100%;
    font-size: .85em;
}

.merati-engraving__hint {
    display: block;
    margin-top: .3em;
    font-size: .75em;
    opacity: .65;
}

.merati-engraving__hint--block {
    margin: 0;
}

.merati-engraving__hint--over {
    opacity: 1;
    color: #b3261e;
}

/* Brief highlight when a chosen design's photo is promoted to the top of the gallery. */
@keyframes merati-engraving-flash {
    0%   { box-shadow: 0 0 0 3px currentColor; }
    100% { box-shadow: 0 0 0 3px rgba(0, 0, 0, 0); }
}

.woocommerce-product-gallery__image.merati-engraving__flash {
    animation: merati-engraving-flash 1.4s ease-out 1;
}

@media (prefers-reduced-motion: reduce) {
    .woocommerce-product-gallery__image.merati-engraving__flash { animation: none; }
}
