/**
 * NewsroomIN — All News Feed & Most Read Ranked Sidebar Styles
 *
 * Specifications:
 * - Perfect vertical & horizontal congruence:
 *   - "Самое читаемое" location and width matches Column 3 ("Последние обновления").
 *   - "Все новости" width extends to 3fr (matching Columns 1 + 2).
 *   - Section headers (All News, Most Read, Latest Updates) share identical 32px height,
 *     red indicator pill, typography, and bottom border line.
 *   - Most Read widget box matches the 8px radius, border, and padding of the OG text box.
 * - Compact editorial list view: 140px 16:10 thumbnails, clean 16px headlines, 2-line excerpts.
 * - Non-destructive expansion: "Load 10 more" expands with smooth internal scroll (.has-scroll).
 * - Big display rank numbers (1 to 5) for Most Read Recently.
 * - Full Dark Mode ([data-theme="dark"]) and Light Mode token support.
 */

/* ==========================================================================
   1. SECTION HEADERS (Identical 32px Bar across All News & Sidebar)
   ========================================================================== */
.all-news-section {
  margin-top: 0;
  margin-bottom: 2.5rem;
  width: 100%;
  box-sizing: border-box;
}

.all-news-header,
.sidebar-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
  box-sizing: border-box;
}

.all-news-title-wrap,
.sidebar-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.all-news-indicator,
.sidebar-header-indicator {
  display: inline-block;
  width: 4px;
  height: 1.15rem;
  background: var(--brand-accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.all-news-title,
.sidebar-header-title {
  font-family: var(--font-body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 1.125rem;
  font-weight: 800;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text-title);
  margin: 0;
  line-height: 1.2;
}

.all-news-header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.all-news-header-link:hover {
  color: var(--brand-accent);
}

.all-news-header-link:hover svg {
  transform: translateX(2px);
}

/* ==========================================================================
   2. EXTENDED ALL NEWS BOX WIDGET (Equal Box Matching Most Read)
   ========================================================================== */
.all-news-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

/* No container-wide hover stroke — per-article hover only (see .all-news-item:hover below) */

/* Internal viewport matching height of Most Read box */
.all-news-list-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden; /* Zero scrollbar on initial load */
  display: flex;
  flex-direction: column;
}

/* Before load more is clicked: distribute articles evenly so both containers are level */
.all-news-list-wrap:not(.has-scroll) .all-news-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.all-news-list-wrap:not(.has-scroll) .all-news-item {
  flex: 1;
  min-height: 0;
}

/* Only when user clicks "Load 10 more" does the container become scrollable with mouse wheel */
.all-news-list-wrap.has-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: auto !important;
  padding-right: 0.45rem;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, #cbd5e1) transparent;
}

.all-news-list-wrap.has-scroll::-webkit-scrollbar {
  width: 5px;
}

.all-news-list-wrap.has-scroll::-webkit-scrollbar-track {
  background: var(--bg-card-hover, rgba(0, 0, 0, 0.04));
  border-radius: 4px;
}

.all-news-list-wrap.has-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong, #cbd5e1);
  border-radius: 4px;
}

.all-news-list-wrap.has-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--brand-accent);
}

.all-news-list-wrap.has-scroll .all-news-list {
  display: flex;
  flex-direction: column;
  height: auto;
}

.all-news-list-wrap.has-scroll .all-news-item {
  flex: none;
}

.all-news-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

/* Single extended compact row with stroke highlight on hover (no full bg, no glow) */
.all-news-item {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 1.15rem;
  padding: 0.65rem 0.65rem;
  margin: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  box-sizing: border-box;
  background: transparent;
  transition: border-color 0.2s ease;
}

.all-news-item:first-child {
  padding-top: 0.5rem;
}

.all-news-item:last-child {
  border-bottom-color: transparent;
}

/* Clean stroke outline on hover: no background change, no glow/shadow */
.all-news-item:hover {
  border-color: var(--brand-accent);
  background: transparent;
  box-shadow: none;
}

/* Compact 16:10 Thumbnail */
.all-news-thumb-col {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 10;
  height: auto;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card-hover);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.all-news-thumb-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  overflow: hidden;
}

.all-news-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  transition: transform 0.3s ease;
}

.all-news-item:hover .all-news-img {
  transform: scale(1.045);
}

.all-news-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1526;
  color: #ffffff;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.8125rem;
  font-weight: 800;
  border-radius: 6px;
}

.all-news-placeholder .accent {
  color: var(--brand-accent);
}

