/* =========================================================================
   Al-Madar v2.3 — hero slider, tabbed news widget, writers, video grid,
   single article. Loaded last so it refines earlier rules.
   ========================================================================= */

/* ---------- Hero slider ---------- */
.hero-slider {
  position: relative; border-radius: var(--radius-xl); overflow: hidden;
  background: var(--color-deep); box-shadow: var(--shadow-md); aspect-ratio: 16 / 9.4; min-height: 360px;
}
.hero-slider .slides { position: absolute; inset: 0; }
.slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 700ms ease, visibility 0s linear 700ms; }
.slide.is-active { opacity: 1; visibility: visible; transition: opacity 700ms ease; z-index: 1; }
.slide-media, .slide-media img { display: block; width: 100%; height: 100%; }
.slide-media img { object-fit: cover; transform: scale(1.04); transition: transform 7s ease-out; }
.slide.is-active .slide-media img { transform: scale(1); }
.slide::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0, 15, 46, 0.95) 0%, rgba(0, 15, 46, 0.6) 38%, rgba(0, 15, 46, 0) 70%);
}
.slide-content { position: absolute; inset-inline: 0; bottom: 0; z-index: 2; padding: var(--space-8) var(--space-8) calc(var(--space-8) + 44px); }
.slide-title { font-size: var(--text-2xl); line-height: 1.3; color: #fff; margin-bottom: var(--space-3); max-width: 30ch; }
.slide-title a:hover { color: var(--color-accent); }
.slide-content p { color: rgba(255, 255, 255, 0.82); max-width: 62ch; margin-bottom: var(--space-3); }
.slide .tag-pill { margin-bottom: var(--space-3); }

.slider-controls {
  position: absolute; z-index: 3; inset-inline: var(--space-8); bottom: var(--space-4);
  display: flex; align-items: center; gap: var(--space-3); color: #fff;
}
.slider-arrow {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.14); color: #fff; backdrop-filter: blur(4px); flex-shrink: 0;
}
.slider-arrow:hover { background: var(--color-accent); color: var(--color-deep); }
.slider-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.slider-dot { width: 8px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.45); transition: width 250ms, background 250ms; }
.slider-dot.is-active { width: 26px; background: var(--color-accent); }
.slider-count { margin-inline-start: auto; font-size: var(--text-xs); font-weight: 700; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.8); }
.slider-progress { position: absolute; z-index: 3; inset-inline: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.12); }
.slider-progress span { display: block; height: 100%; background: var(--color-accent); transform: scaleX(0); transform-origin: right; }

/* ---------- Tabbed news widget ---------- */
.news-tabs {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.news-tabs-head { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--color-divider); }
.news-tabs-head [role='tab'] {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: var(--space-4) var(--space-2);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm); color: var(--color-text-muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.news-tabs-head [role='tab']:hover { color: var(--color-primary); }
.news-tabs-head [role='tab'][aria-selected='true'] { color: var(--color-primary); border-bottom-color: var(--color-primary); background: var(--color-surface-2); }
[data-theme='dark'] .news-tabs-head [role='tab'][aria-selected='true'] { color: #fff; border-bottom-color: var(--color-accent); }
.news-tabs-head .ticker-dot { color: var(--color-live); }
.news-tabs-panel { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.news-tabs-panel .live-feed-list { overflow: visible; }
.live-feed-list.is-ranked li { display: flex; gap: var(--space-3); padding-inline-start: 0; }
.live-feed-list.is-ranked li::before, .live-feed-list.is-ranked li::after { display: none; }
.live-feed-list.is-ranked .rank-num { font-size: var(--text-xl); width: 26px; text-align: center; }
.live-feed-list.is-ranked li:nth-child(-n+3) .rank-num { color: var(--color-primary); }
[data-theme='dark'] .live-feed-list.is-ranked li:nth-child(-n+3) .rank-num { color: var(--color-accent); }
@media (min-width: 1025px) { .news-tabs { contain: size; } }
@media (max-width: 1024px) { .news-tabs-panel { max-height: 560px; } }

/* ---------- Writers: large circular portraits ---------- */
.opinion-card { align-items: center; text-align: center; padding-top: var(--space-8); }
.opinion-author { flex-direction: column; gap: var(--space-2); }
.opinion-avatar { width: 108px; height: 108px; box-shadow: 0 0 0 3px var(--color-surface), 0 0 0 6px var(--color-accent); }
.opinion-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.opinion-card .byname { font-size: var(--text-base); }
.opinion-quote { top: var(--space-4); inset-inline-end: var(--space-4); }

/* ---------- Video: grid of six beside the main video ---------- */
.video-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
.video-list--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.video-list--grid .video-item { display: flex; flex-direction: column; gap: var(--space-2); border-bottom: none; padding-bottom: 0; }
.video-list--grid .video-item .video-thumb { border-radius: var(--radius-md); }
.video-list--grid .video-title { font-size: var(--text-xs); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-list--grid .play-btn { width: 36px; height: 36px; margin: -18px 0 0 -18px; box-shadow: 0 0 0 4px rgba(255, 204, 0, 0.22); }
.video-list--grid .video-time { font-size: 0.7rem; }
@media (max-width: 1024px) { .video-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .video-list--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); } }

/* ---------- Single article ---------- */
.single-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-12); padding-block: var(--space-8) var(--space-12); align-items: start; }
.single-layout .single-article { padding-block: 0; max-width: 780px; width: 100%; justify-self: center; }
.single-layout .article-header { max-width: none; text-align: start; margin-bottom: var(--space-6); }
.single-layout .article-title { font-size: var(--text-2xl); line-height: 1.35; margin-block: var(--space-2) var(--space-4); text-wrap: balance; }
.single-layout .article-excerpt { font-size: var(--text-lg); line-height: 1.8; color: var(--color-text-muted); border-inline-start: 4px solid var(--color-accent); padding-inline-start: var(--space-4); margin-bottom: var(--space-5); }
.article-meta-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); padding-block: var(--space-3); border-block: 1px solid var(--color-divider); }
.single-layout .article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); justify-content: flex-start; }
.meta-source { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--color-primary); }
[data-theme='dark'] .meta-source { color: #fff; }

.single-layout .featured-media {
  max-width: none; margin: 0 0 var(--space-8); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--color-surface-offset); display: flex; flex-direction: column; align-items: center;
}
.single-layout .featured-media img { width: auto; max-width: 100%; height: auto; max-height: 520px; aspect-ratio: auto; object-fit: contain; border-radius: 0; }
.single-layout .featured-media figcaption { align-self: stretch; font-size: var(--text-xs); color: var(--color-text-muted); padding: var(--space-2) var(--space-4); background: var(--color-surface); border-top: 1px solid var(--color-divider); }

