/* Order a Sample — scoped styles (template: templates/sample.php) */

/* Constrain the Shopify product grid on very wide screens. Not provided by
   Bootstrap or the parent/child theme, so define it here. */
.mw-1500 {
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
}

/* Give each variant tile breathing room when the flex grid wraps. */
#ts-order-products .ts-shopify-grid > div {
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Order-a-Sample HubSpot form (#ts-order-form)
   Restyles the raw embed into an on-brand, multi-column layout.
   All rules are scoped to #ts-order-form so the global .hs-form styles in
   style.css (and the quote/lookbook/footer forms) are left untouched.
   ========================================================================== */

#ts-order-form .has-form {
    max-width: 760px;
    /* Left-aligned (not centered) so the form's left edge lines up with the
       "Request Your Sample" heading and intro above it. */
    margin: 2.5rem 0 0;
}

/* --- Field wrappers / rhythm --- */
#ts-order-form .hs-form fieldset {
    margin-bottom: 1.25rem;
}
#ts-order-form .hs-form fieldset:last-of-type {
    margin-bottom: 0;
}

/* Restore HubSpot's two-up rows (global rule forces every field to 100%). */
#ts-order-form .form-columns-2 {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
#ts-order-form .form-columns-2 .hs-form-field {
    flex: 1 1 240px;
    width: auto !important;
    margin-bottom: 0;
}
/* Hide the empty richtext spacer HubSpot injects into two-up rows. */
#ts-order-form .form-columns-2 .hs-richtext {
    display: none;
}
#ts-order-form .form-columns-1 .hs-form-field {
    margin-bottom: 0;
}

/* --- Labels: hide the empty placeholder-only labels, style the real ones. --- */
#ts-order-form .hs-form-field > label:has(> span:only-child:empty) {
    display: none;
}
#ts-order-form .hs-form-field > label {
    display: block;
    margin-bottom: 0.5rem;
    font-family: var(--ts-font);
    font-weight: 600;
    color: var(--ts-grey);
}

/* Field help text (e.g. the photo-upload "PHOTO TIPS" note) is a <legend>
   that renders at 24px by default — bring it down to readable help-text size. */
#ts-order-form .hs-field-desc {
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 400;
    color: var(--ts-grey);
    padding: 0;
    margin: 0.25rem 0 0.75rem;
}

/* --- Inputs / select / textarea: soft, branded, consistent. --- */
#ts-order-form .hs-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d6d2c4;
    border-radius: 2px;
    background-color: #fff;
    font-family: var(--ts-font);
    font-size: 1rem;
    color: var(--ts-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}
#ts-order-form textarea.hs-input {
    min-height: 120px;
    resize: vertical;
}
#ts-order-form .hs-input::placeholder {
    color: #9a9a9a;
}
#ts-order-form .hs-input:focus {
    outline: none;
    border-color: var(--ts-cyan);
    box-shadow: 0 0 0 3px rgba(46, 151, 191, 0.15);
}

/* Custom chevron for the "I am a..." select (appearance reset). */
#ts-order-form select.hs-input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232E97BF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

/* Keep checkboxes/radios from being stretched to 100% by the global rule. */
#ts-order-form input[type="checkbox"],
#ts-order-form input[type="radio"] {
    width: auto !important;
    padding: 0;
    margin: 0;
    accent-color: var(--ts-cyan);
}

/* --- "Are you working with a contractor?" radios: inline. --- */
#ts-order-form .hs-fieldtype-radio > label,
#ts-order-form .hs-dependent-field > div > label {
    color: var(--ts-grey);
    font-weight: 600;
}
#ts-order-form .inputs-list {
    list-style: none;
    padding-left: 0;
    margin: 0.75rem 0 0;
}
#ts-order-form .hs-form-radio {
    display: inline-block;
    margin-right: 1.5rem;
}
#ts-order-form .hs-form-radio-display,
#ts-order-form .hs-form-booleancheckbox-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* --- File upload button. --- */
#ts-order-form input[type="file"].hs-input {
    padding: 10px;
    background: #fff;
}
#ts-order-form input[type="file"]::file-selector-button {
    margin-right: 1rem;
    padding: 0.55rem 1.1rem;
    border: 0;
    background: var(--ts-cyan);
    color: #fff;
    font-family: var(--ts-font);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s;
}
#ts-order-form input[type="file"]::file-selector-button:hover {
    opacity: 0.85;
}

