/*
 Theme Name:   EverGrid Child
 Theme URI:    https://evergrid.ca
 Description:  Finalized WaaS Instagram Clone Master Styles (V1.3 - Form Plugin & Dynamic UI)
 Author:       Checkmate
 Template:     generatepress
 Version:      1.3
*/

/* ==========================================================================
   1. GLOBAL & GRID LAYOUT
   ========================================================================== */

/* Indestructible 3-Column Grid */
.blog main#main, .archive main#main, .home main#main {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0 !important;
    max-width: 935px !important; 
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    clear: both !important;
    float: none !important;
}

/* Perfect Squares (Padding-Bottom Hack) */
.blog main#main article, .archive main#main article, .home main#main article {
    margin: 0 !important;
    padding: 0 0 100% 0 !important; 
    height: 0 !important; 
    position: relative !important;
    float: none !important; 
    width: 100% !important;
    border: none !important;
    overflow: hidden !important; 
    background-color: #fafafa !important; 
}

/* Force Image Containers to Fill Square */
.blog main#main .inside-article, .archive main#main .inside-article, .home main#main .inside-article,
.blog .post-image, .archive .post-image, .home .post-image,
.blog .post-image a, .archive .post-image a, .home .post-image a {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

/* Square Image Cropping */
.blog .post-image img, .archive .post-image img, .home .post-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; 
    border-radius: 0 !important;
}

/* Hide Archive Text & Metadata */
.blog .entry-header, .archive .entry-header, .home .entry-header,
.blog .entry-summary, .archive .entry-summary, .home .entry-summary,
.blog .entry-content, .archive .entry-content, .home .entry-content,
.blog .entry-meta, .archive .entry-meta, .home .entry-meta,
.blog .post-navigation, .archive .post-navigation, .home .post-navigation {
    display: none !important;
}

/* Grid Hover Effects (Eye Icon & Mobile Double-Tap Fix) */
.blog .post-image a::before, .archive .post-image a::before, .home .post-image a::before {
    content: ''; position: absolute; inset: 0; background-color: rgba(0, 0, 0, 0); transition: background-color 0.2s; z-index: 10;
}
.blog .post-image a::after, .archive .post-image a::after, .home .post-image a::after {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white' width='32px' height='32px'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E");
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0; transition: opacity 0.2s; z-index: 20;
}

@media (hover: hover) {
    .blog .post-image:hover a::before, .home .post-image:hover a::before { background-color: rgba(0, 0, 0, 0.4); }
    .blog .post-image:hover a::after, .home .post-image:hover a::after { opacity: 1; }
}

/* ==========================================================================
   2. BUTTONS & UI
   ========================================================================== */
