/*
 * ACF Card Display - Universal/Generic CSS
 */

/* --- 1. WRAPPER RESET --- */
.acd-wrapper {
    display: block;
    width: 100%;
    margin: 0;
    padding: 40px 0; /* Desktop Padding */
    box-sizing: border-box;
    line-height: 1.5;
}

/* --- 2. LAYOUTS --- */

/* Grid Layout (Desktop Default) */
.acd-wrapper.acd-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Updated to fixed 3 columns */
    gap: 25px;
}

/* List Layout (Desktop Default) */
.acd-wrapper.acd-list {
    display: flex;
    flex-direction: column; /* Stacks items vertically */
    gap: 20px;
}

/* --- 3. CARD STYLES --- */
.acd-card {
    background-color: #ffffff;
    /* Professional Enhancement: Added subtle gradient for depth */
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);

    /* Important: Force flex layout */
    display: flex !important;
    flex-direction: column !important; /* Default is Column */

    /* Professional Enhancement: Improved shadow for elevation */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    border-radius: 16px !important; /* Slightly larger for modern look */

    /* Professional Enhancement: Subtle border for definition */
    border: 1px solid rgba(0, 0, 0, 0.08) !important;

    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smoother transitions */

    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Professional Enhancement: Ensure consistent card height in grid */
    min-height: 350px; /* Prevents uneven heights */
}

/* Hover Effect */
.acd-card:hover {
    transform: translateY(-8px); /* More pronounced lift */
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important; /* Deeper shadow */
    border-color: rgba(0, 0, 0, 0.12);
}

/* --- 4. ACTION BUTTON (Download) --- */
.acd-card-action {
    margin-bottom: 10px;
    text-align: right; /* Aligns button to right edge of content area */
}

.acd-download-btn {
    display: inline-block;
    background-color: #007bff; /* Professional blue */
    color: #ffffff;
    text-decoration: none;
    padding: 10px 20px; /* Larger padding for better touch */
    border-radius: 8px; /* Rounded for modern feel */
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2); /* Subtle button shadow */
}

.acd-download-btn:hover {
    background-color: #0056b3;
    text-decoration: none;
    transform: translateY(-2px); /* Lift effect */
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* --- 5. IMAGE HANDLING --- */
.acd-card-image {
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    background-color: #f0f0f0; /* Neutral background for missing images */
    overflow: hidden;
    display: block;
    position: relative;
}

/* Grid Image: Fixed height for consistent, professional proportions */
.acd-wrapper.acd-grid .acd-card-image {
    height: 200px !important; /* Fixed height prevents stretching/cropping issues */
    /* Removed aspect-ratio for better control */
}

.acd-wrapper.acd-grid .acd-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Maintains proportions without distortion; minimal cropping if aspect ratios differ */
    display: block;
    transition: transform 0.4s ease; /* Smoother hover */
}

.acd-card:hover .acd-card-image img {
    transform: scale(1.05); /* Subtle zoom for engagement */
}

/* --- 6. LIST VIEW SPECIFIC FIXES --- */
/* Force Row Layout for List Cards */
.acd-wrapper.acd-list .acd-card {
    flex-direction: row !important; /* Force Side-by-Side layout */
    align-items: center !important; /* Vertically center image with text */
    height: auto; /* Allow card height to fit content */
    min-height: auto; /* Override grid min-height for list */
}

/* Constrain Image Size for List View */
.acd-wrapper.acd-list .acd-card-image {
    width: 200px !important; /* Slightly larger for balance */
    flex-shrink: 0 !important; /* Don't shrink image box */
    height: auto !important; /* Height is automatic based on content */
    border-radius: 0; /* No rounding for straight edges */
}

.acd-wrapper.acd-list .acd-card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Maintain aspect ratio */
    border-radius: 0; /* No rounding for straight edges */
}

/* --- 7. CONTENT SECTION --- */
.acd-card-content {
    padding: 20px 25px !important; /* Increased padding for breathing room */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    /* Ensure description div takes up space even if empty */
    min-height: 30px; /* Slightly larger for professional spacing */
}

