<script setup lang="ts">
import GradientText from "@/components/dredgy/GradientText.vue";
import TourQuickFacts from "@/components/TourNavigator/TourQuickFacts.vue";
import TourOverviewActions from "@/components/TourNavigator/TourOverviewActions.vue";
import TourStepper from "@/components/TourNavigator/TourStepper.vue";
import type {Tour, TourDay} from "@/types";

interface Props {
    tour: Tour;
    tourDay?: TourDay;
}

const props = defineProps<Props>();
</script>

<template>
    <section v-show-on-intersect class="no-gap tour-overview chamfer-tl">
        <div
            class="tour-overview-header"
            :style="{
            backgroundImage: `url(/img/tours/${tour.internal_name}.jpg)`,
            backgroundSize: 'cover',
            backgroundPosition: 'center',
            backgroundRepeat: 'no-repeat',
          }"
        >
            <h1 class="glass chamfer">
                <GradientText>{{ tour.name }}</GradientText>
            </h1>
        </div>
        <div class="tour-overview-body">
            <section class="tour-content">
                <article class="tour-description">
                    <TourStepper  v-if="tour.tour_days" :tourDays="tour.tour_days" />
                </article>
            </section>
            <aside class="chamfer chamfer-tl">
                <TourQuickFacts :tour="tour" />
            </aside>
        </div>
    </section>
</template>

<style scoped>
.tour-overview {
    margin: 5%;
    background: var(--sidebar-background);
    align-self: center;
    justify-self: center;
    min-height: 70vh;
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
}

.tour-overview-header {
    width: 100%;
    flex-shrink: 0;
    position: relative;
    height: 300px;
}

.parallax .v-img__img {
    object-fit: contain !important;  /* fit the whole image */
    object-position: center center !important; /* center it vertically */
    background-color: black; /* optional filler color */
}

.tour-overview-header h1 {
    position: absolute;
    bottom: 0;
    transform: translateY(50%) translateX(-50%);
    left: 37.5%;
    padding: 0.2em 0.75em;
    text-align: center;
    font-size: 2.5em;
    margin: 0;
    z-index: 999;
}

.tour-overview-body {
    flex: 1;
    width: 100%;
    display: flex;
    gap: 2rem;
}

.tour-overview-body .tour-content {
    flex: 1;
    padding: 2em;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
}

.tour-description {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.tour-overview-body aside {
    display: flex;
    flex-direction: column;
    flex-basis: 25%;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .tour-overview {
        height: auto;
    }

    .tour-overview-header h1 {
        font-size: 1.5em;
        left: 50%;
    }

    .tour-overview-body {
        flex-direction: column;
        gap: 1rem;
    }

    .tour-overview-body aside {
        order: 1;
        height: auto;
        min-height: 0;
    }

    .tour-overview-body .tour-content {
        padding-top: 0.5em;
        order: 2;
    }
}

.chamfer {
    --cut: 20px;
    clip-path: polygon(
        0 0,
        calc(100% - var(--cut)) 0,
        100% var(--cut),
        100% 100%,
        var(--cut) 100%,
        0 calc(100% - var(--cut))
    );
}

.chamfer-tl {
    --cut: 20px;
    clip-path: polygon(
        var(--cut) 0,
        100% 0,
        100% 100%,
        0 100%,
        0 0
    );
}

.line-height-relaxed {
    line-height: 1.6;
}
</style>
