/**
 * Blog Grid Layout Styles
 * 
 * @package _cff
 */

/* Blog Grid Container */
.blog-grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    max-width: 100%;
}

/* Blog Post Base Styles */
.blog-post {
    position: relative;
    overflow: visible;
}

.blog-post.type-edu_answers {
    overflow: hidden;
}

.blog-post-wide .post-image-container {
    overflow: visible;
}

/* Featured thumbnail fills the container (the wrapping <a> was removed; the image
   is now a direct child of .post-image-container). margin:0 neutralises the prose
   typography margin (.prose img { margin-top: 2em }) when a card sits inside .prose,
   which otherwise pushes the image below its fixed-height container. */
.post-image-container img.wp-post-image {
    height: 100%;
    width: 100%;
    object-fit: cover;
    margin: 0;
}

.blog-post-wide.type-edu_answers .post-image-container {
    overflow: hidden;
}

/* Wide Post Layout (spans 6 columns) */
.blog-post-wide {
    grid-column: span 6;
}

/* Small Post Layout (spans 3 columns) */
.blog-post-small {
    grid-column: span 3;
}

/* Post Image Container */
.post-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: unset;
}

.blog-post-wide .post-image-container {
    height: 250px;
}

.post-image-container img {
    width: 100%;
    height: 100%;
    object-fit: scale-down  ;
    transition: transform 0.3s ease;
}

.blog-post:hover .post-image-container img:not(.status-icon) {
    transform: scale(1.05);
}

/* Status Badge */
.status-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem;
    border-radius: 50%;
    width: 95px;
    height: 95px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.status-icon {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
}

/* Claim badge tooltip (hover desktop / tap mobile). Do not set position here – use wrap_class so badge stays in place. */
.cff-status-badge-wrap {
    display: inline-flex;
    cursor: default;
}
/* Focusable trigger button: reset native button styling, keep badge shape. */
.cff-status-badge-trigger {
    display: inline-flex;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    border-radius: 24px;
}
/* Visible keyboard focus ring that contrasts on any background (dark + white). */
.cff-status-badge-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--wp--preset--color--primary, #0b3b3b), 0 0 0 5px #fff;
}
/* Inner badge: 95x95 for grid/catalog/related; no position:absolute so wrap gets size and Tailwind positioning applies. */
.cff-status-badge-wrap .status-badge {
    position: static;
    top: auto;
    right: auto;
    width: 90px;
    height: 90px;
    padding: 0.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wp--preset--color--primary);
    border-radius: 24px;
}
.cff-status-badge-wrap .status-badge .status-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Tooltip: below badge, wider */
.cff-claim-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    margin-top: 4px;
    padding: 12px 18px;
    min-width: 320px;
    max-width: 513px;
    font-size: 14px;
    line-height: 1.45;
    color: #1f2937;
    background: #fff;
    border-radius: 19px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    border: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 20;
    pointer-events: none;
}
/* Arrow pointing up to the badge */
.cff-claim-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #fff;
}
@media (hover: hover) {
    .cff-status-badge-wrap:hover .cff-claim-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(4px);
        pointer-events: auto;
    }
    /* Esc dismissed (WCAG 1.4.13): stay hidden even while hovered. */
    .cff-status-badge-wrap.is-dismissed:hover .cff-claim-tooltip {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}
/* Keyboard focus (all devices, not gated by hover) + touch tap. */
.cff-status-badge-wrap:focus-within .cff-claim-tooltip,
.cff-status-badge-wrap.is-tooltip-visible .cff-claim-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(4px);
    pointer-events: auto;
}
/* Esc dismissed (WCAG 1.4.13): stay hidden while focus remains on the badge. */
.cff-status-badge-wrap.is-dismissed:focus-within .cff-claim-tooltip {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.cff-status-badge-wrap.is-tooltip-visible .cff-claim-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(4px);
}

/* Mobile & tablet: tooltip position when visible (tap) */
@media (max-width: 1024px) {
    .cff-status-badge-wrap.is-tooltip-visible .cff-claim-tooltip {
        transform: translateX(-80%) translateY(4px);
    }
    .cff-claim-tooltip::before {
        left: 80%;
        transform: translateX(-50%);
    }
}

/* Very small screens (< 360px): tooltip full viewport width, no fixed min */
@media (max-width: 359px) {
    .cff-claim-tooltip {
        min-width: 0;
        width: calc(100vw - 2rem);
        max-width: calc(100vw - 2rem);
        box-sizing: border-box;
    }
}

