---
import Layout from "../../layouts/Layout.astro";
import Menu from "../../components/Menu.astro";

const response = await fetch('https://curriculum-app-api.beanstalkedu.com/items/occassion?filter[status][_eq]=published');
const data = await response.json();
const occassion = data.data;

const thisOccasionID = data.data[0].id;

const blogResp = await fetch('https://curriculum-app-api.beanstalkedu.com/items/blog?filter[category][_eq]=occassions&filter[property][_eq]=teenybeans_curriculum');
const blogRespJson = await blogResp.json();
const blogRespData = blogRespJson.data.reverse().slice(0, 3);

const csResp = await fetch('https://curriculum-app-api.beanstalkedu.com/items/occassion_celebration_stories?filter[occassion_key][_in]=' + thisOccasionID);
const csRespJson = await csResp.json();
const csRespData = csRespJson.data.reverse().slice(0, 4);

const wkstResp = await fetch('https://curriculum-app-api.beanstalkedu.com/items/occassion_worksheets?filter[occassion_key][_in]=' + thisOccasionID);
const wkstRespJson = await wkstResp.json();
const wkstRespData = wkstRespJson.data.reverse().slice(0, 3);
const wkstRespData2 = wkstRespJson.data[3];

import OccassionVideo from "../../components/OccassionVideo.vue";
import OccasionAudioBook from "../../components/OccasionAudioBook.vue";

const ytResp = await fetch('https://curriculum-app-api.beanstalkedu.com/items/occassion_youtube_videos?filter[occassion_key][_in]=' + thisOccasionID);
const ytRespJson = await ytResp.json();
const ytRespData = ytRespJson.data;

const faqResp = await fetch('https://curriculum-app-api.beanstalkedu.com/items/FAQ?filter[slug][_eq]=occassion');
const faqRespJson = await faqResp.json();
const faqRespData = faqRespJson.data;

