body {
  font-family: 'Lato', sans-serif;
  background-color: #f8f9fa;
  line-height: 1.6;
}

#article-content-area, .article-card .card-text {
  font-family: 'Merriweather', serif;
}

h1, h2, h3, h4, h5, h6, .card-title {
  font-family: 'Merriweather', serif;
  font-weight: 700;
}

.site-header-cnn {
  background-color: #ffffff;
  border-bottom: 1px solid #dee2e6;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  top: 0;
  z-index: 1020;
}

.site-title-brand {
  font-family: 'Lato', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  color: #212529;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 1rem;
}

.header-nav {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.header-nav .nav-item {
}

.header-nav .nav-link {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  white-space: nowrap;
}

.header-nav .nav-link:hover, .header-nav .nav-link:focus {
  color: #000;
  background-color: transparent;
  text-decoration: underline;
}

/* --- NEW: Active menu item color for public site --- */
.header-nav .nav-link.active {
  color: #3F51B5 !important;
}

.header-nav .nav-link.disabled,
span.nav-link.disabled {
  color: #adb5bd !important;
  pointer-events: none;
  cursor: default;
  text-decoration: none !important;
}

.header-nav .signup-link-cnn {
  color: #0d6efd;
}

.header-nav .signup-link-cnn:hover {
  color: #0a58ca;
}

#page-description {
  transition: opacity 0.3s ease-out;
  margin-top: 2rem;
}

#page-description.d-none {
  opacity: 0;
  margin-bottom: 0;
  margin-top: 0;
  overflow: hidden;
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

#page-description hr {
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 1.5rem;
}

#signup-section {
  transition: opacity 0.3s ease-out;
}

#signup-section.d-none {
  opacity: 0;
}

#left-sidebar, #right-sidebar {
  transition: opacity 0.3s ease-out;
}

#right-sidebar {
  z-index: 1019;
  margin-top: 2.5rem;
}

#left-sidebar.d-none, #right-sidebar.d-none {
  opacity: 0;
}

#left-sidebar .sticky-top, #right-sidebar .sticky-top {
  top: 75px;
}

.ad-placeholder-sidebar {
  background-color: #e9ecef;
  border: 1px dashed #adb5bd;
  width: 150px;
  height: 150px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  color: #6c757d;
  font-size: 0.9rem;
}

.ad-placeholder-sidebar a {
  display: block;
  width: 100%;
  height: 100%;
}

.content-banner-slot {
  background-color: transparent;
  border: none;
  width: 100%;
  height: 90px;
  overflow: hidden;
  padding: 0;
  color: #6c757d;
  font-size: 0.9rem;
  background-image: url('../img/banner_ads/site_feature_graphic.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.article-card {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  background-color: #ffffff;
  overflow: hidden;
  position: relative;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.article-card .card-img-top {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-bottom: 1px solid #eee;
  transition: transform 0.3s ease-in-out;
}

.article-card:hover .card-img-top {
  transform: scale(1.05);
}

.article-card .card-body {
  padding: 1rem;
}

.article-card .card-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #343a40;
}

.article-card .card-title a {
  text-decoration: none;
  color: inherit;
}

.article-card .card-title a:hover {
  text-decoration: underline;
  color: #0d6efd;
}

.article-card .card-text {
  font-size: 0.9rem;
  color: #495057;
  margin-bottom: 1rem;
}

.article-card .card-footer {
  background-color: transparent;
  border-top: 1px solid #eee;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  color: #6c757d;
  flex-shrink: 0;
}

#article-content-area {
  background-color: #ffffff;
  padding: 2rem 1.5rem;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
  margin-top: 2.5rem;
}

#article-content-area h1 { font-size: 2.5rem; margin-bottom: 0.5rem; line-height: 1.2; }
#article-content-area h2 { font-size: 1.75rem; margin-top: 2rem; margin-bottom: 1rem; border-bottom: 1px solid #eee; padding-bottom: 0.5rem; }
#article-content-area p { margin-bottom: 1.25rem; font-size: 1.1rem; }
#article-content-area .lead { font-size: 1.25rem; font-weight: 400; }
#article-content-area img { max-width: 100%; height: auto; margin-top: 0.5rem; margin-bottom: 1rem; border-radius: 0.25rem; }
#article-content-area .byline, #article-content-area .text-muted { font-family: 'Lato', sans-serif; font-size: 0.9rem; color: #6c757d; }
#article-content-area blockquote { font-size: 1.15rem; color: #495057; }
#article-content-area blockquote .blockquote-footer { font-family: 'Lato', sans-serif; font-size: 0.95rem; }
#article-content-area .content-banner-slot { margin-top: 2rem; }

