/* ============================================================================
   Promo panels beside the Publisher Spotlight (partials/_side-promo*.blade.php)

   A bookshop window, not a web banner: a printed headline with a hand-drawn
   stroke under the key words, a rubber stamp for the offer, and real covers
   standing on wooden shelves. Five house styles; the accent can be overridden
   per panel. Logical properties, so the layout mirrors itself in Arabic.
   The panel is a size container: at wider widths (tablet, when the column
   goes full width) the shelves sit beside each other instead of stacked.
   ========================================================================== */

/* empty slots in the admin live preview; beats the display rules below */
.sp [hidden] { display: none !important; }

/* ---- rotator ---------------------------------------------------------- */
.sp-col { block-size: 100%; }

.sp-rotator {
    position: relative;
    display: grid;
    block-size: 100%;
}

.sp-rotator__slide {
    grid-area: 1 / 1;
    min-inline-size: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .6s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .6s;
}

.sp-rotator__slide.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity .6s cubic-bezier(.22, .61, .36, 1), visibility 0s;
}

.sp-rotator__dots {
    position: absolute;
    inset-block-start: .95rem;
    inset-inline-end: 1rem;
    z-index: 5;
    display: flex;
    gap: .3rem;
    padding: .3rem .45rem;
    border-radius: 50rem;
    background: rgba(20, 12, 6, .32);
    backdrop-filter: blur(4px);
}

.sp-rotator__dot {
    inline-size: .4rem;
    block-size: .4rem;
    padding: 0;
    border: 0;
    border-radius: 50rem;
    background: currentColor;
    color: rgba(255, 255, 255, .45);
    cursor: pointer;
    transition: inline-size .3s ease, color .3s ease;
}

.sp-rotator__dot.is-active {
    inline-size: 1.1rem;
    color: #fff;
}

/* ---- house styles ------------------------------------------------------ */
.sp {
    --sp-bg: #2f1d12;
    --sp-bg-2: #4a2e1c;
    --sp-ink: #f6ead7;
    --sp-soft: rgba(246, 234, 215, .72);
    --sp-accent: #e8ae45;
    --sp-on-accent: #2b1a0f;
    --sp-wood: #8a5a33;
    --sp-wood-dark: #5b391f;
    --sp-grain-blend: overlay;
    --sp-grain-opacity: .5;
    --sp-cover-edge: rgba(0, 0, 0, .35);
}

.sp--paper {
    --sp-bg: #f1e7d4;
    --sp-bg-2: #faf4e8;
    --sp-ink: #2a2019;
    --sp-soft: #6e5e4c;
    --sp-accent: #b4432a;
    --sp-on-accent: #fff8ee;
    --sp-wood: #c89c6b;
    --sp-wood-dark: #9a7147;
    --sp-grain-blend: multiply;
    --sp-grain-opacity: .55;
    --sp-cover-edge: rgba(60, 40, 20, .25);
}

.sp--ink {
    --sp-bg: #141c29;
    --sp-bg-2: #243149;
    --sp-ink: #eef1f6;
    --sp-soft: rgba(238, 241, 246, .68);
    --sp-accent: #f2b53c;
    --sp-on-accent: #141c29;
    --sp-wood: #4b5872;
    --sp-wood-dark: #2e3850;
}

.sp--sage {
    --sp-bg: #dfe5d3;
    --sp-bg-2: #eef1e6;
    --sp-ink: #1f2d1c;
    --sp-soft: #53624c;
    --sp-accent: #3f6f43;
    --sp-on-accent: #f4f7ee;
    --sp-wood: #b38f63;
    --sp-wood-dark: #86683f;
    --sp-grain-blend: multiply;
    --sp-grain-opacity: .5;
    --sp-cover-edge: rgba(40, 50, 30, .25);
}

.sp--rose {
    --sp-bg: #f3ddd5;
    --sp-bg-2: #fbefea;
    --sp-ink: #3a1d21;
    --sp-soft: #7b5256;
    --sp-accent: #a8323f;
    --sp-on-accent: #fff5f3;
    --sp-wood: #c2917a;
    --sp-wood-dark: #93634f;
    --sp-grain-blend: multiply;
    --sp-grain-opacity: .5;
    --sp-cover-edge: rgba(70, 30, 30, .25);
}

/* ---- panel -------------------------------------------------------------- */
.sp {
    container-type: inline-size;
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    block-size: 100%;
    min-block-size: 30rem;
    padding: 1.6rem 1.35rem 1.25rem;
    border-radius: 1rem;
    overflow: hidden;
    color: var(--sp-ink);
    background:
        radial-gradient(90% 55% at 50% 0%, var(--sp-bg-2) 0%, transparent 100%),
        var(--sp-bg);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 10px 30px -12px rgba(20, 12, 5, .45);
}

