/* ═══════════════════════════════════════════════════════════════════════════
   HOME — Storefront landing page
   Loaded only on the home page (see resources/views/shop/index.blade.php).
   Builds on the tokens defined in shop.css (--bg-card, --primary, --text-*, …).
═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────
   HERO  (centered)
───────────────────────────────────────────────────────────────────────── */
.home-hero {
    position: relative;
    overflow: visible;
    z-index: 30;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    padding: 56px 32px 46px;
    margin-bottom: 22px;
    text-align: center;
}
.home-hero-inner { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }

.home-hero-eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: .78rem; font-weight: 600; color: var(--primary);
    margin-bottom: 18px;
}
.home-hero-eyebrow::before {
    content: ''; width: 26px; height: 2px; border-radius: 2px; background: var(--primary);
}
.home-hero h1 {
    font-size: 2.4rem; font-weight: 900; line-height: 1.42;
    color: var(--text-1); margin-bottom: 14px;
}
.home-hero h1 .accent {
    background: linear-gradient(135deg, var(--primary), #ec4899);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.home-hero p {
    font-size: .95rem; color: var(--text-2); line-height: 1.9;
    max-width: 560px; margin: 0 auto 28px;
}

/* Search (category select + input + button) */
.home-search {
    position: relative;
    display: flex; max-width: 600px; margin: 0 auto 20px;
    background: var(--bg-input); border: 1.5px solid var(--border);
    border-radius: 14px; overflow: visible;
    transition: border-color .2s, box-shadow .2s;
}
.home-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-t); }
/* Category control: the native select is JS-enhanced into .ms/.ms-btn; make
   the custom button blend into the unified search bar (flush, divider, 54px). */
.home-search .ms { flex-shrink: 0; min-width: 120px; }
.home-search .ms-btn {
    height: 54px; width: 100%; min-width: 120px;
    border: none; border-left: 1.5px solid var(--border); border-radius: 0;
    background-color: transparent; color: var(--text-2);
    font-size: .85rem; padding: 0 14px 0 34px;   /* room for the chevron (RTL → left) */
    background-position: left 12px center;
}
.home-search .ms.open .ms-btn { box-shadow: none; }
.home-search input {
    flex: 1; min-width: 0; height: 54px; border: none; background: transparent;
    padding: 0 18px; font: inherit; font-size: .95rem; color: var(--text-1); outline: none;
}
.home-search input::placeholder { color: var(--text-3); }
/* `> button` so these only hit the submit button, never the custom .ms-btn */
.home-search > button {
    height: 54px; padding: 0 28px; border: none; cursor: pointer;
    border-radius: 13px 0 0 13px;
    background: var(--primary); color: #fff; font: inherit; font-weight: 700; font-size: .9rem;
    display: flex; align-items: center; gap: 7px; white-space: nowrap; flex-shrink: 0;
    transition: background .15s;
}
.home-search > button:hover { background: var(--primary-h); }
.home-search .live-search-panel {
    text-align: right;
    top: calc(100% + 10px);
}

/* Popular tags */
.home-tags { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.home-tags-label { font-size: .8rem; color: var(--text-3); }
.home-tag {
    padding: 5px 14px; border-radius: 20px; font-size: .8rem;
    border: 1.5px solid var(--border); color: var(--text-2); transition: all .15s;
}
.home-tag:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-t); }

