/* ========================================
   MODAL STYLES - Intro & Case Study
   Breakpoints: 900px (exhibited/contained), 600px (large/small contained)
   
   POSITIONING: Modal aligns with the frame using the same
   --frame-vertical-offset variable from chatbot.css
   ======================================== */

/* Modal backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--viewport-height, 100vh);
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-backdrop.hidden {
    opacity: 0;
    visibility: hidden;
}

/* ========================================
   INTRO MODAL
   Position relative to frame center using same offset
   Sized relative to frame so it scales automatically
   ======================================== */

.intro-modal {
    position: fixed;
    /* Position: same as frame center, slightly down so eyes peek above */
    top: calc(var(--viewport-height, 100vh) / 2 - var(--frame-vertical-offset, 60px) + 3%);
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Size relative to frame - placard is slightly wider than frame */
    width: calc(var(--frame-size, 630px) * 1.1);
    max-width: 900px;
    
    aspect-ratio: 900 / 400;
    background-image: url('../assets/placard.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    border-radius: 8px;
    padding: 6% 8% 4%;
    z-index: 10000;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.intro-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.intro-modal h1 {
    font-family: 'Jost', sans-serif;
    /* Scale font with frame size */
    font-size: calc(var(--frame-size, 630px) * 0.055);
    font-weight: 500;
    color: #000000;
    margin-top: -5%;
    margin-bottom: 1%;
    text-align: center;
    line-height: 1.1;
}

.intro-modal .tagline {
    font-family: 'Jost', sans-serif;
    font-size: calc(var(--frame-size, 630px) * 0.055);
    font-weight: 500;
    color: #000000;
    margin-top: 0;
    margin-bottom: 2%;
    text-align: center;
    line-height: 1.1;
}

.intro-modal .description {
    font-family: 'Jost', sans-serif;
    font-size: calc(var(--frame-size, 630px) * 0.032);
    font-weight: 500;
    color: #000000;
    margin-top: 2%;
    margin-bottom: 5%;
    text-align: center;
    line-height: 1.5;
}

.intro-logo {
    width: calc(var(--frame-size, 630px) * 0.08);
    height: auto;
    display: block;
    margin: 0 auto 3% auto;
    opacity: 0.85;
    filter: brightness(0.25) saturate(1.3);
}

/* ========================================
   DISMISS BUTTON (shared by modals & walls)
   ======================================== */

.dismiss-btn {
    display: inline-block;
    margin: 0 auto;
    background: rgba(159, 170, 160, 1);
    border: 2px solid rgba(110, 120, 112, 1);
    color: #1a1510;
    padding: 8px 30px;
    border-radius: 2px;
    font-size: 20px;
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    text-decoration: none;
}

.dismiss-btn:hover {
    background: rgba(140, 150, 142, 1); 
    border-color: rgba(90, 100, 92, 1);
}

.intro-modal .dismiss-btn {
    font-size: calc(var(--frame-size, 630px) * 0.03);
    padding: 0.5em 1.8em;
    min-height: 44px;
}

/* ========================================
   PRIVACY NOTICE - Bottom of intro modal
   ======================================== */

.privacy-notice {
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    color: black;
    letter-spacing: 0.5px;
    text-align: center;
    font-weight: 600;
    position: absolute;
    bottom: 25px;
    left: 0;
    right: 0;
    padding: 0 20px;
}

/* ========================================
   CASE STUDY OVERLAY
   ======================================== */

.case-study-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--viewport-height, 100vh);
    background: rgba(0, 0, 0, 0.95);
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.case-study-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.case-study-content {
    position: relative;
    max-width: 900px;
    max-height: calc(var(--viewport-height, 90vh) * 0.9);
    background: #fff4e6;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow-y: auto;
    padding: 0;
    margin: 20px;
}

.close-case-study {
    position: sticky;
    top: 0;
    right: 0;
    float: right;
    background: transparent;
    border: none;
    font-size: 48px;
    color: #2d3e2d;
    cursor: pointer;
    padding: 20px 30px;
    line-height: 1;
    z-index: 10;
    transition: color 0.3s ease;
}

.close-case-study:hover {
    color: #3d5a3d;
}

.case-study-inner {
    padding: 20px 60px 60px 60px;
    font-family: 'Merriweather', serif;
    color: #2d3e2d;
}

.case-study-inner h1 {
    font-family: 'Jost', sans-serif;
    font-size: 48px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #1a2a1a;
}

.case-study-inner h2 {
    font-family: 'Jost', sans-serif;
    font-size: 28px;
    font-weight: 400;
    margin: 0 0 40px 0;
    color: #3d5a3d;
}

.case-study-section {
    margin-bottom: 40px;
}

.case-study-section h3 {
    font-family: 'Jost', sans-serif;
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #2d3e2d;
}

.case-study-section p {
    font-size: 18px;
    line-height: 1.8;
    margin: 0 0 20px 0;
}

.case-study-section ul {
    font-size: 18px;
    line-height: 1.8;
    margin: 20px 0;
    padding-left: 40px;
}

.case-study-section li {
    margin-bottom: 16px;
}

.case-study-section li strong {
    color: #2d3e2d;
    font-weight: 600;
}

.case-study-footer {
    margin-top: 60px;
    padding: 50px 40px;
    border-top: 2px solid #d4c5b0;
    text-align: center;
}

.case-study-footer p {
    font-family: 'Jost', sans-serif;
    font-size: 24px;
    font-weight: 500;
    color: #2d3e2d;
    margin: 0 0 30px 0;
}

/* Case Study Images */
.case-study-image {
    margin: 40px 0;
    text-align: center;
}

.case-study-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.case-study-image figcaption {
    font-family: 'Jost', sans-serif;
    font-size: 14px;
    color: #666;
    margin-top: 12px;
    font-style: italic;
}

.case-study-image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 40px 0;
}

