/**
 * Homepage Styles — Elementor + Hero Slider
 *
 * Hero slider is rendered via [flaman_hero_slider] shortcode (PHP + JS).
 * Remaining sections are built with Elementor widgets — these styles
 * provide the design-system overrides on top of Elementor's defaults.
 *
 * @package Flaman_Storefront
 */

/* ============================================
   Layout Overrides
   ============================================ */

.homepage.site-main {
    padding-top: 0;
}

/* Remove WP block layout padding if Elementor wraps in entry-content */
.homepage .entry-content {
    padding: 0 !important;
    max-width: none !important;
}

/* Section spacing — vertical gap between top-level sections */
.homepage .elementor-top-section:not(:last-child) {
    margin-bottom: var(--spacing-2xl);
}

/* Hero needs less bottom margin (its own padding is 0) */
.homepage .homepage-hero-section {
    margin-bottom: var(--spacing-lg);
}

/* Elementor resets — match header container (1400px + side padding) */
/* Only top-level sections get side padding; inner sections inherit from parent */
.homepage .elementor-top-section.elementor-section-boxed > .elementor-container {
    max-width: 1400px;
    padding: 0 var(--spacing-lg);
    box-sizing: border-box;
}

.homepage .elementor-inner-section.elementor-section-boxed > .elementor-container {
    max-width: none !important;
    padding: 0;
}

/* ============================================
   1. Hero Slider (shortcode-rendered)
   ============================================ */

.homepage-hero {
    background: transparent;
    color: #fff;
    position: relative;
    overflow: hidden;
    padding: 10px 0;
}

.homepage-hero .container {
    max-width: 1400px;
}

.hero-carousel {
    position: relative;
    background: var(--flaman-blue);
    border-radius: 7px;
}

.hero-track {
    display: grid;
    position: relative;
    overflow: hidden;
}

.hero-slide {
    grid-area: 1 / 1;
    visibility: hidden;
    position: relative;
    z-index: 0;
}

.hero-slide.is-active {
    visibility: visible;
    z-index: 1;
}

.hero-slide.is-animating {
    visibility: visible;
    z-index: 2;
}

/* Per-slide background — center blue box + side fillers (all slide with content) */
.hero-slide-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1400px;
    background: var(--flaman-blue);
    border-radius: 7px;
    pointer-events: none;
}

.hero-slide-bg::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: calc(100% + 10px);
    width: calc(50vw - 710px);
    background: var(--flaman-blue);
    border-radius: 0 7px 7px 0;
}

.hero-slide-bg::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(100% + 10px);
    width: calc(50vw - 710px);
    background: var(--flaman-blue);
    border-radius: 7px 0 0 7px;
}

/* Static filler backdrop — keeps viewport edges blue while per-slide fillers slide away */
.homepage-hero::before,
.homepage-hero::after {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    background: var(--flaman-blue);
    pointer-events: none;
    z-index: 0;
}

.homepage-hero::before {
    left: 0;
    width: calc(50% - 710px);
    border-radius: 0 7px 7px 0;
}

.homepage-hero::after {
    right: 0;
    width: calc(50% - 710px);
    border-radius: 7px 0 0 7px;
}

.hero-slide > .container {
    position: relative;
    z-index: 1;
}

/* Nav — flows below the track, still inside the blue carousel bg */
.hero-carousel > .container {
    position: relative;
    z-index: 2;
}

.hero-slide-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl);
    align-items: center;
    height: 530px;
    padding: var(--spacing-2xl) 0;
    overflow: hidden;
}

.hero-text h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 var(--spacing-md);
    color: #fff;
}

.hero-text h1 em {
    font-style: italic;
}

.hero-underline {
    width: 60px;
    height: 4px;
    background: var(--flaman-red);
    margin-bottom: var(--spacing-lg);
    border-radius: 2px;
}

.hero-text p {
    font-size: 1rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 var(--spacing-xl);
    max-width: 480px;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
}

.hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.hero-btn.btn-primary {
    background: var(--flaman-red);
    color: #fff;
    border: 2px solid var(--flaman-red);
}

.hero-btn.btn-primary:hover {
    background: var(--flaman-red-dark);
    border-color: var(--flaman-red-dark);
}

.hero-btn.btn-outline {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.hero-btn.btn-outline:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.hero-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Hero navigation — full-width bar beneath the image, inside the blue container.
   Dots on the left, arrows on the right. */
.hero-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) 0 var(--spacing-lg);
}

.hero-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hero-nav-btn.hero-prev:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.hero-nav-btn.hero-next {
    background: var(--flaman-red);
    border-color: var(--flaman-red);
}

.hero-nav-btn.hero-next:hover {
    background: var(--flaman-red-dark);
    border-color: var(--flaman-red-dark);
}

.hero-arrows {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Hero dot indicators */
.hero-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}

.hero-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-fast);
}

.hero-dot:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.3);
}