/* ─────────────────────────────────────────────────────────────────────────
   STATS BAR  (4 across)
───────────────────────────────────────────────────────────────────────── */
.home-stats {
    position: relative;
    z-index: 1;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px;
}
.home-stat {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
}
.home-stat-num { font-size: 1.15rem; font-weight: 800; color: var(--text-1); display: block; }
.home-stat-label { font-size: .73rem; color: var(--text-3); }
.home-stat-icon {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 11px;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
    background: var(--primary-t); color: var(--primary);
}
.home-stat-icon.blue { background: rgba(59,130,246,.12); color: #3b82f6; }
.home-stat-icon.pink { background: rgba(236,72,153,.12); color: #ec4899; }
.home-stat-icon.red  { background: rgba(239,68,68,.1);  color: var(--red); }

/* ─────────────────────────────────────────────────────────────────────────
   FEATURE CARDS  (3 promos)
───────────────────────────────────────────────────────────────────────── */
.home-features {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0 40px;
}
.feature-card {
    position: relative; overflow: hidden;
    border-radius: 16px; padding: 22px; min-height: 168px; color: #fff;
    display: flex; flex-direction: column; gap: 8px;
}
.feature-card::before {
    content: ''; position: absolute; top: -60px; left: -60px;
    width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.05);
}
.fc-discount { background: linear-gradient(135deg, #1e3a5f, #1a2f4e); }
.fc-vendor   { background: linear-gradient(135deg, #3a2410, #4d2f12); }
.fc-vip      { background: linear-gradient(135deg, #4c1d95, #3730a3); }
.fc-tag {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: .72rem; font-weight: 700; letter-spacing: .4px; opacity: .82;
}
.fc-title { font-size: 1.05rem; font-weight: 800; line-height: 1.45; }
.fc-sub   { font-size: .8rem; opacity: .82; line-height: 1.6; }
.fc-btn {
    margin-top: auto; align-self: flex-start;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: 9px;
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.26);
    font-size: .82rem; font-weight: 600; color: #fff; transition: background .15s;
}
.fc-btn:hover { background: rgba(255,255,255,.28); }

/* ─────────────────────────────────────────────────────────────────────────
   SECTION SHELL  (header shared by every content type)
───────────────────────────────────────────────────────────────────────── */
.home-section { margin-bottom: 42px; }
.home-section-hdr {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 12px; margin-bottom: 18px;
}
.home-section-eyebrow {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: .72rem; font-weight: 600; letter-spacing: .3px; color: var(--primary); margin-bottom: 5px;
}
.home-section-title { font-size: 1.1rem; font-weight: 800; color: var(--text-1); }
.home-section-count { font-size: .76rem; color: var(--text-3); margin-top: 3px; }
.home-section-all {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
    font-size: .82rem; font-weight: 600; color: var(--primary); white-space: nowrap;
    transition: opacity .15s;
}
.home-section-all:hover { opacity: .7; }

/* Shared access/status badge on a thumbnail */
.media-badge {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    padding: 3px 9px; border-radius: 6px; font-size: .67rem; font-weight: 800; letter-spacing: .2px;
}
.media-badge--free { background: var(--green); color: #fff; }
.media-badge--vip  { background: linear-gradient(135deg,#f59e0b,#f97316); color: #fff; }

/* Shared title + price footer for video/audio cards */
.media-card-title {
    font-size: .85rem; font-weight: 600; line-height: 1.5; color: var(--text-1);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.media-card-title:hover { color: var(--primary); }
.media-card-vendor { font-size: .73rem; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.media-card-foot {
    margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.media-price-free { font-size: .88rem; font-weight: 700; color: var(--green); }
.media-price-sub  { font-size: .8rem;  font-weight: 600; color: var(--primary); }
.media-price-paid { font-size: .9rem;  font-weight: 700; color: var(--text-1); }
.media-price-was  { font-size: .72rem; color: var(--text-3); text-decoration: line-through; margin-left: 5px; font-weight: 400; }
.media-price-unit { font-size: .68rem; color: var(--text-3); font-weight: 400; }
.media-cta {
    width: 34px; height: 34px; flex-shrink: 0; border: none; cursor: pointer;
    border-radius: 9px; color: #fff; background: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: .95rem;
    transition: background .15s;
}
.media-cta:hover { background: var(--primary-h); }
.media-cta--free { background: var(--green); }
.media-cta--free:hover { background: #047857; }

/* ─────────────────────────────────────────────────────────────────────────
   IMAGE SECTION  — masonry of varying-size covers
───────────────────────────────────────────────────────────────────────── */
.masonry {
    columns: var(--home-masonry-card-width, 320px);
    column-gap: var(--home-masonry-gap, 22px);
}
.masonry-item { break-inside: avoid; margin: 0 0 var(--home-masonry-gap, 22px); }
.masonry-card {
    position: relative; display: block; overflow: hidden;
    border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card);
}
.masonry-card img { width: 100%; height: auto; display: block; transition: transform .4s ease; }
.masonry-card:hover img { transform: scale(1.05); }
.masonry-card-ph {
    aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
    color: var(--border); font-size: 2.4rem; background: var(--bg);
}
.masonry-overlay {
    position: absolute; inset: 0; z-index: 1;
    display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
    padding: 12px; opacity: 0; transition: opacity .25s;
    background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.15) 55%, transparent 100%);
}
.masonry-card:hover .masonry-overlay { opacity: 1; }
.masonry-overlay-title {
    color: #fff; font-size: .82rem; font-weight: 600; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.masonry-overlay-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.masonry-overlay-price { color: #fff; font-size: .82rem; font-weight: 700; }
.masonry-overlay-price.free { color: #6ee7b7; }
.masonry-overlay-was { color: rgba(255,255,255,.6); font-size: .68rem; font-weight: 400; text-decoration: line-through; margin-left: 5px; }

/* ─────────────────────────────────────────────────────────────────────────
   VIDEO + AUDIO  — responsive card grid
───────────────────────────────────────────────────────────────────────── */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--home-media-card-width, 320px), 1fr));
    gap: var(--home-media-gap, 22px);
}

/* ── Video card ── */
.video-card {
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card);
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.video-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--primary); }
.video-thumb { display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg); }
.video-thumb img,
.video-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-thumb video { opacity: 0; transition: opacity .25s; }
.video-thumb.is-playing video { opacity: 1; }
/* No cover image → the video itself shows its first frame as the still. */
.video-thumb video.video-still { opacity: 1; }
.video-thumb-ph { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--border); font-size: 2.4rem; }
.video-play {
    position: absolute; inset: 0; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.25); opacity: 0; transition: opacity .25s; pointer-events: none;
}
.video-thumb:hover .video-play { opacity: 1; }
.video-thumb.is-playing .video-play { opacity: 0; }
.video-play .video-play-hit {
    width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.92); color: #111;
    display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
    border: none; cursor: pointer; pointer-events: auto;   /* only the circle is tappable → rest of thumb navigates */
    transform: scale(.85); transition: transform .25s; box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.video-thumb:hover .video-play .video-play-hit { transform: scale(1); }
/* Touch devices have no hover → keep the play button visible so it's tappable. */
@media (hover: none) {
    .video-thumb .video-play { opacity: 1; background: transparent; }
    .video-thumb.is-playing .video-play { opacity: 0; }
}
.video-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; }

/* ── Audio card ── */
.audio-card {
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card);
    transition: box-shadow .2s, border-color .2s;
}
.audio-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.audio-player {
    display: flex; align-items: center; gap: 10px; padding: 14px;
}
.audio-play-btn {
    width: 40px; height: 40px; flex-shrink: 0; border: none; cursor: pointer; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px var(--primary-t); transition: transform .12s, background .15s;
}
.audio-play-btn:hover { transform: scale(1.06); background: var(--primary-h); }
.audio-play-btn:active { transform: scale(.94); }
.audio-card--no-preview .audio-play-btn { background: var(--text-3); cursor: not-allowed; box-shadow: none; }
.audio-card--no-preview .audio-play-btn:hover { transform: none; background: var(--text-3); }
.audio-card--no-preview .audio-bars { cursor: default; opacity: .7; }
.audio-wave-wrap { flex: 1; min-width: 0; }
.audio-bars { display: flex; align-items: flex-end; gap: 2px; height: 40px; cursor: pointer; direction: ltr; }
.audio-bars .bar { flex: 1; min-width: 0; border-radius: 1px 1px 0 0; background: var(--border); transition: background .1s; }
.audio-bars .bar.on { background: var(--primary); }
.audio-time { font-size: .68rem; color: var(--text-3); font-variant-numeric: tabular-nums; flex-shrink: 0; white-space: nowrap; }
.audio-body { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; }

/* ─────────────────────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .home-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .home-features { grid-template-columns: 1fr; }
    .home-hero { padding: 36px 22px; }
    .home-hero h1 { font-size: 1.7rem; }
}
@media (max-width: 640px) {
    .home-hero { padding: 30px 16px; }
    .home-hero h1 { font-size: 1.35rem; }
    .home-hero p { font-size: .88rem; margin-bottom: 22px; }
    .home-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .home-stat { padding: 12px 14px; }

    /* ── Search: separate, well-spaced fields instead of one merged bar ── */
    .home-search {
        flex-direction: column; gap: 10px;
        background: transparent; border: none; overflow: visible;
    }
    .home-search:focus-within { box-shadow: none; }
    .home-search .ms { width: 100%; }
    .home-search .ms-btn,
    .home-search input,
    .home-search button {
        width: 100%; height: 50px;
        border: 1.5px solid var(--border); border-radius: 12px;
        background-color: var(--bg-input);
    }
    .home-search .ms-btn { color: var(--text-1); padding: 0 16px 0 34px; }
    .home-search input { padding: 0 16px; }
    .home-search > button {
        background: var(--primary); border-color: var(--primary);
        justify-content: center; font-size: .95rem;
    }

    /* ── Category sections → swipeable horizontal sliders on phones ──
       Image masonry and the video/audio grid both collapse to a single
       scroll-snapping row so the homepage feels native on mobile. */
    .masonry,
    .media-grid,
    .home-section .product-grid {
        display: flex; flex-wrap: nowrap; gap: 12px;
        columns: auto; grid-template-columns: none;
        overflow-x: auto; overflow-y: hidden;
        /* mandatory snap + scroll-padding keeps each card aligned; a hard flick
           settles on a card boundary instead of racing past the whole row. */
        scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
        scroll-padding-inline: 14px;
        padding-bottom: 6px;
        scrollbar-width: none;
        /* let the row bleed to the screen edges for a slider feel */
        margin-inline: -14px; padding-inline: 14px;
    }
    .masonry::-webkit-scrollbar,
    .media-grid::-webkit-scrollbar,
    .home-section .product-grid::-webkit-scrollbar { display: none; }

    /* scroll-snap-stop: always → one swipe advances at most one card (no fast skip). */
    .masonry-item {
        flex: 0 0 var(--mobile-masonry-slide-width, 44%);
        max-width: var(--mobile-masonry-slide-max, 200px);
        margin: 0;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
    .media-grid > * {
        flex: 0 0 var(--mobile-media-slide-width, 82%);
        max-width: var(--mobile-media-slide-max, 320px);
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
    .home-section .product-grid > * {
        flex: 0 0 var(--mobile-product-slide-width, 82%);
        max-width: var(--mobile-product-slide-max, 320px);
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    /* On touch there's no hover — keep the image card's title/price visible. */
    .masonry-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.12) 60%, transparent 100%);
    }

    /* Carousel dots (built by home.js) — signal that the row is swipeable. */
    .slider-dots {
        display: flex; justify-content: center; align-items: center; gap: 6px;
        margin-top: 14px;
    }
    .slider-dots .dot {
        width: 7px; height: 7px; padding: 0; border: none; cursor: pointer;
        border-radius: 50%; background: var(--border);
        transition: width .25s ease, background .25s ease;
    }
    .slider-dots .dot.active { width: 20px; border-radius: 4px; background: var(--primary); }
}

/* Never show the mobile dots on desktop (in case of a breakpoint flip). */
@media (min-width: 641px) { .slider-dots { display: none; } }