/* Body / Editorial Column */
.all-news-body-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  height: 100%;
}

.all-news-cat-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
  line-height: 1;
}

.all-news-cat-pill {
  display: inline-block;
  font-family: var(--font-body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--brand-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  line-height: 1.1;
  transition: opacity 0.15s ease;
}

.all-news-cat-pill:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.all-news-cat-sep {
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.4375rem;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.45;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  user-select: none;
  margin: 0 1px;
}

.all-news-headline {
  font-family: var(--font-body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) !important;
  font-size: 0.9375rem;
  font-weight: 600 !important;
  line-height: 1.32;
  letter-spacing: -0.01em;
  margin: 0 0 0.22rem 0;
}

.all-news-headline a {
  color: var(--text-title);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 2.65em;
  transition: color 0.15s ease;
}

.all-news-headline a:hover {
  color: var(--brand-accent);
}

.all-news-excerpt {
  font-family: var(--font-body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-body);
  margin: 0 0 0.3rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 1.35em;
}

.all-news-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1;
}

.all-news-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.all-news-meta-item .meta-icon {
  stroke: currentColor;
  opacity: 0.8;
  display: inline-block;
  flex-shrink: 0;
}

.all-news-meta-sep {
  color: var(--border-strong, rgba(0, 0, 0, 0.25));
  font-size: 0.5625rem;
}

.all-news-author {
  color: var(--text-title);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   3. FOOTER: "LOAD 10 MORE" (Scroll Expand) & "VIEW ALL" LINKS
   ========================================================================== */
.all-news-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.all-news-load-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
  line-height: 1;
  gap: 0.5rem;
  padding: 0 1.85rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-title);
  font-family: var(--font-body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
  transition: border-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  outline: none;
  position: relative;
}

.all-news-load-btn-icon {
  display: block;
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.all-news-load-btn:hover:not(:disabled) {
  background: transparent;
  border-color: var(--brand-accent);
  color: var(--brand-accent);
  box-shadow: none;
  transform: none;
}

.all-news-load-btn:hover:not(:disabled) .all-news-load-btn-icon {
  transform: translateY(2px);
}

.all-news-load-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* Loading Spinner on button */
.all-news-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand-accent);
  border-radius: 50%;
  animation: allNewsSpin 0.65s linear infinite;
}

@keyframes allNewsSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.all-news-load-btn.is-loading .all-news-load-btn-icon {
  display: none;
}

.all-news-load-btn.is-loading .all-news-spinner {
  display: inline-block;
}

/* Secondary "View All News" link */
.all-news-all-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
  line-height: 1;
  gap: 0.45rem;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-title);
  text-decoration: none;
  padding: 0 1.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  box-shadow: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.all-news-all-link:hover {
  color: var(--brand-accent);
  border-color: var(--brand-accent);
  background: transparent;
  box-shadow: none;
}

.all-news-all-link svg {
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.all-news-all-link:hover svg {
  transform: translateX(3px);
}

/* Prominent All News Stroke CTA replacing Load More when feed reaches the end */
.all-news-prominent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
  line-height: 1;
  gap: 0.55rem;
  padding: 0 2rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-title);
  font-family: var(--font-body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: none;
  transition: border-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.all-news-prominent-btn:hover {
  background: transparent;
  border-color: var(--brand-accent);
  color: var(--brand-accent);
  box-shadow: none;
  transform: none;
}

.all-news-prominent-btn svg {
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.all-news-prominent-btn:hover svg {
  transform: translateX(3px);
}

/* ==========================================================================
   4. MOST READ RECENTLY (Full Editorial Depth & Hover Stroke Highlight)
   ========================================================================== */
.sidebar-ranked-widget {
  margin-bottom: 2.25rem;
}

.sidebar-ranked-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.85rem 0.85rem;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, height 0.15s ease;
}

/* Category View: Equalize height to match 3x3 card grid flushly */
.sidebar-ranked-box.is-category-expanded {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.sidebar-ranked-box.is-category-expanded .widget-ranked-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  height: 100%;
}

.sidebar-ranked-box.is-category-expanded .widget-ranked-item {
  flex: 1;
  display: grid;
  align-items: center;
  padding: 0.95rem 0.85rem;
}

/* No container-wide hover stroke on Most Read — per-article hover only (see .widget-ranked-item:hover below) */

.widget-ranked-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Individual article box with stroke highlight on hover */
.widget-ranked-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.widget-ranked-item:last-child {
  border-bottom-color: transparent;
}

/* Clean stroke outline on hover: no background change, no glow/shadow */
.widget-ranked-item:hover {
  border-color: var(--brand-accent);
  background: transparent;
  box-shadow: none;
}

.ranked-num {
  font-family: var(--font-display, "Inter", sans-serif);
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 0.95;
  color: var(--text-muted);
  opacity: 0.4;
  letter-spacing: -0.04em;
  text-align: center;
  transition: color 0.2s ease, opacity 0.2s ease;
  user-select: none;
  margin-top: 2px;
}

.widget-ranked-item:hover .ranked-num {
  color: var(--brand-accent);
  opacity: 1;
}

.ranked-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 1. Category & Date row on top */
.ranked-meta-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  line-height: 1.2;
  margin-bottom: 0.35rem;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.6875rem;
}

