/*
 * PartsDone_HomeFitment 1.0.17
 * A7.4.2e r12 — exact Hyvä controls and clean CMS architecture.
 *
 * Real Hyvä classes own controls and cards. This stylesheet keeps only
 * HomeFitment layout, VIN popover geometry, brand/category media sizing, and
 * targeted reconciliation for the homepage component layout.
 */

.pd-custom-fitment,
.pd-custom-fitment * {
    box-sizing: border-box;
}

.pd-custom-fitment {
    color: var(--color-fg);
}

.pd-custom-fitment-form {
    width: 100%;
}

.pd-custom-fitment .w-full {
    width: 100%;
}

.pd-custom-fitment-actions {
    width: 100%;
}

.pd-custom-fitment-actions > .btn {
    width: 100%;
}

.pd-custom-fitment [hidden] {
    display: none !important;
}

/* -------------------------------------------------------------------------
   Genuine Hyvä form controls
   ------------------------------------------------------------------------- */

.pd-custom-fitment .form-select,
.pd-custom-fitment .form-input {
    width: 100%;
}

/* Preserve the exact installed Hyvä form geometry used by the approved finder. */
.pd-home-body-v41 .pd-custom-fitment .pd-custom-fitment-form .form-select,
.pd-home-body-v41 .pd-custom-fitment .pd-custom-fitment-form .form-input {
    height: 42px !important;
    min-height: 0 !important;
    border: 1px solid var(--form-stroke) !important;
    border-radius: var(--form-radius) !important;
    background-color: var(--form-bg) !important;
    color: var(--form-color) !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    font-weight: 400 !important;
    line-height: 1.5rem !important;
    box-shadow: none !important;
}

.pd-home-body-v41 .pd-custom-fitment .pd-custom-fitment-form .form-input {
    padding: .5rem .75rem !important;
}

.pd-home-body-v41 .pd-custom-fitment .pd-custom-fitment-form select.form-select {
    padding: .5rem 2.32rem .5rem .75rem !important;
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' stroke='hsl(0 0% 0%)'><path d='m6 9 6 6 6-6'/></svg>") !important;
    background-position: right .75rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.25em 1.25em !important;
    appearance: none !important;
}

.pd-custom-fitment .form-select:disabled,
.pd-custom-fitment .form-input:disabled {
    cursor: not-allowed;
    opacity: .5 !important;
}

.pd-custom-fitment .form-input::placeholder {
    color: var(--color-fg-secondary);
}

/* -------------------------------------------------------------------------
   Hyvä / GDS buttons
   ------------------------------------------------------------------------- */

/*
 * Button appearance is intentionally not restyled here. The template uses
 * the installed Hyvä/GDS classes (btn + btn-primary/btn-secondary) directly,
 * so Global Design System Settings remains the single visual source of truth.
 */

/* -------------------------------------------------------------------------
   VIN actions and help card
   ------------------------------------------------------------------------- */

.pd-home-body-v41 .pd-home-finder-card,
.pd-home-body-v41 .pd-home-finder-body,
.pd-home-body-v41 .pd-custom-fitment,
.pd-home-body-v41 .pd-custom-fitment-form {
    overflow: visible !important;
}

.pd-custom-fitment .pd-custom-vin-actions,
.pd-home-body-v41 .pd-custom-fitment .pd-custom-vin-actions {
    position: relative !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: .5rem !important;
    align-items: start !important;
    justify-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow: visible !important;
    transform: none !important;
}


