/* News page — article view */
.news-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.news-layout {
  display: flex;
  gap: 48px;
  align-items: flex-start;
  max-width: 1260px;
  margin-left: auto;
  margin-right: 48px;
}

.news-container {
  flex: 1;
  min-width: 0;
  max-width: 800px;
}

/* Progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  z-index: 9999;
  transition: width 0.1s linear;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 13px;
  align-items: center;
}

.news-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.news-meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.news-title {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

.news-author {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  margin-bottom: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.news-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  color: var(--text-secondary);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.news-author-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.news-author-info {
  flex: 1;
  min-width: 0;
}

.news-author-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.news-author-name a {
  color: var(--text);
  text-decoration: none;
}

.news-author-name a:hover {
  color: var(--primary);
}

.news-author-role {
  font-size: 12px;
  color: var(--text-muted);
}

.news-content {
  font-size: 17px;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.87);
}

.news-content p {
  margin-bottom: 20px;
}

.news-content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  margin: 24px 0;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.news-content img:hover {
  transform: scale(1.01);
}

.news-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.news-content a:hover {
  color: var(--primary-light);
}

.news-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 40px 0 16px;
  color: var(--text);
  scroll-margin-top: 110px;
}

.news-content h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 32px 0 14px;
  color: var(--text);
  scroll-margin-top: 110px;
}

.news-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 12px 20px;
  margin: 24px 0;
  color: rgba(255, 255, 255, 0.65);
  font-style: italic;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 12px 12px 0;
}

.news-content ul,
.news-content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.news-content li {
  margin-bottom: 8px;
}

/* Reactions */
.reactions-section {
  margin: 48px 0;
}

.reactions-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reaction-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 58px;
  height: 58px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}

.reaction-btn:hover {
  background: rgba(0, 176, 185, 0.08);
  border-color: var(--primary);
  transform: translateY(-3px);
}

.reaction-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.08);
}

.reaction-emoji {
  font-size: 20px;
  line-height: 1;
}

.reaction-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.reaction-btn.active .reaction-count {
  color: var(--bg-dark);
}

/* Polls */
.poll-section {
  margin: 32px 0;
  padding: 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.poll-option {
  width: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 14px;
}

.poll-option:hover {
  border-color: var(--primary);
  background: rgba(0, 176, 185, 0.06);
}

.poll-option.active {
  border-color: var(--primary);
  background: rgba(0, 176, 185, 0.14);
}

.poll-option-fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, rgba(0, 176, 185, 0.3), rgba(0, 255, 255, 0.15));
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  z-index: 0;
}

.poll-option-content,
.poll-option-votes {
  position: relative;
  z-index: 1;
}

.poll-option.is-voting {
  opacity: 0.6;
  pointer-events: none;
}

.poll-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Floating share */
.floating-share {
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.floating-share.visible {
  opacity: 1;
  pointer-events: auto;
}

.floating-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s;
  font-size: 16px;
}

.floating-share-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--bg-dark);
  transform: scale(1.1);
}

.floating-share-btn svg {
  width: 18px;
  height: 18px;
}

/* TOC sidebar */
.news-toc-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 18px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.news-toc-sidebar::-webkit-scrollbar {
  width: 4px;
}

.news-toc-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.news-toc-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.news-toc-sidebar[hidden] {
  display: none !important;
}

@media (max-width: 1099px) {
  .news-toc-sidebar {
    display: none !important;
  }
}

@media (min-width: 1100px) {
  .toc-mobile-wrap {
    display: none;
  }
}

.toc-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 14px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toc-list li a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12.5px;
  line-height: 1.45;
  text-decoration: none;
  transition:
    color 0.15s,
    background 0.15s;
}

.toc-list li a:hover,
.toc-list li a.toc-active {
  color: var(--primary);
  background: rgba(0, 176, 185, 0.08);
}

.toc-h3 > a {
  padding-left: 22px !important;
  font-size: 11.5px !important;
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Mobile TOC */
.toc-mobile-wrap {
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.toc-mobile-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  list-style: none;
  user-select: none;
}

.toc-mobile-summary::-webkit-details-marker {
  display: none;
}

.toc-mobile-wrap[open] .toc-mobile-summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.toc-mobile-wrap .toc-list {
  padding: 6px;
}

.toc-mobile-wrap .toc-list li a {
  font-size: 13px;
  padding: 6px 10px;
}

/* Related news */
.related-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--text);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.related-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.related-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 16px 30px rgba(0, 176, 185, 0.2);
}

.related-card-image {
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--bg-card);
}

.related-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-card-content {
  padding: 20px;
}

.related-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.related-card-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* Share section (mobile/fallback) */
.share-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.share-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.share-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s;
  font-family: inherit;
}

.share-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--bg-dark);
  transform: translateY(-2px);
}

.share-btn svg {
  width: 16px;
  height: 16px;
}

/* Image modal */
.image-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}

.image-modal.active {
  display: flex;
}

.image-modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 36px;
  font-weight: 300;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  z-index: 1001;
}

.image-modal-close:hover {
  opacity: 1;
  color: var(--primary);
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  gap: 16px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(0, 176, 185, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Error */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  text-align: center;
}

.error-code {
  font-size: 100px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.error-message {
  font-size: 18px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* Ad blocks */
.ad-block {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Responsive */
@media (max-width: 1199px) {
  .floating-share {
    display: none;
  }
}

@media (max-width: 900px) {
  .news-wrapper {
    padding: 0 16px 60px;
  }
  .news-layout {
    gap: 0;
    margin-left: 0;
    margin-right: 0;
  }
  .related-section {
    padding: 0 16px 60px;
  }
}

@media (max-width: 768px) {
  .news-content {
    font-size: 16px;
  }
  .reactions-row {
    gap: 8px;
  }
  .reaction-btn {
    width: 50px;
    height: 50px;
  }
  .reaction-emoji {
    font-size: 18px;
  }
}

/* ============================================
   Light theme
   ============================================ */

:root[data-theme='light'] .news-content {
  color: var(--text);
}

:root[data-theme='light'] .news-content blockquote {
  color: var(--text-secondary);
  background: var(--bg-card);
}

:root[data-theme='light'] .news-author {
  border-top-color: var(--border);
  border-bottom-color: var(--border);
}

:root[data-theme='light'] .news-meta-dot {
  background: var(--border);
}

:root[data-theme='light'] .news-toc-sidebar,
:root[data-theme='light'] .toc-mobile-wrap,
:root[data-theme='light'] .poll-section,
:root[data-theme='light'] .ad-block {
  background: var(--bg-card);
  border-color: var(--border);
}

:root[data-theme='light'] .toc-heading,
:root[data-theme='light'] .toc-mobile-summary,
:root[data-theme='light'] .toc-list li a {
  color: var(--text);
}

:root[data-theme='light'] .toc-list li a:hover,
:root[data-theme='light'] .toc-list li a.toc-active {
  background: var(--al-primary-10);
  color: var(--primary-dark);
}

:root[data-theme='light'] .toc-h3 > a {
  color: var(--text-secondary) !important;
}

:root[data-theme='light'] .reaction-btn,
:root[data-theme='light'] .floating-share-btn,
:root[data-theme='light'] .share-btn,
:root[data-theme='light'] .poll-option {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text);
}

:root[data-theme='light'] .reaction-count {
  color: var(--text-muted);
}

:root[data-theme='light'] .reaction-btn.active {
  color: #fff;
}

:root[data-theme='light'] .related-card {
  border-color: var(--border);
}
