/**
 * Zeal Ad Manager
 *
 * This file contains the styles and animations for the "Animated Ad" format.
 */

/**
 * TABLE OF CONTENTS
 * --------------------------------------------------------------------------
 * 1.0 - Base Animated Ad Styles & Layout
 * 2.0 - Dimension-Specific Adjustments
 * 3.0 - Animation Trigger Logic
 * 4.0 - Keyframe Definitions
 * --------------------------------------------------------------------------
 */


/* --- 1.0 - Base Animated Ad Styles & Layout --- */
.zam-anim-ad-unit {
    position: relative;
    overflow: hidden;
    background: #ddd;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

.zam-anim-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.4s ease;
    z-index: 1;
}

.zam-anim-content {
    position: relative;
    z-index: 2;
    padding: 20px;
    flex-grow: 1; /* Allow content to fill available space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

.zam-anim-logo-wrapper {
    text-align: center;
    margin-bottom: 10px;
    opacity: 0;
}

.zam-anim-logo {
    max-width: 120px;
    max-height: 40px;
    display: inline-block;
}

.zam-anim-headline,
.zam-anim-description,
.zam-anim-button {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    margin: 0;
    opacity: 0;
}

.zam-anim-headline {
    color: #fff;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zam-anim-description {
    line-height: 1.5;
    margin-top: 8px;
    font-weight: 400;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zam-anim-button {
    position: absolute;
    z-index: 3;
    padding: 12px;
    width: 80%;
    left: 10%;
    bottom: 10px;
    text-align: center;
    font-weight: 600;
    border-radius: 6px;
    background-color: #4A90E2;
    box-sizing: border-box;
}


/* --- 2.0 - Dimension-Specific Adjustments --- */

/* Default: Spotlight (300x250) */
.zam-anim-ad-unit.is-spotlight {
    width: 300px;
    height: 250px;
}
.is-spotlight .zam-anim-headline { font-size: 26px; }
.is-spotlight .zam-anim-description { font-size: 14px; }
.is-spotlight .zam-anim-button {
    bottom: 20px;
    left: 20px;
    right: 20px;
    width: auto;
}

/* Portrait (300x500) */
.zam-anim-ad-unit.is-portrait {
    width: 300px;
    height: 500px;
}
.is-portrait .zam-anim-content { justify-content: flex-end; padding-bottom: 100px; }
.is-portrait .zam-anim-headline { font-size: 32px; -webkit-line-clamp: 2; }
.is-portrait .zam-anim-description { font-size: 16px; -webkit-line-clamp: 3; margin-top: 15px;}
.is-portrait .zam-anim-button {
    bottom: 30px;
    left: 30px;
    right: 30px;
    width: auto;
}
.is-portrait .zam-anim-focus-zoom .zam-anim-content,
.is-portrait .zam-anim-text-spotlight .zam-anim-content {
    justify-content: center;
    padding-bottom: 20px;
}

/* Banner (728x90) */
.zam-anim-ad-unit.is-banner {
    width: 728px;
    height: 90px;
    max-width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 0 15px;
}
.is-banner .zam-anim-content {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    flex-grow: 1;
}
.is-banner .zam-anim-logo-wrapper {
    margin: 0 20px 0 0;
    flex-shrink: 0;
}
.is-banner .zam-anim-logo { max-height: 50px; }
.is-banner .zam-anim-text-container { flex-grow: 1; }
.is-banner .zam-anim-headline { font-size: 22px; text-align: left; }
.is-banner .zam-anim-description { font-size: 14px; margin-top: 2px; text-align: left; }
.is-banner .zam-anim-button {
    margin-top: 20px;
    width: 150px;
    position: static;
    margin-left: 30px;
    padding: 10px 25px;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0;
}
.is-banner .zam-anim-text-spotlight .zam-anim-headline,
.is-banner .zam-anim-text-spotlight .zam-anim-description {
    text-align: left;
}


/* --- 3.0 - Animation Trigger Logic --- */

/* Template 1: Classic Slide */
.zam-is-animating.zam-anim-classic-slide .zam-anim-headline {
    animation: zam-slide-in-left 6.0s cubic-bezier(0.2, 0.8, 0.2, 1) 1.0s infinite forwards;
}
.zam-is-animating.zam-anim-classic-slide .zam-anim-description {
    animation: zam-slide-in-right 6.0s cubic-bezier(0.2, 0.8, 0.2, 1) 2.0s infinite forwards;
}
.zam-is-animating.zam-anim-classic-slide .zam-anim-button {
    animation: zam-slide-in-bottom 5.0s cubic-bezier(0.2, 0.8, 0.2, 1) 3.0s infinite forwards;
}

/* Template 2: Focus Zoom */
.zam-is-animating.zam-anim-focus-zoom .zam-anim-background {
    animation: zam-slow-zoom 50.0s ease-in-out infinite alternate;
}
.zam-is-animating.zam-anim-focus-zoom .zam-anim-logo-wrapper {
    animation: zam-fade-in 7.5s ease 1.0s infinite forwards;
}
.zam-is-animating.zam-anim-focus-zoom .zam-anim-headline {
    animation: zam-slide-in-bottom 6.0s ease 2.5s infinite forwards;
}
.zam-is-animating.zam-anim-focus-zoom .zam-anim-description {
    display: none;
}
.zam-is-animating.zam-anim-focus-zoom .zam-anim-button {
    animation: zam-fade-in 7.5s ease 4.0s infinite forwards;
}

/* Template 3: Text Spotlight */
.zam-is-animating.zam-anim-text-spotlight .zam-anim-background {
    filter: brightness(0.6) blur(2px);
}
.zam-is-animating.zam-anim-text-spotlight .zam-anim-background::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%; width: 1px; height: 1px;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    animation: zam-light-reveal 20.0s ease-out infinite;
}
.zam-is-animating.zam-anim-text-spotlight .zam-anim-headline {
    animation: zam-fade-blur-in 7.5s ease 3.0s infinite forwards;
}
.zam-is-animating.zam-anim-text-spotlight .zam-anim-description {
    animation: zam-fade-blur-in 7.5s ease 4.0s infinite forwards;
}
.zam-is-animating.zam-anim-text-spotlight .zam-anim-button {
    animation: zam-fade-scale-in 6.0s ease 5.5s infinite forwards;
}


/* --- 4.0 - Keyframe Definitions --- */

@keyframes zam-fade-in {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes zam-slide-in-bottom {
    0%, 100% { opacity: 0; transform: translateY(25px); }
    50%, 90% { opacity: 1; transform: translateY(0); }
}

@keyframes zam-slide-in-left {
    0%, 100% { opacity: 0; transform: translateX(-25px); }
    50%, 90% { opacity: 1; transform: translateX(0); }
}

@keyframes zam-slide-in-right {
    0%, 100% { opacity: 0; transform: translateX(25px); }
    50%, 90% { opacity: 1; transform: translateX(0); }
}

@keyframes zam-slow-zoom {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}

@keyframes zam-light-reveal {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(500); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}

@keyframes zam-fade-scale-in {
    0%, 100% { opacity: 0; transform: scale(0.9); }
    50%, 90% { opacity: 1; transform: scale(1); }
}

@keyframes zam-fade-blur-in {
    0%, 100% { opacity: 0; filter: blur(8px); transform: scale(0.95); }
    50%, 90% { opacity: 1; filter: blur(0); transform: scale(1); }
}