/* ==========================================================================
   CPT Listing Card Grid & Modal Styles
   Follows skill: cpt-listing-detail-behavior
   ========================================================================== */

.cpt-grid,
.cpt-listing-wrapper .listing-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 0 0 32px 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 992px) {
    .cpt-grid,
    .cpt-listing-wrapper .listing-results {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 600px) {
    .cpt-grid,
    .cpt-listing-wrapper .listing-results {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.cpt-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    height: 100%;
}

.cpt-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

/* Card Link wrapper */
.cpt-card__link {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    color: inherit;
    text-decoration: none;
}

.cpt-card__link--static {
    cursor: default;
}

/* Media / Thumb */
.cpt-card__media {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #f1f5f9;
    overflow: hidden;
}

.cpt-card__img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.cpt-card:hover .cpt-card__img {
    transform: scale(1.05);
}

/* Body */
.cpt-card__body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.cpt-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.cpt-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    text-decoration: none;
}

.cpt-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: #1e293b;
    margin: 0 0 10px 0;
}

.cpt-card__excerpt {
    color: #64748b;
    font-size: 0.925rem;
    line-height: 1.6;
    margin: 0;
}

/* Footer */
.cpt-card__footer {
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
    display: flex;
    align-items: center;
}

.cpt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.cpt-btn--detail {
    background: #2563eb;
    color: #ffffff !important;
}

.cpt-btn--modal {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}

/* Modal Trigger Overlay for modal cards */
.cpt-card__trigger {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 5;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ==========================================================================
   Single Detail Page Styles (`single-cpt_item.php`)
   ========================================================================== */
.cpt-single-main {
    padding: 40px 20px;
    background: #f8fafc;
    min-height: 80vh;
}

.cpt-single-container {
    max-width: 840px;
    margin: 0 auto;
}

.cpt-detail-article {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    padding: 40px;
    border: 1px solid #e2e8f0;
}

@media (max-width: 600px) {
    .cpt-detail-article {
        padding: 24px 16px;
    }
}

.cpt-detail-breadcrumb {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 24px;
}

.cpt-detail-breadcrumb a {
    color: #2563eb;
    text-decoration: none;
}

.cpt-detail-breadcrumb a:hover {
    text-decoration: underline;
}

.cpt-detail-breadcrumb .current-page {
    color: #334155;
    font-weight: 500;
}

.cpt-detail-header {
    margin-bottom: 28px;
}

.cpt-detail-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.cpt-detail-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    margin: 0;
}

@media (max-width: 600px) {
    .cpt-detail-title {
        font-size: 1.75rem;
    }
}

.cpt-detail-hero {
    margin-bottom: 32px;
    border-radius: 12px;
    overflow: hidden;
    max-height: 460px;
    background: #f1f5f9;
}

.cpt-detail-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.cpt-detail-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #334155;
    margin-bottom: 40px;
}

.cpt-detail-body h2,
.cpt-detail-body h3 {
    color: #0f172a;
    margin-top: 1.75em;
    margin-bottom: 0.75em;
}

.cpt-detail-body p {
    margin-bottom: 1.5em;
}

.cpt-detail-footer {
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.cpt-btn--back {
    background: #f1f5f9;
    color: #334155 !important;
}

.cpt-btn--back:hover {
    background: #e2e8f0;
    color: #0f172a !important;
}

/* ==========================================================================
   Modal Overlay & Popup Styles
   ========================================================================== */
.cpt-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cpt-modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.cpt-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
}

.cpt-modal-container {
    position: relative;
    background: #ffffff;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    z-index: 2;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cpt-modal-overlay.is-active .cpt-modal-container {
    transform: scale(1);
}

.cpt-modal-close-btn {
    position: sticky;
    top: 16px;
    float: right;
    margin: 16px 16px 0 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    color: #475569;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.cpt-modal-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cpt-modal-body-area {
    padding: 32px;
}

.cpt-modal-payload-header {
    margin-bottom: 20px;
}

.cpt-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.cpt-modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    margin: 0;
}

.cpt-modal-media {
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
}

.cpt-modal-img {
    width: 100%;
    height: auto;
    display: block;
}

.cpt-modal-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #334155;
}

.cpt-modal-content p {
    margin-bottom: 1rem;
}