.case-study-image-grid img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========================================
   CONTAINED LARGE: 600px - 899px
   ======================================== */

@media (max-width: 899px) and (min-width: 600px) {
    .intro-modal {
        width: 95%;
        max-width: 700px;
    }
    
    .intro-modal h1 {
        margin-top: -20px;
    }
    
    .case-study-inner {
        padding: 20px 40px 50px 40px;
    }
    
    .case-study-inner h1 {
        font-size: 36px;
    }
    
    .case-study-inner h2 {
        font-size: 24px;
    }
    
    .case-study-section h3 {
        font-size: 26px;
    }
    
    .case-study-section p,
    .case-study-section ul {
        font-size: 17px;
    }
}

/* ========================================
   CONTAINED SMALL: < 600px - USE MOBILE PLACARD
   ======================================== */

@media (max-width: 599px) {
    .intro-modal {
        /* Use square mobile placard for all phones */
        background-image: url('../assets/placard_mobile.png');
        aspect-ratio: 1 / 1;
        width: 75vw;
        max-width: 320px;
        padding: 14% 10% 8%;
    }
    
    .intro-modal h1,
    .intro-modal .tagline {
        font-size: 26px !important;
    }
    
    .intro-modal h1 {
        margin-top: 0;
        margin-bottom: 2%;
    }
    
    .intro-modal .description {
        font-size: 16px !important;
        margin-top: 3%;
        margin-bottom: 5%;
    }
    
    .intro-modal .dismiss-btn {
        font-size: 16px !important;
        margin-top: 3%;
    }
    
    .privacy-notice {
        position: absolute;
        bottom: 12%;
        left: 10%;
        right: 10%;
        margin-top: 0;
        font-size: 12px;
    }
    
    .case-study-inner {
        padding: 20px 30px 40px 30px;
    }
    
    .case-study-inner h1 {
        font-size: 32px;
    }
    
    .case-study-inner h2 {
        font-size: 22px;
    }
    
    .case-study-section h3 {
        font-size: 24px;
    }
    
    .case-study-section p,
    .case-study-section ul {
        font-size: 16px;
    }
}

/* ========================================
   EXTRA SMALL: < 400px (iPhones, Galaxy Fold)
   ======================================== */

@media (max-width: 399px) {
    .intro-modal {
        width: 95vw;
        max-width: 380px;
        padding: 14% 8% 8%;
        /* Shift placard down so eyes peek above */
        top: calc(var(--viewport-height, 100vh) / 2 - var(--frame-vertical-offset, 60px) + 12%);
    }
    
    .intro-modal h1,
    .intro-modal .tagline {
        font-size: 28px !important;
        line-height: 1.2;
        margin-top: 0;
        margin-bottom: 2%;
    }
    
    .intro-modal .description {
        font-size: 18px !important;
        line-height: 1.4;
        margin-top: 1%;
        margin-bottom: 6%;
    }
    
    .intro-modal .dismiss-btn {
        font-size: 20px !important;
    }
}

/* ========================================
   TALL/NARROW DEVICES (Z Flip folded ONLY)
   Only for truly narrow screens < 290px
   ======================================== */

@media (max-aspect-ratio: 55/100) and (max-width: 290px) {
    .intro-modal {
        width: 90%;
        max-width: 280px;
        top: 50%;
        transform: translate(-50%, -50%);
        padding: 25px 30px 20px;
        background-image: url('../assets/placard_mobile.png');
        background-size: 100% 100%;
    }
    
    .intro-modal h1,
    .intro-modal .tagline {
        font-size: 20px !important;
        line-height: 1.2;
    }
    
    .intro-modal h1 {
        margin-top: 0;
        margin-bottom: 5px;
    }
    
    .intro-modal .description {
        font-size: 14px !important;
        line-height: 1.4;
        margin-top: 8px;
        margin-bottom: 15px;
    }
    
    .intro-modal .dismiss-btn {
        font-size: 16px !important;
        padding: 10px 25px;
    }
    
    .intro-logo {
        width: 40px;
        margin-bottom: 15px;
    }
}