﻿@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700;900&display=swap');
/* COVER 1 */


.final-cover-wrapper {
    position: relative; /* Required for absolute positioning of the headline */
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
    border-radius: 4px;
    overflow: hidden;
}

.award-container {
    position: absolute;
    top: 3%;      /* Adjust based on cover.png white space */
    right: -3.4%;    /* Standard newspaper margin */
    width: 28%;   /* Proportional width for responsiveness */
    z-index: 10;
}

/* Create a fixed aspect-ratio box for the award without using the CSS aspect-ratio
   property (which html2canvas can mis-handle). 250 / 120 ≈ 0.48 => 48% padding. */
.award-container::before {
    content: "";
    display: block;
    padding-top: 48%; /* height / width * 100% */
}

.award-img {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Keep intrinsic aspect ratio without object-fit so html2canvas treats it as a simple image */
    width: auto;
    height: 100%;
    max-width: 100%;
    display: block;
}

.final-render {
    width:100%;
    display: block;
    z-index: 1;
}

/* Position the headline exactly where the text should be on the newspaper */
.aiframe #cover1 .headline-overlay {
    position: absolute;
    top: 13%; /* Align with the headline gap in cover image */
    left: 0;
    right: 0;
    width: 100%;
    height: 14%; /* Fixed slot height so text cannot overlap the photo/footer */
    padding: 0 10%; /* Keeps text away from the paper edges */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden; /* Prevents long headlines from spilling into the design below */
    box-sizing: border-box;
    z-index: 10;
}

.aiframe-app #cover1 #dynamic-headline {
    font-family: 'Roboto', sans-serif;
    font-size: clamp(0.7em, 4.5vw, 1.9em);
    font-weight: 900;
    color: #333;
    line-height: 1.1;
    margin: 0;
    word-break: break-word;
    hyphens: auto;
}

/* Smaller font when headline wraps to 3+ lines to prevent overlay */
.aiframe-app #cover1 .final-cover-wrapper {
    position: relative;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    background: #ffffff00;
    overflow: hidden;
    box-shadow: none;
}
.frame-option-item{
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    /* Reserve border space so active state doesn't shrink content and shift the headline */
    border: 1px solid transparent;
    box-sizing: border-box;
}
/* Container for the frame options */
.frame-options-grid {
    gap: 10px;
    margin-top: 10px;
}

/* Container for all dynamic text and images */
.newspaper-content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows clicks to pass through if needed */
}

/* Position the Photo */
#cover1 .user-photo-container {
    position: absolute;
    top: 27%;
    /* Center without transform so html2canvas sees a simple box */
    left: 12.5%;   /* (100% - 75%) / 2 */
    width: 75%;
    height: 46%; /* Matches the aspect ratio of the photo slot */
    background: #eee;
    overflow: hidden;
    z-index: 5;
}

#cover1 #main-photo-output {
    height: 100%;
    width: 100%;
    object-fit: cover;
}
#cover1 .newspaper-footer {
    position: absolute;
    bottom: 0; /* Anchors it to the bottom of the user-photo-container */    
    height: 24px;
    background-color: #eee; /* Slight transparency for a better blend */
    display: flex;
    align-items: center;
    font-family: 'Roboto', sans-serif;
    z-index: 10;
}
#cover1 .footer-tag {
    background-color: #000;
    min-width:12%;
    color: #fff;
    font-size: 0.5em;
    font-weight: 700;
    padding: 0 4px;
    height: 100%;
    display: flex;
    align-items: center;
    text-transform: uppercase; /* Matches the bold look in mockup */
    white-space: nowrap;
}
#cover1 .footer-credit {
    color: #333;
    font-size: 0.63em;
    padding-left: 5px;
    white-space: nowrap;
}