.ranked-cat {
  color: var(--brand-accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  font-size: 0.65rem;
  line-height: 1.2;
}

.ranked-cat:hover {
  text-decoration: underline;
}

.ranked-date {
  color: var(--text-muted);
  font-weight: 500;
}

.ranked-meta-sep {
  color: var(--border-strong, rgba(0, 0, 0, 0.25));
  font-size: 0.5625rem;
  user-select: none;
}

/* 2. Full Headline row in middle */
.ranked-title {
  font-family: var(--font-body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) !important;
  font-size: 0.9375rem; /* 15px clean editorial typography */
  font-weight: 600 !important;
  line-height: 1.4;
  margin: 0;
  word-break: break-word;
}

.ranked-title a {
  color: var(--text-title);
  text-decoration: none;
  transition: color 0.15s ease;
  display: block; /* Full title displayed nicely without clamp truncation */
}

.ranked-title a:hover {
  color: var(--brand-accent);
}

/* 3. View count as last, dedicated row */
.ranked-footer-row {
  display: flex;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.3rem;
  line-height: 1;
}

.ranked-reads-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.ranked-reads-pill svg {
  stroke: currentColor;
  opacity: 0.75;
  transition: stroke 0.15s ease, opacity 0.15s ease;
}

.widget-ranked-item:hover .ranked-reads-pill {
  color: var(--text-title);
}

.widget-ranked-item:hover .ranked-reads-pill svg {
  stroke: var(--brand-accent);
  opacity: 1;
}

/* ==========================================================================
   5. DARK MODE ADAPTATIONS ([data-theme="dark"])
   ========================================================================== */
[data-theme="dark"] .all-news-load-btn,
[data-theme="dark"] .all-news-all-link,
[data-theme="dark"] .all-news-prominent-btn {
  background: transparent;
  border-color: var(--border-subtle);
  box-shadow: none;
}

[data-theme="dark"] .all-news-load-btn:hover:not(:disabled),
[data-theme="dark"] .all-news-all-link:hover,
[data-theme="dark"] .all-news-prominent-btn:hover {
  background: transparent;
  border-color: var(--brand-accent);
  color: var(--brand-accent);
  box-shadow: none;
}

[data-theme="dark"] .ranked-num {
  opacity: 0.35;
}

[data-theme="dark"] .widget-ranked-item:hover .ranked-num {
  opacity: 1;
}

[data-theme="dark"] .all-news-list.has-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong, #475569);
}

/* ==========================================================================
   6. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 991px) {
  /* Un-stretch cards when stacked vertically on tablet & mobile */
  .all-news-list-wrap:not(.has-scroll) .all-news-list {
    height: auto !important;
    justify-content: flex-start !important;
  }
  .all-news-list-wrap:not(.has-scroll) .all-news-item {
    flex: none !important;
    min-height: auto !important;
  }
  .all-news-item {
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 640px) {
  .all-news-item {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 0.85rem;
    padding: 0.65rem 0.25rem;
    align-items: center;
  }

  .all-news-thumb-col {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 10 !important;
  }

  .all-news-headline {
    font-size: 0.875rem !important;
    line-height: 1.32 !important;
    margin-bottom: 0.2rem !important;
  }

  .all-news-cat-pill {
    font-size: 0.625rem;
  }

  .all-news-meta {
    font-size: 0.625rem;
  }

  .all-news-excerpt {
    display: none; /* Hide excerpt on mobile for extreme compactness */
  }
}

@media (max-width: 420px) {
  .all-news-item {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.55rem 0;
  }

  .all-news-headline {
    font-size: 0.8125rem !important;
    line-height: 1.28 !important;
  }

  .all-news-box {
    padding: 0.75rem 0.75rem;
  }
}
