/* Journals Redesign CSS (Final Revert with Improvements) */

.site-main {
    font-family: var(--ast-global-font-family, inherit);
    padding-bottom: 80px;
    background-color: #fcfcfc;
}

/* Breadcrumb */
.cn-breadcrumb {
    padding: 30px 0;
    color: #666;
    font-size: 14px;
}
.cn-active-crumb {
    color: #a81010;
    font-weight: 600;
}

/* Hero Stack Section (Restored) */
.cn-journals-hero {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 60px;
    padding: 50px 0 80px 0;
}
.cn-hero-stack {
    flex: 1;
    position: relative;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cn-stack-img {
    position: absolute;
    width: 200px;
    height: auto;
    box-shadow: -5px 10px 25px rgba(0,0,0,0.2);
    border: 2px solid #fff;
    border-radius: 4px;
    transition: transform 0.4s ease, left 0.4s ease, z-index 0.4s ease;
}
.cn-stack-0 { left: 0px; transform: rotate(-8deg) translateY(20px); z-index: 1; }
.cn-stack-1 { left: 70px; transform: rotate(-4deg) translateY(5px); z-index: 2; }
.cn-stack-2 { left: 140px; transform: rotate(0deg) translateY(-10px); z-index: 3; }
.cn-stack-3 { left: 210px; transform: rotate(4deg) translateY(5px); z-index: 4; }
.cn-stack-4 { left: 280px; transform: rotate(8deg) translateY(20px); z-index: 5; }

.cn-hero-stack:hover .cn-stack-img {
    transform: rotate(0deg) translateY(0);
}
.cn-hero-stack:hover .cn-stack-0 { left: -50px; }
.cn-hero-stack:hover .cn-stack-1 { left: 80px; }
.cn-hero-stack:hover .cn-stack-2 { left: 210px; }
.cn-hero-stack:hover .cn-stack-3 { left: 340px; }
.cn-hero-stack:hover .cn-stack-4 { left: 470px; }

.cn-hero-content {
    flex: 1;
}
.cn-hero-title {
    font-size: 42px;
    font-weight: 800;
    color: #101d36 !important;
    margin-bottom: 20px;
    line-height: 1.3;
}
.cn-hero-divider {
    width: 60px;
    height: 4px;
    background: #a81010;
    margin-bottom: 30px;
    border-radius: 2px;
}
.cn-hero-desc {
    font-size: 18px;
    line-height: 1.8;
    color: #555 !important;
    max-width: 90%;
}

/* Filters Wrapper */
.cn-journals-filters-wrapper {
    margin-bottom: 50px;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 20px;
}

/* Underline Filter Tabs (Retained Graphic) */
.cn-editorial-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    justify-content: center;
}
.cn-editorial-filters button.cn-filter-tab {
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 0 10px 0 !important;
    margin: 0 !important;
    color: #777 !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    outline: none;
    transition: color 0.3s ease;
    border-radius: 0 !important;
}
.cn-editorial-filters button.cn-filter-tab::after {
    content: '';
    position: absolute;
    bottom: -21px; /* Align with border-bottom of header */
    left: 0;
    width: 100%;
    height: 2px;
    background: #a81010;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}
.cn-editorial-filters button.cn-filter-tab:hover,
.cn-editorial-filters button.cn-filter-tab.active {
    color: #101d36 !important;
    background-color: transparent !important;
}
.cn-editorial-filters button.cn-filter-tab.active::after {
    transform: scaleX(1);
}

/* Journals Main Grid */
.cn-journals-main {
    position: relative;
    min-height: 400px;
}
.cn-journal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px 30px;
}

/* Hero Mini Card inside the grid (First Box) */
.cn-journal-hero-card {
    grid-column: 1 / -1; /* span all columns */
    display: flex;
    align-items: center;
    gap: 40px;
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    margin-bottom: 20px;
}
.cn-jhc-cover {
    flex: 0 0 350px;
}
.cn-jhc-cover img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: block;
}
.cn-jhc-content {
    flex: 1;
}
.cn-jhc-label {
    display: inline-block;
    color: #a81010;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    border-bottom: 2px solid #a81010;
    padding-bottom: 4px;
}
.cn-jhc-title {
    font-size: 28px;
    font-weight: 800;
    color: #101d36;
    margin: 0 0 15px;
    line-height: 1.4;
}
.cn-jhc-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}
.cn-jhc-title a:hover {
    color: #a81010;
}
.cn-jhc-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #777;
    margin-bottom: 25px;
}
.cn-jhc-tag {
    color: #d35400;
    background: #fdf5e6;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
}
.cn-jhc-excerpt {
    font-size: 15px;
    line-height: 1.8;
    color: #555;
    margin-bottom: 30px;
    max-width: 600px;
}
.cn-jhc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #a81010;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: background 0.3s ease;
}
.cn-jhc-btn:hover {
    background: #d61a1a;
    color: #fff;
}