#cover1 .footer-credit span {
    font-weight: 700;
}
/* Mobile Adjustments */
@media (max-width: 600px) {
    #cover1 #dynamic-headline {
        font-size: clamp(0.7em, 5.5vw, 1.6em);
        top: 15%;
    }
    #cover1 .newspaper-footer {
        height: 18px; 
        font-size: 0.7em;
    }
    #cover1 .user-photo-container {
        width: 75.5%;
        height: 46.5%;
    }
    #cover1 .footer-tag {
        font-size: 0.3em;
        padding: 0 5px;
    }
    
    #cover1 .footer-credit {
        font-size: 8px;
    }
}
@media (max-width: 1024px) {
    #cover1 #dynamic-headline {
        font-size: clamp(0.7em, 5.5vw, 2.4em);
    }
    .step3-thumb .headline-overlay {
        top: 12%; 
    }
}
/* Container for the footer bar */
.newspaper-footer {
    position: absolute;
    top: 73%; /* Adjust this to sit exactly at the bottom edge of your photo container */
    /* Center without transform for better html2canvas compatibility */
    left: 12.5%;
    width: 75%; /* Matches user-photo-container width */
    height: 20px;
    background-color: #e9e8e3; /* Light grey/bone color from mockup */
    display: flex;
    align-items: center;
    font-family: 'Roboto', sans-serif;
    overflow: hidden;
}

/* The credit text area */
.footer-credit {
    color: #333;
    font-size: 0.6em;
    padding-left: 3px;
    white-space: nowrap;
}

.footer-credit span {
    font-weight: 700; /* Bolder name as seen in mockup */
}

/* Responsive adjustment */
@media (max-width: 600px) {
    .footer-tag { font-size: 8px; }
    .footer-credit { font-size: 7px; }
    .newspaper-footer { height: 20px; }
}

/* Step 3 thumbnails: shared scaling/typography wrapper */
.step3-thumb .final-cover-wrapper {
    border-radius: 0;
    width: 100%;
    height: auto;
    cursor: pointer;
}

.frame-option-item.active {
    border-color: #bb0000;
}

/* Cover 1: tiny preview headline and footer inside Step 3 thumbnails */

.step3-thumb #cover1 #dynamic-headline {  
    font-size: clamp(0.7em, 0.8vw, 0.78em);
}

.step3-thumb #cover1 .newspaper-footer {
    min-height: 8px;
    max-height: 12px;
    font-size: 0.7em;
    top: 70%;
}
.step3-thumb #cover1 .final-render {
    width:100%;
    display: block;
    z-index: 1;
}
.step3-thumb #cover1 .footer-tag {
    font-size: 0.3em;
    padding: 0 4px;
}
.step3-thumb #cover1 .footer-credit {
    font-size: 0.4em;
}

@media (max-width: 1024px) {
    .step3-thumb .final-cover-wrapper {
        width: 100%;
        max-width: 850px;
        height:auto; 
    }
    .step3-thumb #cover1 #dynamic-headline {
        font-size: clamp(1.7em, 4.5vw, 2.9em);
    }
    .step3-thumb #cover1 .newspaper-footer {
        position: absolute;
        top: 72%; 
    }   
    .step3-thumb #cover1 .footer-credit {
        font-size: clamp(0.6em, 4.5vw, 1.3em);
    }

    .step3-thumb #cover1 .footer-tag {
        font-size: clamp(0.7em, 4.5vw, 1.0em);
        padding: 0 4px;
    }
}
@media (max-width: 600px) {
    .step3-thumb .final-cover-wrapper {
        width: 100%;
        max-width: 450px;
        height:auto; 
        object-fit: cover;
    }
    .step3-thumb #cover1 #dynamic-headline {
        font-size: clamp(20px, 0.5vw, 36px);
    }
    .step3-thumb #cover1 .newspaper-footer {
        position: absolute;
        top: 72%; 
    }   
    .step3-thumb #cover1 .footer-credit {
        font-size: 0.7em;
    }

    .step3-thumb #cover1 .footer-tag {
        font-size: 0.6em;
        padding: 0 4px;
    }
}

/* COVER 2 */
/* --- Global Reset for Cover 2 --- */
.aiframe-app #cover2 {
    position: relative;
    font-family: 'Roboto', sans-serif;
    background-color: #fff;
}

/* Position Award Top-Right */
    .aiframe-app #cover2 .award-container {
        position: absolute;
        top: 2%;
        right: 0;
        z-index: 5;
    }

/* Container specific to the second frame */
    .aiframe-app #cover2 .user-photo-container {
        position: absolute;
        width: 90%; /* Matches Frame 2 layout */
        margin: 0 auto;
        top: 14%; /* Specific to Frame 2 layout */
        left: 5%;
        height: 55%;
        overflow: hidden;
        display: block;
    }
    .aiframe-app #cover2 #main-photo-output {
        height: 100%;
        width: 100%;
        object-fit: cover;
    }