.sp--image {
    padding: 0;
    min-block-size: 0;
    background: transparent;
    box-shadow: none;
}

.sp__image-link,
.sp__image-link img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
}

.sp__image-link img {
    object-fit: cover;
    border-radius: 1rem;
}

/* optional photo behind a designed panel, washed with the panel colour so
   the type always reads */
.sp__bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
}

.sp--has-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, var(--sp-bg) 0%, color-mix(in srgb, var(--sp-bg) 78%, transparent) 45%, var(--sp-bg) 100%);
}

/* paper / wood grain — an SVG noise tile, not a flat gradient */
.sp__grain {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: var(--sp-grain-opacity);
    mix-blend-mode: var(--sp-grain-blend);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .4 0 0 0 0 .3 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- headline block ------------------------------------------------------ */
.sp__head {
    position: relative;
    text-align: center;
}

.sp__eyebrow {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: 0 0 .7rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--sp-accent);
}

.sp__eyebrow::before,
.sp__eyebrow::after {
    content: "";
    flex: 1;
    block-size: 1px;
    background: linear-gradient(90deg, transparent, currentColor 60%);
    opacity: .6;
}

.sp__eyebrow::after {
    background: linear-gradient(90deg, currentColor 40%, transparent);
}

.sp__title {
    margin: 0;
    color: var(--sp-ink) !important;
    font-size: clamp(1.55rem, 9cqi, 2.25rem);
    line-height: 1.35;
    font-weight: 700;
    text-wrap: balance;
}

.sp--font-ruqaa .sp__title { font-family: 'Aref Ruqaa', 'Amiri', serif !important; line-height: 1.45; }
.sp--font-naskh .sp__title { font-family: 'Amiri', 'Aref Ruqaa', serif !important; }
.sp--font-modern .sp__title { font-family: 'Almarai', var(--bp-sans, sans-serif) !important; font-weight: 800; letter-spacing: -.01em; }

.sp__hl {
    position: relative;
    display: inline-block;
    color: var(--sp-accent);
    white-space: nowrap;
}

.sp__stroke {
    position: absolute;
    inset-inline: -2%;
    inset-block-end: -.2em;
    inline-size: 104%;
    block-size: .38em;
    overflow: visible;
}

.sp__stroke path {
    fill: none;
    stroke: currentColor;
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    transition: stroke-dashoffset 1.1s cubic-bezier(.65, 0, .35, 1) .25s;
}

.sp-rotator__slide.is-active .sp__stroke path,
.sp--preview .sp__stroke path {
    stroke-dashoffset: 0;
}

.sp__sub {
    margin: .85rem auto 0;
    max-inline-size: 26ch;
    font-size: .85rem;
    line-height: 1.7;
    color: var(--sp-soft);
}

/* ---- display: stamp + shelves ------------------------------------------- */
.sp__display {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: 1.1rem .6rem;
}

.sp__stamp {
    position: absolute;
    z-index: 3;
    inset-block-start: .1rem;
    inset-inline-end: -.2rem;
    transform: rotate(-11deg);
}

.sp__stamp-ring {
    inline-size: 5.4rem;
    block-size: 5.4rem;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .05rem;
    padding: .5rem;
    text-align: center;
    background: var(--sp-accent);
    color: var(--sp-on-accent);
    /* inner dashed ring + a slightly uneven outer edge = inked, not drawn */
    box-shadow:
        inset 0 0 0 .22rem var(--sp-accent),
        inset 0 0 0 .3rem color-mix(in srgb, var(--sp-on-accent) 70%, transparent),
        0 6px 14px -4px rgba(0, 0, 0, .45);
    outline: 1.5px dashed color-mix(in srgb, var(--sp-on-accent) 55%, transparent);
    outline-offset: -.6rem;
}

.sp__stamp-top,
.sp__stamp-bottom {
    font-size: .6rem;
    font-weight: 700;
    line-height: 1.2;
    opacity: .9;
}

.sp__stamp-main {
    font-family: 'Aref Ruqaa', 'Amiri', serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.05;
}

.sp__stamp-main[dir="ltr"] {
    /* Ruqaa draws "+" and "%" wide enough to overlap the digit next to them */
    font-family: 'Almarai', var(--bp-sans, sans-serif);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: .02em;
}

.sp__shelves {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.sp__shelf {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: .55rem;
    padding-inline: .75rem;
    padding-block-end: .7rem;          /* room for the ledge */
}

/* the ledge: a lit front edge, a darker lip and a soft cast shadow */
.sp__shelf::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    block-size: .7rem;
    border-radius: 2px 2px 4px 4px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .28) 0 1px, transparent 1px 3px, rgba(0, 0, 0, .18) 100%),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, .06) 0 2px, transparent 2px 9px, rgba(255, 255, 255, .05) 9px 11px, transparent 11px 23px),
        linear-gradient(180deg, var(--sp-wood), var(--sp-wood-dark));
    box-shadow: 0 10px 14px -8px rgba(0, 0, 0, .55);
}