.hero-dot.is-active {
    background: #C4161C;
    border-color: #C4161C;
    width: 24px;
    border-radius: 5px;
}

/* ============================================
   2. Category Tiles (shortcode — scrollable row)
   ============================================ */

/* Contain the scrollable row within Elementor's flex nesting */
.homepage-categories {
    overflow: hidden;
}

.homepage-categories-section .elementor-widget-wrap,
.homepage-categories-section .elementor-shortcode {
    min-width: 0;
}

/* Category card */
.category-tile {
    flex: 0 0 calc((100% - 5 * 24px) / 6);
    background: #fff;
    border: 1px solid #DBE1E5;
    border-radius: 7px;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    text-decoration: none;
    color: inherit;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.category-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-sm);
}

/* Tile image — 4:3 container */
.category-tile-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
}

.category-tile-image img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
}

/* Cycling images */
.category-tile-image[data-cycle] {
    position: relative;
}

.category-tile-image[data-cycle] .cycle-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.category-tile-image[data-cycle] .cycle-img.active {
    position: relative;
    opacity: 1;
}

/* Tile label */
.category-tile-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
}

/* ============================================
   3. Latest Inventory (shortcode)
   ============================================ */

.homepage-section {
    padding: 0;
}

.homepage-section-title {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-xl);
}

.homepage-section-title strong {
    color: var(--flaman-red);
    font-weight: 700;
}

/* Inventory scrollable row — product cards */
.homepage-inventory {
    overflow: hidden;
}

.homepage-inventory-section .elementor-widget-wrap,
.homepage-inventory-section .elementor-shortcode {
    min-width: 0;
}

.inventory-row {
    list-style: none;
    margin: 0;
    padding: 0;
}

.inventory-row > li {
    flex: 0 0 calc((100% - 3 * 24px) / 4);
    width: calc((100% - 3 * 24px) / 4) !important;
}

/* Match PLP product card title styles */
.inventory-row .woocommerce-loop-product__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}


/* ============================================
   4. Shop By Brand (scrollable shortcode)
   ============================================ */

/* Contain the scrollable row within Elementor's flex nesting */
.homepage-brands {
    overflow: hidden;
}

.homepage-brands-section .elementor-widget-wrap,
.homepage-brands-section .elementor-shortcode {
    min-width: 0;
}

/* Section header — title left, nav right */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.section-header-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.2;
    color: #003646;
    margin: 0;
}

.section-header-title span {
    color: #C4161C;
}

.section-header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Pagination dots */
.pagination-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 10px;
    background: #DBE1E5;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-dots .dot.is-active {
    width: 20px;
    background: #C4161C;
}

/* Scroll arrow button */
.scroll-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #DBE1E5;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    padding: 0;
    color: #C4161C;
}

.scroll-arrow:hover:not(:disabled) {
    border-color: #C4161C;
}

.scroll-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Scrollable row */
.scrollable-row {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
}

.scrollable-row > * {
    scroll-snap-align: start;
}

.scrollable-row::-webkit-scrollbar {
    display: none;
}

/* Brand cards */
.homepage-brands .brand-card {
    flex: 0 0 calc((100% - 5 * 24px) / 6);
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.homepage-brands .brand-card:hover {
    border-color: var(--flaman-red);
    box-shadow: var(--shadow-sm);
}

.homepage-brands .brand-card img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    object-position: center;
    padding: var(--spacing-md);
}

/* ============================================
   5. Parts & Accessories (native Elementor widgets)
   ============================================ */

/* Card — CSS class on Elementor column */
.parts-card {
    background: var(--background-gray);
    border-radius: 16px;
    overflow: hidden;
}

.parts-card > .elementor-widget-wrap {
    padding: var(--spacing-2xl) !important;
}

/* Inner section layout — gap and vertical centering */
.parts-card .elementor-inner-section > .elementor-container {
    gap: var(--spacing-2xl);
    align-items: center;
}

/* Text column */
.parts-text-col > .elementor-widget-wrap {
    padding: 0 !important;
    gap: var(--spacing-md);
}

.parts-card h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.parts-card h2 strong {
    font-weight: 700;
}

.parts-card .parts-text-col p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* Button — red CTA */
.parts-card .elementor-button {
    background-color: var(--flaman-red) !important;
    color: #fff !important;
    border: 2px solid var(--flaman-red) !important;
    border-radius: 6px !important;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.parts-card .elementor-button:hover {
    background-color: var(--flaman-red-dark) !important;
    border-color: var(--flaman-red-dark) !important;
    color: #fff !important;
}

/* Tile columns — card style (matches category tiles) */
.parts-tile-col {
    background: #fff;
    border: 1px solid #DBE1E5;
    border-radius: 7px;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
}

.parts-tile-col:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-sm);
}

.parts-tile-col > .elementor-widget-wrap {
    padding: var(--spacing-md) !important;
    gap: var(--spacing-sm);
    align-items: center;
}