.site-footer-links a { color: #6c757d; text-decoration: none; }
.site-footer-links a:hover { color: #0d6efd; text-decoration: underline; }
#loading-indicator { margin-top: 3rem; margin-bottom: 3rem; }
#error-message { margin-top: 1rem; margin-bottom: 1rem; }

.article-preview-wrapper {
  outline: 3px solid transparent;
  outline-offset: 4px;
  box-shadow: 0 0 0 5px rgba(13, 110, 253, 0);
  border-radius: 0.375rem;
  transition: outline-color 0.5s ease-out, box-shadow 0.5s ease-out;
}

.highlighted-preview {
  outline-color: #0d6efd;
  box-shadow: 0 0 0 5px rgba(13, 110, 253, 0.4);
  animation-name: flashHighlight;
  animation-duration: 0.6s;
  animation-timing-function: linear;
  animation-iteration-count: 2;
}

@keyframes flashHighlight { 0%, 49.9% { outline-color: #0d6efd; box-shadow: 0 0 0 5px rgba(13, 110, 253, 0.4); } 50%, 99.9% { outline-color: transparent; box-shadow: 0 0 0 5px rgba(13, 110, 253, 0); } 100% { outline-color: #0d6efd; box-shadow: 0 0 0 5px rgba(13, 110, 253, 0.4); } }

.front-page-section { scroll-margin-top: 90px; }
.ad-container, #anchor-before-articles { scroll-margin-top: 90px; }
.front-page-section h3 { margin-bottom: 1.5rem !important; padding-bottom: 0.5rem; border-bottom: 1px solid #eee; }
#primary-content-column { transition: width 0.3s ease-in-out; }

.is-group-representative .article-card {
    box-shadow: 0 0.25rem 1rem rgba(13, 110, 253, 0.2);
}

.is-group-representative:hover .article-card {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(13, 110, 253, 0.35);
}

#article-navigation .btn {
    font-size: 0.85rem;
    font-weight: 700;
}

#article-navigation .btn-outline-primary {
    --bs-btn-color: #0D6EFD;
    --bs-btn-border-color: #0D6EFD;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #0D6EFD;
    --bs-btn-hover-border-color: #0D6EFD;
}

/* --- MODIFIED: Improved sidebar list styling --- */
#sidebar-related-posts .sidebar-related-list { list-style: none; padding-left: 0; margin-bottom: 0; }
#sidebar-related-posts .sidebar-related-list li { margin-bottom: 0.1rem; }
#sidebar-related-posts .related-post-link { text-decoration: none; color: #0d6efd; font-size: 0.9rem; display: block; transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out; line-height: 1.4; padding: 0.3rem 0.6rem; border-radius: 0.25rem; border-left: 3px solid transparent; }
#sidebar-related-posts .related-post-link:hover, #sidebar-related-posts .related-post-link:focus { color: #0a58ca; background-color: #e9ecef; }

#sidebar-related-posts span.current-post-link {
    color: #212529;
    font-weight: bold;
    pointer-events: none;
    cursor: default;
    display: block;
    font-size: 0.9rem;
    line-height: 1.4;
    background-color: #e0e7ff;
    padding: 0.3rem 0.6rem;
    border-radius: 0.25rem;
    border-left: 3px solid #0d6efd;
}

.post-hidden {
    display: none !important;
}

.search-result-item {
    border-left: 3px solid #0d6efd;
    transition: box-shadow 0.2s ease-in-out;
}
.search-result-item:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,0.07);
}

.archived-article .article-card {
    filter: grayscale(100%);
    opacity: 0.65;
    transition: filter 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
}
.archived-article .article-card:hover {
    filter: grayscale(20%);
    opacity: 0.85;
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

/* --- FORUM STYLES --- */
.forum-card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background-color: #ffffff;
}
.forum-category-item .row > div {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
.forum-category-title {
    color: #212529;
    text-decoration: none;
    font-weight: 700;
}
.forum-category-title:hover {
    color: #0d6efd;
    text-decoration: underline;
}
.forum-topic-table .table-light th {
    font-weight: 600;
    color: #495057;
}
.forum-topic-table a {
    text-decoration: none;
    color: #212529;
}
.forum-topic-table a:hover {
    text-decoration: underline;
}
.forum-post-card {
    border: 1px solid #dee2e6;
    background-color: #ffffff;
}
.forum-post-author {
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
}
.forum-post-content {
    min-height: 100px;
    line-height: 1.7;
}

.best-answer {
    border: 1px solid #198754 !important;
}
.best-answer .card-header {
    font-weight: bold;
}
.vote-widget .vote-btn {
    background-color: transparent;
    border: 1px solid #ced4da;
    color: #6c757d;
    line-height: 1;
}
.vote-widget .vote-btn:hover {
    background-color: #e9ecef;
}
.vote-widget .vote-btn.voted-up,
.vote-widget .vote-btn.voted-down {
    background-color: rgba(13, 110, 253, 0.1);
    border-color: #0d6efd;
    color: #0d6efd;
}
.vote-widget .vote-score {
    min-width: 25px;
    display: inline-block;
    text-align: center;
}

.forum-topic-table .topic-icons i {
    font-size: 1.1rem;
    margin-right: 4px;
}
.forum-topic-table .dropdown-toggle::after {
    display: none;
}

.table-responsive.overflow-visible {
    overflow: visible;
}

#header-extra-container {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    border-top: 1px solid #eee;
}
.header-action-buttons a {
    text-decoration: none;
}