/* Card reading order: the heading comes first in the DOM (so screen readers and
   keyboard users meet the section's heading before the thumbnail/tags), while the
   original VISUAL order (Thumbnail → Tags → Heading → Excerpt) is kept via flex order. */
.cff-card-reordered {
    display: flex;
    flex-direction: column;
}
.cff-card-reordered .post-image-container {
    order: 1;
    cursor: pointer; /* mouse affordance; navigation handled by card-thumbnail-link.js */
}
.cff-card-reordered .post-content {
    order: 2;
    display: flex;
    flex-direction: column;
}
/* DOM inside .post-content is Heading → Tags → Excerpt; restore visual Tags → Heading → Excerpt. */
.cff-card-reordered .post-taxonomies {
    order: 1;
}
.cff-card-reordered .post-title {
    order: 2;
}
.cff-card-reordered .post-excerpt {
    order: 3;
}

/* Mobile: full-width Apply button. */
.filter-apply-btn {
    width: 100%;
}

/* Blue keyboard focus ring, matching the inputs/dropdowns. */
.filter-apply-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #3B82F6, 0 0 0 4px rgba(59, 130, 246, 0.25);
}

/* Filter form: on desktop keep the "Apply" button on the same row as the filters,
   aligned to the right (instead of wrapping to a new line below). */
@media (min-width: 768px) {
    .filter-form {
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        gap: 1rem;
    }
    .filter-form > .grid {
        flex: 1 1 auto;
        min-width: 0;
    }
    .filter-form > .filter-apply-row {
        margin-top: 0;
    }
    .filter-apply-btn {
        width: auto;
        height: 54px; /* match input/dropdown height */
    }
}

/* Post Content */
.post-content {
    padding: 1.5rem;
}

.blog-post-wide .post-content, .blog-post-small .post-content {
    padding: 0;
}

/* Post Categories */
.post-categories {
    margin-bottom: 0;
}

.category-tag {
    color: rgba(0, 0, 0, 0.45);
    font-family: Figtree;
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    line-height: normal;
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-skip-ink: none;
    text-decoration-thickness: auto;
    text-underline-offset: auto;
    text-underline-position: from-font;
}

/* Post Title */
.post-title {
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: #111827;
}

.blog-post-wide .post-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-title a:hover {
    color: #2563eb;
}

/* Post Excerpt */
.post-excerpt p {
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 14px;
    color: var(--Neutral-Black, #3A3A3A);

font-style: normal;
font-weight: 400;
line-height: normal;
letter-spacing: 0.42px;
}

.blog-post-wide .post-excerpt {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* Post Meta */
.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #9ca3af;
}

.post-date {
    font-size: 0.875rem;
}

.read-more {
    color: #2563eb;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.read-more:hover {
    color: #1d4ed8;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.pagination-container .page-numbers {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.75rem;
    align-items: center;
}

.pagination-container .page-numbers li {
    margin: 0;
}

.pagination-container .page-numbers a,
.pagination-container .page-numbers span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.75rem;
    height: 3.375rem;
    border-radius: 19.5px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s ease;
    border: 1px solid #BFBFBF;
    color: #000;
    background: white;
}

.pagination-container .page-numbers a:hover {
    background-color: #f3f4f6;
    color: #000;
}

.pagination-container .page-numbers .current {
    background-color: #abf4c4;
    color: #000;
    border-color: #abf4c4;
}

