/**
 * Product Family Styling - Journal3 Theme
 * Keeps variant navigation aligned with the size selector and product options UI.
 */

.product-family-wrapper {
    --product-family-accent: rgb(225, 90, 40);
    --product-family-font-default: var(--j-font_size-default, 14px);
    --product-family-font-small: var(--j-font_size-small, 13px);
    margin-bottom: 20px;
}

#product > .product-family-wrapper + .button-group-page,
#product > .product-family-wrapper + script + .button-group-page,
#product > .product-family-wrapper + .product-options,
#product > .product-family-wrapper + script + .product-options {
    margin-top: 20px;
}

.product-family-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
}

.product-family-title {
    grid-column: 1 / -1;
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 0 8px;
    color: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.product-family-content {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-width: 0;
    container-type: inline-size;
}

.product-family-current {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    color: #666;
    font-size: var(--product-family-font-small);
    line-height: 1.4;
}

.product-family-current-label {
    color: #333;
    font-weight: 600;
    line-height: 34px;
}

.product-family-current-values {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.product-family-current-chip {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--product-family-accent);
    background: #fff;
}

.product-family-current-attribute {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.product-family-current-name {
    color: #666;
}

.current-variant-value {
    color: #333;
    font-weight: 600;
}

.variant-color-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.variant-color-swatch {
    --product-family-swatch-border: rgba(0, 0, 0, 0.12);
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid var(--product-family-swatch-border);
    border-radius: 50%;
    background: var(--product-family-swatch-color);
    flex: 0 0 14px;
}

.variant-color-swatch.is-light {
    --product-family-swatch-border: rgba(0, 0, 0, 0.3);
}

.product-family-current-chip .variant-color-swatch {
    box-shadow: 0 0 0 1px rgba(225, 90, 40, 0.18);
}

.variant-color-label:empty {
    display: none;
}

.product-family-variants {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
}

.variant-item {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.variant-link {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 56px;
    width: 100%;
    height: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.075s ease-out, border-color 0.075s ease-out, box-shadow 0.075s ease-out;
}

.variant-link:not(.is-disabled):hover {
    border-color: var(--product-family-accent);
    background: #f9f9f9;
    color: inherit;
    text-decoration: none;
}

.variant-link:not(.is-disabled):focus {
    border-color: var(--product-family-accent);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 0 0 2px rgba(225, 90, 40, 0.18);
}

.variant-link.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.variant-image {
    flex: 0 0 auto;
    width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: 1px solid #eee;
    background: #fff;
}

.variant-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

.variant-details {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.variant-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    min-width: 0;
}

.variant-attribute {
    display: inline-flex;
    gap: 4px;
    min-width: 0;
    font-size: var(--product-family-font-small);
    line-height: 1.4;
}

.variant-attribute-name {
    color: #666;
}

.variant-attribute-value {
    color: #333;
    font-weight: 600;
}

.variant-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
    color: #666;
    font-size: var(--product-family-font-small);
    line-height: 1.4;
}

.variant-model {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent 100%);
}

.variant-price {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    color: #333;
    font-weight: 600;
}

.variant-price .price-old {
    color: #999;
    font-weight: 400;
    text-decoration: line-through;
}

.variant-price .price-new {
    color: rgb(225, 90, 40);
}

.variant-stock-status {
    display: block;
    width: 100%;
    color: #a94442;
    font-size: var(--product-family-font-small);
    font-weight: 600;
    line-height: 1.4;
}

.product-family-more {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-family-variants-extra {
    display: none;
}

.product-family-more.is-open .product-family-variants-extra {
    display: grid;
}

.btn-product-family-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: center;
    padding: 6px 12px;
}

.btn-product-family-toggle .fa {
    transition: transform 0.2s ease;
}

.product-family-toggle-text-less {
    display: none;
}

.product-family-more.is-open .btn-product-family-toggle .fa {
    transform: rotate(180deg);
}

.product-family-more.is-open .product-family-toggle-text-more {
    display: none;
}

.product-family-more.is-open .product-family-toggle-text-less {
    display: inline;
}

@media (max-width: 768px) {
    .product-family-wrapper {
        --product-family-font-small: 14px;
    }

    .product-family-variants {
        grid-template-columns: 1fr;
    }

    .variant-link {
        width: 100%;
    }
}

@container (min-width: 520px) {
    .product-family-variants {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@container (max-width: 519px) {
    .product-family-variants {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container (max-width: 359px) {
    .product-family-variants {
        grid-template-columns: 1fr;
    }
}