.sp__book {
    position: relative;
    z-index: 1;
    flex: 0 1 29%;
    max-inline-size: 6.6rem;
    aspect-ratio: 2 / 3;
    border-radius: 2px 4px 4px 2px;
    overflow: hidden;
    background: rgba(0, 0, 0, .15);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .12) inset,
        -1px 0 0 var(--sp-cover-edge),
        0 12px 16px -10px rgba(0, 0, 0, .6);
    transform-origin: 50% 100%;
    transition: transform .35s cubic-bezier(.22, .61, .36, 1), box-shadow .35s ease;
}

/* a spine crease and a little gloss, so the covers read as objects */
.sp__book::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, .28) 0, rgba(255, 255, 255, .18) 3%, rgba(0, 0, 0, .12) 6%, transparent 10%),
        linear-gradient(115deg, rgba(255, 255, 255, .14) 0%, transparent 40%);
}

[dir="rtl"] .sp__book::after {
    background:
        linear-gradient(270deg, rgba(0, 0, 0, .28) 0, rgba(255, 255, 255, .18) 3%, rgba(0, 0, 0, .12) 6%, transparent 10%),
        linear-gradient(245deg, rgba(255, 255, 255, .14) 0%, transparent 40%);
}

.sp__book img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
}

/* not a perfect row: one taller, one leaning on its neighbour */
.sp__book:nth-child(2) { flex-basis: 31%; max-inline-size: 7.1rem; }
.sp__shelf:nth-child(odd) .sp__book:nth-child(3) { transform: rotate(4deg); transform-origin: 0 100%; }
.sp__shelf:nth-child(even) .sp__book:nth-child(1) { transform: rotate(-3.5deg); transform-origin: 100% 100%; }
[dir="rtl"] .sp__shelf:nth-child(odd) .sp__book:nth-child(3) { transform: rotate(-4deg); transform-origin: 100% 100%; }
[dir="rtl"] .sp__shelf:nth-child(even) .sp__book:nth-child(1) { transform: rotate(3.5deg); transform-origin: 0 100%; }

.sp__book:hover,
.sp__book:focus-visible {
    z-index: 2;
    transform: translateY(-.55rem) rotate(0) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 20px 22px -12px rgba(0, 0, 0, .7);
}

/* ---- footer ------------------------------------------------------------ */
.sp__foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    padding-block-start: .6rem;
}

.sp__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    inline-size: 100%;
    padding: .75rem 1.2rem;
    border-radius: .6rem;
    background: var(--sp-accent);
    color: var(--sp-on-accent) !important;
    font-weight: 800;
    font-size: .95rem;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 3px 0 color-mix(in srgb, var(--sp-accent) 60%, #000);
    transition: transform .15s ease, box-shadow .15s ease;
}

.sp__cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 4px 0 color-mix(in srgb, var(--sp-accent) 60%, #000);
}

.sp__cta:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 1px 0 color-mix(in srgb, var(--sp-accent) 60%, #000);
}

.sp__cta-icon { transition: transform .2s ease; }
.sp__cta:hover .sp__cta-icon { transform: translateX(3px); }
[dir="rtl"] .sp__cta-icon { transform: scaleX(-1); }
[dir="rtl"] .sp__cta:hover .sp__cta-icon { transform: scaleX(-1) translateX(3px); }

.sp__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: .35rem .9rem;
    font-size: .78rem;
    color: var(--sp-soft);
}