/* Arrow buttons */
.pagination-container .page-numbers .prev,
.pagination-container .page-numbers .next {
    width: 3.75rem;
    height: 3.375rem;
    border-radius: 19.5px;
    border: 1px solid #BFBFBF;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination-container .page-numbers .prev:hover,
.pagination-container .page-numbers .next:hover {
    background-color: #f3f4f6;
    color: #000;
}

/* Arrow icons */
.pagination-container .page-numbers .prev::before {
    content: '';
    width: 0.75rem;
    height: 0.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 19l-7-7 7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.pagination-container .page-numbers .next::before {
    content: '';
    width: 0.75rem;
    height: 0.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .blog-grid-container {
        grid-template-columns: repeat(8, 1fr);
        gap: 1rem;
    }
    
    .blog-post-wide {
        grid-column: span 8;
    }
    
    .blog-post-small {
        grid-column: span 4;
    }
}

@media (max-width: 768px) {
    .blog-grid-container {
        grid-template-columns: repeat(12, 1fr);
        gap: 1rem;
    }
    
    .blog-post-wide {
        grid-column: span 12;
    }
    
    .blog-post-small {
        grid-column: span 12;
    }
    
    .post-content {
        padding: 1rem;
    }
    
    .blog-post-wide .post-content {
        padding: 0;
    }
    
    .post-title {
        font-size: 1.125rem;
    }
    
    .blog-post-wide .post-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .blog-grid-container {
        grid-template-columns: repeat(12, 1fr);
        gap: 0.75rem;
    }
    
    .blog-post-wide,
    .blog-post-small {
        grid-column: span 12;
    }
    
    .post-image-container {
        height: 260px;
    }
    
    .blog-post-wide .post-image-container {
        height: 260px;
    }
    
    .post-content {
        padding: 0.75rem;
    }
    
    .blog-post-wide .post-content {
        padding: 0;
    }
    
    .post-title {
        font-size: 1rem;
    }
    
    .blog-post-wide .post-title {
        font-size: 1.125rem;
    }
    
    .status-badge {
        width: 95px;
        height: 95px;
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .status-icon {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* Extra small screens - maintain 12 column grid */
@media (max-width: 320px) {
    .blog-grid-container {
        grid-template-columns: repeat(12, 1fr);
        gap: 0.5rem;
    }
    
    .blog-post-wide,
    .blog-post-small {
        grid-column: span 12;
    }
    
    .post-content {
        padding: 0.5rem;
    }
    
    .blog-post-wide .post-content {
        padding: 0;
    }
    
    .post-title {
        font-size: 0.875rem;
    }
    
    .blog-post-wide .post-title {
        font-size: 1rem;
    }
    
    .status-badge {
        width: 95px;
        height: 95px;
    }
    
    .status-icon {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* Grid Pattern Specific Styles */
.blog-grid-container {
    /* Ensure proper spacing and alignment */
    align-items: start;
}

/* No Posts Found Styling */
.no-posts-found-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;

    border-radius: 40px;
    margin: 2rem 0;
}

.no-posts-content {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.no-posts-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, #abf4c4 0%, #abf4c4 100%);
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(171, 244, 196, 0.3);
    position: relative;
}

.no-posts-icon::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(135deg, #abf4c4 0%, #abf4c4 100%);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.2;
}

.no-posts-icon-svg {
    width: 48px;
    height: 48px;
    color: #1a1a1a;
    stroke-width: 2.5;
}

.no-posts-title {
    font-family: 'Clash Display Variable', sans-serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.no-posts-description {
    font-family: 'Figtree', sans-serif;
    font-size: 1.125rem;
    color: #4a5568;
    margin-bottom: 2rem;
    line-height: 1.6;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.active-filters {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(191, 191, 191, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.filter-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}

.filter-item:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-family: 'Figtree', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-value {
    font-family: 'Figtree', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a1a1a;
    background: rgba(255, 217, 104, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 217, 104, 0.3);
}

.no-posts-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    border-radius: 19.5px;
    font-family: 'Figtree', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    min-width: 160px;
    height: 54px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #113743 0%, #0A2431 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(17, 55, 67, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(17, 55, 67, 0.4);
    color: white;
}

.btn-secondary {
    background: white;
    color: #4a5568;
    border-color: #BFBFBF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: #f8fafc;
    border-color: #113743;
    color: #113743;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Responsive Design for No Posts Found */
@media (max-width: 768px) {
    .no-posts-found-container {
        min-height: 300px;
        padding: 2rem 1rem;
        margin: 1rem 0;
    }
    
    .no-posts-icon {
        width: 100px;
        height: 100px;
        margin-bottom: 1.5rem;
    }
    
    .no-posts-icon-svg {
        width: 40px;
        height: 40px;
    }
    
    .no-posts-title {
        font-size: 2rem;
    }
    
    .no-posts-description {
        font-size: 1rem;
    }
    
    .active-filters {
        padding: 1rem;
    }
    
    .no-posts-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .no-posts-found-container {
        padding: 1.5rem 0.75rem;
        border-radius: 24px;
    }
    
    .no-posts-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 1rem;
    }
    
    .no-posts-icon-svg {
        width: 32px;
        height: 32px;
    }
    
    .no-posts-title {
        font-size: 1.75rem;
    }
    
    .no-posts-description {
        font-size: 0.875rem;
    }
    
    .filter-item {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
        height: 48px;
    }
}

.blog-grid-container article .post-content .post-excerpt p a {
	display: block;
	margin-top: 8px;
	font-weight: 700;
	text-decoration: underline;
}