import SubmitCelebration from "../../components/SubmitCelebration.vue";
import Footer from "../../components/Footer.vue";
---
<Layout title="TeenyBeans Occassion">
    <Menu/>
    <main>
            <!-- hero section -->
    <section class="bg-gradient-to-t bg3 shadow-2xl container-fluid">
        <div class="flex flex-col xl:flex-row container mx-auto px-3 xl:px-24">
            <div class="flex flex-col w-full justify-center">
                <div >
                    <h1 class="text-blue-700 hero-text font-bold">Occasion Based Resources <br> <span class="text-color-1" >{occassion[0].occasson_title}</span></h1>
                    <div class="flex h2-text text-color-1 font-semibold pt-8">{occassion[0].occassion_text }</div>
                    <div class="flex text-justify font-20px text-color-2 pt-4">{occassion[0].occassion_details }</div> 
                </div>
            </div>
            <div class="flex w-fit justify-center place-items-center">
                <img class="w-fit h-fit" src={'https://curriculum-app-api.beanstalkedu.com/assets/'+data.data[0].occassion} alt={occassion[0].occassion_text }>
            </div> 
        </div>
    </section>  <!-- hero section Ends -->
    <section class="container mx-auto px-2 xl:px-24 pt-24">
        <h1 class=" text-blue-700 h1-text px-4 font-semibold">Check Out Our Occasion Blog</h1>
        <p class="text-justify text-xl lg:text-3xl pt-2 text-color-2 px-4">Find relevant helpful articles for marketing preschool solutions below and get to know more about the same. </p>
        <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-8 mt-10 place-items-center">
            {blogRespData.map((data) => 
            <div class="grid w-fit" > 
                
                <img class="w-full rounded-tl-3xl rounded-br-3xl px-4" v-if="occassionblog.img" src={'https://curriculum-app-api.beanstalkedu.com/assets/'+data.img+'?width=420&amp;height=280'} alt="" >
                <div class="flex bg-yellow-200 absolute mt-56 lg:mt-40 ml-4 text-lg leading-tight w-14 h-14 font-semibold text-blue-700 rounded-full text-center p-1">{ data.date}</div>
                <h2 class="text-color-1 text-3xl font-semibold pt-4 px-4 line-clamp-2">{ data.title}</h2>
                <div class="text-justify line-clamp-3 font-20px text-color-2 px-4 line-clamp-4" set:html="data.meta_description"></div>
                    <a href={'/blog/' + data.slug} class="text-blue-600 font-20px px-4">Read More &gt;&gt;</a>
                    
                
            </div>
            )}
        </div>
        <a href="/blog">
            <div class="flex justify-center mt-8">
                <button class="bg-blue-700 p-2 text-2xl text-white px-4 rounded-tl-lg rounded-br-lg">Read All Articles</button>
            </div>
        </a>
    </section>
                    <!-- Worksheets Section -->
    <section class="container mx-auto xl:px-24 p-4 py-14">  
        <div class="h1-text text-blue-700 font-semibold">Worksheets</div>
        <h1 class="text-2xl text-justify text-color-2 py-4" v-if="page">{occassion[0].worksheets_text}</h1>
        <div v-if="worksheets" class="grid place-items-center grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 mt-0">
            {wkstRespData.map((data) =>             
                <div class="flex relative p-4">
                    <img v-if="wkst.occassion_worksheets_img" src={'https://curriculum-app-api.beanstalkedu.com/assets/'+data.occassion_worksheets_img} alt="" class="w-80 shadow-2xl rounded-tl-lg rounded-br-lg" />
                    <div v-if="wkst.file" class="absolute bottom-10 left-28">
                        <a href={'https://curriculum-app-api.beanstalkedu.com/assets/'+ data.file+'?download'}>
                        <h3 class="text-center inline-block px-6 py-2.5 bg-blue-500 text-white font-medium text-xs leading-tight rounded shadow-md hover:bg-blue-400 hover:shadow-lg focus:bg-blue-600 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out"> Download </h3>
                        </a>
                    </div>
                </div>
                )}
            <a href="/plan">
                <div class="p-4">
                    <div class="flex relative">
                        <img v-if="wkst.occassion_worksheets_img" src={'https://curriculum-app-api.beanstalkedu.com/assets/'+ wkstRespData2.occassion_worksheets_img} alt="" class="w-80 shadow-2xl rounded-tl-lg rounded-br-lg" />
                        <div class="absolute top-40 left-24">
                            <h3 class="text-center inline-block px-6 py-2.5 bg-amber-500 text-white font-medium text-xs leading-tight rounded shadow-md hover:bg-amber-400 hover:shadow-lg focus:bg-amber-600 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out"> + Subscribe </h3>
                            <h3 class=""> &nbsp;To download <br> more resources</h3>
                        </div>
                    </div>
                </div>
            </a>
        </div>
    </section>
    <OccassionVideo client:visible/>
    <OccasionAudioBook client:visible/>
    
    <!-- Celebration Stories   -->
    <section class="container mx-auto pt-16 xl:px-24 px-4">
        <h1 class="h1-text text-blue-700 font-semibold">Celebretion stories</h1>
        <h1 class="text-2xl text-justify text-color-2 py-4" v-if="page">{occassion[0].celebretion_stories_text}</h1>
        <div class="grid place-items-center grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 py-10 px-4 gap-12">
            {csRespData.map((data) => 
                <div class="flex bg-gray-200 rotate-6  rounded-tl-lg rounded-br-lg">
                    <div class="flex -rotate-6 relative"><img src={'https://curriculum-app-api.beanstalkedu.com/assets/'+data.img} alt="" class="rounded-tl-lg rounded-br-lg" />
                        <div class="flex absolute bg-white p-2 rounded-md m-4 justify-center text-sm md:text-xl">{data.title}</div>
                        <p class="absolute inset-x-0 bottom-6 text-blue-100 text-justify p-3 font-semibold rounded-br-lg line-clamp-4">{data.text}</p>
                        <span class="absolute inset-x-0 bottom-0 bg-gradient-to-t from-white text-justify p-3 "><a href="" class="text-blue-700 hover:font-extrabold"> <br> Read Full Storry &#62;&#62; </a></span>
                    </div>
                </div>
            )}
        </div>
    </section>
    <SubmitCelebration client:visible/>
    <section class="container mx-auto px-4 xl:px-24">  
        <div class="h1-text text-blue-700 font-semibold pt-16 ">YouTube Videos for your reference </div>
        <h1 class="text-2xl text-justify text-color-2 py-4">{occassion[0].youtube_text}</h1>
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5">
            {ytRespData.map((data) => 
                <div class="p-2">
                    <a href={'https://www.youtube.com/watch?v='+data.youtube_id}>
                        <div>
                            <img class="rounded-tl-xl rounded-br-xl" src={'https://curriculum-app-api.beanstalkedu.com/assets/'+ data.youtube_thumbnail} alt="">
                            <div class="text-center text-xl line-clamp-1 text-color-2 pt-4" >{data.about_the_video}</div>
                        </div>
                    </a>
                </div>
            )}
        </div>
    </section>
    <section class="container mx-auto py-20 px-4 xl:px-24" style="font-family: quicksand;">
        <div class="grid grid-cols-1 xl:grid-cols-2 xl:space-x-48">
            <div class="grid h-fit ">
                <h1 class="text-4xl py-6 text-blue-700 font-semibold">Frequently Asked <span class="text-color-1">Questions</span></h1>
                    {faqRespData.map((data) =>
                        <details>
                            <summary> 
                                <div class="flex inline-flex cursor-pointer"> {data.title}</div>
                            </summary>
                                <div set:html="data.content"></div>
                        </details>
                    )}
            </div>
            <div class="grid place-items-center">
                <img src="/img/frequently.png" alt="">
            </div> 
        </div>
    </section>
    </main>
    <Footer/>