/* --- 8. TYPOGRAPHY --- */
.acd-card-title {
    margin: 0 0 15px 0 !important; /* More space below */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 1.2rem !important; /* Slightly larger for prominence */
    font-weight: 700 !important;
    line-height: 1.4 !important;
    color: #333; /* Darker for contrast */
}

.acd-card-title a {
    text-decoration: none !important;
    color: inherit;
    transition: color 0.3s ease;
    display: block;
}

.acd-card-title a:hover {
    color: #007bff; /* Professional blue on hover */
    text-decoration: underline;
}

.acd-card-date {
    font-size: 0.8rem !important; /* Slightly larger */
    text-transform: uppercase;
    letter-spacing: 0.1em; /* More spacing for elegance */
    font-weight: 600;
    color: #666 !important; /* Softer gray */
    margin-bottom: 15px;
    font-family: sans-serif;
}

.acd-card-desc {
    font-size: 1rem !important; /* Standard size */
    line-height: 1.6 !important;
    color: #555; /* Balanced gray */
    opacity: 0.9;
    font-family: "Georgia", "Times New Roman", serif;
    /* Ensure it doesn't collapse if text is short */
    min-height: 1.2em;
}

/* --- 9. PAGINATION --- */
.acd-pagination {
    margin-top: 40px; /* More space */
    text-align: center;
}
.acd-pagination ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-flex;
    gap: 8px; /* Slightly larger gap */
}
.acd-pagination li {
    display: inline-block;
}
.acd-pagination a, .acd-pagination span {
    display: block;
    padding: 10px 15px; /* Larger for better usability */
    border: 1px solid #ddd;
    background: #fff;
    text-decoration: none;
    color: #333;
    border-radius: 8px; /* Rounded for modern look */
    font-weight: 500;
    transition: background 0.3s ease, color 0.3s ease;
}
.acd-pagination a:hover {
    background: #f8f9fa;
    color: #007bff;
}
.acd-pagination span.current {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: 600;
}

/* --- 10. RESPONSIVE MEDIA QUERIES --- */

/* Tablet (Screens up to 1024px) */
@media (max-width: 1024px) {
    /* Reduce padding for main container */
    .acd-wrapper {
        padding: 30px 0 !important;
    }

    /* Grid Layout - Reduce minimum width or gap */
    .acd-wrapper.acd-grid {
        /* Keeps grid but reduces padding/gap */
        gap: 20px;
    }

    /* List Layout - Slightly reduce image width */
    .acd-wrapper.acd-list .acd-card-image {
        width: 180px !important;
    }
}

/* Mobile (Screens less than 768px) */
@media (max-width: 767px) {
    /* 1. Grid Layout - Force Single Column */
    .acd-wrapper.acd-grid {
        grid-template-columns: 1fr !important; /* Single Column */
        padding: 20px 0 !important; /* Reduced padding */
    }

    /* 2. List Layout - Stack Vertically */
    .acd-wrapper.acd-list {
        flex-direction: column !important;
        gap: 15px; /* Slightly smaller gap */
        padding: 20px 0 !important; /* Reduced padding */
    }

    /* 3. On mobile, stack image on top of text (List View) */
    .acd-wrapper.acd-list .acd-card {
        flex-direction: column !important;
        height: auto;
    }

    .acd-wrapper.acd-list .acd-card-image {
        width: 100% !important; /* Full width */
        height: 200px !important; /* Fixed height for mobile view */
        margin: 0 auto 15px !important; /* Spacing below image */
    }

    .acd-wrapper.acd-list .acd-card-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .acd-wrapper.acd-list .acd-card-content {
        padding: 15px 20px !important;
    }

    /* 4. Button Adjustments for Mobile */
    .acd-card-action {
        text-align: center !important; /* Center button on mobile */
        width: 100%; /* Full width container */
    }

    .acd-download-btn {
        width: 100% !important; /* Full width button on mobile */
        box-sizing: border-box;
        display: block;
        text-align: center;
    }
}