/*
 * Halloween theme for the front page and the listings, loaded on top of
 * halloween.css, which holds the shared shapes, keyframes and reduced motion
 * rules.
 */

/* Listings: the spider on the search field */

.hh-spider-search {
    --hh-thread: 26px;
    --hh-spider-color: #3a3c48;
    --hh-thread-color: rgba(30, 32, 42, 0.3);
    right: 0;
    bottom: 0;
    z-index: 11;
    width: 80px;
}

/* Hangs from the edge without bobbing, 26px from the right like the design. */
.hh-spider-search .hh-spider {
    right: 13.5px;
}

.hh-spider-search .hh-spider-bob {
    animation: none;
}

.hh-spider-search .hh-spider-thread {
    height: var(--hh-thread);
    margin-top: 0;
}

@media (max-width: 767.98px) {
    /* The search field is lower on small screens. */
    .hh-spider-search {
        --hh-thread: 20px;
    }
}

/* Front page: figures perched on the choice cards */

.hh-perch {
    position: absolute;
    right: 18px;
    bottom: 0;
    transform: scale(1.15);
    transform-origin: right bottom;
}

@media (max-width: 767.98px) {
    .hh-perch {
        right: 12px;
        transform: scale(0.8);
    }
}

.hh-jack {
    --hh-s: 30px;
    position: relative;
    flex: none;
    width: var(--hh-s);
    height: calc(var(--hh-s) * 0.8);
    margin-top: calc(var(--hh-s) * 0.12);
}

.hh-jack .hh-pumpkin {
    position: absolute;
    left: 0;
    top: 0;
}

.hh-jack-eye {
    position: absolute;
    top: calc(var(--hh-s) * 0.22);
    width: calc(var(--hh-s) * 0.17);
    height: calc(var(--hh-s) * 0.14);
    background: #6b2e0b;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.hh-jack-eye-left {
    left: calc(var(--hh-s) * 0.24);
}

.hh-jack-eye-right {
    left: calc(var(--hh-s) * 0.58);
}

.hh-jack-mouth {
    position: absolute;
    left: calc(var(--hh-s) * 0.26);
    top: calc(var(--hh-s) * 0.46);
    width: calc(var(--hh-s) * 0.48);
    height: calc(var(--hh-s) * 0.16);
    background: #6b2e0b;
    clip-path: polygon(
        0 0, 20% 40%, 40% 0, 60% 40%, 80% 0, 100% 0, 85% 100%, 15% 100%
    );
}

.hh-cat {
    position: relative;
    width: 32px;
    height: 24px;
}

.hh-cat-ear {
    position: absolute;
    top: -7px;
    width: 11px;
    height: 12px;
    background: #1e202a;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.hh-cat-ear-left {
    left: 2px;
}

.hh-cat-ear-right {
    left: 19px;
}

.hh-cat-head {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 50% 50% 42% 42%;
    background: #1e202a;
}

.hh-cat-eye {
    position: absolute;
    top: 9px;
    width: 6px;
    height: 7px;
    border-radius: 50%;
    background: #f5c542;
    animation: hh-blink 4.5s infinite;
}

.hh-cat-eye-left {
    left: 8px;
}

.hh-cat-eye-right {
    left: 18px;
}

.hh-candle {
    position: relative;
    width: 16px;
    height: 34px;
}

.hh-candle-halo {
    position: absolute;
    left: -6px;
    top: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 190, 90, 0.45), transparent 70%);
    animation: hh-flicker 2.2s infinite;
}

.hh-candle-flame {
    position: absolute;
    left: 4px;
    top: 0;
    width: 8px;
    height: 12px;
    border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
    background: #f7a234;
    transform-origin: center bottom;
    animation: hh-flame 1.4s ease-in-out infinite;
}

.hh-candle-wick {
    position: absolute;
    left: 7.5px;
    top: 10px;
    width: 1px;
    height: 3px;
    background: #1e202a;
}

.hh-candle-wax {
    position: absolute;
    left: 0;
    top: 13px;
    width: 16px;
    height: 21px;
    border-radius: 3px 3px 1px 1px;
    background: #f4eee2;
    box-shadow: inset -3px 0 0 #e4dccb;
}

/* Front page: more room between the cards and the next section for the bats
   and the vampire. */
.index-choices-container.mb-4 {
    margin-bottom: 64px !important;
}

@media (min-width: 768px) {
    .index-choices-container.mb-md-5 {
        margin-bottom: 80px !important;
    }
}

/* Front page: bats over the next section */

/* Has no height, so the margins around it collapse and the layout is unchanged;
   its top is the top of the next section. */
.hh-hero-bats-anchor {
    position: relative;
    height: 0;
}

.hh-hero-bats {
    position: absolute;
    left: 0;
    right: 0;
    top: -20px;
    height: 90px;
    overflow: hidden;
}

.hh-hero-bat-1,
.hh-hero-bat-2,
.hh-hero-bat-3 {
    --hh-fly-duration: 18s;
}

.hh-hero-bat-1 {
    --hh-s: 18px;
    --hh-fly-delay: 2s;
}

