/* Accessibility */
.skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    background: #3498db;
    color: white;
    z-index: 1200;
}

.skip-link:focus {
    width: auto;
    height: auto;
    clip: auto;
    margin: 0;
    padding: 8px 15px;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.5);
}

/* Page Layout */
.page-hero {
    background-color: #fff;
    padding: 8rem 0 0.75rem;
    margin-bottom: 0;
    position: relative;
}

.page-hero .container {
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

#news-content {
    padding-top: 0;  /* Add this to remove extra space */
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 0 2rem 3rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-top: 0.75rem;
}

/* News Items */
.news-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.news-item:hover,
.news-item:focus-within {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

/* Grid Layout for News Item Content */
.news-item-content {
    padding: 1.5rem;
    display: grid;
    grid-template-rows: auto auto minmax(4.8rem, auto) 200px auto;
    gap: 1rem;
    height: 100%;
}

.news-date {
    grid-row: 1;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0;
}

.news-item h3 {
    grid-row: 2;
    margin: 0;
    color: #2c3e50;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    line-height: 1.3;
    height: 3.9rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.news-item p {
    grid-row: 3;
    margin: 0;
    color: #333;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.news-image {
    grid-row: 4;
    margin: 0;
    border-radius: 8px;
    overflow: hidden;
    height: 200px;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-item:hover .preview-image {
    transform: scale(1.05);
}

.read-more {
    grid-row: 5;
    justify-self: center;
    padding: 1rem 2rem;
    background: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.read-more:hover,
.read-more:focus {
    background: #2980b9;
    transform: translateY(-2px);
}

/* Loading State */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    z-index: 2000; /* Higher than skip-link */
}

.loading-indicator p {
    margin: 0;
    color: #666;
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    border: 4px solid rgba(0,0,0,0.1);
    border-left-color: #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.error-message {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
    background: #fdf0ed;
    border-radius: 8px;
    margin: 2rem 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background: #fff;
    margin: 2rem auto;
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    color: #2c3e50;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.3s ease;
}

.modal-close:hover,
.modal-close:focus {
    color: #3498db;
}

/* Modal Content */
#modal-content h2 {
    color: #2c3e50;
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

#modal-content .news-date {
    display: block;
    margin-bottom: 2rem;
    color: #7f8c8d;
}

#modal-content .content {
    line-height: 1.8;
    color: #333;
    font-size: 1.1rem;
}

/* Carousel */
.image-carousel {
    position: relative;
    margin: 2rem 0;
}

.featured-image-container {
    position: relative;
    margin-bottom: 1rem;
}

.featured-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background-color 0.3s ease;
    z-index: 2;
}

.carousel-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-button.prev {
    left: 0;
    border-radius: 0 3px 3px 0;
}

.carousel-button.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

/* Thumbnails */
.thumbnail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.gallery-item {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.gallery-item.active {
    opacity: 1;
    border: 2px solid #3498db;
}

.gallery-item:hover {
    opacity: 1;
}

.gallery-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.image-caption {
    text-align: center;
    margin-top: 0.5rem;
    color: #666;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .page-hero {
        padding: 7rem 0 0.75rem;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
        margin: 0 1rem 2rem;
        gap: 1.5rem;
    }
    
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
        width: calc(100% - 2rem);
    }
    
    #modal-content h2 {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .news-grid {
        display: block;
    }
    
    .news-item {
        break-inside: avoid;
        margin-bottom: 2rem;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .read-more {
        display: none;
    }
}
