/* Pinify — 3D Flip Book  ·  pivot LEFT, pages sweep RIGHT */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ══ Body ══════════════════════════════════════════════════════ */
body {
    font-family: 'Poppins', 'Inter', 'Noto Naskh Arabic', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #080808;
    color: #fff;
    overflow: hidden;
    transition: background .7s;
}

/* ambient glow blobs */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 55% at 15% 15%, rgba(140,70,10,.28) 0%, transparent 100%),
        radial-gradient(ellipse 50% 50% at 85% 85%, rgba(80,30,5,.25)  0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* subtle dot grid */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}

/* ══ Scene ══════════════════════════════════════════════════════
   perspective-origin: LEFT edge  →  depth effect comes from left.
   Pages pivot on their LEFT edge and sweep RIGHT.
══════════════════════════════════════════════════════════════ */
.flip-scene {
    position: relative;
    z-index: 1;
    width: clamp(260px, 85vw, 480px);
    height: clamp(260px, 85vh, 620px);
    perspective: 1600px;
    perspective-origin: left center;
    transition: width .7s cubic-bezier(.77,0,.175,1),
                height .7s cubic-bezier(.77,0,.175,1),
                border-radius .7s;
    border-radius: 20px;
}

/* expanded state — triggered when first page is flipped open */
.flip-scene.fp-open {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.flip-book {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ══ Page ═══════════════════════════════════════════════════════
   transform-origin: left   pivot = left edge
   flipped state:  rotateY(-180deg)  →  sweeps to the RIGHT
   back face pre-rotation: rotateY(+180deg)
   math: -180 + 180 = 0  →  back face reads normally after flip
══════════════════════════════════════════════════════════════ */
.fp-page {
    position: absolute;
    inset: 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.9s cubic-bezier(0.77, 0, 0.175, 1);
    cursor: pointer;
    border-radius: 18px;
}

.fp-page.fp-flipped {
    transform: rotateY(-180deg);
    pointer-events: none;
    z-index: 1 !important;
}

/* back face items stay clickable */
.fp-page.fp-flipped .fp-back {
    pointer-events: auto;
}

/* ══ Faces ══════════════════════════════════════════════════════ */
.fp-front,
.fp-back {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    overflow: hidden;
    padding: clamp(24px, 5vw, 48px) clamp(20px, 4.5vw, 44px);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow:
        0 30px 80px rgba(0,0,0,.75),
        0 0 0 1px rgba(255,200,80,.07),
        inset 0 1px 0 rgba(255,255,255,.05);
    transition: border-radius .7s, padding .7s;
}

.fp-open .fp-front,
.fp-open .fp-back {
    border-radius: 0;
    padding: clamp(28px, 6vw, 80px) clamp(24px, 8vw, 120px);
}

.fp-front {
    background:
        radial-gradient(ellipse 80% 60% at 110% -10%, rgba(255,185,50,.09) 0%, transparent 60%),
        linear-gradient(155deg, #202020 0%, #131313 100%);
    border: 1px solid rgba(255,200,80,.13);
}

.fp-back {
    background:
        radial-gradient(ellipse 80% 60% at -10% 110%, rgba(255,185,50,.07) 0%, transparent 60%),
        linear-gradient(155deg, #1c1c1c 0%, #0f0f0f 100%);
    border: 1px solid rgba(255,200,80,.10);
    /* pre-rotated +180deg so after -180deg flip it lands at 0deg = readable */
    transform: rotateY(180deg);
}

/* thin gold spine line on left edge */
.fp-front::after {
    content: '';
    position: absolute;
    left: 0; top: 8%; bottom: 8%;
    width: 2px;
    background: linear-gradient(to bottom, transparent, rgba(255,200,80,.25), transparent);
    border-radius: 2px;
}

/* ══ Cover ══════════════════════════════════════════════════════ */
.fp-cover-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 11px;
}

.fp-cover-name {
    font-size: clamp(1.9rem, 5.5vw, 52px);
    font-family: 'Cormorant Garamond', 'Playfair Display', 'Noto Naskh Arabic', serif;
    font-weight: 700;
    color: #f6cc74;
    letter-spacing: 4px;
    line-height: 1.15;
    text-shadow: 0 0 50px rgba(246,204,116,.2);
}

.fp-cover-tagline {
    font-size: clamp(.68rem, 1.7vw, 12.5px);
    color: #707070;
    letter-spacing: 5px;
    text-transform: uppercase;
}

.fp-click-hint {
    position: absolute;
    bottom: 20px;
    right: 24px;
    font-size: 11px;
    color: rgba(255,255,255,.2);
    letter-spacing: 1.5px;
    pointer-events: none;
    animation: hint 2.5s ease-in-out infinite;
}
@keyframes hint { 0%,100%{opacity:.2; transform:translateX(0)} 50%{opacity:.5; transform:translateX(4px)} }

/* ══ Section title ══════════════════════════════════════════════ */
.fp-section-title {
    font-family: 'Cormorant Garamond', 'Playfair Display', 'Noto Naskh Arabic', serif;
    font-size: clamp(1.05rem, 2.6vw, 24px);
    font-weight: 700;
    color: #f6cc74;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    position: relative;
}

.fp-section-title::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, rgba(246,204,116,.3), transparent);
}

.fp-item-count {
    font-family: 'Poppins', sans-serif;
    font-size: .55rem;
    font-weight: 700;
    color: #f6cc74;
    background: rgba(246,204,116,.1);
    border: 1px solid rgba(246,204,116,.2);
    padding: 1px 7px;
    border-radius: 20px;
    flex-shrink: 0;
    line-height: 1.7;
}

/* ══ Items ══════════════════════════════════════════════════════ */
.fp-items {
    overflow-y: auto;
    height: calc(100% - 58px);
    scrollbar-width: thin;
    scrollbar-color: rgba(246,204,116,.1) transparent;
}
.fp-items::-webkit-scrollbar       { width: 2px; }
.fp-items::-webkit-scrollbar-thumb { background: rgba(246,204,116,.15); border-radius: 2px; }

.fp-item {
    display: flex;
    flex-direction: column;
    padding: 9px 10px;
    margin-bottom: 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .18s, transform .18s;
    border: 1px solid transparent;
}
.fp-item:hover {
    background: rgba(246,204,116,.06);
    border-color: rgba(246,204,116,.12);
    transform: translateX(3px);
}
.fp-item:last-child { margin-bottom: 0; }

.fp-item.unavailable { opacity: .3; cursor: default; }
.fp-item.unavailable:hover { background: none; border-color: transparent; transform: none; }
.fp-item.unavailable .fp-item-name { text-decoration: line-through; }

.fp-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.fp-item-name {
    font-size: clamp(.78rem, 1.5vw, 14.5px);
    font-weight: 600;
    color: #e5e5e5;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    transition: color .18s;
}
.fp-item:hover .fp-item-name { color: #fff; }

.fp-item-price {
    font-size: .72rem;
    font-weight: 700;
    color: #f6cc74;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: .85;
    transition: opacity .18s;
}
.fp-item:hover .fp-item-price { opacity: 1; }

.fp-item-desc {
    font-size: 11px;
    color: #555;
    line-height: 1.5;
    margin-top: 3px;
    transition: color .18s;
}
.fp-item:hover .fp-item-desc { color: #777; }

.fp-item-img {
    width: 42px; height: 42px;
    border-radius: 7px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255,200,80,.15);
    margin-bottom: 5px;
    display: block;
    cursor: zoom-in;
    transition: transform .18s, box-shadow .18s;
}
.fp-item:hover .fp-item-img {
    transform: scale(1.07);
    box-shadow: 0 4px 14px rgba(0,0,0,.5);
}

.fp-sold-badge {
    font-size: .46rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #f87171;
    background: rgba(248,113,113,.1);
    border: 1px solid rgba(248,113,113,.2);
    padding: 1px 5px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ══ Closing page ══════════════════════════════════════════════ */
.fp-page-closing { cursor: default; pointer-events: none; }

.fp-closing-title {
    font-family: 'Cormorant Garamond', 'Playfair Display', serif;
    font-size: clamp(1.2rem, 3.5vw, 34px);
    color: #f6cc74;
    letter-spacing: 2px;
}
.fp-closing-sub {
    font-size: clamp(.68rem, 1.6vw, 12.5px);
    color: #555;
    letter-spacing: 3px;
    margin-top: 8px;
}

/* ══ Social / links bar ════════════════════════════════════════ */
.fp-cover-content .ml-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}
.fp-cover-content .ml-socials,
.fp-cover-content .ml-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.fp-cover-content .ml-social-btn {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform .18s, opacity .18s;
    flex-shrink: 0;
}
.fp-cover-content .ml-social-btn:hover { transform: scale(1.15); opacity: .8; }
.fp-cover-content .ml-social-btn svg   { width: 15px; height: 15px; display: block; }

.fp-cover-content .ml-link-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .03em;
    color: rgba(246,204,116,.8);
    background: rgba(246,204,116,.07);
    border: 1px solid rgba(246,204,116,.16);
    text-decoration: none;
    transition: background .2s, color .2s;
}
.fp-cover-content .ml-link-btn:hover { background: rgba(246,204,116,.14); color: #f6cc74; }
.fp-cover-content .ml-link-btn svg { display: none; }

/* ══ Powered-by ════════════════════════════════════════════════ */
.powered-by {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .56rem; color: rgba(255,255,255,.1);
    text-decoration: none; transition: color .2s;
    margin-top: 20px;
}
.powered-by:hover { color: rgba(255,255,255,.28); }
.powered-by-icon {
    width: 12px; height: 12px;
    background: linear-gradient(135deg, #a855f7, #22d3ee);
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ══ Navigation arrows ═════════════════════════════════════════ */
.fp-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(246,204,116,.2);
    background: rgba(20,20,20,.85);
    backdrop-filter: blur(8px);
    color: rgba(246,204,116,.8);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s, opacity .3s;
    outline: none;
}
.fp-nav svg { width: 18px; height: 18px; }
.fp-nav:hover {
    background: rgba(246,204,116,.12);
    color: #f6cc74;
    transform: translateY(-50%) scale(1.1);
}
.fp-nav-prev { left: 16px; }
.fp-nav-next { right: 16px; }

.fp-nav-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* hide arrows when book is closed */
.flip-scene:not(.fp-open) .fp-nav {
    opacity: 0;
    pointer-events: none;
}
.flip-scene.fp-open .fp-nav {
    opacity: 1;
    pointer-events: auto;
}

/* ══ Page counter ═══════════════════════════════════════════════ */
.fp-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: .65rem;
    color: rgba(246,204,116,.4);
    letter-spacing: 3px;
    font-weight: 600;
    transition: opacity .3s;
    white-space: nowrap;
    z-index: 100;
}

/* ══ Mobile: flat stack, no 3D ═════════════════════════════════ */
@media (max-width: 680px) {
    body {
        align-items: flex-start;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 14px 10px 110px;
    }
    .flip-scene {
        width: 100%; height: auto; perspective: none;
    }
    .flip-book {
        position: static; display: flex;
        flex-direction: column; gap: 10px; height: auto;
    }
    .fp-page {
        position: static; height: auto;
        transform: none !important; transform-style: flat;
        transition: none; cursor: default;
        display: flex; flex-direction: column; gap: 8px;
    }
    .fp-front, .fp-back {
        position: static; height: auto;
        transform: none !important;
        backface-visibility: visible;
        -webkit-backface-visibility: visible;
        border-radius: 14px; padding: 20px 16px;
    }
    .fp-items    { height: auto; overflow: visible; }
    .fp-click-hint { display: none; }
    .fp-cover-content { height: auto; padding: 18px 0 6px; }
    .fp-item:hover { transform: none; }
    .fp-nav { display: none; }
    .fp-counter { display: none; }
}
