/* Publications Stylesheet */

/* Maintain the exact paper styling you requested */
/* ============================================
   UNIFIED DOCUMENT GRID SYSTEM
   ============================================ */

/* Base Grid Container */
.policy-grid,
.papers-grid {
    display: grid;
    gap: 15px;
    margin: 0 auto;
    width: 100%;
    justify-items: center;
}

/* Desktop: 6 columns */
@media (min-width: 1200px) {
    .policy-grid,
    .papers-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Medium Desktop: 4 columns */
@media (min-width: 992px) and (max-width: 1199px) {
    .policy-grid,
    .papers-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablet: 2 columns */
@media (min-width: 768px) and (max-width: 991px) {
    .policy-grid,
    .papers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: 2 columns */
@media (max-width: 767px) {
    .policy-grid,
    .papers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 10px;
        margin: 0;
    }
}

/* Very Small Mobile: 1 column */
@media (max-width: 480px) {
    .policy-grid,
    .papers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   DOCUMENT CARD STYLES (Shared by both sections)
   ============================================ */

.policy-card,
.paper-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(42, 157, 143, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    max-width: 200px;
    min-height: 0;
}

.policy-card:hover,
.paper-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(42, 157, 143, 0.15);
    border-color: rgba(42, 157, 143, 0.2);
}

/* Preview Area */
.policy-preview,
.paper-preview {
    position: relative;
    height: 140px;
    background: #f8f9fa;
    overflow: hidden;
    flex-shrink: 0;
}

.pdf-preview {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    display: block;
}

.pdf-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2a9d8f, #43aa8b);
    color: white;
    padding: 15px;
    text-align: center;
}

.pdf-fallback i {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.pdf-fallback span {
    font-size: 0.8rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   ACTION BUTTONS (Fixed - Properly Aligned & Round)
   ============================================ */

.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(0);
    z-index: 10;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    text-decoration: none;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Ensure perfect circle on all browsers */
.action-btn,
.action-btn:focus,
.action-btn:hover {
    border-radius: 50%;
}

.preview-btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-green);
    border: 1px solid rgba(42, 157, 143, 0.3);
}

.preview-btn:hover {
    background: white;
    color: var(--dark-green);
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 4px 12px rgba(42, 157, 143, 0.25);
}

.download-btn {
    background: rgba(42, 157, 143, 0.95);
    color: white;
    border: 1px solid var(--primary-green);
}

.download-btn:hover {
    background: var(--primary-green);
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(42, 157, 143, 0.3);
}

/* ============================================
   CARD INFO (Shared by both sections)
   ============================================ */

.policy-info,
.paper-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
}

.policy-info h3,
.paper-info h3 {
    color: var(--dark-green);
    font-size: 0.85rem;
    line-height: 1.3;
    margin: 8px 0 0 0;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* ============================================
   TAGS (Shared by both sections)
   ============================================ */

.policy-tag,
.paper-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.65rem !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    align-self: flex-start;
    margin: 0;
}

/* Policy Briefs Tag Colors */
.transport-tag { background: rgba(72, 202, 228, 0.12); color: var(--sky-blue); border: 1px solid rgba(72, 202, 228, 0.25); }
.social-tag { background: rgba(255, 183, 3, 0.12); color: var(--sun-yellow); border: 1px solid rgba(255, 183, 3, 0.25); }
.hydrogen-tag { background: rgba(42, 157, 143, 0.12); color: var(--primary-green); border: 1px solid rgba(42, 157, 143, 0.25); }
.regional-tag { background: rgba(108, 117, 125, 0.12); color: var(--medium-gray); border: 1px solid rgba(108, 117, 125, 0.25); }
.rural-tag { background: rgba(212, 165, 116, 0.12); color: var(--earth-brown); border: 1px solid rgba(212, 165, 116, 0.25); }
.mobility-tag { background: rgba(0, 153, 102, 0.12); color: #009966; border: 1px solid rgba(0, 153, 102, 0.25); }
.justice-tag { background: rgba(138, 43, 226, 0.12); color: #8a2be2; border: 1px solid rgba(138, 43, 226, 0.25); }
.ev-tag { background: rgba(0, 102, 51, 0.12); color: #006633; border: 1px solid rgba(0, 102, 51, 0.25); }
.ammonia-tag { background: rgba(72, 149, 239, 0.12); color: #4895ef; border: 1px solid rgba(72, 149, 239, 0.25); }
.mineral-tag { background: rgba(255, 149, 0, 0.12); color: #ff9500; border: 1px solid rgba(255, 149, 0, 0.25); }
.equity-tag { background: rgba(255, 107, 107, 0.12); color: #ff6b6b; border: 1px solid rgba(255, 107, 107, 0.25); }
.infrastructure-tag { background: rgba(102, 102, 102, 0.12); color: #666; border: 1px solid rgba(102, 102, 102, 0.25); }
.access-tag { background: rgba(76, 175, 80, 0.12); color: #4caf50; border: 1px solid rgba(76, 175, 80, 0.25); }
.decarbonisation-tag { background: rgba(156, 39, 176, 0.12); color: #9c27b0; border: 1px solid rgba(156, 39, 176, 0.25); }

/* Research Papers Tag Color */
.research-tag { background: rgba(156, 39, 176, 0.12); color: #9c27b0; border: 1px solid rgba(156, 39, 176, 0.25); }

/* Article Tag Colors */
.renewable-tag { background: rgba(72, 202, 228, 0.12); color: var(--sky-blue); border: 1px solid rgba(72, 202, 228, 0.25); }
.hydrogen-tag { background: rgba(42, 157, 143, 0.12); color: var(--primary-green); border: 1px solid rgba(42, 157, 143, 0.25); }
.transport-tag { background: rgba(0, 153, 102, 0.12); color: #009966; border: 1px solid rgba(0, 153, 102, 0.25); }
.climate-tag { background: rgba(76, 175, 80, 0.12); color: #4caf50; border: 1px solid rgba(76, 175, 80, 0.25); }
.policy-tag { background: rgba(156, 39, 176, 0.12); color: #efe8f1; border: 1px solid rgba(156, 39, 176, 0.25); }

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 1200px) {
    .policy-preview,
    .paper-preview {
        height: 130px;
    }
    
    .action-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

@media (max-width: 992px) {
    .policy-preview,
    .paper-preview {
        height: 120px;
    }
    
    .policy-info h3,
    .paper-info h3 {
        font-size: 0.8rem;
    }
    
    .card-actions {
        top: 8px;
        right: 8px;
        gap: 6px;
    }
}

@media (max-width: 768px) {
    .policy-preview,
    .paper-preview {
        height: 110px;
    }
    
    .policy-info,
    .paper-info {
        padding: 10px;
    }
    
    .policy-info h3,
    .paper-info h3 {
        font-size: 0.75rem;
    }
    
    .action-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    .pdf-fallback i {
        font-size: 1.3rem;
    }
    
    .pdf-fallback span {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .policy-preview,
    .paper-preview {
        height: 120px;
    }
    
    .policy-info,
    .paper-info {
        padding: 12px;
    }
    
    .policy-info h3,
    .paper-info h3 {
        font-size: 0.8rem;
    }
    
    .action-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

/* ============================================
   LOADING AND ERROR STATES
   ============================================ */

.pdf-preview.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}