/* ---------- Blurred full-bleed backdrop (fills the space beyond the page frame) ---------- */
.page-backdrop {
    position: fixed;
    inset: -60px; /* overscan so the blur never reveals a hard edge */
    z-index: -1;
    background-size: cover;
    background-position: center;
    filter: blur(50px);
}

.page-backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35); /* keeps the white page frame readable on top */
}

/* ---------- Page boundary (caps the whole page on ultrawide instead of an endless gray canvas) ---------- */
.page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--surface-page);
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.06);
}

/* ---------- Carousel ---------- */
.carousel-section {
    position: relative;
    width: 100%;
    height: 60vh;
    max-height: 720px;
    background: #000000;
    overflow: hidden;
}

.carousel-scroll {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
}

.carousel-image {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    scroll-snap-align: start;
    -webkit-user-drag: none;
    pointer-events: none;
}

.carousel-gradient-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 100px;
    background: linear-gradient(to bottom, var(--surface-primary-60), transparent);
    pointer-events: none;
}

.carousel-gradient-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 130px;
    background: linear-gradient(to top, var(--surface-primary-60), transparent);
    pointer-events: none;
}

.carousel-top-row {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.carousel-top-spacer {
    width: 48px;
    height: 48px;
}

.carousel-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.carousel-bottom-row {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 16px 16px 28px 16px;
}

.carousel-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 40px;
}

/* ---------- Content card (overlaps carousel by 24px, rounded top) ---------- */
.post-container {
    margin-top: -24px;
    padding-bottom: 96px; /* room for the floating button */
    position: relative;
    z-index: 3;
    background-color: var(--surface-page);
    border-radius: 24px 24px 0 0;
}

/* ---------- Header ---------- */
.header-section {
    padding: 12px 16px 12px 16px;
    /* flex so margins don't collapse */
    display: flex;
    flex-direction: column;
}

.post-title {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.price {
    color: var(--text-primary);
}

.item-count {
    color: var(--text-tertiary);
}

.description-label {
    color: var(--text-primary);
    margin: 8px 0;
}

.description-text {
    color: var(--text-secondary);
    padding-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 12px;
    padding-top: 6px;
    padding-bottom: 8px;
}

.tag {
    color: var(--text-primary);
}

/* ---------- Creator section ---------- */
.creator-section {
    background-color: var(--surface-page);
    padding: 16px;
}

.creator-header {
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ---------- Items in this post ---------- */
.items-section {
    padding: 24px 0 4px 0;
}

.items-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    margin-bottom: 24px;
}

.section-title {
    color: var(--text-primary);
}

.see-all {
    color: var(--text-brand);
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    padding: 6px 16px;
    text-decoration: none;
}

.item-scroll {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 0 16px 8px 16px;
    scroll-padding-inline: 16px;
    scroll-snap-type: x mandatory;
}

/* ---------- Similar items / posts scroll sections ---------- */
.similar-section {
    padding: 16px 0;
}

.similar-header {
    padding: 4px 16px;
    margin-bottom: 8px;
}

.similar-scroll {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 0 16px;
}

/* ---------- Floating "Add to list" ---------- */
.add-to-list-button {
    position: fixed;
    right: 16px;
    bottom: calc(28px + env(safe-area-inset-bottom));
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 32px;
    border: 1px solid var(--surface-primary);
    border-radius: 60px;
    background-color: var(--surface-primary);
    color: var(--text-inverse);
    font-family: inherit;
    cursor: pointer;
    transition: transform 150ms ease, background-color 150ms ease;
}

.add-to-list-button:active {
    transform: scale(0.97);
    background-color: var(--surface-primary-hover);
}

.add-to-list-button svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* ---------- Desktop: swap horizontal-scroll rows for a wrapping grid ---------- */
/* Phones keep the scroll/drag/snap carousel above this breakpoint; carousel.js already
   no-ops its drag/wheel handling once a track's overflow-x stops being scrollable, so no
   JS changes are needed here beyond that check. */
@media (min-width: 900px) {
    .carousel-bottom-row,
    .header-section,
    .creator-section,
    .items-section-header,
    .similar-header {
        padding-left: 40px;
        padding-right: 40px;
    }

    .item-scroll,
    .similar-scroll {
        cursor: auto; /* grid rows don't drag-scroll, so no grab cursor */
    }

    .item-scroll {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 32px;
        overflow: visible;
        scroll-snap-type: none;
        padding: 8px 40px 16px 40px;
    }

    .item-card {
        width: 100%;
    }

    .item-card-image {
        height: 260px;
    }

    /* Pagination only makes sense for the mobile single-row carousel. */
    .items-section .pager-dots {
        display: none;
    }

    .similar-scroll {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 24px;
        overflow: visible;
        padding: 0 40px;
    }

    .similar-item-card,
    .similar-post-card {
        width: 100%;
    }

    .similar-item-image {
        width: 100%;
        height: 240px;
    }

    .similar-post-image-wrap {
        width: 100%;
        height: 240px;
    }
}