.ig-btn-primary, .ig-btn-secondary, .ig-btn-small {
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer;
    border: none !important;
    padding: 8px 16px;
    font-family: inherit;
    transition: background-color 0.2s;
}
.ig-btn-primary { background-color: #0095f6; color: #fff; }
.ig-btn-primary:hover { background-color: #1877f2; }
.ig-btn-secondary { background-color: #efefef; color: #262626; }
.ig-btn-secondary:hover { background-color: #dbdbdb; }

/* ==========================================================================
   3. PROFILE HEADER & DIVIDER
   ========================================================================== */

.ig-profile-header {
    grid-column: 1 / -1 !important;
    display: flex !important;
    width: 100% !important;
    max-width: 935px !important;
    margin: 0 auto !important;
    padding: 30px 20px 44px !important;
    gap: 30px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ig-profile-avatar { flex: 1 1 30%; display: flex; justify-content: center; }
.ig-avatar-img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 1px solid #dbdbdb; padding: 2px; }
.ig-profile-info { flex: 1 1 70%; display: flex; flex-direction: column; color: #262626; }
.ig-info-top { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.ig-handle { font-size: 28px; font-weight: 300; margin: 0; }
.ig-info-stats { display: flex; gap: 40px; margin-bottom: 20px; font-size: 16px; }
.ig-info-stats span strong { font-weight: 600; }
.ig-info-bio { font-size: 14px; line-height: 1.5; }
.ig-bio-name { font-weight: 600; display: block; }
.ig-bio-link { color: #00376b; font-weight: 600; text-decoration: none; }

.ig-grid-divider {
    grid-column: 1 / -1 !important;
    display: flex !important;
    width: 100% !important;
    max-width: 935px !important;
    margin: 0 auto !important;
    border-top: 1px solid #dbdbdb !important;
    justify-content: center !important;
}
.ig-grid-tab { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #8e8e8e; padding: 15px 0; }
.ig-grid-tab.active-tab { color: #262626; border-top: 1px solid #262626; margin-top: -1px; }

/* ==========================================================================
   4. SINGLE POST LAYOUT
   ========================================================================== */

.single-post .inside-article {
    max-width: 740px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
    background-color: transparent !important;
}

.ig-single-mini-header {
    max-width: 740px; margin: 0 auto 20px auto; 
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ig-mini-left { display: flex; flex-direction: column; gap: 10px; }
.ig-mini-author-link { display: flex; align-items: center; gap: 10px; text-decoration: none !important; height: 44px; }
.ig-mini-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid #dbdbdb; }
.ig-mini-handle { font-size: 15px; font-weight: 600; color: #262626; }
.ig-mini-actions { display: flex; gap: 8px; }
.ig-mini-right { display: flex; align-items: center; height: 44px; }

@media (min-width: 481px) {
    .ig-single-mini-header { align-items: center; }
    .ig-mini-left { flex-direction: row; align-items: center; gap: 12px; }
}

.single-post .entry-title { text-align: center; font-size: 28px !important; font-weight: 700; margin-bottom: 20px !important; }
.single-post .featured-image img { border-radius: 8px; width: 100%; object-fit: cover; }
.single-post .entry-content { font-size: 16px !important; line-height: 1.5 !important; color: #262626 !important; }
.single-post .entry-content p { margin-bottom: 20px !important; white-space: pre-wrap !important; }
.single-post .entry-content a { color: #0095f6 !important; font-weight: 600; text-decoration: none !important; }

.waas-affiliate-btn {
    display: block !important; width: 100%; text-align: center; background-color: #0095f6 !important; color: #fff !important;
    padding: 16px !important; border-radius: 8px !important; font-weight: 600; text-transform: uppercase; margin: 30px 0 !important;
}

.single-post .entry-content img:not(.emoji):not(.wp-smiley) {
    width: 100% !important; height: auto !important; border-radius: 8px !important; margin: 30px 0 !important; display: block;
}

/* ==========================================================================
   5. MOBILE RESPONSIVENESS
   ========================================================================== */
@media (max-width: 768px) {
    .ig-profile-header {
        flex-direction: column !important; align-items: center !important; text-align: center !important; padding: 20px 15px !important; gap: 15px !important;
    }
    .ig-profile-avatar, .ig-profile-info { flex: none !important; width: 100% !important; align-items: center !important; }
    .ig-avatar-img { width: 100px !important; height: 100px !important; }
    .ig-info-top { flex-direction: column !important; gap: 12px !important; margin-bottom: 10px !important; }
    
    .ig-info-stats {
        width: 100% !important; justify-content: space-around !important; gap: 0 !important;
        border-top: 1px solid #dbdbdb !important; border-bottom: 1px solid #dbdbdb !important;
        padding: 12px 0 !important; margin: 10px 0 20px 0 !important;
    }
    .ig-mini-left { flex: 1; gap: 8px; }
    .ig-mini-actions { width: auto; display: flex; gap: 5px; }
}

@media (max-width: 480px) {
    .ig-mini-author-link { width: 100%; margin-bottom: 5px; }
}

/* ==========================================================================
   6. 404 ERROR PAGE
   ========================================================================== */
.error404 .inside-article {
    max-width: 600px !important; margin: 80px auto !important;
    text-align: center !important; padding: 20px !important;
    background-color: transparent !important; box-shadow: none !important;
}
.error404 .entry-title {
    font-size: 22px !important; font-weight: 600 !important; color: #262626 !important;
    margin-bottom: 25px !important; font-family: inherit;
}
.error404 .entry-content p { font-size: 16px !important; color: #262626 !important; line-height: 1.5 !important; }
.error404 .search-form { display: none !important; }

/* ==========================================================================
   7. STICKY FOOTER & BRANDING
   ========================================================================== */
body { display: flex !important; flex-direction: column !important; min-height: 100vh !important; }
#page { flex: 1 0 auto !important; width: 100% !important; }
.site-footer { flex-shrink: 0 !important; width: 100% !important; }

.site-info {
    background-color: transparent !important; color: #8e8e8e !important;
    font-size: 13px !important; padding: 25px 0 !important;
    border-top: 1px solid #dbdbdb !important; font-family: inherit;
}
.site-info a { color: #262626 !important; font-weight: 600 !important; text-decoration: none !important; }
.site-info a:hover { color: #0095f6 !important; }

/* ==========================================================================
   8. APP MODALS
   ========================================================================== */
.ig-app-modal {
    padding: 0; border: none; border-radius: 16px; background: #ffffff;
    width: 90%; max-width: 400px; box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.ig-app-modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.ig-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid #efefef; }
.ig-modal-header h3 { margin: 0 !important; font-size: 18px !important; font-weight: 600 !important; color: #262626 !important; }
.ig-close-modal { background: none; border: none; cursor: pointer; color: #262626; padding: 0; display: flex; align-items: center; }
.ig-modal-content { padding: 20px; }
.ig-modal-content p { font-size: 15px !important; color: #8e8e8e !important; line-height: 1.4 !important; margin-bottom: 20px !important; text-align: center; }

/* ==========================================================================
   9. FORM PLUGIN STYLING (Fluent Forms / WPForms)
   ========================================================================== */

/* Remove the blinking cursor/focus outline on the modal itself */
.ig-app-modal:focus, .waas-form-wrapper:focus {
    outline: none !important;
}

/* Force WPForms internal wrappers to fill the modal width */
.waas-form-wrapper div.wpforms-container,
.waas-form-wrapper .wpforms-form,
.waas-form-wrapper .wpforms-field-container,
.waas-form-wrapper .wpforms-field,
.waas-form-wrapper .wpforms-field input {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/* Styling the input field to look like a premium app */
.waas-form-wrapper input[type="text"],
.waas-form-wrapper input[type="email"],
.waas-form-wrapper textarea {
    display: block !important;
    width: 100% !important;
    padding: 14px 15px !important;
    border: 1px solid #dbdbdb !important;
    border-radius: 8px !important;
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    background-color: #fafafa !important;
    font-family: inherit !important;
    margin-bottom: 15px !important;
    -webkit-appearance: none; /* Fixes iOS shadow/rounded corners */
}

/* Fix the Submit Button alignment and styling */
.waas-form-wrapper .wpforms-submit-container {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
}

.waas-form-wrapper button[type="submit"].wpforms-submit,
.waas-form-wrapper input[type="submit"] {
    display: block !important;
    width: 100% !important;
    background-color: #0095f6 !important;
    color: #ffffff !important;
    padding: 16px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    border: none !important;
    cursor: pointer !important;
    transition: background-color 0.2s;
    box-shadow: none !important;
}

.waas-form-wrapper button[type="submit"]:hover {
    background-color: #1877f2 !important;
}

/* Hide WPForms Branding & Labels for the ultra-clean app look */
.waas-form-wrapper .wpforms-field-label, 
.waas-form-wrapper .wpforms-head-container {
    display: none !important;
}