</Layout>
<style scopped>
.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}
details {
    font-weight: lighter;
    border-bottom: 1px solid #d4d4d4;
    border-color: #d4d4d4;    
    padding: .75em .75em 0;
    font-size: 17px;
	/* margin-top: 10px; */
	/* box-shadow:0 0 8px #d4d4d4; */
}

summary {	
    margin: -.75em -.75em 0;
    padding: .75em;
}

details[open] {
    padding: .75em;
	  border-bottom: 1px solid #d4d4d4;
}

details[open] summary {
    border-bottom: 1px solid #d4d4d4;
    margin-bottom: 10px;
}
.font-20px {
    font-size: 20px;
}
@media screen and (min-width: 1500px) {
  .hero-text {
    font-size: 50px;
    
    
  }
}

@media screen and (max-width: 1499px) {
  .hero-text {
    font-size: 40px;
    
  }
}
@media screen and (max-width: 1199px) {
  .hero-text {
    font-size: 30px;
    
  }
}
@media screen and (min-width: 801px) {
  .h1-text {
    font-size: 40px;
    
    
  } 
}

@media screen and (min-width: 1500px) {
  .h2-text {
    font-size: 30px;
  } 
}
@media screen and (max-width: 1499px) {
  .h2-text {
    font-size: 24px;
  }
}
@media screen and (max-width: 1199px) {
  .h2-text {
    font-size: 20px;
  }
}

@media screen and (max-width: 800px) {
  .h1-text {
    font-size: 30px;
    
  }
}


.load-wraper{
  position: relative;
  height: 100%;
  width: 100%;
  background-color: rgb(211,211,211);
  z-index: 44;
  overflow: hidden;
  border-radius: 5px;
}
.activity{
  position: absolute;
  left: -45%;
  height: 100%;
  width: 45%;
  background-image: linear-gradient(to left, rgba(251,251,251, .05), rgba(251,251,251, .3), rgba(251,251,251, .6), rgba(251,251,251, .3), rgba(251,251,251, .05));
  background-image: -moz-linear-gradient(to left, rgba(251,251,251, .05), rgba(251,251,251, .3), rgba(251,251,251, .6), rgba(251,251,251, .3), rgba(251,251,251, .05));
  background-image: -webkit-linear-gradient(to left, rgba(251,251,251, .05), rgba(251,251,251, .3), rgba(251,251,251, .6), rgba(251,251,251, .3), rgba(251,251,251, .05));
  animation: loading 1s infinite;
  z-index: 45;
}

@keyframes loading {
  0%{
    left: -45%;
  }
  100%{
    left: 100%;
  }
}
.text-color-1 {
    color: #7C4C23;
}

.text-color-2 {
    color: #333333;
}
.box{
        width: 380px;
        height: 220px;
    }
    .box1 {
        width: 500px;
        height: 220px;
    }
    input[type="file"] {
    display: none;
}
.custom-file-upload {
    border: 1px solid #ccc;
    display: inline-block;
    padding: 6px 12px;
    cursor: pointer;
}
.ytModal {
  /* display: none;  */
  position: fixed;
  width: 80%;
  z-index: 999991;
  padding-top: 100px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0,0.4);
}
.bg3 {
  background: linear-gradient(0deg, rgb(191, 219, 254, 1) 0%, rgba(255, 255, 255) 100%);}



</style>