.navbar-toggler {
    border: none;
}
.navbar-toggler:focus {
    box-shadow: none;
}

.forum-post-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.forum-post-badges .badge {
    font-size: 0.7rem;
    padding: 0.3em 0.5em;
}
.forum-post-signature {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* --- NEW: Custom Pagination Active State --- */
.pagination .page-item.active .page-link {
    background-color: #e9ecef;
    border-color: #0d6efd;
    color: #0d6efd;
    font-weight: 700;
}

@media (max-width: 991.98px) {
  .site-header-cnn nav.container {
    max-width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
  }
  .navbar-collapse {
    flex-basis: 100%;
    flex-grow: 1;
    align-items: stretch;
  }
  .header-nav {
    align-items: flex-start !important;
    margin-top: 0.5rem;
  }
  .header-nav .nav-link {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

@media (max-width: 767.98px) {
  body { padding-top: 60px; }
  .front-page-section, .ad-container, #anchor-before-articles { scroll-margin-top: 120px; }
  #home-link {
    margin-left: auto;
    margin-right: auto !important;
  }
  .site-header-cnn { padding-bottom: 0.8rem; }
  #left-sidebar .sticky-top, #right-sidebar .sticky-top { position: static; }
  #left-sidebar { margin-bottom: 2rem; order: -1; }
  #right-sidebar { margin-top: 2rem; order: 1; }
  .ad-placeholder-sidebar { width: 120px; height: 120px; }
  #article-content-area { padding: 1.5rem 1rem; }
  #article-content-area h1 { font-size: 2rem; }
  .category-grid .col-lg-4.col-md-6 { width: 100%; }
  .article-card .card-img-top { height: 160px; }
  #page-description { margin-top: 1rem; margin-bottom: 2rem; }
  #page-description hr { margin-top: 1rem; }
  
  @media (max-width: 767.98px) {
    .forum-post-author {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    .forum-category-item .text-center, 
    .forum-category-item .small {
        text-align: left !important;
        margin-top: 0.5rem;
    }
    #header-extra-container .row > div {
        text-align: center;
    }
    #header-extra-container .header-action-buttons {
        margin-bottom: 1rem;
    }
  }
}

/* --- NEW: Scrollable Sidebar List --- */
#sidebar-related-posts .sidebar-related-list {
    max-height: 220px; /* Adjust this value to control how many items are visible (approx. 5) */
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 0.25rem;
    padding: 0.5rem;
}

/* --- NEW: Thinner scrollbar for Webkit browsers --- */
#sidebar-related-posts .sidebar-related-list::-webkit-scrollbar {
  width: 5px;
}
#sidebar-related-posts .sidebar-related-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}
#sidebar-related-posts .sidebar-related-list::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}
#sidebar-related-posts .sidebar-related-list::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}


/* --- NEW: Locked/Premium Content Styles --- */
.article-card .article-link {
    position: relative;
    display: block;
}
.locked-article .article-card {
    cursor: pointer;
}
.locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    border-radius: 0.375rem; /* Match the card's border-radius */
    z-index: 2;
}
.locked-article .article-card:hover .locked-overlay {
    opacity: 1;
}
.locked-overlay i {
    margin-right: 0.5rem;
}
.locked-category {
    background-color: #fef8e4; /* Light yellow to indicate premium */
    opacity: 0.8;
}
.locked-category:hover {
    opacity: 1;
}

/* --- NEW: Early Access Badge --- */
.early-access-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #6f42c1; /* Bootstrap Purple */
    color: white;
    padding: 0.3em 0.6em;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 0.25rem;
    z-index: 1;
}
.early-access-badge i {
    margin-right: 0.3em;
}

.archived-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #6c757d;
    color: white;
    padding: 0.3em 0.6em;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 0.25rem;
    z-index: 1;
}
.archived-badge i {
    margin-right: 0.3em;
}

/* --- NEW: Resource & Gallery Styles --- */
.resource-card.locked-resource {
    opacity: 0.7;
    filter: grayscale(80%);
}
.resource-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}
.gallery-thumbnail-wrapper {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: .25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.gallery-thumbnail-wrapper:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.gallery-thumbnail-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 5px rgba(0,0,0,0.5);
    pointer-events: none; /* Allows clicks to pass through to the link */
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}
.gallery-thumbnail-wrapper:hover .gallery-thumbnail-icon {
    opacity: 1;
}