/**
 * Phone Exchange — Homepage Styles
 *
 * Matches React Index page sections:
 * Hero, TrustBadges, Brands grid, All Phones grid, Stores ScrollRow, Eco CTA.
 *
 * @package Phone_Exchange_Child
 * @since   1.0.0
 */

/* ═══════════════════════════════════════════════════════════════
   1. HERO SECTION
   ═══════════════════════════════════════════════════════════════ */

/* Break out of .col-full container for full-width sections */
.pe-hero,
.pe-eco-cta {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.pe-hero {
    overflow: hidden;
    min-height: 360px;
}

.pe-hero__bg {
    position: absolute;
    inset: 0;
}

.pe-hero__bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* If no image, show a dark gradient background */
.pe-hero__bg:not(:has(.pe-hero__bg-img)) {
    background: linear-gradient(135deg, hsl(0 0% 12%) 0%, hsl(0 0% 25%) 100%);
}

.pe-hero__overlay {
    position: absolute;
    inset: 0;
    background: hsla(var(--foreground), 0.5);
}

.pe-hero__content {
    position: relative;
    z-index: 1;
    padding-top: 4rem;
    padding-bottom: 4rem;
    text-align: center;
}

@media (min-width: 768px) {
    .pe-hero__content {
        padding-top: 7rem;
        padding-bottom: 7rem;
    }
}

.pe-hero__inner {
    max-width: 42rem;
    margin: 0 auto;
}

.pe-hero__inner > * + * {
    margin-top: 1.25rem;
}

/* Eco badge pill */
.pe-hero__eco-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: hsla(var(--primary), 0.2);
    backdrop-filter: blur(4px);
    color: hsl(var(--primary-foreground));
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
}

.pe-hero__eco-badge svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* Title */
.pe-hero__title {
    font-family: var(--font-heading);
    font-size: 1.875rem;
    font-weight: 700;
    color: hsl(var(--primary-foreground));
    line-height: 1.15;
    margin: 0;
}

@media (min-width: 768px) {
    .pe-hero__title {
        font-size: 3rem;
    }
}

@media (min-width: 1024px) {
    .pe-hero__title {
        font-size: 3.75rem;
    }
}

/* Description */
.pe-hero__desc {
    font-size: 0.875rem;
    color: hsla(var(--primary-foreground), 0.8);
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .pe-hero__desc {
        font-size: 1.125rem;
    }
}

/* CTA */
.pe-hero__actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
    padding-top: 0.5rem;
}

@media (min-width: 640px) {
    .pe-hero__actions {
        flex-direction: row;
    }
}

.pe-btn--hero {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    color: hsl(var(--primary-foreground));
    background: linear-gradient(135deg, hsl(0, 0%, 15%) 0%, hsl(0, 0%, 25%) 100%);
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-decoration: none;
}

.pe-btn--hero:hover {
    opacity: 0.9;
    color: hsl(var(--primary-foreground));
    text-decoration: none;
}

.pe-btn--hero svg {
    width: 1rem;
    height: 1rem;
}


/* ═══════════════════════════════════════════════════════════════
   2. TRUST BADGES
   ═══════════════════════════════════════════════════════════════ */

.pe-trust-section {
    padding: 2.5rem 0 3.5rem;
}

@media (min-width: 768px) {
    .pe-trust-section {
        padding: 3.5rem 0;
    }
}

.pe-trust-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .pe-trust-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

.pe-trust-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    border-radius: var(--radius);
}

.pe-trust-card__icon {
    margin-bottom: 0.75rem;
    color: hsl(var(--accent));
}

.pe-trust-card__icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

@media (min-width: 768px) {
    .pe-trust-card__icon svg {
        width: 2rem;
        height: 2rem;
    }
}

.pe-trust-card__title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.75rem;
    margin: 0 0 0.25rem;
    color: hsl(var(--foreground));
}

@media (min-width: 768px) {
    .pe-trust-card__title {
        font-size: 0.875rem;
    }
}

.pe-trust-card__desc {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.5;
    margin: 0;
}


/* ═══════════════════════════════════════════════════════════════
   3. GENERIC SECTION LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.pe-section {
    padding-bottom: 3.5rem;
}

.pe-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.pe-section__title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pe-section__title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0;
    color: hsl(var(--foreground));
}

@media (min-width: 768px) {
    .pe-section__title {
        font-size: 1.5rem;
    }
}

/* Only apply margin when title is standalone (not inside __header) */
.pe-section > .pe-container > .pe-section__title {
    margin-bottom: 1.5rem;
}