/* Tile images — 4:3 container, centered, no deformation */
.parts-tile-col .elementor-widget-image {
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    overflow: hidden !important;
    border-radius: 6px;
    background: var(--background-gray);
}

.parts-tile-col .elementor-widget-image a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.parts-tile-col .elementor-widget-image img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* Tile labels */
.parts-tile-col .elementor-heading-title {
    font-size: 0.875rem !important;
    font-weight: 600;
    color: var(--text-primary) !important;
    text-align: center;
}

/* Tile links — no blue/visited color */
.parts-tile-col a {
    color: inherit !important;
    text-decoration: none !important;
}

/* ============================================
   6. Promo Cards (native Elementor widgets)
   ============================================ */

/* 24px gap between the two card columns */
.homepage-promos-section > .elementor-container {
    gap: 24px;
}

/* Card container — CSS class applied to Elementor column */
.promo-card {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #E5E7EB;
    transition: box-shadow var(--transition-fast);
}

.promo-card:hover {
    box-shadow: var(--shadow-md);
}

/* Card inner padding */
.promo-card > .elementor-widget-wrap {
    padding: var(--spacing-xl) !important;
}

/* Image — flush to card edges, 2:1 crop, fill from center */
.promo-card .elementor-widget-image {
    aspect-ratio: 2 / 1 !important;
    overflow: hidden !important;
    background: var(--background-gray);
}

.promo-card .elementor-widget-image img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}


/* Heading (h3 inside text-editor widget) */
.promo-card h3 {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-primary);
    margin: 0;
}

.promo-card h3 strong {
    font-weight: 700;
}

/* Description paragraph */
.promo-card .elementor-widget-text-editor p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* Button — red CTA (!important to override Elementor kit defaults) */
.promo-card .elementor-button {
    background-color: var(--flaman-red) !important;
    color: #fff !important;
    border: 2px solid var(--flaman-red) !important;
    border-radius: 6px !important;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.promo-card .elementor-button:hover {
    background-color: var(--flaman-red-dark) !important;
    border-color: var(--flaman-red-dark) !important;
    color: #fff !important;
}

/* ============================================
   Elementor Widget Overrides
   ============================================ */

/* Make Elementor section titles match Figma design */
.homepage .elementor-heading-title {
    font-family: var(--font-primary);
}

/* Reset Elementor default margins inside homepage */
.homepage .elementor-widget-text-editor p:last-child {
    margin-bottom: 0;
}

/* Elementor shortcode widget — remove extra wrapper padding */
.homepage .elementor-widget-shortcode {
    width: 100%;
}

/* ============================================
   Responsive — 1024px (Tablet Landscape)
   ============================================ */

@media (max-width: 1024px) {
    .hero-slide-inner {
        min-height: 380px;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .inventory-row > li {
        flex: 0 0 calc((100% - 2 * 24px) / 3);
        width: calc((100% - 2 * 24px) / 3) !important;
    }

    .parts-card .elementor-inner-section > .elementor-container {
        gap: var(--spacing-xl);
        flex-wrap: wrap;
    }

    .parts-card .parts-text-col {
        width: 100% !important;
    }

    .parts-card .parts-tile-col {
        width: 30% !important;
        flex: 1;
    }

    .homepage-promos-section > .elementor-container {
        flex-direction: column;
        gap: 20px;
    }

    .homepage-promos-section .elementor-column {
        width: 100% !important;
    }

    .homepage-brands .brand-card {
        flex: 0 0 calc((100% - 3 * 24px) / 4);
    }

    .category-tile {
        flex: 0 0 calc((100% - 3 * 24px) / 4);
    }
}

/* ============================================
   Responsive — 768px (Tablet Portrait)
   ============================================ */

@media (max-width: 768px) {
    .hero-slide-inner {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
        padding: var(--spacing-xl) 0;
    }

    .hero-text h1 {
        font-size: 1.75rem;
    }

    .hero-image {
        max-width: 400px;
    }

    .inventory-row > li {
        flex: 0 0 calc((100% - 24px) / 2);
        width: calc((100% - 24px) / 2) !important;
    }

    .parts-card > .elementor-widget-wrap {
        padding: var(--spacing-xl) !important;
    }

    .category-tile {
        flex: 0 0 calc((100% - 2 * 24px) / 3);
    }

    .homepage-brands .brand-card {
        flex: 0 0 calc((100% - 2 * 24px) / 3);
    }
}

/* ============================================
   Responsive — 480px (Mobile)
   ============================================ */

@media (max-width: 480px) {
    .homepage-brands .brand-card {
        flex: 0 0 calc((100% - 24px) / 2);
    }

    .category-tile {
        flex: 0 0 calc((100% - 24px) / 2);
    }

    .hero-text h1 {
        font-size: 1.5rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-btn {
        width: 100%;
        text-align: center;
    }

    .homepage-section-title,
    .parts-text h2 {
        font-size: 1.25rem;
    }

}