.single-layout .entry-content { max-width: none; font-size: 1.14rem; line-height: 2; }
.single-layout .entry-content p { margin-bottom: 0; }
.single-layout .entry-content img { height: auto; max-height: 560px; width: auto; max-width: 100%; margin-inline: auto; display: block; }
.single-layout .entry-content figure { margin-inline: auto; max-width: 100%; }
.single-layout .entry-content iframe { max-width: 100%; }
.single-layout .entry-content blockquote { border-inline-start: 4px solid var(--color-primary); background: var(--color-surface-2); padding: var(--space-4) var(--space-6); border-radius: var(--radius-md); font-family: var(--font-display); font-size: var(--text-lg); }

/* Writer hero (opinion) */
.writer-hero { display: flex; align-items: center; gap: var(--space-6); margin-block: var(--space-4) var(--space-2); }
.writer-portrait {
  width: 168px; height: 168px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--color-surface-offset);
  box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 8px var(--color-accent), var(--shadow-md);
}
.writer-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; border-radius: 0; }
.writer-portrait--sm { width: 96px; height: 96px; box-shadow: 0 0 0 3px var(--color-surface), 0 0 0 6px var(--color-accent); }
.writer-meta { display: flex; flex-direction: column; gap: 2px; }
.writer-label { font-size: var(--text-xs); color: var(--color-text-faint); font-weight: 600; }
.writer-name { font-family: var(--font-display); font-size: var(--text-xl); color: var(--color-primary); line-height: 1.3; }
[data-theme='dark'] .writer-name { color: #fff; }
.writer-sub { font-size: var(--text-sm); color: var(--color-accent-ink); font-weight: 700; }

/* Share */
.single-layout .article-share { max-width: none; margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.single-layout .article-share a, .single-layout .article-share button {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-surface-offset); color: var(--color-text-muted);
}
.article-share .share-facebook:hover { background: #1877F2; color: #fff; }
.article-share .share-x:hover { background: #000; color: #fff; }
.article-share .share-whatsapp:hover { background: #25D366; color: #fff; }
.article-share .share-telegram:hover { background: #229ED9; color: #fff; }
.article-share .share-copy:hover, .article-share .share-copy.is-copied { background: var(--color-primary); color: #fff; }
.article-footer { margin-top: var(--space-10); display: flex; flex-direction: column; gap: var(--space-6); }
.article-footer .article-tags { margin: 0; max-width: none; }
.article-share--bottom { padding: var(--space-4) var(--space-5); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.author-box--writer { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-5); background: var(--color-surface); border: 1px solid var(--color-border); border-top: 3px solid var(--color-accent); border-radius: var(--radius-lg); max-width: none; margin: 0; }
.author-box--writer .writer-portrait img { width: 100%; height: 100%; }
.single-layout .post-nav-links { max-width: none; margin: 0; }

.single-sidebar { position: sticky; top: calc(66px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; }
.admin-bar .single-sidebar { top: 98px; }

@media (max-width: 1024px) {
  .single-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-10); }
  .single-sidebar { position: static; }
}
@media (max-width: 760px) {
  .hero-slider { aspect-ratio: 4 / 5; min-height: 0; border-radius: var(--radius-lg); }
  .slide-content { padding: var(--space-5) var(--space-5) calc(var(--space-5) + 40px); }
  .slide-title { font-size: var(--text-xl); }
  .slide-content p { display: none; }
  .slider-controls { inset-inline: var(--space-4); bottom: var(--space-3); }
  .slider-dots { display: none; }
  .slider-count { margin-inline: auto; }
  .writer-hero { flex-direction: column; text-align: center; }
  .writer-portrait { width: 136px; height: 136px; }
  .single-layout .article-title { font-size: var(--text-xl); }
  .single-layout .entry-content { font-size: 1.06rem; line-height: 1.95; }
  .single-layout .featured-media img { max-height: 360px; }
  .article-meta-row { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .slide, .slide.is-active { transition: none; }
  .slide-media img { transform: none; transition: none; }
}

.slider-count { direction: ltr; unicode-bidi: isolate; }
.side-story { align-items: flex-start; }
.side-story-img { height: auto; align-self: flex-start; }
.single-sidebar .side-story-img { width: 96px; }
.single-sidebar .side-story-body h3 { font-size: var(--text-sm); }

/* v2.4 — every article image in the same 16:9 frame; the whole picture stays visible */
.single-layout .featured-media { display: block; background: none; }
.featured-frame { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; background: var(--color-deep); border-radius: var(--radius-lg); }
.featured-frame::before {
  content: ''; position: absolute; inset: -24px; background: var(--featured-bg) center / cover no-repeat;
  filter: blur(22px) brightness(0.75) saturate(1.1);
}
.single-layout .featured-frame img {
  position: relative; display: block; width: 100%; height: 100%; max-height: none; object-fit: contain; border-radius: 0;
}
.single-layout .featured-media figcaption { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 760px) { .single-layout .featured-media img { max-height: none; } }

/* ---------- v2.5: section flags & icons ---------- */
.section-header h2 { align-items: center; }
.sec-badge { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sec-badge.is-flag .sec-flag { width: 32px; height: 22px; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 26, 77, 0.15); display: block; }
.sec-badge.is-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--color-accent-light); color: var(--color-primary); box-shadow: inset 0 0 0 1.5px var(--color-accent); }
.sec-badge.is-icon .sec-icon { width: 19px; height: 19px; }
[data-theme='dark'] .sec-badge.is-icon { color: var(--color-accent); background: rgba(255, 204, 0, 0.1); }
.section-header--inverse .sec-badge.is-icon { background: rgba(255, 204, 0, 0.15); color: var(--color-accent); }

/* ---------- v2.5: excerpts line up everywhere ---------- */
.card-body p, .stacked-story p, .column-top p, .opinion-card p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feature-main-body p, .slide-content p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-body h3, .column-top h3, .opinion-card h3, .sub-lead h3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-body p { min-height: calc(2 * 1.7em); }
.page-title { display: flex; align-items: center; gap: var(--space-3); }

/* ---------- v2.6: sidebar video + Facebook boxes ---------- */
.side-videos h4, .side-facebook h4 { display: flex; align-items: center; gap: var(--space-2); }
.side-videos .sec-badge.is-icon, .side-facebook .sec-badge.is-icon { width: 30px; height: 30px; }
.side-video-main { display: block; margin-bottom: var(--space-3); }
.side-video-main .video-thumb { border-radius: var(--radius-md); }
.side-video-main .side-video-title { display: block; margin-top: var(--space-2); font-weight: 700; font-size: var(--text-sm); line-height: 1.5; }
.side-video-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.side-video-list a { display: grid; grid-template-columns: 96px 1fr; gap: var(--space-3); align-items: center; }
.side-video-list .video-thumb { border-radius: var(--radius-sm); }
.side-video-list .play-btn { width: 26px; height: 26px; margin: -13px 0 0 -13px; box-shadow: none; }
.side-video-list .side-video-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--text-xs); font-weight: 600; line-height: 1.5; }
.side-video-list .video-time { display: block; font-size: 0.7rem; color: var(--color-text-faint); }
.side-empty { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-4); }
.side-cta { display: flex !important; justify-content: center; width: 100%; padding: 0.6rem var(--space-4) !important; border-radius: var(--radius-md) !important; font-size: var(--text-sm) !important; }
.fb-frame { border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface-offset); min-height: 200px; margin-bottom: var(--space-4); }
.fb-frame iframe { display: block; width: 100%; max-width: 100%; }
.fb-follow { display: flex; align-items: center; gap: var(--space-2); background: #1877F2; color: #fff !important; font-weight: 700; }
.fb-follow:hover { background: #0f5fd0; }
.fb-badge { background: rgba(24, 119, 242, 0.12) !important; color: #1877F2 !important; box-shadow: inset 0 0 0 1.5px #1877F2 !important; }
