/* ==========================================================
   ADVERT STRIP (Shop and News pages)
   Adverts come live from the dashboard (js/spotlight.js).
   One shows at a time; every few seconds the strip turns
   like a box, and the next advert comes up from below.
   The strip itself never moves.

   Design sizes for image adverts:
     desktop  1600 x 134 px   (keep text in the middle 80%)
     phone    1080 x 354 px
   ========================================================== */

.spot-strip {
    --ad-brown: #412e03;
    --ad-brown-dark: #2c1f02;
    --ad-gold: #d89b00;
    --ad-gold-soft: #fdf3d8;
    --ad-light: #fafafa;
    --ad-line: #ececec;
    --ad-text: #1f1c16;

    position: relative;

    height: 92px;

    overflow: hidden;

    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

.spot-strip[hidden] {
    display: none;
}

.spot-list {
    position: relative;

    height: 100%;
    margin: 0;
    padding: 0;

    list-style: none;
}


/* ----------------------------------------------------------
   Motion: 3D turn
   The adverts sit on the faces of a box. Every few seconds the
   box turns upward: the next advert comes up from below
   while the current one turns away over the top edge. The
   strip itself (its left and right sides) never moves.
   --spot-half is half the strip's height (the box's depth).
   ---------------------------------------------------------- */

.spot-strip {
    --spot-half: 46px;
    --spot-turn: 0.6s;
    --spot-ease: cubic-bezier(0.4, 0, 0.2, 1);

    perspective: 1000px;
    perspective-origin: 50% 50%;
}

.spot-list {
    transform-style: preserve-3d;
}

.spot-slide {
    position: absolute;
    inset: 0;

    opacity: 0;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    /* Waiting on the lower face of the box */
    transform:
        translateZ(calc(var(--spot-half) * -1))
        rotateX(-90deg)
        translateZ(var(--spot-half));

    filter: brightness(0.85);

    transition:
        transform var(--spot-turn) var(--spot-ease),
        filter var(--spot-turn) ease,
        opacity 0.2s linear;
}

/* Before the script runs (or without it): show the first one */
.spot-list:not(.is-ticking) .spot-slide:first-child,
.spot-slide.is-active {
    opacity: 1;

    transform:
        translateZ(calc(var(--spot-half) * -1))
        rotateX(0deg)
        translateZ(var(--spot-half));

    filter: brightness(1);
}

/* Turning away over the top edge */
.spot-slide.is-leaving {
    opacity: 1;

    transform:
        translateZ(calc(var(--spot-half) * -1))
        rotateX(90deg)
        translateZ(var(--spot-half));

    filter: brightness(0.85);
}

/* Moving a slide back below without being seen */
.spot-slide.no-motion {
    transition: none !important;
}

@media (max-width: 768px) {

    .spot-strip {
        --spot-half: 59px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .spot-slide,
    .spot-slide.is-active,
    .spot-slide.is-leaving {
        transform: none !important;
        filter: none !important;
        transition: opacity 0.5s ease !important;
    }

    .spot-slide.is-leaving {
        opacity: 0 !important;
    }
}


/* ----------------------------------------------------------
   Link area (whole advert is clickable)
   ---------------------------------------------------------- */

.spot-slide > a,
.spot-slide > div {
    box-sizing: border-box;

    display: flex;
    align-items: center;
    gap: 24px;

    width: 100%;
    height: 100%;
    padding: 0 28px;

    border: 1px solid transparent;

    text-decoration: none;
}

.spot-slide > a:focus-visible {
    outline: 3px solid var(--ad-gold);
    outline-offset: -3px;
}


/* ----------------------------------------------------------
   Image adverts
   ---------------------------------------------------------- */

.spot-slide.spot-image > a,
.spot-slide.spot-image > div {
    padding: 0;

    background: var(--ad-brown-dark);
}

.spot-image picture,
.spot-image img {
    display: block;

    width: 100%;
    height: 100%;
}

.spot-image img {
    object-fit: cover;
    object-position: center;
}


/* ----------------------------------------------------------
   Text adverts
   ---------------------------------------------------------- */

.spot-tag {
    flex-shrink: 0;

    padding: 5px 10px;

    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.spot-title {
    flex: 1;
    min-width: 0;

    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.spot-cta {
    flex-shrink: 0;

    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.spot-cta::after {
    content: " \2192";

    display: inline-block;

    margin-left: 2px;

    transition: transform 0.2s ease;
}

.spot-slide a:hover .spot-cta::after {
    transform: translateX(3px);
}

.spot-dark > a,
.spot-dark > div {
    background: var(--ad-brown);
    color: #ffffff;
}

.spot-dark .spot-tag {
    background: var(--ad-gold);
    color: var(--ad-brown-dark);
}

.spot-dark .spot-cta {
    color: var(--ad-gold);
}

.spot-gold > a,
.spot-gold > div {
    background: var(--ad-gold-soft);
    color: var(--ad-brown-dark);
}

.spot-gold .spot-tag {
    background: var(--ad-brown);
    color: #ffffff;
}

.spot-light > a,
.spot-light > div {
    background: var(--ad-light);
    border-color: var(--ad-line);
    color: var(--ad-text);
}

.spot-light .spot-tag {
    background: #ffffff;
    border: 1px solid var(--ad-line);
    color: var(--ad-brown);
}

.spot-gold .spot-cta,
.spot-light .spot-cta {
    color: var(--ad-brown);
}

.spot-slide > a:hover {
    border-color: var(--ad-gold);
}

.spot-slide > a:hover .spot-cta {
    color: var(--ad-gold);
}


/* ----------------------------------------------------------
   News page placement
   ---------------------------------------------------------- */

.news-spotlight {
    width: 94%;
    max-width: 1100px;

    margin: 0 auto 32px;
}


/* ----------------------------------------------------------
   Phones
   ---------------------------------------------------------- */

@media (max-width: 768px) {

    .spot-strip {
        height: 118px;
    }

    .spot-slide > a,
    .spot-slide > div {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 6px;

        padding: 0 16px;
    }

    .spot-slide.spot-image > a,
    .spot-slide.spot-image > div {
        padding: 0;
    }

    .spot-tag {
        padding: 3px 8px;

        font-size: 10.5px;
    }

    .spot-title {
        flex: 0 0 auto;

        font-size: 15.5px;
    }

    .spot-cta {
        font-size: 13px;
    }

    .news-spotlight {
        width: calc(100% - 28px);

        margin-bottom: 22px;
    }
}


/* ----------------------------------------------------------
   Designed text adverts (made on the dashboard designer)
   Colours, fonts and lines come from the design itself;
   these rules only handle size and layout.
   ---------------------------------------------------------- */

.spot-custom > a,
.spot-custom > div {
    background-origin: border-box;
}

.spot-custom .spot-tag {
    font-size: var(--tag-size, 11.5px);
}

.spot-custom .spot-words {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;

    min-width: 0;
}

.spot-custom .spot-title {
    flex: 0 0 auto;

    display: -webkit-box;
    overflow: hidden;

    font-size: var(--title-size, 18px);
    line-height: 1.2;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.spot-custom .spot-sub {
    display: block;
    overflow: hidden;

    font-size: var(--sub-size, 13px);
    line-height: 1.3;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.spot-custom .spot-cta {
    font-size: var(--cta-size, 14px);
    line-height: 1.2;
}

.spot-custom .spot-cta-outline,
.spot-custom .spot-cta-filled {
    padding: 9px 16px;
}

.spot-custom .spot-cta-outline::after,
.spot-custom .spot-cta-filled::after {
    margin-left: 4px;
}

.spot-custom > a:hover .spot-cta-filled {
    filter: brightness(1.08);
}

/* Stack: small label sits above the headline */
.spot-layout-stack .spot-words .spot-tag {
    align-self: flex-start;

    margin-bottom: 3px;
}

/* Centre: everything in the middle */
.spot-layout-center > a,
.spot-layout-center > div {
    justify-content: center;

    text-align: center;
}

.spot-layout-center .spot-words {
    flex: 0 1 auto;
    align-items: center;
}

/* Picture or logo at one side */
.spot-pic {
    flex-shrink: 0;
    display: block;

    box-sizing: border-box;
    width: auto;
    max-width: 180px;
    height: var(--pic-size, 70%);

    object-fit: contain;
}

.spot-pic-rounded {
    border-radius: 10px;
}

.spot-pic-circle {
    border-radius: 50%;
}

.spot-pic-right .spot-pic {
    order: 10;
}

/* Lines between the parts */
.spot-divider {
    flex-shrink: 0;
    align-self: center;

    width: 0;
    height: 46%;

    border-left: var(--line-width, 1px) var(--line-style, solid) var(--line-color, #d89b00);
}


/* Phones (and the dashboard's phone preview) */
@media (max-width: 768px) {

    .spot-custom .spot-tag   { font-size: calc(var(--tag-size, 11.5px) * 0.9); }
    .spot-custom .spot-title { font-size: calc(var(--title-size, 18px) * 0.85); }
    .spot-custom .spot-sub   { font-size: calc(var(--sub-size, 13px) * 0.9); }
    .spot-custom .spot-cta   { font-size: calc(var(--cta-size, 14px) * 0.9); }

    .spot-custom .spot-words {
        flex: 0 0 auto;
        gap: 1px;

        width: 100%;
    }

    .spot-custom > a,
    .spot-custom > div {
        gap: 4px;
    }

    .spot-custom .spot-title {
        -webkit-line-clamp: 2;
    }

    .spot-layout-stack .spot-words .spot-tag {
        margin-bottom: 2px;
    }

    .spot-custom .spot-cta-outline,
    .spot-custom .spot-cta-filled {
        padding: 3px 10px;
    }

    .spot-layout-center > a,
    .spot-layout-center > div {
        align-items: center;
    }

    .spot-divider,
    .spot-pic {
        display: none;
    }

    .spot-bg-split > a,
    .spot-bg-split > div {
        background: var(--spot-bg-phone) !important;
        background-origin: border-box !important;
        padding-left: 22px;
    }
}

/* The same phone layout for the dashboard preview */
.spot-strip.is-phone {
    height: 118px;
}

.spot-strip.is-phone .spot-slide > a,
.spot-strip.is-phone .spot-slide > div {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;

    padding: 0 16px;
}

.spot-strip.is-phone .spot-slide.spot-image > a,
.spot-strip.is-phone .spot-slide.spot-image > div {
    padding: 0;
}

.spot-strip.is-phone .spot-tag   { padding: 3px 8px; font-size: 10.5px; }
.spot-strip.is-phone .spot-title { flex: 0 0 auto; font-size: 15.5px; }
.spot-strip.is-phone .spot-cta   { font-size: 13px; }

.spot-strip.is-phone .spot-custom .spot-tag   { font-size: calc(var(--tag-size, 11.5px) * 0.9); }
.spot-strip.is-phone .spot-custom .spot-title { font-size: calc(var(--title-size, 18px) * 0.85); }
.spot-strip.is-phone .spot-custom .spot-sub   { font-size: calc(var(--sub-size, 13px) * 0.9); }
.spot-strip.is-phone .spot-custom .spot-cta   { font-size: calc(var(--cta-size, 14px) * 0.9); }

.spot-strip.is-phone .spot-custom .spot-words {
    flex: 0 0 auto;
    gap: 1px;

    width: 100%;
}

.spot-strip.is-phone .spot-custom > a,
.spot-strip.is-phone .spot-custom > div {
    gap: 4px;
}

.spot-strip.is-phone .spot-layout-stack .spot-words .spot-tag {
    margin-bottom: 2px;
}

.spot-strip.is-phone .spot-custom .spot-cta-outline,
.spot-strip.is-phone .spot-custom .spot-cta-filled {
    padding: 3px 10px;
}

.spot-strip.is-phone .spot-layout-center > a,
.spot-strip.is-phone .spot-layout-center > div {
    align-items: center;
}

.spot-strip.is-phone .spot-divider,
.spot-strip.is-phone .spot-pic {
    display: none;
}

.spot-strip.is-phone .spot-bg-split > a,
.spot-strip.is-phone .spot-bg-split > div {
    background: var(--spot-bg-phone) !important;
    background-origin: border-box !important;
    padding-left: 22px;
}

/* A picture set to "show on phones" sits at the right edge,
   beside the stacked words */
@media (max-width: 768px) {

    .spot-pic-phone > a,
    .spot-pic-phone > div {
        position: relative;

        padding-right: 96px;
    }

    .spot-pic-phone .spot-pic {
        position: absolute;
        top: 50%;
        right: 14px;

        display: block;

        max-width: 72px;
        height: min(var(--pic-size, 70%), 72px);

        transform: translateY(-50%);
    }
}

.spot-strip.is-phone .spot-pic-phone > a,
.spot-strip.is-phone .spot-pic-phone > div {
    position: relative;

    padding-right: 96px;
}

.spot-strip.is-phone .spot-pic-phone .spot-pic {
    position: absolute;
    top: 50%;
    right: 14px;

    display: block;

    max-width: 72px;
    height: min(var(--pic-size, 70%), 72px);

    transform: translateY(-50%);
}
