/* ============================================================
   Shared Article Overlay Modal
   Used across all pages for news article reader view
   ============================================================ */
.article-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}
.article-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.article-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 20, 0.82);
  cursor: pointer;
}
.article-overlay-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 75vw;
  max-width: 900px;
  max-height: 80vh;
  background: #1a1a2e;
  border-radius: 12px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  z-index: 1;
}

/* --- Header bar (sticky) --- */
.article-overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #151528;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  min-height: 52px;
  flex-shrink: 0;
}
.article-overlay-header-source {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.article-overlay-header-extlink {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.45);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  text-decoration: none;
}
.article-overlay-header-extlink:hover {
  background: rgba(63, 185, 168, 0.15);
  color: #3fb9a8;
}
.article-overlay-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.article-overlay-close:hover {
  background: rgba(255, 80, 80, 0.15);
  color: #ff6b6b;
}

/* --- Scrollable body --- */
.article-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.article-overlay-body::-webkit-scrollbar { width: 6px; }
.article-overlay-body::-webkit-scrollbar-track { background: transparent; }
.article-overlay-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* --- Loading state --- */
.article-overlay-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 28px;
  gap: 18px;
}
.article-overlay-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(63, 185, 168, 0.2);
  border-top-color: #3fb9a8;
  border-radius: 50%;
  animation: articleSpinnerRotate 0.8s linear infinite;
}
@keyframes articleSpinnerRotate { to { transform: rotate(360deg); } }
.article-overlay-loading-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
}

/* --- Reader view --- */
.article-overlay-reader {
  padding: 36px 48px 48px;
}
.article-overlay-reader-title {
  font-size: 26px;
  font-weight: 700;
  color: #ffffffee;
  line-height: 1.35;
  margin: 0 0 12px;
}
.article-overlay-reader-meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 28px;
  line-height: 1.5;
}
.article-overlay-reader-content {
  font-size: 17px;
  line-height: 1.7;
  color: #d0d0d0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.article-overlay-reader-content p {
  margin: 0 0 1.1em;
}
.article-overlay-reader-content h1,
.article-overlay-reader-content h2 {
  font-size: 22px;
  font-weight: 700;
  color: #ffffffdd;
  margin: 1.6em 0 0.6em;
  line-height: 1.3;
}
.article-overlay-reader-content h3,
.article-overlay-reader-content h4 {
  font-size: 18px;
  font-weight: 600;
  color: #ffffffcc;
  margin: 1.4em 0 0.5em;
  line-height: 1.4;
}
.article-overlay-reader-content a {
  color: #3fb9a8;
  text-decoration: underline;
  text-decoration-color: rgba(63, 185, 168, 0.35);
  text-underline-offset: 2px;
}
.article-overlay-reader-content a:hover {
  text-decoration-color: #3fb9a8;
}
.article-overlay-reader-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.2em auto;
  border-radius: 8px;
}
.article-overlay-reader-content figure {
  margin: 1.2em 0;
  padding: 0;
}
.article-overlay-reader-content figcaption {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  margin-top: 8px;
}
.article-overlay-reader-content blockquote {
  margin: 1.2em 0;
  padding: 12px 20px;
  border-left: 3px solid #3fb9a8;
  background: rgba(63, 185, 168, 0.06);
  border-radius: 0 6px 6px 0;
  color: #bbb;
  font-style: italic;
}
.article-overlay-reader-content ul,
.article-overlay-reader-content ol {
  margin: 0.8em 0;
  padding-left: 1.5em;
}
.article-overlay-reader-content li {
  margin-bottom: 0.4em;
}
.article-overlay-reader-content pre,
.article-overlay-reader-content code {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}
.article-overlay-reader-content pre {
  padding: 14px 18px;
  overflow-x: auto;
  margin: 1em 0;
}
.article-overlay-reader-content code {
  padding: 2px 6px;
}
.article-overlay-reader-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 15px;
}
.article-overlay-reader-content th,
.article-overlay-reader-content td {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}
.article-overlay-reader-content th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  color: #ffffffcc;
}

/* --- Fallback card (when reader fails) --- */
.article-overlay-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 28px 40px;
  text-align: center;
}
.article-overlay-title {
  font-size: 18px;
  font-weight: 600;
  color: #ffffffee;
  line-height: 1.4;
  margin-bottom: 10px;
}
.article-overlay-source {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 24px;
}
.article-overlay-message {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 28px;
}
.article-overlay-readbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: #3fb9a8;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.article-overlay-readbtn:hover {
  background: #34a090;
  transform: translateY(-1px);
}
.article-overlay-readbtn svg {
  flex-shrink: 0;
}

/* --- Mobile responsive --- */
@media (max-width: 600px) {
  .article-overlay-container {
    width: 96vw;
    max-width: none;
    max-height: 85vh;
    border-radius: 10px;
  }
  .article-overlay-reader {
    padding: 24px 18px 32px;
  }
  .article-overlay-reader-title {
    font-size: 20px;
  }
  .article-overlay-reader-content {
    font-size: 16px;
  }
  .article-overlay-fallback {
    padding: 28px 18px 32px;
  }
  .article-overlay-title {
    font-size: 16px;
  }
}