.pd-custom-fitment .pd-custom-vin-popover.card,
.pd-home-body-v41 .pd-custom-fitment .pd-custom-vin-actions .pd-custom-vin-popover.card {
    position: absolute !important;
    top: calc(100% + .625rem) !important;
    right: auto !important;
    bottom: auto !important;
    left: 0 !important;
    z-index: 10050 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1.5rem !important;
    border: 1px solid var(--card-stroke, oklch(87.2% .01 258.338)) !important;
    border-radius: var(--card-radius, var(--radius-lg, .5rem)) !important;
    background: var(--card-bg, var(--color-surface, #fff)) !important;
    color: var(--color-fg) !important;
    box-shadow: var(--shadow-xl, 0 16px 40px rgb(15 23 42 / .18)) !important;
    transform: none !important;
}

.pd-custom-fitment .pd-custom-vin-popover.card[hidden] {
    display: none !important;
}

.pd-custom-fitment .pd-custom-vin-popover > strong {
    display: block;
    padding-right: 2.75rem;
    font-size: 1rem;
    line-height: 1.5rem;
}

.pd-custom-fitment .pd-custom-vin-popover > p {
    margin: .5rem 0 0;
    color: var(--color-fg-secondary);
    font-size: .875rem;
    line-height: 1.375rem;
}

.pd-custom-fitment .pd-custom-vin-close.btn {
    position: absolute !important;
    top: .5rem !important;
    right: .5rem !important;
    width: 2.5rem !important;
    min-width: 2.5rem !important;
    height: 2.5rem !important;
    min-height: 0 !important;
    padding: .5rem !important;
    font-size: 1.25rem !important;
    line-height: 1 !important;
}

.pd-custom-fitment .pd-custom-vin-locations {
    display: grid;
    gap: .5rem;
    margin-top: 1rem;
}

.pd-custom-fitment .pd-custom-vin-locations > div {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr);
    align-items: center;
    gap: .625rem;
    color: var(--color-fg-secondary);
    font-size: .875rem;
    line-height: 1.25rem;
}

.pd-custom-fitment .pd-custom-vin-locations > div > span {
    display: inline-grid;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface, #fff));
    color: var(--color-primary);
    font-weight: 600;
}

/* -------------------------------------------------------------------------
   Hyvä messages and garage checkbox
   ------------------------------------------------------------------------- */

.pd-custom-fitment .pd-custom-message.message[hidden] {
    display: none !important;
}

.pd-home-body-v41 .pd-custom-fitment .pd-custom-message.message:not([hidden]) {
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: .5rem .5rem .5rem 1.25rem !important;
    overflow: visible !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    line-height: 1.5rem !important;
}

.pd-custom-fitment .pd-custom-garage {
    display: inline-flex;
    align-items: center;
    gap: .625rem;
    color: var(--color-fg);
    font-size: .875rem;
    line-height: 1.25rem;
    cursor: pointer;
}

/* PD_HOMEFITMENT_A7_4_2E_R12_CLEAN_CMS_ARCHITECTURE */

/* -------------------------------------------------------------------------
   Attribute-driven brands and top categories
   ------------------------------------------------------------------------- */

.pd-home-body-v41 .pd-magento-brand-card.card,
.pd-home-body-v41 .pd-magento-category-card.card {
    border: 1px solid var(--card-stroke, oklch(87.2% .01 258.338)) !important;
    border-radius: var(--card-radius, var(--radius-lg, .5rem)) !important;
    background: var(--card-bg, var(--color-surface, #fff)) !important;
    color: var(--color-fg) !important;
    /* Keep the normal card shadow configurable, but do not make it important.
       The homepage hover rule must be allowed to apply the approved shadow. */
    box-shadow: var(--shadow-card, none);
    text-decoration: none;
}

.pd-magento-brand-card.card {
    min-height: 132px !important;
    flex-direction: column !important;
    gap: .625rem !important;
    padding: .875rem !important;
}

.pd-brand-card__visual {
    display: flex;
    width: 110px;
    height: 66px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
}

.pd-brand-card__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 110px;
    max-height: 66px;
    object-fit: contain;
}

.pd-brand-card__color,
.pd-brand-card__fallback {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 9999px;
}

.pd-brand-card__color {
    border: 1px solid var(--form-stroke);
    box-shadow: inset 0 0 0 3px var(--color-surface, #fff);
}

.pd-brand-card__fallback {
    background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface, #fff));
    color: var(--color-primary);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.pd-brand-card__name {
    display: block;
    max-width: 100%;
    color: inherit;
    font-size: .875rem;
    line-height: 1.25rem;
    text-align: center;
    overflow-wrap: anywhere;
}

.pd-magento-category-card.card {
    color: var(--color-fg) !important;
}

@media (max-width: 768px) {
    .pd-custom-fitment .pd-custom-vin-popover.card,
    .pd-home-body-v41 .pd-custom-fitment .pd-custom-vin-actions .pd-custom-vin-popover.card {
        right: 0 !important;
        left: 0 !important;
        padding: 1.25rem !important;
    }
}

/* PD_GDS_A7_4_2E_R2_EXACT_HYVA_BUTTON_GEOMETRY */


/* PARTSDONE_HOMEFITMENT_SHARED_VIN_TRIGGER_V4_20260729
 * Reuse the exact FitmentPro VIN-help trigger contract on the homepage.
 * The higher specificity only prevents HomeFitment action sizing from
 * overriding the shared component. */
.pd-home-body-v41 .pd-custom-fitment .pd-custom-vin-actions .pd-vin-fitment-help-toggle {
    grid-column: 1 / -1 !important;
    justify-self: start !important;
    display: inline !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--pd-fitment-color-primary, var(--color-primary)) !important;
    box-shadow: none !important;
    font-family: var(--pd-fitment-font-family, inherit) !important;
    font-size: var(--pd-fitment-font-size-sm, .875rem) !important;
    font-weight: var(--pd-fitment-weight-semibold, 600) !important;
    line-height: var(--pd-fitment-line-height-base, 1.5) !important;
    text-align: left !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    transform: none !important;
}

.pd-home-body-v41 .pd-custom-fitment .pd-custom-vin-actions .pd-vin-fitment-help-toggle:hover,
.pd-home-body-v41 .pd-custom-fitment .pd-custom-vin-actions .pd-vin-fitment-help-toggle[aria-expanded="true"] {
    background: transparent !important;
    color: var(--pd-fitment-color-primary-hover, var(--color-primary-darker, var(--color-primary))) !important;
    text-decoration: underline !important;
    text-underline-offset: 2px !important;
}