.sp__countdown {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.sp__countdown-value {
    color: var(--sp-ink);
    font-variant-numeric: tabular-nums;
    direction: ltr;
    unicode-bidi: isolate;
}

.sp__countdown.is-urgent .sp__countdown-value { color: var(--sp-accent); }

/* ---- wide panel (column goes full width on tablets) ---------------------- */
@container (min-width: 34rem) {
    .sp__shelves { flex-direction: row; gap: 1.25rem; }
    .sp__shelf { flex: 1; }
    .sp__sub { max-inline-size: 44ch; }
    .sp__foot { flex-direction: row; justify-content: space-between; }
    .sp__cta { inline-size: auto; min-inline-size: 13rem; }
}

/* ---- phones: one shelf is plenty ---------------------------------------- */
@media (max-width: 575.98px) {
    .sp { min-block-size: 0; padding: 1.3rem 1.1rem 1.1rem; }
    .sp__shelf:nth-child(n+2) { display: none; }
    .sp__stamp-ring { inline-size: 4.7rem; block-size: 4.7rem; }
    .sp__stamp-main { font-size: 1.1rem; }
    .sp__image-link img { block-size: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .sp-rotator__slide, .sp-rotator__slide.is-active, .sp__book, .sp__cta, .sp__stroke path { transition: none; }
}

/* ============================================================================
   2026-10-03 polish layer: navigation pill with arrows + autoplay progress,
   swipe-friendly, entrance motion when a slide comes in, richer book hover.
   ========================================================================== */
.sp-rotator__nav {
    position: absolute;
    inset-block-start: .85rem;
    inset-inline-end: .85rem;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: .1rem;
    padding: .15rem;
    border-radius: 50rem;
    background: rgba(20, 12, 6, .34);
    backdrop-filter: blur(6px);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
}

.sp-rotator__nav .sp-rotator__dots {
    position: static;
    padding: 0 .2rem;
    background: none;
    backdrop-filter: none;
}

.sp-rotator__arrow {
    display: inline-grid;
    place-items: center;
    inline-size: 1.45rem;
    block-size: 1.45rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, .8);
    font-size: .72rem;
    cursor: pointer;
    transition: background-color .2s, color .2s, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}

.sp-rotator__arrow:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.sp-rotator__arrow:active { transform: scale(.85); }
.sp-rotator__arrow:focus-visible, .sp-rotator__dot:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

[dir="ltr"] .sp-rotator__arrow i { display: inline-block; transform: scaleX(-1); }

/* the active dot becomes a track that fills over the slide's time */
.sp-rotator__dot { position: relative; overflow: hidden; }

.sp-rotator__dot.is-active { inline-size: 1.4rem; color: rgba(255, 255, 255, .4); }

.sp-rotator__fill {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left center;
}

[dir="rtl"] .sp-rotator__fill { transform-origin: right center; }

.sp-rotator:not(.is-autoplay) .sp-rotator__dot.is-active .sp-rotator__fill { transform: none; }

.sp-rotator.is-autoplay .sp-rotator__dot.is-active .sp-rotator__fill { animation: sp-fill var(--sp-interval, 8s) linear forwards; }

.sp-rotator.is-paused .sp-rotator__dot.is-active .sp-rotator__fill { animation-play-state: paused; }

@keyframes sp-fill { to { transform: none; } }

/* incoming slide: headline, then shelves rise in */
.sp-rotator__slide.is-active .sp__head { animation: sp-rise .6s cubic-bezier(.22, .61, .36, 1) backwards; }
.sp-rotator__slide.is-active .sp__stamp { animation: sp-stamp .7s cubic-bezier(.34, 1.56, .64, 1) .25s backwards; }
.sp-rotator__slide.is-active .sp__shelf { animation: sp-rise .6s cubic-bezier(.22, .61, .36, 1) backwards; }
.sp-rotator__slide.is-active .sp__shelf:nth-child(1) { animation-delay: .12s; }
.sp-rotator__slide.is-active .sp__shelf:nth-child(2) { animation-delay: .22s; }
.sp-rotator__slide.is-active .sp__foot { animation: sp-rise .6s cubic-bezier(.22, .61, .36, 1) .3s backwards; }

@keyframes sp-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes sp-stamp { from { opacity: 0; transform: scale(1.6) rotate(-18deg); } }

/* books: lift, straighten, and a soft light spot on the shelf below */
.sp__book { transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), box-shadow .35s ease, filter .3s ease; }

.sp__shelf:hover .sp__book:not(:hover) { filter: brightness(.82) saturate(.9); }

.sp__book:hover,
.sp__book:focus-visible {
    transform: translateY(-.7rem) rotate(0) scale(1.04) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 22px 26px -12px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .12);
}

.sp__book img { background: linear-gradient(110deg, rgba(255, 255, 255, .06) 30%, rgba(255, 255, 255, .16) 50%, rgba(255, 255, 255, .06) 70%) 0 0 / 300% 100%; animation: sp-shimmer 1.6s linear infinite; }
.sp__book img[src] { animation-iteration-count: 2; }

@keyframes sp-shimmer { to { background-position: -150% 0; } }

/* call to action: a gentle arrow nudge */
.sp__cta:hover .sp__cta-icon { animation: sp-nudge .7s ease-in-out infinite; }
[dir="rtl"] .sp__cta-icon { transform: scaleX(-1); }

@keyframes sp-nudge { 50% { translate: .25rem 0; } }
[dir="rtl"] .sp__cta:hover .sp__cta-icon { animation-name: sp-nudge-rtl; }
@keyframes sp-nudge-rtl { 50% { translate: -.25rem 0; } }

@media (hover: none) {
    .sp__shelf:hover .sp__book:not(:hover) { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    .sp-rotator__slide.is-active .sp__head, .sp-rotator__slide.is-active .sp__stamp,
    .sp-rotator__slide.is-active .sp__shelf, .sp-rotator__slide.is-active .sp__foot,
    .sp-rotator__fill, .sp__book img, .sp__cta-icon { animation: none !important; }
    .sp__book { transition: none; }
}