.hh-hero-bat-2 {
    --hh-s: 13px;
    --hh-fly-delay: 3.4s;
}

.hh-hero-bat-3 {
    --hh-s: 10px;
    --hh-fly-delay: 4.3s;
}

@media (min-width: 768px) {
    .hh-hero-bats {
        top: -40px;
    }

    .hh-hero-bat-1 {
        --hh-s: 24px;
    }

    .hh-hero-bat-2 {
        --hh-s: 16px;
    }

    .hh-hero-bat-3 {
        --hh-s: 12px;
    }
}

/* Front page: vampire peeking over "HYBEL PREMIUM" */

.hh-vampire-host {
    position: relative;
}

/* The bottom edge is the top of the label, and the figure starts 10px below
   it, so the vampire rises from behind the text. */
.hh-vampire {
    position: absolute;
    left: 50%;
    bottom: 100%;
    width: 64px;
    height: 54px;
    /* Centres on the letters, not on the trailing letter spacing. */
    margin-left: calc(-32px - 0.125rem);
    overflow: hidden;
}

.hh-vampire-figure {
    position: absolute;
    left: 4px;
    bottom: -10px;
    width: 56px;
    height: 60px;
    transform: translateY(62px);
    animation: hh-peek 11s ease-in-out 3s infinite;
}

.hh-vampire svg {
    display: block;
}

.hh-vampire-eye {
    filter: drop-shadow(0 0 2px #ff3b3b);
    animation: hh-eyes 1.2s ease-in-out infinite;
}

/* Listings: the search field */

#search-place-form .form-group-search {
    position: relative;
}

#search-place-form .form-group-search .form-control {
    transition: border-color 0.15s ease-in-out, box-shadow 0.25s ease-in-out;
}

#search-place-form .form-group-search .form-control:focus {
    box-shadow:
        0 0 0 2px rgba(240, 124, 42, 0.35),
        0 0 22px rgba(240, 124, 42, 0.18);
}

.hh-search-web {
    --hh-s: 46px;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 11;
    width: var(--hh-s);
    height: var(--hh-s);
    overflow: hidden;
    border-top-right-radius: 5px;
}

.hh-web-line {
    position: absolute;
    right: 0;
    top: 0;
    width: calc(var(--hh-s) * var(--hh-length));
    height: 1px;
    background: rgba(30, 32, 42, 0.22);
    transform-origin: right center;
    transform: rotate(var(--hh-angle));
}

/* Each arc is the lower left quarter of a circle centred on the corner. */
.hh-web-arc {
    position: absolute;
    right: calc(var(--hh-s) * var(--hh-radius) * -1);
    top: calc(var(--hh-s) * var(--hh-radius) * -1);
    width: calc(var(--hh-s) * var(--hh-radius) * 2);
    height: calc(var(--hh-s) * var(--hh-radius) * 2);
    border: 1px solid rgba(30, 32, 42, 0.22);
    border-radius: 50%;
    clip-path: polygon(0 50%, 50% 50%, 50% 100%, 0 100%);
}

.hh-search-pumpkin {
    --hh-s: 20px;
    position: absolute;
    left: -9px;
    top: -13px;
    z-index: 11;
    transform: rotate(-14deg);
}

/* Listings: ghosts rising from the photos */

#list-container .card-listing-home .card-body {
    position: relative;
}

/* The bottom edge lines up with the bottom of the photo. */
.hh-ghost-clip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 60px;
    overflow: hidden;
}

.hh-ghost {
    position: absolute;
    left: 16px;
    bottom: 0;
    transform: translateY(105%);
    transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.hh-ghost-float {
    animation: hh-float 2.4s ease-in-out infinite;
    animation-play-state: paused;
}

.card-listing-home:hover .hh-ghost,
.card-listing-home:focus-visible .hh-ghost {
    transform: translateY(18%);
}

.card-listing-home:hover .hh-ghost-float,
.card-listing-home:focus-visible .hh-ghost-float {
    animation-play-state: running;
}

.hh-ghost-shape {
    position: relative;
    width: 34px;
    height: 42px;
    border-radius: 17px 17px 8px 8px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(30, 32, 42, 0.25);
}

.hh-ghost-eye,
.hh-ghost-mouth {
    position: absolute;
    border-radius: 50%;
    background: #1e202a;
}

.hh-ghost-eye {
    top: 13px;
    width: 4px;
    height: 6px;
}

.hh-ghost-eye-left {
    left: 9px;
}

.hh-ghost-eye-right {
    right: 9px;
}

.hh-ghost-mouth {
    left: 14px;
    top: 22px;
    width: 6px;
    height: 4px;
    opacity: 0.7;
}

/* Touch screens have no hover to reveal the ghosts. */
@media not all and (hover: hover) and (pointer: fine) {
    .hh-ghost-clip {
        display: none;
    }
}

/* Listings: saved ads get an orange heart */

.listing-list .manage-favourite .remove-favourite .fas.fa-heart.text-white,
.listing-list .manage-favourite .remove-favourite .fas.fa-heart.text-danger {
    color: #f07c2a !important;
}

@media (prefers-reduced-motion: reduce) {
    .hh-vampire {
        display: none;
    }
}