/* Simple Image Cover Cards */
.cn-journal-simple-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03); /* Very subtle base shadow */
}
.cn-journal-simple-card:hover {
    transform: translateY(-8px) scale(1.02); /* Tiny motion */
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    z-index: 2;
}
.cn-jsc-link {
    display: block;
    width: 100%;
    position: relative;
}
.cn-jsc-img {
    display: block;
    width: 100%;
    height: auto;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .cn-journals-hero { flex-direction: column; text-align: center; gap: 40px; }
    .cn-hero-stack { width: 100%; height: auto; display: flex; justify-content: center; margin-bottom: 20px; }
    .cn-stack-img { position: relative; top: auto; right: auto; margin-right: -100px; width: 200px; height: 290px; }
    .cn-stack-0 { margin-right: 0; z-index: 5; transform: scale(1); }
    .cn-stack-1 { z-index: 4; transform: scale(0.95); }
    .cn-stack-2 { z-index: 3; transform: scale(0.9); }
    .cn-stack-3 { display: none; }
    .cn-stack-4 { display: none; }
    .cn-hero-divider { margin: 0 auto 30px auto; }
    
    .cn-journal-grid { grid-template-columns: repeat(3, 1fr); }
    .cn-journal-hero-card { flex-direction: column; text-align: center; padding: 30px; }
    .cn-jhc-cover { flex: auto; max-width: 400px; margin: 0 auto; }
    .cn-jhc-meta { justify-content: center; }
    .cn-jhc-excerpt { margin: 0 auto 30px auto; }
}
@media (max-width: 768px) {
    .cn-journal-grid { grid-template-columns: repeat(2, 1fr); }
    .cn-hero-title { font-size: 32px; }
    .cn-stack-img { margin-right: -60px; width: 150px; height: 220px; }
    .cn-editorial-filters { gap: 15px; }
    .cn-editorial-filters button.cn-filter-tab { font-size: 14px; }
    .cn-jhc-title { font-size: 24px; }
}
@media (max-width: 480px) {
    .cn-journal-grid { grid-template-columns: 1fr; }
    .cn-stack-img { margin-right: -40px; }
    .cn-stack-2 { display: none; }
}

/* Pagination */
.cn-journals-pagination {
    display: flex;
    justify-content: center;
    margin-top: 60px;
    margin-bottom: 60px;
}
.cn-journals-pagination ul.page-numbers {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}
.cn-journals-pagination ul.page-numbers li { margin: 0 !important; padding: 0 !important; }
.cn-journals-pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px; background: #fff;
    border: 1px solid #eaeaea; border-radius: 4px; color: #333; font-size: 14px;
    font-weight: bold; text-decoration: none; transition: all 0.2s;
}
.cn-journals-pagination .page-numbers.current, .cn-journals-pagination .page-numbers:hover {
    background: #a81010; color: #fff; border-color: #a81010;
}

/* Loading Overlay & Spinner */
.cn-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(252, 252, 252, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}
.cn-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eaeaea;
    border-top-color: #a81010;
    border-radius: 50%;
    animation: cn-spin 1s linear infinite;
}
@keyframes cn-spin {
    to { transform: rotate(360deg); }
}

/* 3D Flip Card Overlay for Grid */
.cn-journal-simple-card {
   perspective: 1200px;
   position: relative;
   border-radius: 12px;
   aspect-ratio: 3 / 4;
   background: transparent;
   box-shadow: none;
   overflow: visible;
}
.cn-journal-simple-card:hover {
   transform: none;
   box-shadow: none;
}

.cn-jc-inner {
   position: absolute;
   width: 100%;
   height: 100%;
   transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
   transform-style: preserve-3d;
   border-radius: 12px;
   box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.cn-journal-simple-card:hover .cn-jc-inner {
   transform: rotateY(-180deg);
}

.cn-jc-front, .cn-jc-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 12px; overflow: hidden; background: #fff; }
.cn-jc-front { padding: 15px; border: 1px solid #eaeaea; }

.cn-jc-front img { width: 100%; height: 100%; object-fit: contain; background: #fff; display: block; border-radius: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

.cn-jc-back {
   transform: rotateY(180deg);
   display: flex;
   align-items: center;
   justify-content: center;
   text-align: center;
   padding: 20px;
   background: #fffcf5;
   border: 2px solid #e8dec8;
}

.cn-jc-back-content {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 12px;
   width: 100%;
}

.cn-jc-back-icon {
   width: 50px;
   height: 50px;
   border-radius: 50%;
   border: 2px solid #b89762;
   color: #b89762;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 24px;
   margin-bottom: 10px;
}

.cn-jc-type {
   font-size: 14px;
   color: #555;
   font-weight: bold;
}

.cn-jc-title {
   font-size: 22px;
   font-weight: 800;
   color: #0B192C;
   margin: 0;
   line-height: 1.4;
}

.cn-jc-issue {
   font-size: 15px;
   color: #444;
   margin-top: 15px;
   font-weight: bold;
}

.cn-jc-date {
   font-size: 14px;
   color: #777;
}

.cn-jc-link {
   position: absolute;
   inset: 0;
   z-index: 10;
}

/* Override and refine Filter Buttons */
.cn-journals-filters-wrapper {
    margin: 50px 0 60px 0 !important;
    border: none !important;
    padding: 0 !important;
    text-align: center;
}

.cn-journals-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.cn-journals-filters .cn-filter-btn {
    background-color: #900000 !important;
    color: #fff !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    font-family: 'Vazirmatn', sans-serif !important;
    font-weight: normal !important;
}

.cn-journals-filters .cn-filter-btn:hover {
    background-color: #0B192C !important;
}

.cn-journals-filters .cn-filter-btn.active {
    background-color: #b89762 !important;
    color: #fff !important;
    font-weight: bold !important;
}
