/* Hero Section - Apple Mac Aesthetic */

.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    background-color: var(--apple-white);
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 800px;
    padding: 0 2rem;
}

.hero h1 {
    font-size: 80px;
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-bottom: 24px;
    color: var(--apple-black);
    animation: appleFadeInUp 1.2s cubic-bezier(0.28, 0.11, 0.32, 1) forwards;
}

.hero .tagline {
    font-size: 28px;
    line-height: 1.14286;
    font-weight: 400;
    letter-spacing: 0.007em;
    margin-bottom: 40px;
    color: var(--apple-gray);
    font-style: normal;
    animation: appleFadeInUp 1.2s cubic-bezier(0.28, 0.11, 0.32, 1) 0.2s forwards;
    opacity: 0;
}

.cta-button {
    animation: appleFadeInUp 1.2s cubic-bezier(0.28, 0.11, 0.32, 1) 0.4s forwards;
    opacity: 0;
}

/* About Section */

.about-section {
    padding: 120px 0;
    max-width: 980px;
    margin: 0 auto;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.about-text h3 {
    font-size: 40px;
    line-height: 1.1;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--apple-black);
}

.about-text p {
    font-size: 19px;
    line-height: 1.4211;
    font-weight: 400;
    color: var(--apple-gray);
    margin-bottom: 1.5rem;
}

.about-image {
    width: 100%;
    height: 500px;
    background-color: var(--apple-off-white);
    border-radius: 28px; /* Classic Apple rounding */
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
}

.about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-image:hover img {
    transform: scale(1.05);
}

/* Brands Section */

.brands-section {
    padding: 100px 0;
    background: var(--apple-off-white);
    overflow: hidden;
}

.brands-carousel-container {
    padding: 40px 0;
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.brands-carousel {
    display: flex;
    gap: 100px;
    animation: appleScroll 40s linear infinite;
}

@keyframes appleScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.brand-item {
    opacity: 0.5;
    transition: opacity 0.3s;
}

.brand-item:hover {
    opacity: 1;
}

.brand-item img {
    height: 40px;
    filter: grayscale(1) brightness(0); /* Black logos */
    object-fit: contain;
}

/* Carousel Styles */
.featured-section {
    position: relative;
    background: radial-gradient(circle at 50% 0%, rgba(184, 134, 11, 0.05) 0%, transparent 70%);
}

.carousel-container {
    position: relative;
    padding: 0 60px;
    margin: 48px 0;
}

.carousel-wrapper {
    overflow: hidden;
    padding: 20px 0;
    /* Gradient mask: fades the leftmost and rightmost ~1-card-width,
       making the 2 edge cards appear as soft ghosts while the 4 center cards are fully solid */
    mask-image: linear-gradient(to right, transparent 0%, black 16%, black 84%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 16%, black 84%, transparent 100%);
}

.carousel-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    justify-content: flex-start;
    align-items: stretch;
    /* Smooth horizontal slide transition */
    transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.carousel-track .product-card {
    /* 6 cards visible: (100% - 5 gaps) / 6 */
    flex: 0 0 calc((100% - (20px * 5)) / 6);
    min-width: 0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.6s ease,
                border-color 0.3s ease;
    cursor: pointer;
    display: flex; /* Always visible — JS slides the track, CSS mask fades edges */
    flex-direction: column;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}

.carousel-track .product-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 40px 80px rgba(0,0,0,0.12);
    border-color: rgba(184, 134, 11, 0.2);
}

.product-image {
    aspect-ratio: 1/1; /* Square aspect ratio for consistency */
    background: var(--apple-off-white);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

.product-info {
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center contents vertically/horizontally */
    text-align: center; /* Center the text */
    flex-grow: 1;
}

.product-name {
    font-size: 16px;
    line-height: 1.2;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--apple-black);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
}

.product-description {
    font-size: 13px;
    line-height: 1.4;
    color: var(--apple-gray);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-clamp: 2;
}

.product-price {
    font-size: 15px;
    font-weight: 500;
    color: var(--apple-black);
    margin-top: auto;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--apple-white);
    border: 1px solid var(--apple-border);
    color: var(--apple-black);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.carousel-nav:hover {
    background: var(--apple-black);
    color: var(--apple-white);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.carousel-nav.prev {
    left: 0;
}

.carousel-nav.next {
    right: 0;
}

.carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.grid-loading {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--apple-off-white);
    border-top: 4px solid var(--apple-black);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cta-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 19px;
    color: var(--apple-black);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-quick);
}

.cta-link i {
    transition: transform 0.3s ease;
}

.cta-link:hover {
    color: #b8860b; /* Gold accent on hover */
}

.cta-link:hover i {
    transform: translateX(4px);
}

.section-actions {
    display: flex;
    justify-content: center;
    margin-top: 64px;
    width: 100%;
}

/* Responsive */
@media (max-width: 1200px) {
    .carousel-track .product-card {
        /* 4 cards visible on medium desktop */
        flex: 0 0 calc((100% - (20px * 3)) / 4);
    }
    .carousel-wrapper {
        mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
    }
}

@media (max-width: 900px) {
    .carousel-track .product-card {
        /* 3 cards visible on tablet — 2 solid, 1 ghost each side */
        flex: 0 0 calc((100% - (16px * 2)) / 3);
    }
    .carousel-wrapper {
        mask-image: linear-gradient(to right, transparent 0%, black 25%, black 75%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 25%, black 75%, transparent 100%);
    }
    .carousel-track { gap: 16px; }
}

@media (max-width: 600px) {
    .hero h1 { font-size: 40px; }
    .hero .tagline { font-size: 18px; }
    .about-content { grid-template-columns: 1fr; gap: 40px; }
    .about-section, .featured-section { padding: 40px 16px; }
    .about-image { height: 280px; }

    /* Give room for the prev/next buttons on each side */
    .carousel-container { padding: 0 44px; margin: 32px 0; }

    .carousel-wrapper {
        overflow: hidden;
        /* Fade only the very edge (1 card = 100/2.4 ≈ 42%), soft ghost peek */
        mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
    }

    .carousel-track {
        gap: 14px;
        align-items: stretch;
    }

    /* 2 cards + peek: each card ≈ (viewport - padding - gaps) / 2.4
       JS returns 2 for visible; CSS makes cards slightly narrower than 50%
       so the 3rd card naturally peeks on the right */
    .carousel-track .product-card {
        flex: 0 0 calc((100% - 14px) / 2.3) !important;
        border-radius: 20px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    }

    /* Square image fills nicely */
    .carousel-track .product-card .product-image {
        aspect-ratio: 1 / 1;
    }

    /* Info section: clean, centred, comfortable */
    .carousel-track .product-card .product-info {
        padding: 14px 12px;
        align-items: center;
        text-align: center;
    }

    /* Readable name — 2 lines max */
    .carousel-track .product-card .product-name {
        font-size: 13px;
        font-weight: 600;
        line-height: 1.3;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 4px;
    }

    /* Short description — 1 line */
    .carousel-track .product-card .product-description {
        font-size: 11px;
        -webkit-line-clamp: 1;
        line-clamp: 1;
        margin-bottom: 8px;
    }

    /* Price prominent */
    .carousel-track .product-card .product-price {
        font-size: 13px;
        font-weight: 600;
    }

    /* Small, unobtrusive nav buttons */
    .carousel-nav {
        display: flex !important;
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .carousel-nav.prev { left: 4px; }
    .carousel-nav.next { right: 4px; }
}