/* The Overlay Bar */
    .aiframe-app #cover2 .photo-credit-bar {
        position: absolute;
        bottom: 0;
        right: 0;
        width: 100%;
        /*padding: 40px 15px 10px;*/ /* Top padding allows the gradient to fade in */
        padding: 40px 15px 13px;
        display: flex;
        flex-direction: column;
        align-items: flex-end; /* Aligns text and tag to the right */
        right: 0;
        bottom: -1%;
        margin: 0;
        /* White transparent gradient starting from bottom-right */
        background: linear-gradient( to top, rgba(255, 255, 255, 0.90) 0%, /* Solid white at the very bottom */
        rgba(255, 255, 255, 0.5) 40%, /* Still quite visible halfway up the text area */
        rgba(255, 255, 255, 0) 100% /* Fades to transparent at the top */
        );
        z-index: 5;
    }
/* Text Styling */
    .aiframe-app #cover2 .credit-and-date {
        font-family: 'Roboto', sans-serif;
        color: #000;
        font-size: 0.7em;
        text-align: right;
        line-height: 1.2;
        margin-bottom: 5px;
    }
        .aiframe-app #cover2 .credit-and-date .cdate {
            white-space: nowrap;
        }

        .aiframe-app #cover2 .credit-and-date strong {
            font-weight: 700;
            font-size: 14px; /* Larger name as seen in Frame 2 */
            display: block;
            white-space: nowrap;
        }

/* The Red Tag */
    .aiframe-app #cover2 .born-tag {
        background-color: #cc0000;
        color: #fff;
        font-family: 'Roboto', sans-serif;
        font-size: 10px;
        font-weight: 900;
        font-style: italic;
        text-transform: uppercase;
        padding: 3px 10px;
        white-space: nowrap;
    }
/* Container for the headline moved to the bottom */
    .aiframe-app #cover2 .headline-overlay-bottom {
        position: absolute;
        top: 70%; /* Positioned directly after the photo container which ends at ~68% */
        left: 0;
        width: 100%;
        height: 13%; /* Fixed slot height to keep headline off the bottom design */
        padding: 0 10%;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        overflow: hidden;
        box-sizing: border-box;
        z-index: 10;
    }

    .aiframe-app #cover2 .dynamic-headline {
        font-family: 'Roboto', sans-serif;
        font-weight: 900;
        color: #333;
        font-size: clamp(24px, 4.5vw, 36px);
        line-height: 1.1;
        margin: 0;
        text-transform: none;
        word-break: break-word;
        hyphens: auto;
    }

/* Adjusting the bottom news blurbs to start lower */
    .aiframe-app #cover2 .bottom-content-area {
        position: absolute;
        top: 82%; /* Moves the 'SMG charts 55 years' section lower to make room for headline */
        width: 100%;
    }

.step3-thumb #cover2 .dynamic-headline {
    font-size: clamp(0.74em, 0.5vw, 1.78em);
}

.step3-thumb #cover2 .photo-credit-bar {
    padding: 40px 5px 10px;
}

.step3-thumb #cover2 .credit-and-date {
    font-weight: 400;
    font-size: 0.4em; /* Larger name as seen in Frame 2 */
    display: block;
}
.step3-thumb #cover2 .credit-and-date strong {
    font-weight: 700;
    font-size: 1.2em; /* Larger name as seen in Frame 2 */
    display: block;
}
.step3-thumb #cover2 .born-tag {
   font-size: 0.3em;
}
@media (max-width: 600px) {
    .step3-thumb #cover2 .dynamic-headline {
        font-size: 1.7em;
    }
}
@media (max-width: 1024px) {
    .step3-thumb #cover2 .dynamic-headline {
        font-size: clamp(20px, 4.5vw, 46px);
    }
    .step3-thumb #cover2 .credit-and-date {
        font-weight: 400;
        font-size: clamp(0.74em, 2.5vw, 1.4em);
        display: block;
    }
    .step3-thumb #cover2 .photo-credit-bar {
        padding: 40px 15px 10px;
    }
}
/* CSS Styles */
/* --- COVER 3 SPECIFIC STYLING --- */
/* --- COVER 3 OVERALL STYLING --- */
/* --- COVER 3 OVERALL STYLING --- */