.pe-section__link {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--primary));
    text-decoration: none;
    white-space: nowrap;
}

.pe-section__link:hover {
    text-decoration: underline;
}

.pe-section__more {
    text-align: center;
    margin-top: 2rem;
}

.pe-icon--accent {
    color: hsl(var(--accent));
}


/* ═══════════════════════════════════════════════════════════════
   4. BRANDS GRID
   ═══════════════════════════════════════════════════════════════ */

.pe-brands-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .pe-brands-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .pe-brands-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.pe-brand-card {
    display: block;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9375rem;
    color: hsl(var(--foreground));
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pe-brand-card:hover {
    border-color: hsl(var(--primary));
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    color: hsl(var(--foreground));
    text-decoration: none;
}


/* ═══════════════════════════════════════════════════════════════
   5. PRODUCTS GRID
   ═══════════════════════════════════════════════════════════════ */

.pe-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .pe-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}

@media (min-width: 1024px) {
    .pe-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* ═══════════════════════════════════════════════════════════════
   6. SCROLL ROW (Horizontal scroll with arrows)
   ═══════════════════════════════════════════════════════════════ */

.pe-scroll-row {
    position: relative;
}

.pe-scroll-row__track {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    padding: 0.25rem 0;
}

.pe-scroll-row__track::-webkit-scrollbar {
    display: none;
}

.pe-scroll-row__item {
    flex: 0 0 70%;
    scroll-snap-align: start;
    min-width: 0;
}

@media (min-width: 640px) {
    .pe-scroll-row__item {
        flex: 0 0 45%;
    }
}

@media (min-width: 768px) {
    .pe-scroll-row__item {
        flex: 0 0 30%;
    }
}

@media (min-width: 1024px) {
    .pe-scroll-row__item {
        flex: 0 0 23%;
    }
}

/* Arrow buttons */
.pe-scroll-row__prev,
.pe-scroll-row__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: none; /* Hidden by default, visible on desktop */
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0 !important;
    background: hsl(var(--card)) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.pe-scroll-row__prev:hover,
.pe-scroll-row__next:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

@media (min-width: 768px) {
    .pe-scroll-row__prev,
    .pe-scroll-row__next {
        display: flex;
    }
}

.pe-scroll-row__prev {
    left: -1.25rem;
}

.pe-scroll-row__next {
    right: -1.25rem;
}

/* ── Store Card (inside ScrollRow) ───────────────────────────── */

.pe-store-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
    height: 100%;
    transition: box-shadow 0.2s ease;
}

.pe-store-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.pe-store-card__name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.875rem;
    margin: 0 0 0.75rem;
    color: hsl(var(--foreground));
}

@media (min-width: 768px) {
    .pe-store-card__name {
        font-size: 1rem;
    }
}

.pe-store-card__detail {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.5rem;
}

.pe-store-card__detail svg {
    width: 1rem;
    height: 1rem;
    color: hsl(var(--accent));
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.pe-store-card__detail a {
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    transition: color 0.15s ease;
}

.pe-store-card__detail a:hover {
    color: hsl(var(--foreground));
}

.pe-store-card__map-link {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    color: hsl(var(--accent));
    text-decoration: none;
    margin-top: 0.25rem;
}

.pe-store-card__map-link:hover {
    text-decoration: underline;
}


/* ═══════════════════════════════════════════════════════════════
   7. ECO CTA SECTION
   ═══════════════════════════════════════════════════════════════ */

.pe-eco-cta {
    padding: 3rem 0;
}

@media (min-width: 768px) {
    .pe-eco-cta {
        padding: 4rem 0;
    }
}

.pe-eco-cta__inner {
    text-align: center;
}

.pe-eco-cta__title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: hsl(var(--primary-foreground));
    margin: 0 0 0.75rem;
}

@media (min-width: 768px) {
    .pe-eco-cta__title {
        font-size: 1.875rem;
    }
}

.pe-eco-cta__desc {
    font-size: 0.875rem;
    color: hsla(var(--primary-foreground), 0.8);
    max-width: 28rem;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .pe-eco-cta__desc {
        font-size: 1rem;
    }
}

/* Secondary button (white bg on dark gradient) */
.pe-btn--secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    background: hsl(var(--secondary));
    color: hsl(var(--foreground));
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.pe-btn--secondary:hover {
    opacity: 0.9;
    color: hsl(var(--foreground));
    text-decoration: none;
}

/* Large button variant */
.pe-btn--lg {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
}