/* --- "Choose your Style!" -> swatch cards (image paired with checkbox).
   The swatch <img> is cloned into each checkbox <li> by order-form.php's
   onFormReady handler; here we lay each option out as a card: circular swatch
   on top, checkbox + label beneath, with a cyan ring when selected. --- */
#ts-order-form .hs_choose_your_color > label {
    display: block;
    /* Left-aligned to match the other field labels above (the form is
       left-aligned within .has-form, not centered). */
    text-align: left;
    margin-bottom: 1.25rem;
}
#ts-order-form .hs_choose_your_color .inputs-list {
    display: flex;
    flex-wrap: wrap;
    /* Left-align the swatch grid so its left edge and width line up with the
       form fields above (was centered, which read as a narrower, off-axis block). */
    justify-content: flex-start;
    gap: 1.5rem 1rem;
    margin: 0;
}
#ts-order-form .hs_choose_your_color .hs-form-checkbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 150px;
    margin: 0;
}
#ts-order-form .ts-swatch-img {
    display: block;
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 2px;
    border: 2px solid var(--ts-gold);
    margin: 0 auto 0.6rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
/* Natural inline flow (not flex) so the checkbox stays attached to the label
   and the pair centers cleanly even when the label wraps to two lines. */
#ts-order-form .hs_choose_your_color .hs-form-checkbox-display {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.9rem;
    line-height: 1.3;
    text-align: center;
    cursor: pointer;
    transition: color 0.2s;
}
#ts-order-form .hs_choose_your_color .hs-form-checkbox-display input {
    margin-right: 0.35rem !important;
    vertical-align: middle;
}
#ts-order-form .hs_choose_your_color .hs-form-checkbox-display span {
    vertical-align: middle;
}
/* Selected state: cyan ring on the swatch + emphasized label. */
#ts-order-form .hs-form-checkbox:has(input:checked) .ts-swatch-img {
    border-color: var(--ts-cyan);
    box-shadow: 0 0 0 3px rgba(46, 151, 191, 0.25);
}
#ts-order-form .hs-form-checkbox-display:has(input:checked) {
    color: var(--ts-cyan);
    font-weight: 600;
}
#ts-order-form .hs-form-checkbox:hover .ts-swatch-img {
    border-color: var(--ts-cyan);
}

/* --- Swatch gallery (richtext .swatchWrapper) -> centered circular row. ---
   HubSpot's richtext nests these thumbnails inconsistently (some at
   .swatch > img, others buried in .titleBottom > .titleBottom > img) and the
   Rustic ones ship an inline width:300px. Rather than fight the nesting, drop
   to an inline-block flow: font-size:0 on the wrapper collapses every caption
   and the whitespace between tiles, the wrapper divs unwrap to inline, and the
   images flow as equal circular siblings regardless of how deep they sit. */
#ts-order-form .swatchWrapper {
    text-align: center;
    font-size: 0;
    line-height: 0;
    /* Width for four 88px circles + margins so the row breaks 4 Classic /
       4 Rustic, echoing the two collections. */
    max-width: 460px;
    margin: 1.25rem auto 0;
}
#ts-order-form .swatchWrapper .swatch,
#ts-order-form .swatchWrapper .titleBottom {
    display: inline;
}
#ts-order-form .swatchWrapper br {
    display: none;
}
#ts-order-form .swatchWrapper img {
    display: inline-block;
    width: 88px !important;
    height: 88px !important;
    max-width: 88px !important;
    margin: 8px;
    object-fit: cover;
    border-radius: 2px;
    border: 2px solid var(--ts-gold);
    vertical-align: middle;
}

/* --- Validation messages. --- */
#ts-order-form .hs-error-msgs {
    list-style: none;
    padding-left: 0;
    margin: 0.4rem 0 0;
}
#ts-order-form .hs-error-msg,
#ts-order-form .hs-error-msgs label {
    color: #c0392b;
    font-size: 0.85rem;
}

/* --- Submit button (centered, brand outline -> fill on hover). --- */
#ts-order-form .hs_submit {
    text-align: center;
}
#ts-order-form .hs_submit .actions {
    margin-top: 1.5rem;
}
#ts-order-form .hs_submit input.hs-button {
    width: auto;
    min-width: 220px;
    margin-top: 1.5rem !important;
    padding: 13px 48px !important;
    background: #fff !important;
    color: var(--ts-cyan) !important;
    border: 2px solid var(--ts-cyan) !important;
    border-radius: 0;
    font-family: var(--ts-font);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background-color 0.25s, color 0.25s;
}
#ts-order-form .hs_submit input.hs-button:hover {
    background: var(--ts-cyan) !important;
    color: #fff !important;
}