.aiframe-app #cover3 .user-photo-container {
    position: absolute;
    top: 26%;
    /* Center without transform so html2canvas sees a simple box */
    /* left: 9%; (100% - 82%) / 2 */
    width: 82%;
    height: 50%;
    overflow: hidden;
    z-index: 5; /* Stays above the base template */
    display: block;
}
.aiframe-app #cover3 #main-photo-output {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

/* Headline positioned at the top-center white space */
.aiframe-app #cover3 .headline-overlay-top {
    position: absolute;
    top: 14%;
    width: 100%;
    height: 12%; /* Fixed slot height for top headline area */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 10;
}

.aiframe-app #cover3 .dynamic-headline {
    font-family: 'Roboto', sans-serif;
    font-weight: 900;
    font-size: clamp(24px, 4.5vw, 34px);
    color: #000;
    line-height: 1.1;
    text-transform: none;
    word-break: break-word;
    hyphens: auto;
    padding: 0 10%;
}

/* Photo Credit Bar - Adjusted for "Beside" layout */
.aiframe-app #cover3 .photo-credit-bar {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 30%;
    padding: 10px 15px;
    display: flex;
    justify-content: flex-start; /* Aligns both items to the left */
    align-items: center; /* Keeps bottoms aligned */
    gap: 15px; /* Space between text and stamp */
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    z-index: 10;
}

.aiframe-app #cover3 .credit-and-date {
    color: #fff;
    font-size: 10px;
    text-align: left;
    line-height: 1.2;
    z-index: 11;
}
    .aiframe-app #cover3 .credit-and-date .cdate {
        white-space: nowrap;
    }
    .aiframe-app #cover3 .credit-and-date strong {
        font-size: 14px; /* Matches the prominent SARAH LEE text */
        display: block;
        text-transform: uppercase;
        white-space: nowrap;
    }

/* Stamp Container positioned beside the text */
.aiframe-app #cover3 .stamp-container {
    position: absolute;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 12; /* The highest layer within the photo area */
}

.aiframe-app #cover3 .born-stamp {
    position: absolute;
    padding-bottom: 20px;
    width: 60px;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    margin-left: -20%;
}

/* --- Small Preview / Desktop Grid Fixes for Cover 3 thumbnails --- */

.step3-thumb #cover3 .headline-overlay-top {
    top: 14%;
}

.step3-thumb #cover3 .dynamic-headline {
    font-size: 0.75em;
}

.step3-thumb #cover3 .photo-credit-bar {
    padding: 10px 5px;
}
.step3-thumb #cover3 .credit-and-date {
    font-size: 0.3em;
}
.step3-thumb #cover3 .credit-and-date strong {
    font-size: 1.2em;
}
.step3-thumb #cover3 .born-stamp {
    padding-bottom: 10%;
    width: 15%;
}

@media (max-width: 600px) {
    .step3-thumb #cover3 .dynamic-headline {
        font-size: clamp(20px, 4.5vw, 46px);
    }
    .step3-thumb #cover3 .credit-and-date {
        font-size: clamp(10px, 1.5vw, 24px);
        z-index: 11;
        font-weight: 400;
    }
    .step3-thumb #cover3 .photo-credit-bar {
        padding: 10px 15px;
    }
    .step3-thumb #cover3 .born-stamp {
        padding-bottom: 7%;
        width: 15%;
    }
}
@media (max-width: 1024px) {
    .step3-thumb #cover3 .dynamic-headline {
        font-size: clamp(20px, 4.5vw, 46px);
    } 
    .step3-thumb #cover3 .credit-and-date {
        font-size: clamp(12px, 1.5vw, 24px);
        z-index: 11;
        font-weight: 400;
    }
    .step3-thumb #cover3 .credit-and-date strong {
        font-size: 1.1em;
    }
    .step3-thumb #cover3 .born-stamp {
        padding-bottom: 5%;
        width: 15%;
    }
    .step3-thumb #cover3 .photo-credit-bar {
        padding: 10px 20px;
    }
}